aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/atomicio.h10
-rw-r--r--include/acpi/processor.h2
-rw-r--r--include/asm-generic/io-64-nonatomic-hi-lo.h28
-rw-r--r--include/asm-generic/io-64-nonatomic-lo-hi.h28
-rw-r--r--include/asm-generic/iomap.h2
-rw-r--r--include/asm-generic/pci_iomap.h10
-rw-r--r--include/asm-generic/poll.h2
-rw-r--r--include/asm-generic/socket.h5
-rw-r--r--include/crypto/scatterwalk.h28
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drmP.h1
-rw-r--r--include/drm/exynos_drm.h22
-rw-r--r--include/keys/user-type.h3
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/altera_uart.h4
-rw-r--r--include/linux/amba/serial.h2
-rw-r--r--include/linux/bcma/bcma.h9
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h26
-rw-r--r--include/linux/bcma/bcma_driver_pci.h125
-rw-r--r--include/linux/bcma/bcma_regs.h27
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/bio.h8
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/can/dev.h2
-rw-r--r--include/linux/cdrom.h3
-rw-r--r--include/linux/cgroup.h70
-rw-r--r--include/linux/clocksource.h7
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/connector.h1
-rw-r--r--include/linux/cpu.h7
-rw-r--r--include/linux/dcache.h33
-rw-r--r--include/linux/dccp.h8
-rw-r--r--include/linux/devfreq.h25
-rw-r--r--include/linux/device.h32
-rw-r--r--include/linux/digsig.h4
-rw-r--r--include/linux/dynamic_debug.h19
-rw-r--r--include/linux/elevator.h9
-rw-r--r--include/linux/errno.h1
-rw-r--r--include/linux/etherdevice.h13
-rw-r--r--include/linux/ethtool.h23
-rw-r--r--include/linux/freezer.h2
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/ftrace.h77
-rw-r--r--include/linux/ftrace_event.h9
-rw-r--r--include/linux/genhd.h1
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/highmem.h79
-rw-r--r--include/linux/hyperv.h175
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_ppp.h174
-rw-r--r--include/linux/if_team.h10
-rw-r--r--include/linux/if_vlan.h7
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/interrupt.h7
-rw-r--r--include/linux/iocontext.h15
-rw-r--r--include/linux/ipv6.h8
-rw-r--r--include/linux/irqdomain.h191
-rw-r--r--include/linux/isdn.h2
-rw-r--r--include/linux/jump_label.h162
-rw-r--r--include/linux/kbd_kern.h7
-rw-r--r--include/linux/kernel.h13
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/keyboard.h2
-rw-r--r--include/linux/kmsg_dump.h9
-rw-r--r--[-rwxr-xr-x]include/linux/lp8727.h0
-rw-r--r--include/linux/math64.h4
-rw-r--r--include/linux/mdio.h10
-rw-r--r--include/linux/memcontrol.h5
-rw-r--r--include/linux/mfd/mcp.h12
-rw-r--r--include/linux/mfd/twl6040.h2
-rw-r--r--include/linux/mfd/ucb1x00.h5
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/migrate_mode.h16
-rw-r--r--include/linux/mlx4/device.h6
-rw-r--r--include/linux/mlx4/qp.h5
-rw-r--r--include/linux/mmc/card.h4
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h20
-rw-r--r--include/linux/mod_devicetable.h32
-rw-r--r--include/linux/mpi.h2
-rw-r--r--include/linux/mtd/mtd.h6
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h129
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/ipset/ip_set.h35
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h119
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h12
-rw-r--r--include/linux/netfilter/nfnetlink_cttimeout.h114
-rw-r--r--include/linux/netfilter/xt_CT.h12
-rw-r--r--include/linux/netfilter/xt_LOG.h19
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild2
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h20
-rw-r--r--include/linux/netfilter_ipv4/ipt_realm.h7
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h2
-rw-r--r--include/linux/netlink.h30
-rw-r--r--include/linux/nfc.h8
-rw-r--r--include/linux/nfs_xdr.h2
-rw-r--r--include/linux/nl80211.h72
-rw-r--r--include/linux/of.h25
-rw-r--r--include/linux/of_address.h33
-rw-r--r--include/linux/of_device.h8
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/of_platform.h15
-rw-r--r--include/linux/pci.h25
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/percpu.h29
-rw-r--r--include/linux/perf_event.h109
-rw-r--r--include/linux/pkt_sched.h21
-rw-r--r--include/linux/platform_data/cpsw.h55
-rw-r--r--include/linux/platform_data/dwc3-exynos.h24
-rw-r--r--include/linux/platform_data/efm32-uart.h18
-rw-r--r--include/linux/pm.h59
-rw-r--r--include/linux/pm_domain.h25
-rw-r--r--include/linux/pm_qos.h52
-rw-r--r--include/linux/pm_wakeup.h22
-rw-r--r--include/linux/ppp-comp.h38
-rw-r--r--include/linux/ppp-ioctl.h119
-rw-r--r--include/linux/ppp_defs.h38
-rw-r--r--include/linux/preempt.h5
-rw-r--r--include/linux/printk.h18
-rw-r--r--include/linux/proportions.h4
-rw-r--r--include/linux/quota.h6
-rw-r--r--include/linux/rcupdate.h83
-rw-r--r--include/linux/rcutiny.h10
-rw-r--r--include/linux/rcutree.h19
-rw-r--r--include/linux/regset.h10
-rw-r--r--include/linux/res_counter.h11
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/sched.h67
-rw-r--r--include/linux/security.h2
-rw-r--r--include/linux/serial.h4
-rw-r--r--include/linux/serialP.h142
-rw-r--r--include/linux/serial_core.h12
-rw-r--r--include/linux/sh_dma.h1
-rw-r--r--include/linux/sh_eth.h1
-rw-r--r--include/linux/shmem_fs.h1
-rw-r--r--include/linux/signalfd.h5
-rw-r--r--include/linux/skbuff.h56
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/srcu.h15
-rw-r--r--include/linux/ssb/ssb.h108
-rw-r--r--include/linux/ssb/ssb_regs.h34
-rw-r--r--include/linux/static_key.h1
-rw-r--r--include/linux/sunserialcore.h33
-rw-r--r--include/linux/suspend.h23
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/sys_soc.h37
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/sysdev.h164
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/thermal.h4
-rw-r--r--include/linux/timex.h17
-rw-r--r--include/linux/tracepoint.h28
-rw-r--r--include/linux/tty.h6
-rw-r--r--include/linux/tty_driver.h8
-rw-r--r--include/linux/usb.h11
-rw-r--r--include/linux/usb/audio-v2.h21
-rw-r--r--include/linux/usb/cdc-wdm.h19
-rw-r--r--include/linux/usb/ch11.h15
-rw-r--r--include/linux/usb/ch9.h7
-rw-r--r--include/linux/usb/ehci_pdriver.h46
-rw-r--r--include/linux/usb/gadget.h10
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/intel_mid_otg.h6
-rw-r--r--include/linux/usb/langwell_otg.h139
-rw-r--r--include/linux/usb/msm_hsusb.h2
-rw-r--r--include/linux/usb/ohci_pdriver.h38
-rw-r--r--include/linux/usb/otg.h164
-rw-r--r--include/linux/usb/renesas_usbhs.h1
-rw-r--r--include/linux/usb/serial.h36
-rw-r--r--include/linux/usb/storage.h38
-rw-r--r--include/linux/usb/uas.h69
-rw-r--r--include/linux/usb/ulpi.h4
-rw-r--r--include/linux/vt_kern.h26
-rw-r--r--include/linux/wait.h5
-rw-r--r--include/linux/workqueue.h4
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/net/addrconf.h1
-rw-r--r--include/net/arp.h4
-rw-r--r--include/net/bluetooth/bluetooth.h42
-rw-r--r--include/net/bluetooth/hci.h78
-rw-r--r--include/net/bluetooth/hci_core.h307
-rw-r--r--include/net/bluetooth/hci_mon.h51
-rw-r--r--include/net/bluetooth/l2cap.h97
-rw-r--r--include/net/bluetooth/mgmt.h338
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/caif/caif_hsi.h1
-rw-r--r--include/net/cfg80211.h185
-rw-r--r--include/net/compat.h2
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/dn.h1
-rw-r--r--include/net/flow.h10
-rw-r--r--include/net/genetlink.h31
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h4
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/iucv/af_iucv.h3
-rw-r--r--include/net/mac80211.h154
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h13
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h19
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h78
-rw-r--r--include/net/netfilter/xt_log.h2
-rw-r--r--include/net/netlink.h35
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/netprio_cgroup.h49
-rw-r--r--include/net/nfc/nci.h53
-rw-r--r--include/net/nfc/nci_core.h36
-rw-r--r--include/net/nfc/nfc.h39
-rw-r--r--include/net/route.h4
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h9
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sock.h54
-rw-r--r--include/net/tcp.h87
-rw-r--r--include/net/tcp_memcontrol.h2
-rw-r--r--include/net/udplite.h4
-rw-r--r--include/net/xfrm.h5
-rw-r--r--include/scsi/scsi_device.h7
-rw-r--r--include/sound/core.h2
-rw-r--r--include/target/target_core_backend.h4
-rw-r--r--include/target/target_core_base.h1
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/trace/events/power.h3
-rw-r--r--include/trace/events/printk.h41
-rw-r--r--include/trace/events/rcu.h63
-rw-r--r--include/trace/events/sched.h77
-rw-r--r--include/trace/events/signal.h85
-rw-r--r--include/trace/events/writeback.h7
-rw-r--r--include/video/omapdss.h5
246 files changed, 4510 insertions, 2313 deletions
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 2fe8639b3ae..7c9aebe8a7a 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -218,9 +218,13 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
218 */ 218 */
219acpi_status 219acpi_status
220acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); 220acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width);
221acpi_status
222acpi_os_read_memory64(acpi_physical_address address, u64 *value, u32 width);
221 223
222acpi_status 224acpi_status
223acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); 225acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
226acpi_status
227acpi_os_write_memory64(acpi_physical_address address, u64 value, u32 width);
224 228
225/* 229/*
226 * Platform and hardware-independent PCI configuration space access 230 * Platform and hardware-independent PCI configuration space access
diff --git a/include/acpi/atomicio.h b/include/acpi/atomicio.h
deleted file mode 100644
index 8b9fb4b0b9c..00000000000
--- a/include/acpi/atomicio.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef ACPI_ATOMIC_IO_H
2#define ACPI_ATOMIC_IO_H
3
4int acpi_pre_map_gar(struct acpi_generic_address *reg);
5int acpi_post_unmap_gar(struct acpi_generic_address *reg);
6
7int acpi_atomic_read(u64 *val, struct acpi_generic_address *reg);
8int acpi_atomic_write(u64 val, struct acpi_generic_address *reg);
9
10#endif
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 610f6fb1bbc..9d650476d5d 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -195,6 +195,7 @@ struct acpi_processor_flags {
195 u8 has_cst:1; 195 u8 has_cst:1;
196 u8 power_setup_done:1; 196 u8 power_setup_done:1;
197 u8 bm_rld_set:1; 197 u8 bm_rld_set:1;
198 u8 need_hotplug_init:1;
198}; 199};
199 200
200struct acpi_processor { 201struct acpi_processor {
@@ -224,6 +225,7 @@ struct acpi_processor_errata {
224 } piix4; 225 } piix4;
225}; 226};
226 227
228extern void acpi_processor_load_module(struct acpi_processor *pr);
227extern int acpi_processor_preregister_performance(struct 229extern int acpi_processor_preregister_performance(struct
228 acpi_processor_performance 230 acpi_processor_performance
229 __percpu *performance); 231 __percpu *performance);
diff --git a/include/asm-generic/io-64-nonatomic-hi-lo.h b/include/asm-generic/io-64-nonatomic-hi-lo.h
new file mode 100644
index 00000000000..a6806a94250
--- /dev/null
+++ b/include/asm-generic/io-64-nonatomic-hi-lo.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_IO_64_NONATOMIC_HI_LO_H_
2#define _ASM_IO_64_NONATOMIC_HI_LO_H_
3
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
7#ifndef readq
8static inline __u64 readq(const volatile void __iomem *addr)
9{
10 const volatile u32 __iomem *p = addr;
11 u32 low, high;
12
13 high = readl(p + 1);
14 low = readl(p);
15
16 return low + ((u64)high << 32);
17}
18#endif
19
20#ifndef writeq
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{
23 writel(val >> 32, addr + 4);
24 writel(val, addr);
25}
26#endif
27
28#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */
diff --git a/include/asm-generic/io-64-nonatomic-lo-hi.h b/include/asm-generic/io-64-nonatomic-lo-hi.h
new file mode 100644
index 00000000000..ca546b1ff8b
--- /dev/null
+++ b/include/asm-generic/io-64-nonatomic-lo-hi.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_IO_64_NONATOMIC_LO_HI_H_
2#define _ASM_IO_64_NONATOMIC_LO_HI_H_
3
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
7#ifndef readq
8static inline __u64 readq(const volatile void __iomem *addr)
9{
10 const volatile u32 __iomem *p = addr;
11 u32 low, high;
12
13 low = readl(p);
14 high = readl(p + 1);
15
16 return low + ((u64)high << 32);
17}
18#endif
19
20#ifndef writeq
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{
23 writel(val, addr);
24 writel(val >> 32, addr + 4);
25}
26#endif
27
28#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 8a3d4fde260..6afd7d6a989 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -70,7 +70,7 @@ extern void ioport_unmap(void __iomem *);
70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 72extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
73#else 73#elif defined(CONFIG_GENERIC_IOMAP)
74struct pci_dev; 74struct pci_dev;
75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
76{ } 76{ }
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
index 8de4b73e19e..ce37349860f 100644
--- a/include/asm-generic/pci_iomap.h
+++ b/include/asm-generic/pci_iomap.h
@@ -15,7 +15,17 @@ struct pci_dev;
15#ifdef CONFIG_PCI 15#ifdef CONFIG_PCI
16/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 16/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
17extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 17extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
18/* Create a virtual mapping cookie for a port on a given PCI device.
19 * Do not call this directly, it exists to make it easier for architectures
20 * to override */
21#ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
22extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
23 unsigned int nr);
18#else 24#else
25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
26#endif
27
28#elif defined(CONFIG_GENERIC_PCI_IOMAP)
19static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
20{ 30{
21 return NULL; 31 return NULL;
diff --git a/include/asm-generic/poll.h b/include/asm-generic/poll.h
index 44bce836d35..9ce7f44aebd 100644
--- a/include/asm-generic/poll.h
+++ b/include/asm-generic/poll.h
@@ -28,6 +28,8 @@
28#define POLLRDHUP 0x2000 28#define POLLRDHUP 0x2000
29#endif 29#endif
30 30
31#define POLLFREE 0x4000 /* currently only for epoll */
32
31struct pollfd { 33struct pollfd {
32 int fd; 34 int fd;
33 short events; 35 short events;
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 49c1704173e..b1bea03274d 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -67,4 +67,9 @@
67 67
68#define SO_WIFI_STATUS 41 68#define SO_WIFI_STATUS 41
69#define SCM_WIFI_STATUS SO_WIFI_STATUS 69#define SCM_WIFI_STATUS SO_WIFI_STATUS
70#define SO_PEEK_OFF 42
71
72/* Instruct lower device to use last 4-bytes of skb data as FCS */
73#define SO_NOFCS 43
74
70#endif /* __ASM_GENERIC_SOCKET_H */ 75#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 4fd95a323be..3744d2a642d 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -25,28 +25,6 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28static inline enum km_type crypto_kmap_type(int out)
29{
30 enum km_type type;
31
32 if (in_softirq())
33 type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0;
34 else
35 type = out * (KM_USER1 - KM_USER0) + KM_USER0;
36
37 return type;
38}
39
40static inline void *crypto_kmap(struct page *page, int out)
41{
42 return kmap_atomic(page, crypto_kmap_type(out));
43}
44
45static inline void crypto_kunmap(void *vaddr, int out)
46{
47 kunmap_atomic(vaddr, crypto_kmap_type(out));
48}
49
50static inline void crypto_yield(u32 flags) 28static inline void crypto_yield(u32 flags)
51{ 29{
52 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) 30 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
@@ -121,15 +99,15 @@ static inline struct page *scatterwalk_page(struct scatter_walk *walk)
121 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); 99 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
122} 100}
123 101
124static inline void scatterwalk_unmap(void *vaddr, int out) 102static inline void scatterwalk_unmap(void *vaddr)
125{ 103{
126 crypto_kunmap(vaddr, out); 104 kunmap_atomic(vaddr);
127} 105}
128 106
129void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); 107void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg);
130void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, 108void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
131 size_t nbytes, int out); 109 size_t nbytes, int out);
132void *scatterwalk_map(struct scatter_walk *walk, int out); 110void *scatterwalk_map(struct scatter_walk *walk);
133void scatterwalk_done(struct scatter_walk *walk, int out, int more); 111void scatterwalk_done(struct scatter_walk *walk, int out, int more);
134 112
135void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, 113void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index a5c0e10fd47..1e38a19d68f 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -2,6 +2,7 @@ header-y += drm.h
2header-y += drm_fourcc.h 2header-y += drm_fourcc.h
3header-y += drm_mode.h 3header-y += drm_mode.h
4header-y += drm_sarea.h 4header-y += drm_sarea.h
5header-y += exynos_drm.h
5header-y += i810_drm.h 6header-y += i810_drm.h
6header-y += i915_drm.h 7header-y += i915_drm.h
7header-y += mga_drm.h 8header-y += mga_drm.h
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 76caa67c22e..92f0981b5fb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1328,6 +1328,7 @@ extern int drm_getmagic(struct drm_device *dev, void *data,
1328 struct drm_file *file_priv); 1328 struct drm_file *file_priv);
1329extern int drm_authmagic(struct drm_device *dev, void *data, 1329extern int drm_authmagic(struct drm_device *dev, void *data,
1330 struct drm_file *file_priv); 1330 struct drm_file *file_priv);
1331extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1331 1332
1332/* Cache management (drm_cache.c) */ 1333/* Cache management (drm_cache.c) */
1333void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1334void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 5e120f1c5cd..1ed3aae893a 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -97,15 +97,30 @@ struct drm_exynos_plane_set_zpos {
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99 99
100#ifdef __KERNEL__
101
100/** 102/**
101 * Platform Specific Structure for DRM based FIMD. 103 * A structure for lcd panel information.
102 * 104 *
103 * @timing: default video mode for initializing 105 * @timing: default video mode for initializing
106 * @width_mm: physical size of lcd width.
107 * @height_mm: physical size of lcd height.
108 */
109struct exynos_drm_panel_info {
110 struct fb_videomode timing;
111 u32 width_mm;
112 u32 height_mm;
113};
114
115/**
116 * Platform Specific Structure for DRM based FIMD.
117 *
118 * @panel: default panel info for initializing
104 * @default_win: default window layer number to be used for UI. 119 * @default_win: default window layer number to be used for UI.
105 * @bpp: default bit per pixel. 120 * @bpp: default bit per pixel.
106 */ 121 */
107struct exynos_drm_fimd_pdata { 122struct exynos_drm_fimd_pdata {
108 struct fb_videomode timing; 123 struct exynos_drm_panel_info panel;
109 u32 vidcon0; 124 u32 vidcon0;
110 u32 vidcon1; 125 u32 vidcon1;
111 unsigned int default_win; 126 unsigned int default_win;
@@ -139,4 +154,5 @@ struct exynos_drm_hdmi_pdata {
139 unsigned int bpp; 154 unsigned int bpp;
140}; 155};
141 156
142#endif 157#endif /* __KERNEL__ */
158#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index c37c34275a4..bc9ec1d7698 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -17,7 +17,7 @@
17 17
18/*****************************************************************************/ 18/*****************************************************************************/
19/* 19/*
20 * the payload for a key of type "user" 20 * the payload for a key of type "user" or "logon"
21 * - once filled in and attached to a key: 21 * - once filled in and attached to a key:
22 * - the payload struct is invariant may not be changed, only replaced 22 * - the payload struct is invariant may not be changed, only replaced
23 * - the payload must be read with RCU procedures or with the key semaphore 23 * - the payload must be read with RCU procedures or with the key semaphore
@@ -33,6 +33,7 @@ struct user_key_payload {
33}; 33};
34 34
35extern struct key_type key_type_user; 35extern struct key_type key_type_user;
36extern struct key_type key_type_logon;
36 37
37extern int user_instantiate(struct key *key, const void *data, size_t datalen); 38extern int user_instantiate(struct key *key, const void *data, size_t datalen);
38extern int user_update(struct key *key, const void *data, size_t datalen); 39extern int user_update(struct key *key, const void *data, size_t datalen);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index c94e71781b7..a2555538109 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -238,6 +238,7 @@ header-y += magic.h
238header-y += major.h 238header-y += major.h
239header-y += map_to_7segment.h 239header-y += map_to_7segment.h
240header-y += matroxfb.h 240header-y += matroxfb.h
241header-y += mdio.h
241header-y += media.h 242header-y += media.h
242header-y += mempolicy.h 243header-y += mempolicy.h
243header-y += meye.h 244header-y += meye.h
@@ -304,6 +305,7 @@ header-y += poll.h
304header-y += posix_types.h 305header-y += posix_types.h
305header-y += ppdev.h 306header-y += ppdev.h
306header-y += ppp-comp.h 307header-y += ppp-comp.h
308header-y += ppp-ioctl.h
307header-y += ppp_defs.h 309header-y += ppp_defs.h
308header-y += pps.h 310header-y += pps.h
309header-y += prctl.h 311header-y += prctl.h
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
index a10a9079197..c022c82db7c 100644
--- a/include/linux/altera_uart.h
+++ b/include/linux/altera_uart.h
@@ -5,8 +5,6 @@
5#ifndef __ALTUART_H 5#ifndef __ALTUART_H
6#define __ALTUART_H 6#define __ALTUART_H
7 7
8#include <linux/init.h>
9
10struct altera_uart_platform_uart { 8struct altera_uart_platform_uart {
11 unsigned long mapbase; /* Physical address base */ 9 unsigned long mapbase; /* Physical address base */
12 unsigned int irq; /* Interrupt vector */ 10 unsigned int irq; /* Interrupt vector */
@@ -14,6 +12,4 @@ struct altera_uart_platform_uart {
14 unsigned int bus_shift; /* Bus shift (address stride) */ 12 unsigned int bus_shift; /* Bus shift (address stride) */
15}; 13};
16 14
17int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp);
18
19#endif /* __ALTUART_H */ 15#endif /* __ALTUART_H */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 514ed45c462..d117b29d106 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -23,6 +23,8 @@
23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H 23#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H 24#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
25 25
26#include <linux/types.h>
27
26/* ------------------------------------------------------------------------------- 28/* -------------------------------------------------------------------------------
27 * From AMBA UART (PL010) Block Specification 29 * From AMBA UART (PL010) Block Specification
28 * ------------------------------------------------------------------------------- 30 * -------------------------------------------------------------------------------
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 83c209f3949..5af9a075498 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -136,6 +136,7 @@ struct bcma_device {
136 bool dev_registered; 136 bool dev_registered;
137 137
138 u8 core_index; 138 u8 core_index;
139 u8 core_unit;
139 140
140 u32 addr; 141 u32 addr;
141 u32 wrap; 142 u32 wrap;
@@ -175,6 +176,12 @@ int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
175 176
176extern void bcma_driver_unregister(struct bcma_driver *drv); 177extern void bcma_driver_unregister(struct bcma_driver *drv);
177 178
179/* Set a fallback SPROM.
180 * See kdoc at the function definition for complete documentation. */
181extern int bcma_arch_register_fallback_sprom(
182 int (*sprom_callback)(struct bcma_bus *bus,
183 struct ssb_sprom *out));
184
178struct bcma_bus { 185struct bcma_bus {
179 /* The MMIO area. */ 186 /* The MMIO area. */
180 void __iomem *mmio; 187 void __iomem *mmio;
@@ -195,6 +202,7 @@ struct bcma_bus {
195 struct list_head cores; 202 struct list_head cores;
196 u8 nr_cores; 203 u8 nr_cores;
197 u8 init_done:1; 204 u8 init_done:1;
205 u8 num;
198 206
199 struct bcma_drv_cc drv_cc; 207 struct bcma_drv_cc drv_cc;
200 struct bcma_drv_pci drv_pci; 208 struct bcma_drv_pci drv_pci;
@@ -282,6 +290,7 @@ static inline void bcma_maskset16(struct bcma_device *cc,
282 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); 290 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
283} 291}
284 292
293extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid);
285extern bool bcma_core_is_enabled(struct bcma_device *core); 294extern bool bcma_core_is_enabled(struct bcma_device *core);
286extern void bcma_core_disable(struct bcma_device *core, u32 flags); 295extern void bcma_core_disable(struct bcma_device *core, u32 flags);
287extern int bcma_core_enable(struct bcma_device *core, u32 flags); 296extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index a33086a7530..8bbfe31fbac 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -56,6 +56,9 @@
56#define BCMA_CC_OTPS_HW_PROTECT 0x00000001 56#define BCMA_CC_OTPS_HW_PROTECT 0x00000001
57#define BCMA_CC_OTPS_SW_PROTECT 0x00000002 57#define BCMA_CC_OTPS_SW_PROTECT 0x00000002
58#define BCMA_CC_OTPS_CID_PROTECT 0x00000004 58#define BCMA_CC_OTPS_CID_PROTECT 0x00000004
59#define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */
60#define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8
61#define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */
59#define BCMA_CC_OTPC 0x0014 /* OTP control */ 62#define BCMA_CC_OTPC 0x0014 /* OTP control */
60#define BCMA_CC_OTPC_RECWAIT 0xFF000000 63#define BCMA_CC_OTPC_RECWAIT 0xFF000000
61#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 64#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00
@@ -72,6 +75,8 @@
72#define BCMA_CC_OTPP_READ 0x40000000 75#define BCMA_CC_OTPP_READ 0x40000000
73#define BCMA_CC_OTPP_START 0x80000000 76#define BCMA_CC_OTPP_START 0x80000000
74#define BCMA_CC_OTPP_BUSY 0x80000000 77#define BCMA_CC_OTPP_BUSY 0x80000000
78#define BCMA_CC_OTPL 0x001C /* OTP layout */
79#define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */
75#define BCMA_CC_IRQSTAT 0x0020 80#define BCMA_CC_IRQSTAT 0x0020
76#define BCMA_CC_IRQMASK 0x0024 81#define BCMA_CC_IRQMASK 0x0024
77#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ 82#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */
@@ -79,6 +84,10 @@
79#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ 84#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */
80#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ 85#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */
81#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ 86#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */
87#define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1
88#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2
89#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2
90#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4
82#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ 91#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
83#define BCMA_CC_JCMD_START 0x80000000 92#define BCMA_CC_JCMD_START 0x80000000
84#define BCMA_CC_JCMD_BUSY 0x80000000 93#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -181,6 +190,22 @@
181#define BCMA_CC_FLASH_CFG 0x0128 190#define BCMA_CC_FLASH_CFG 0x0128
182#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ 191#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
183#define BCMA_CC_FLASH_WAITCNT 0x012C 192#define BCMA_CC_FLASH_WAITCNT 0x012C
193#define BCMA_CC_SROM_CONTROL 0x0190
194#define BCMA_CC_SROM_CONTROL_START 0x80000000
195#define BCMA_CC_SROM_CONTROL_BUSY 0x80000000
196#define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000
197#define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000
198#define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000
199#define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000
200#define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000
201#define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010
202#define BCMA_CC_SROM_CONTROL_LOCK 0x00000008
203#define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006
204#define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000
205#define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002
206#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004
207#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1
208#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001
184/* 0x1E0 is defined as shared BCMA_CLKCTLST */ 209/* 0x1E0 is defined as shared BCMA_CLKCTLST */
185#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 210#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
186#define BCMA_CC_UART0_DATA 0x0300 211#define BCMA_CC_UART0_DATA 0x0300
@@ -240,7 +265,6 @@
240#define BCMA_CC_PLLCTL_ADDR 0x0660 265#define BCMA_CC_PLLCTL_ADDR 0x0660
241#define BCMA_CC_PLLCTL_DATA 0x0664 266#define BCMA_CC_PLLCTL_DATA 0x0664
242#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 267#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
243#define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */
244 268
245/* Divider allocation in 4716/47162/5356 */ 269/* Divider allocation in 4716/47162/5356 */
246#define BCMA_CC_PMU5_MAINPLL_CPU 1 270#define BCMA_CC_PMU5_MAINPLL_CPU 1
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3871b668caf..46c71e27d31 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -53,6 +53,35 @@ struct pci_dev;
53#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 53#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000
54#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ 54#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
55#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 55#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000
56#define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */
57#define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */
58#define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */
59#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */
60#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2
61#define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */
62#define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */
63#define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */
64#define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */
65#define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */
66#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */
67#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */
68#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */
69#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */
70#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */
71#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */
72#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */
73#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */
74#define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */
75#define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */
76#define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */
77#define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */
78#define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */
79#define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */
80#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */
81#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */
82#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */
83#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */
84#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */
56#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ 85#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
57#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ 86#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
58#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
@@ -72,20 +101,114 @@ struct pci_dev;
72#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ 101#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */
73#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ 102#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */
74 103
104/* PCIE protocol PHY diagnostic registers */
105#define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */
106#define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */
107#define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */
108#define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */
109#define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */
110#define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */
111#define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */
112#define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */
113#define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */
114#define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */
115#define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */
116#define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */
117#define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */
118#define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */
119#define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */
120#define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */
121#define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */
122
123/* PCIE protocol DLLP diagnostic registers */
124#define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */
125#define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */
126#define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */
127#define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16)
128#define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */
129#define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */
130#define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */
131#define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */
132#define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */
133#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
134#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
135#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
136#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
137#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
138#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
139#define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */
140#define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */
141#define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */
142#define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */
143#define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */
144#define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */
145#define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */
146#define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */
147
148/* SERDES RX registers */
149#define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */
150#define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */
151#define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */
152#define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */
153#define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */
154#define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */
155
156/* SERDES PLL registers */
157#define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */
158#define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */
159
75/* PCIcore specific boardflags */ 160/* PCIcore specific boardflags */
76#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ 161#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
77 162
163/* PCIE Config space accessing MACROS */
164#define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */
165#define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */
166#define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */
167#define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */
168
169#define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */
170#define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */
171#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */
172#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */
173
174/* PCIE Root Capability Register bits (Host mode only) */
175#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
176
177struct bcma_drv_pci;
178
179#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
180struct bcma_drv_pci_host {
181 struct bcma_drv_pci *pdev;
182
183 u32 host_cfg_addr;
184 spinlock_t cfgspace_lock;
185
186 struct pci_controller pci_controller;
187 struct pci_ops pci_ops;
188 struct resource mem_resource;
189 struct resource io_resource;
190};
191#endif
192
78struct bcma_drv_pci { 193struct bcma_drv_pci {
79 struct bcma_device *core; 194 struct bcma_device *core;
80 u8 setup_done:1; 195 u8 setup_done:1;
196 u8 hostmode:1;
197
198#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
199 struct bcma_drv_pci_host *host_controller;
200#endif
81}; 201};
82 202
83/* Register access */ 203/* Register access */
84#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 204#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
85#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 205#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
86 206
87extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 207extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
88extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 208extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
89 struct bcma_device *core, bool enable); 209 struct bcma_device *core, bool enable);
90 210
211extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
212extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
213
91#endif /* LINUX_BCMA_DRIVER_PCI_H_ */ 214#endif /* LINUX_BCMA_DRIVER_PCI_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 9faae2ae02e..5a71d571964 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -56,4 +56,31 @@
56#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ 56#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
57#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ 57#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
58 58
59/* SiliconBackplane Address Map.
60 * All regions may not exist on all chips.
61 */
62#define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */
63#define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */
64#define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024)
65#define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */
66#define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */
67#define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */
68
69
70#define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */
71#define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */
72#define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */
73#define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2
74 * (2 ZettaBytes), low 32 bits
75 */
76#define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2
77 * (2 ZettaBytes), high 32 bits
78 */
79
80#define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */
81#define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */
82#define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2
83 * (2 ZettaBytes), high 32 bits
84 */
85
59#endif /* LINUX_BCMA_REGS_H_ */ 86#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fd88a3945aa..0092102db2d 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -18,7 +18,7 @@ struct pt_regs;
18#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/list.h> 21#include <linux/sched.h>
22 22
23#define CORENAME_MAX_SIZE 128 23#define CORENAME_MAX_SIZE 128
24 24
@@ -58,6 +58,7 @@ struct linux_binprm {
58 unsigned interp_flags; 58 unsigned interp_flags;
59 unsigned interp_data; 59 unsigned interp_data;
60 unsigned long loader, exec; 60 unsigned long loader, exec;
61 char tcomm[TASK_COMM_LEN];
61}; 62};
62 63
63#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 64#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 129a9c09795..de5422a5751 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -101,10 +101,10 @@ static inline int bio_has_allocated_vec(struct bio *bio)
101 * I/O completely on that queue (see ide-dma for example) 101 * I/O completely on that queue (see ide-dma for example)
102 */ 102 */
103#define __bio_kmap_atomic(bio, idx, kmtype) \ 103#define __bio_kmap_atomic(bio, idx, kmtype) \
104 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ 104 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
105 bio_iovec_idx((bio), (idx))->bv_offset) 105 bio_iovec_idx((bio), (idx))->bv_offset)
106 106
107#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) 107#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr)
108 108
109/* 109/*
110 * merge helpers etc 110 * merge helpers etc
@@ -317,7 +317,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
317 * balancing is a lot nicer this way 317 * balancing is a lot nicer this way
318 */ 318 */
319 local_irq_save(*flags); 319 local_irq_save(*flags);
320 addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); 320 addr = (unsigned long) kmap_atomic(bvec->bv_page);
321 321
322 BUG_ON(addr & ~PAGE_MASK); 322 BUG_ON(addr & ~PAGE_MASK);
323 323
@@ -328,7 +328,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
328{ 328{
329 unsigned long ptr = (unsigned long) buffer & PAGE_MASK; 329 unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
330 330
331 kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); 331 kunmap_atomic((void *) ptr);
332 local_irq_restore(*flags); 332 local_irq_restore(*flags);
333} 333}
334 334
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 3c1063acb2a..94300fe46cc 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -56,6 +56,26 @@ static inline unsigned long hweight_long(unsigned long w)
56} 56}
57 57
58/** 58/**
59 * rol64 - rotate a 64-bit value left
60 * @word: value to rotate
61 * @shift: bits to roll
62 */
63static inline __u64 rol64(__u64 word, unsigned int shift)
64{
65 return (word << shift) | (word >> (64 - shift));
66}
67
68/**
69 * ror64 - rotate a 64-bit value right
70 * @word: value to rotate
71 * @shift: bits to roll
72 */
73static inline __u64 ror64(__u64 word, unsigned int shift)
74{
75 return (word >> shift) | (word << (64 - shift));
76}
77
78/**
59 * rol32 - rotate a 32-bit value left 79 * rol32 - rotate a 32-bit value left
60 * @word: value to rotate 80 * @word: value to rotate
61 * @shift: bits to roll 81 * @shift: bits to roll
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6c6a1f00806..606cf339bb5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -399,9 +399,6 @@ struct request_queue {
399 /* Throttle data */ 399 /* Throttle data */
400 struct throtl_data *td; 400 struct throtl_data *td;
401#endif 401#endif
402#ifdef CONFIG_LOCKDEP
403 int ioc_release_depth;
404#endif
405}; 402};
406 403
407#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 404#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index a0969fcb72b..5d2efe7e3f1 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev);
92 92
93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, 93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
94 unsigned int idx); 94 unsigned int idx);
95void can_get_echo_skb(struct net_device *dev, unsigned int idx); 95unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
96void can_free_echo_skb(struct net_device *dev, unsigned int idx); 96void can_free_echo_skb(struct net_device *dev, unsigned int idx);
97 97
98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 35eae4b6750..7c48029dffe 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -952,7 +952,8 @@ struct cdrom_device_info {
952 char name[20]; /* name of the device type */ 952 char name[20]; /* name of the device type */
953/* per-device flags */ 953/* per-device flags */
954 __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ 954 __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */
955 __u8 reserved : 6; /* not used yet */ 955 __u8 keeplocked : 1; /* CDROM_LOCKDOOR status */
956 __u8 reserved : 5; /* not used yet */
956 int cdda_method; /* see flags */ 957 int cdda_method; /* see flags */
957 __u8 last_sense; 958 __u8 last_sense;
958 __u8 media_written; /* dirty flag, DVD+RW bookkeeping */ 959 __u8 media_written; /* dirty flag, DVD+RW bookkeeping */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e9b602151ca..501adb1b2f4 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -160,38 +160,6 @@ enum {
160 CGRP_CLONE_CHILDREN, 160 CGRP_CLONE_CHILDREN,
161}; 161};
162 162
163/* which pidlist file are we talking about? */
164enum cgroup_filetype {
165 CGROUP_FILE_PROCS,
166 CGROUP_FILE_TASKS,
167};
168
169/*
170 * A pidlist is a list of pids that virtually represents the contents of one
171 * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
172 * a pair (one each for procs, tasks) for each pid namespace that's relevant
173 * to the cgroup.
174 */
175struct cgroup_pidlist {
176 /*
177 * used to find which pidlist is wanted. doesn't change as long as
178 * this particular list stays in the list.
179 */
180 struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
181 /* array of xids */
182 pid_t *list;
183 /* how many elements the above list has */
184 int length;
185 /* how many files are using the current array */
186 int use_count;
187 /* each of these stored in a list by its cgroup */
188 struct list_head links;
189 /* pointer to the cgroup we belong to, for list removal purposes */
190 struct cgroup *owner;
191 /* protects the other fields */
192 struct rw_semaphore mutex;
193};
194
195struct cgroup { 163struct cgroup {
196 unsigned long flags; /* "unsigned long" so bitops work */ 164 unsigned long flags; /* "unsigned long" so bitops work */
197 165
@@ -484,23 +452,18 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
484 */ 452 */
485 453
486struct cgroup_subsys { 454struct cgroup_subsys {
487 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 455 struct cgroup_subsys_state *(*create)(struct cgroup *cgrp);
488 struct cgroup *cgrp); 456 int (*pre_destroy)(struct cgroup *cgrp);
489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 457 void (*destroy)(struct cgroup *cgrp);
490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 458 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 459 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
492 struct cgroup_taskset *tset); 460 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
493 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 461 void (*fork)(struct task_struct *task);
494 struct cgroup_taskset *tset); 462 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
495 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 463 struct task_struct *task);
496 struct cgroup_taskset *tset); 464 int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
497 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 465 void (*post_clone)(struct cgroup *cgrp);
498 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 466 void (*bind)(struct cgroup *root);
499 struct cgroup *old_cgrp, struct task_struct *task);
500 int (*populate)(struct cgroup_subsys *ss,
501 struct cgroup *cgrp);
502 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
503 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
504 467
505 int subsys_id; 468 int subsys_id;
506 int active; 469 int active;
@@ -602,11 +565,6 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan);
602int cgroup_attach_task(struct cgroup *, struct task_struct *); 565int cgroup_attach_task(struct cgroup *, struct task_struct *);
603int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 566int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
604 567
605static inline int cgroup_attach_task_current_cg(struct task_struct *tsk)
606{
607 return cgroup_attach_task_all(current, tsk);
608}
609
610/* 568/*
611 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works 569 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
612 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. 570 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
@@ -669,10 +627,6 @@ static inline int cgroup_attach_task_all(struct task_struct *from,
669{ 627{
670 return 0; 628 return 0;
671} 629}
672static inline int cgroup_attach_task_current_cg(struct task_struct *t)
673{
674 return 0;
675}
676 630
677#endif /* !CONFIG_CGROUPS */ 631#endif /* !CONFIG_CGROUPS */
678 632
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 081147da056..fbe89e17124 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -319,13 +319,6 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
319 __clocksource_updatefreq_scale(cs, 1000, khz); 319 __clocksource_updatefreq_scale(cs, 1000, khz);
320} 320}
321 321
322static inline void
323clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
324{
325 return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
326 NSEC_PER_SEC, minsec);
327}
328
329#ifdef CONFIG_GENERIC_TIME_VSYSCALL 322#ifdef CONFIG_GENERIC_TIME_VSYSCALL
330extern void 323extern void
331update_vsyscall(struct timespec *ts, struct timespec *wtm, 324update_vsyscall(struct timespec *ts, struct timespec *wtm,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41c9f6515f4..7e05fcee75a 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -561,5 +561,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
561 unsigned long liovcnt, const struct compat_iovec __user *rvec, 561 unsigned long liovcnt, const struct compat_iovec __user *rvec,
562 unsigned long riovcnt, unsigned long flags); 562 unsigned long riovcnt, unsigned long flags);
563 563
564#else
565
566#define is_compat_task() (0)
567
564#endif /* CONFIG_COMPAT */ 568#endif /* CONFIG_COMPAT */
565#endif /* _LINUX_COMPAT_H */ 569#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 4a243546d14..923d093c9ce 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -236,7 +236,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
236 236
237/* 237/*
238 * Rather then using noinline to prevent stack consumption, use 238 * Rather then using noinline to prevent stack consumption, use
239 * noinline_for_stack instead. For documentaiton reasons. 239 * noinline_for_stack instead. For documentation reasons.
240 */ 240 */
241#define noinline_for_stack noinline 241#define noinline_for_stack noinline
242 242
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 3c9c54fd569..76384074262 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -43,6 +43,7 @@
43#define CN_IDX_DRBD 0x8 43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1 44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */ 45#define CN_KVP_IDX 0x9 /* HyperV KVP */
46#define CN_KVP_VAL 0x1 /* queries from the kernel */
46 47
47#define CN_NETLINK_USERS 10 /* Highest index + 1 */ 48#define CN_NETLINK_USERS 10 /* Highest index + 1 */
48 49
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 1f6587590a1..6e53b4823d7 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -44,6 +44,13 @@ extern ssize_t arch_cpu_release(const char *, size_t);
44#endif 44#endif
45struct notifier_block; 45struct notifier_block;
46 46
47#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
48extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env);
49extern ssize_t arch_print_cpu_modalias(struct device *dev,
50 struct device_attribute *attr,
51 char *bufptr);
52#endif
53
47/* 54/*
48 * CPU notifier priorities. 55 * CPU notifier priorities.
49 */ 56 */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d64a55b23af..ff5f5256d17 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -47,27 +47,6 @@ struct dentry_stat_t {
47}; 47};
48extern struct dentry_stat_t dentry_stat; 48extern struct dentry_stat_t dentry_stat;
49 49
50/*
51 * Compare 2 name strings, return 0 if they match, otherwise non-zero.
52 * The strings are both count bytes long, and count is non-zero.
53 */
54static inline int dentry_cmp(const unsigned char *cs, size_t scount,
55 const unsigned char *ct, size_t tcount)
56{
57 int ret;
58 if (scount != tcount)
59 return 1;
60 do {
61 ret = (*cs != *ct);
62 if (ret)
63 break;
64 cs++;
65 ct++;
66 tcount--;
67 } while (tcount);
68 return ret;
69}
70
71/* Name hashing routines. Initial hash value */ 50/* Name hashing routines. Initial hash value */
72/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ 51/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
73#define init_name_hash() 0 52#define init_name_hash() 0
@@ -89,14 +68,7 @@ static inline unsigned long end_name_hash(unsigned long hash)
89} 68}
90 69
91/* Compute the hash for a name string. */ 70/* Compute the hash for a name string. */
92static inline unsigned int 71extern unsigned int full_name_hash(const unsigned char *, unsigned int);
93full_name_hash(const unsigned char *name, unsigned int len)
94{
95 unsigned long hash = init_name_hash();
96 while (len--)
97 hash = partial_name_hash(*name++, hash);
98 return end_name_hash(hash);
99}
100 72
101/* 73/*
102 * Try to keep struct dentry aligned on 64 byte cachelines (this will 74 * Try to keep struct dentry aligned on 64 byte cachelines (this will
@@ -309,7 +281,8 @@ extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
309extern struct dentry *d_lookup(struct dentry *, struct qstr *); 281extern struct dentry *d_lookup(struct dentry *, struct qstr *);
310extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 282extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
311extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 283extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
312extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 284extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
285 const struct qstr *name,
313 unsigned *seq, struct inode **inode); 286 unsigned *seq, struct inode **inode);
314 287
315/** 288/**
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 710c04302a1..eaf95a023af 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -376,8 +376,10 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
376/** 376/**
377 * struct dccp_request_sock - represent DCCP-specific connection request 377 * struct dccp_request_sock - represent DCCP-specific connection request
378 * @dreq_inet_rsk: structure inherited from 378 * @dreq_inet_rsk: structure inherited from
379 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 379 * @dreq_iss: initial sequence number, sent on the first Response (RFC 4340, 7.1)
380 * @dreq_isr: initial sequence number received on the Request 380 * @dreq_gss: greatest sequence number sent (for retransmitted Responses)
381 * @dreq_isr: initial sequence number received in the first Request
382 * @dreq_gsr: greatest sequence number received (for retransmitted Request(s))
381 * @dreq_service: service code present on the Request (there is just one) 383 * @dreq_service: service code present on the Request (there is just one)
382 * @dreq_featneg: feature negotiation options for this connection 384 * @dreq_featneg: feature negotiation options for this connection
383 * The following two fields are analogous to the ones in dccp_sock: 385 * The following two fields are analogous to the ones in dccp_sock:
@@ -387,7 +389,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
387struct dccp_request_sock { 389struct dccp_request_sock {
388 struct inet_request_sock dreq_inet_rsk; 390 struct inet_request_sock dreq_inet_rsk;
389 __u64 dreq_iss; 391 __u64 dreq_iss;
392 __u64 dreq_gss;
390 __u64 dreq_isr; 393 __u64 dreq_isr;
394 __u64 dreq_gsr;
391 __be32 dreq_service; 395 __be32 dreq_service;
392 struct list_head dreq_featneg; 396 struct list_head dreq_featneg;
393 __u32 dreq_timestamp_echo; 397 __u32 dreq_timestamp_echo;
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 98ce8124b1c..281c72a3b9d 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -44,6 +44,14 @@ struct devfreq_dev_status {
44 void *private_data; 44 void *private_data;
45}; 45};
46 46
47/*
48 * The resulting frequency should be at most this. (this bound is the
49 * least upper bound; thus, the resulting freq should be lower or same)
50 * If the flag is not set, the resulting frequency should be at most the
51 * bound (greatest lower bound)
52 */
53#define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1
54
47/** 55/**
48 * struct devfreq_dev_profile - Devfreq's user device profile 56 * struct devfreq_dev_profile - Devfreq's user device profile
49 * @initial_freq The operating frequency when devfreq_add_device() is 57 * @initial_freq The operating frequency when devfreq_add_device() is
@@ -54,6 +62,8 @@ struct devfreq_dev_status {
54 * higher than any operable frequency, set maximum. 62 * higher than any operable frequency, set maximum.
55 * Before returning, target function should set 63 * Before returning, target function should set
56 * freq at the current frequency. 64 * freq at the current frequency.
65 * The "flags" parameter's possible values are
66 * explained above with "DEVFREQ_FLAG_*" macros.
57 * @get_dev_status The device should provide the current performance 67 * @get_dev_status The device should provide the current performance
58 * status to devfreq, which is used by governors. 68 * status to devfreq, which is used by governors.
59 * @exit An optional callback that is called when devfreq 69 * @exit An optional callback that is called when devfreq
@@ -66,7 +76,7 @@ struct devfreq_dev_profile {
66 unsigned long initial_freq; 76 unsigned long initial_freq;
67 unsigned int polling_ms; 77 unsigned int polling_ms;
68 78
69 int (*target)(struct device *dev, unsigned long *freq); 79 int (*target)(struct device *dev, unsigned long *freq, u32 flags);
70 int (*get_dev_status)(struct device *dev, 80 int (*get_dev_status)(struct device *dev,
71 struct devfreq_dev_status *stat); 81 struct devfreq_dev_status *stat);
72 void (*exit)(struct device *dev); 82 void (*exit)(struct device *dev);
@@ -124,6 +134,8 @@ struct devfreq_governor {
124 * touch this. 134 * touch this.
125 * @being_removed a flag to mark that this object is being removed in 135 * @being_removed a flag to mark that this object is being removed in
126 * order to prevent trying to remove the object multiple times. 136 * order to prevent trying to remove the object multiple times.
137 * @min_freq Limit minimum frequency requested by user (0: none)
138 * @max_freq Limit maximum frequency requested by user (0: none)
127 * 139 *
128 * This structure stores the devfreq information for a give device. 140 * This structure stores the devfreq information for a give device.
129 * 141 *
@@ -149,6 +161,9 @@ struct devfreq {
149 void *data; /* private data for governors */ 161 void *data; /* private data for governors */
150 162
151 bool being_removed; 163 bool being_removed;
164
165 unsigned long min_freq;
166 unsigned long max_freq;
152}; 167};
153 168
154#if defined(CONFIG_PM_DEVFREQ) 169#if defined(CONFIG_PM_DEVFREQ)
@@ -160,7 +175,7 @@ extern int devfreq_remove_device(struct devfreq *devfreq);
160 175
161/* Helper functions for devfreq user device driver with OPP. */ 176/* Helper functions for devfreq user device driver with OPP. */
162extern struct opp *devfreq_recommended_opp(struct device *dev, 177extern struct opp *devfreq_recommended_opp(struct device *dev,
163 unsigned long *freq); 178 unsigned long *freq, u32 flags);
164extern int devfreq_register_opp_notifier(struct device *dev, 179extern int devfreq_register_opp_notifier(struct device *dev,
165 struct devfreq *devfreq); 180 struct devfreq *devfreq);
166extern int devfreq_unregister_opp_notifier(struct device *dev, 181extern int devfreq_unregister_opp_notifier(struct device *dev,
@@ -200,18 +215,18 @@ struct devfreq_simple_ondemand_data {
200static struct devfreq *devfreq_add_device(struct device *dev, 215static struct devfreq *devfreq_add_device(struct device *dev,
201 struct devfreq_dev_profile *profile, 216 struct devfreq_dev_profile *profile,
202 struct devfreq_governor *governor, 217 struct devfreq_governor *governor,
203 void *data); 218 void *data)
204{ 219{
205 return NULL; 220 return NULL;
206} 221}
207 222
208static int devfreq_remove_device(struct devfreq *devfreq); 223static int devfreq_remove_device(struct devfreq *devfreq)
209{ 224{
210 return 0; 225 return 0;
211} 226}
212 227
213static struct opp *devfreq_recommended_opp(struct device *dev, 228static struct opp *devfreq_recommended_opp(struct device *dev,
214 unsigned long *freq) 229 unsigned long *freq, u32 flags)
215{ 230{
216 return -EINVAL; 231 return -EINVAL;
217} 232}
diff --git a/include/linux/device.h b/include/linux/device.h
index 5b3adb8f958..7c46bc32fcb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -238,8 +238,6 @@ struct device_driver {
238extern int __must_check driver_register(struct device_driver *drv); 238extern int __must_check driver_register(struct device_driver *drv);
239extern void driver_unregister(struct device_driver *drv); 239extern void driver_unregister(struct device_driver *drv);
240 240
241extern struct device_driver *get_driver(struct device_driver *drv);
242extern void put_driver(struct device_driver *drv);
243extern struct device_driver *driver_find(const char *name, 241extern struct device_driver *driver_find(const char *name,
244 struct bus_type *bus); 242 struct bus_type *bus);
245extern int driver_probe_done(void); 243extern int driver_probe_done(void);
@@ -279,11 +277,11 @@ struct device *driver_find_device(struct device_driver *drv,
279 277
280/** 278/**
281 * struct subsys_interface - interfaces to device functions 279 * struct subsys_interface - interfaces to device functions
282 * @name name of the device function 280 * @name: name of the device function
283 * @subsystem subsytem of the devices to attach to 281 * @subsys: subsytem of the devices to attach to
284 * @node the list of functions registered at the subsystem 282 * @node: the list of functions registered at the subsystem
285 * @add device hookup to device function handler 283 * @add_dev: device hookup to device function handler
286 * @remove device hookup to device function handler 284 * @remove_dev: device hookup to device function handler
287 * 285 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can 286 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not 287 * attach to a subsystem and its devices. Unlike drivers, they do not
@@ -612,6 +610,7 @@ struct device_dma_parameters {
612 * @archdata: For arch-specific additions. 610 * @archdata: For arch-specific additions.
613 * @of_node: Associated device tree node. 611 * @of_node: Associated device tree node.
614 * @devt: For creating the sysfs "dev". 612 * @devt: For creating the sysfs "dev".
613 * @id: device instance
615 * @devres_lock: Spinlock to protect the resource of the device. 614 * @devres_lock: Spinlock to protect the resource of the device.
616 * @devres_head: The resources list of the device. 615 * @devres_head: The resources list of the device.
617 * @knode_class: The node used to add the device to the class list. 616 * @knode_class: The node used to add the device to the class list.
@@ -945,14 +944,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
945 944
946#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 945#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
947 946
948#if defined(DEBUG) 947#if defined(CONFIG_DYNAMIC_DEBUG)
949#define dev_dbg(dev, format, arg...) \
950 dev_printk(KERN_DEBUG, dev, format, ##arg)
951#elif defined(CONFIG_DYNAMIC_DEBUG)
952#define dev_dbg(dev, format, ...) \ 948#define dev_dbg(dev, format, ...) \
953do { \ 949do { \
954 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 950 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
955} while (0) 951} while (0)
952#elif defined(DEBUG)
953#define dev_dbg(dev, format, arg...) \
954 dev_printk(KERN_DEBUG, dev, format, ##arg)
956#else 955#else
957#define dev_dbg(dev, format, arg...) \ 956#define dev_dbg(dev, format, arg...) \
958({ \ 957({ \
@@ -1003,18 +1002,23 @@ extern long sysfs_deprecated;
1003 * Each module may only use this macro once, and calling it replaces 1002 * Each module may only use this macro once, and calling it replaces
1004 * module_init() and module_exit(). 1003 * module_init() and module_exit().
1005 * 1004 *
1005 * @__driver: driver name
1006 * @__register: register function for this driver type
1007 * @__unregister: unregister function for this driver type
1008 * @...: Additional arguments to be passed to __register and __unregister.
1009 *
1006 * Use this macro to construct bus specific macros for registering 1010 * Use this macro to construct bus specific macros for registering
1007 * drivers, and do not use it on its own. 1011 * drivers, and do not use it on its own.
1008 */ 1012 */
1009#define module_driver(__driver, __register, __unregister) \ 1013#define module_driver(__driver, __register, __unregister, ...) \
1010static int __init __driver##_init(void) \ 1014static int __init __driver##_init(void) \
1011{ \ 1015{ \
1012 return __register(&(__driver)); \ 1016 return __register(&(__driver) , ##__VA_ARGS__); \
1013} \ 1017} \
1014module_init(__driver##_init); \ 1018module_init(__driver##_init); \
1015static void __exit __driver##_exit(void) \ 1019static void __exit __driver##_exit(void) \
1016{ \ 1020{ \
1017 __unregister(&(__driver)); \ 1021 __unregister(&(__driver) , ##__VA_ARGS__); \
1018} \ 1022} \
1019module_exit(__driver##_exit); 1023module_exit(__driver##_exit);
1020 1024
diff --git a/include/linux/digsig.h b/include/linux/digsig.h
index b01558b1581..6f85a070bb4 100644
--- a/include/linux/digsig.h
+++ b/include/linux/digsig.h
@@ -30,7 +30,7 @@ enum digest_algo {
30 30
31struct pubkey_hdr { 31struct pubkey_hdr {
32 uint8_t version; /* key format version */ 32 uint8_t version; /* key format version */
33 time_t timestamp; /* key made, always 0 for now */ 33 uint32_t timestamp; /* key made, always 0 for now */
34 uint8_t algo; 34 uint8_t algo;
35 uint8_t nmpi; 35 uint8_t nmpi;
36 char mpi[0]; 36 char mpi[0];
@@ -38,7 +38,7 @@ struct pubkey_hdr {
38 38
39struct signature_hdr { 39struct signature_hdr {
40 uint8_t version; /* signature format version */ 40 uint8_t version; /* signature format version */
41 time_t timestamp; /* signature made */ 41 uint32_t timestamp; /* signature made */
42 uint8_t algo; 42 uint8_t algo;
43 uint8_t hash; 43 uint8_t hash;
44 uint8_t keyid[8]; 44 uint8_t keyid[8];
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 0564e3c3988..7e3c53a900d 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -15,20 +15,24 @@ struct _ddebug {
15 const char *function; 15 const char *function;
16 const char *filename; 16 const char *filename;
17 const char *format; 17 const char *format;
18 unsigned int lineno:24; 18 unsigned int lineno:18;
19 /* 19 /*
20 * The flags field controls the behaviour at the callsite. 20 * The flags field controls the behaviour at the callsite.
21 * The bits here are changed dynamically when the user 21 * The bits here are changed dynamically when the user
22 * writes commands to <debugfs>/dynamic_debug/control 22 * writes commands to <debugfs>/dynamic_debug/control
23 */ 23 */
24#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 24#define _DPRINTK_FLAGS_NONE 0
25#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
25#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) 26#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
26#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) 27#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
27#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) 28#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
28#define _DPRINTK_FLAGS_INCL_TID (1<<4) 29#define _DPRINTK_FLAGS_INCL_TID (1<<4)
30#if defined DEBUG
31#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
32#else
29#define _DPRINTK_FLAGS_DEFAULT 0 33#define _DPRINTK_FLAGS_DEFAULT 0
34#endif
30 unsigned int flags:8; 35 unsigned int flags:8;
31 char enabled;
32} __attribute__((aligned(8))); 36} __attribute__((aligned(8)));
33 37
34 38
@@ -62,21 +66,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
62 .format = (fmt), \ 66 .format = (fmt), \
63 .lineno = __LINE__, \ 67 .lineno = __LINE__, \
64 .flags = _DPRINTK_FLAGS_DEFAULT, \ 68 .flags = _DPRINTK_FLAGS_DEFAULT, \
65 .enabled = false, \
66 } 69 }
67 70
68#define dynamic_pr_debug(fmt, ...) \ 71#define dynamic_pr_debug(fmt, ...) \
69do { \ 72do { \
70 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 73 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
71 if (unlikely(descriptor.enabled)) \ 74 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
72 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 75 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
73 ##__VA_ARGS__); \ 76 ##__VA_ARGS__); \
74} while (0) 77} while (0)
75 78
76#define dynamic_dev_dbg(dev, fmt, ...) \ 79#define dynamic_dev_dbg(dev, fmt, ...) \
77do { \ 80do { \
78 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 81 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
79 if (unlikely(descriptor.enabled)) \ 82 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
80 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 83 __dynamic_dev_dbg(&descriptor, dev, fmt, \
81 ##__VA_ARGS__); \ 84 ##__VA_ARGS__); \
82} while (0) 85} while (0)
@@ -84,7 +87,7 @@ do { \
84#define dynamic_netdev_dbg(dev, fmt, ...) \ 87#define dynamic_netdev_dbg(dev, fmt, ...) \
85do { \ 88do { \
86 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 89 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
87 if (unlikely(descriptor.enabled)) \ 90 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
88 __dynamic_netdev_dbg(&descriptor, dev, fmt, \ 91 __dynamic_netdev_dbg(&descriptor, dev, fmt, \
89 ##__VA_ARGS__); \ 92 ##__VA_ARGS__); \
90} while (0) 93} while (0)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index c24f3d7fbf1..7d4e0356f32 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -42,12 +42,6 @@ struct elevator_ops
42 elevator_merged_fn *elevator_merged_fn; 42 elevator_merged_fn *elevator_merged_fn;
43 elevator_merge_req_fn *elevator_merge_req_fn; 43 elevator_merge_req_fn *elevator_merge_req_fn;
44 elevator_allow_merge_fn *elevator_allow_merge_fn; 44 elevator_allow_merge_fn *elevator_allow_merge_fn;
45
46 /*
47 * Used for both plugged list and elevator merging and in the
48 * former case called without queue_lock. Read comment on top of
49 * attempt_plug_merge() for details.
50 */
51 elevator_bio_merged_fn *elevator_bio_merged_fn; 45 elevator_bio_merged_fn *elevator_bio_merged_fn;
52 46
53 elevator_dispatch_fn *elevator_dispatch_fn; 47 elevator_dispatch_fn *elevator_dispatch_fn;
@@ -122,7 +116,6 @@ extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
122extern void elv_add_request(struct request_queue *, struct request *, int); 116extern void elv_add_request(struct request_queue *, struct request *, int);
123extern void __elv_add_request(struct request_queue *, struct request *, int); 117extern void __elv_add_request(struct request_queue *, struct request *, int);
124extern int elv_merge(struct request_queue *, struct request **, struct bio *); 118extern int elv_merge(struct request_queue *, struct request **, struct bio *);
125extern int elv_try_merge(struct request *, struct bio *);
126extern void elv_merge_requests(struct request_queue *, struct request *, 119extern void elv_merge_requests(struct request_queue *, struct request *,
127 struct request *); 120 struct request *);
128extern void elv_merged_request(struct request_queue *, struct request *, int); 121extern void elv_merged_request(struct request_queue *, struct request *, int);
@@ -155,7 +148,7 @@ extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
155extern int elevator_init(struct request_queue *, char *); 148extern int elevator_init(struct request_queue *, char *);
156extern void elevator_exit(struct elevator_queue *); 149extern void elevator_exit(struct elevator_queue *);
157extern int elevator_change(struct request_queue *, const char *); 150extern int elevator_change(struct request_queue *, const char *);
158extern int elv_rq_merge_ok(struct request *, struct bio *); 151extern bool elv_rq_merge_ok(struct request *, struct bio *);
159 152
160/* 153/*
161 * Helper functions. 154 * Helper functions.
diff --git a/include/linux/errno.h b/include/linux/errno.h
index 46685832ed9..2d09bfa5c26 100644
--- a/include/linux/errno.h
+++ b/include/linux/errno.h
@@ -16,6 +16,7 @@
16#define ERESTARTNOHAND 514 /* restart if no handler.. */ 16#define ERESTARTNOHAND 514 /* restart if no handler.. */
17#define ENOIOCTLCMD 515 /* No ioctl command */ 17#define ENOIOCTLCMD 515 /* No ioctl command */
18#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ 18#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
19#define EPROBE_DEFER 517 /* Driver requests probe retry */
19 20
20/* Defined for the NFSv3 protocol */ 21/* Defined for the NFSv3 protocol */
21#define EBADHANDLE 521 /* Illegal NFS file handle */ 22#define EBADHANDLE 521 /* Illegal NFS file handle */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 05955cf0993..8a1835855fa 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr)
140} 140}
141 141
142/** 142/**
143 * dev_hw_addr_random - Create random MAC and set device flag 143 * eth_hw_addr_random - Generate software assigned random Ethernet and
144 * set device flag
144 * @dev: pointer to net_device structure 145 * @dev: pointer to net_device structure
145 * @hwaddr: Pointer to a six-byte array containing the Ethernet address
146 * 146 *
147 * Generate random MAC to be used by a device and set addr_assign_type 147 * Generate a random Ethernet address (MAC) to be used by a net device
148 * so the state can be read by sysfs and be used by udev. 148 * and set addr_assign_type so the state can be read by sysfs and be
149 * used by userspace.
149 */ 150 */
150static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr) 151static inline void eth_hw_addr_random(struct net_device *dev)
151{ 152{
152 dev->addr_assign_type |= NET_ADDR_RANDOM; 153 dev->addr_assign_type |= NET_ADDR_RANDOM;
153 random_ether_addr(hwaddr); 154 random_ether_addr(dev->dev_addr);
154} 155}
155 156
156/** 157/**
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index da5b2de99ae..e1d9e0ede30 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -30,10 +30,15 @@ struct ethtool_cmd {
30 * access it */ 30 * access it */
31 __u8 duplex; /* Duplex, half or full */ 31 __u8 duplex; /* Duplex, half or full */
32 __u8 port; /* Which connector port */ 32 __u8 port; /* Which connector port */
33 __u8 phy_address; 33 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45).
34 * May be read-only or read-write
35 * depending on the driver.
36 */
34 __u8 transceiver; /* Which transceiver to use */ 37 __u8 transceiver; /* Which transceiver to use */
35 __u8 autoneg; /* Enable or disable autonegotiation */ 38 __u8 autoneg; /* Enable or disable autonegotiation */
36 __u8 mdio_support; 39 __u8 mdio_support; /* MDIO protocols supported. Read-only.
40 * Not set by all drivers.
41 */
37 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 42 __u32 maxtxpkt; /* Tx pkts before generating tx int */
38 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 43 __u32 maxrxpkt; /* Rx pkts before generating rx int */
39 __u16 speed_hi; /* The forced speed (upper 44 __u16 speed_hi; /* The forced speed (upper
@@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
59 return (ep->speed_hi << 16) | ep->speed; 64 return (ep->speed_hi << 16) | ep->speed;
60} 65}
61 66
67/* Device supports clause 22 register access to PHY or peripherals
68 * using the interface defined in <linux/mii.h>. This should not be
69 * set if there are known to be no such peripherals present or if
70 * the driver only emulates clause 22 registers for compatibility.
71 */
72#define ETH_MDIO_SUPPORTS_C22 1
73
74/* Device supports clause 45 register access to PHY or peripherals
75 * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
76 * This should not be set if there are known to be no such peripherals
77 * present.
78 */
79#define ETH_MDIO_SUPPORTS_C45 2
80
62#define ETHTOOL_FWVERS_LEN 32 81#define ETHTOOL_FWVERS_LEN 32
63#define ETHTOOL_BUSINFO_LEN 32 82#define ETHTOOL_BUSINFO_LEN 32
64/* these strings are set to whatever the driver author decides... */ 83/* these strings are set to whatever the driver author decides... */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 0ab54e16a91..d09af4b67cf 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -39,6 +39,7 @@ extern bool __refrigerator(bool check_kthr_stop);
39extern int freeze_processes(void); 39extern int freeze_processes(void);
40extern int freeze_kernel_threads(void); 40extern int freeze_kernel_threads(void);
41extern void thaw_processes(void); 41extern void thaw_processes(void);
42extern void thaw_kernel_threads(void);
42 43
43static inline bool try_to_freeze(void) 44static inline bool try_to_freeze(void)
44{ 45{
@@ -174,6 +175,7 @@ static inline bool __refrigerator(bool check_kthr_stop) { return false; }
174static inline int freeze_processes(void) { return -ENOSYS; } 175static inline int freeze_processes(void) { return -ENOSYS; }
175static inline int freeze_kernel_threads(void) { return -ENOSYS; } 176static inline int freeze_kernel_threads(void) { return -ENOSYS; }
176static inline void thaw_processes(void) {} 177static inline void thaw_processes(void) {}
178static inline void thaw_kernel_threads(void) {}
177 179
178static inline bool try_to_freeze(void) { return false; } 180static inline bool try_to_freeze(void) { return false; }
179 181
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0244082d42c..69cd5bb640f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -396,6 +396,7 @@ struct inodes_stat_t {
396#include <linux/rculist_bl.h> 396#include <linux/rculist_bl.h>
397#include <linux/atomic.h> 397#include <linux/atomic.h>
398#include <linux/shrinker.h> 398#include <linux/shrinker.h>
399#include <linux/migrate_mode.h>
399 400
400#include <asm/byteorder.h> 401#include <asm/byteorder.h>
401 402
@@ -526,7 +527,6 @@ enum positive_aop_returns {
526struct page; 527struct page;
527struct address_space; 528struct address_space;
528struct writeback_control; 529struct writeback_control;
529enum migrate_mode;
530 530
531struct iov_iter { 531struct iov_iter {
532 const struct iovec *iov; 532 const struct iovec *iov;
@@ -2496,6 +2496,7 @@ extern void get_filesystem(struct file_system_type *fs);
2496extern void put_filesystem(struct file_system_type *fs); 2496extern void put_filesystem(struct file_system_type *fs);
2497extern struct file_system_type *get_fs_type(const char *name); 2497extern struct file_system_type *get_fs_type(const char *name);
2498extern struct super_block *get_super(struct block_device *); 2498extern struct super_block *get_super(struct block_device *);
2499extern struct super_block *get_super_thawed(struct block_device *);
2499extern struct super_block *get_active_super(struct block_device *bdev); 2500extern struct super_block *get_active_super(struct block_device *bdev);
2500extern void drop_super(struct super_block *sb); 2501extern void drop_super(struct super_block *sb);
2501extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2502extern void iterate_supers(void (*)(struct super_block *, void *), void *);
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 028e26f0bf0..72a6cabb4d5 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -31,16 +31,33 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
31 31
32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
33 33
34/*
35 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
36 * set in the flags member.
37 *
38 * ENABLED - set/unset when ftrace_ops is registered/unregistered
39 * GLOBAL - set manualy by ftrace_ops user to denote the ftrace_ops
40 * is part of the global tracers sharing the same filter
41 * via set_ftrace_* debugfs files.
42 * DYNAMIC - set when ftrace_ops is registered to denote dynamically
43 * allocated ftrace_ops which need special care
44 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops
45 * could be controled by following calls:
46 * ftrace_function_local_enable
47 * ftrace_function_local_disable
48 */
34enum { 49enum {
35 FTRACE_OPS_FL_ENABLED = 1 << 0, 50 FTRACE_OPS_FL_ENABLED = 1 << 0,
36 FTRACE_OPS_FL_GLOBAL = 1 << 1, 51 FTRACE_OPS_FL_GLOBAL = 1 << 1,
37 FTRACE_OPS_FL_DYNAMIC = 1 << 2, 52 FTRACE_OPS_FL_DYNAMIC = 1 << 2,
53 FTRACE_OPS_FL_CONTROL = 1 << 3,
38}; 54};
39 55
40struct ftrace_ops { 56struct ftrace_ops {
41 ftrace_func_t func; 57 ftrace_func_t func;
42 struct ftrace_ops *next; 58 struct ftrace_ops *next;
43 unsigned long flags; 59 unsigned long flags;
60 int __percpu *disabled;
44#ifdef CONFIG_DYNAMIC_FTRACE 61#ifdef CONFIG_DYNAMIC_FTRACE
45 struct ftrace_hash *notrace_hash; 62 struct ftrace_hash *notrace_hash;
46 struct ftrace_hash *filter_hash; 63 struct ftrace_hash *filter_hash;
@@ -97,6 +114,55 @@ int register_ftrace_function(struct ftrace_ops *ops);
97int unregister_ftrace_function(struct ftrace_ops *ops); 114int unregister_ftrace_function(struct ftrace_ops *ops);
98void clear_ftrace_function(void); 115void clear_ftrace_function(void);
99 116
117/**
118 * ftrace_function_local_enable - enable controlled ftrace_ops on current cpu
119 *
120 * This function enables tracing on current cpu by decreasing
121 * the per cpu control variable.
122 * It must be called with preemption disabled and only on ftrace_ops
123 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
124 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
125 */
126static inline void ftrace_function_local_enable(struct ftrace_ops *ops)
127{
128 if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
129 return;
130
131 (*this_cpu_ptr(ops->disabled))--;
132}
133
134/**
135 * ftrace_function_local_disable - enable controlled ftrace_ops on current cpu
136 *
137 * This function enables tracing on current cpu by decreasing
138 * the per cpu control variable.
139 * It must be called with preemption disabled and only on ftrace_ops
140 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
141 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
142 */
143static inline void ftrace_function_local_disable(struct ftrace_ops *ops)
144{
145 if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
146 return;
147
148 (*this_cpu_ptr(ops->disabled))++;
149}
150
151/**
152 * ftrace_function_local_disabled - returns ftrace_ops disabled value
153 * on current cpu
154 *
155 * This function returns value of ftrace_ops::disabled on current cpu.
156 * It must be called with preemption disabled and only on ftrace_ops
157 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
158 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
159 */
160static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
161{
162 WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL));
163 return *this_cpu_ptr(ops->disabled);
164}
165
100extern void ftrace_stub(unsigned long a0, unsigned long a1); 166extern void ftrace_stub(unsigned long a0, unsigned long a1);
101 167
102#else /* !CONFIG_FUNCTION_TRACER */ 168#else /* !CONFIG_FUNCTION_TRACER */
@@ -178,12 +244,13 @@ struct dyn_ftrace {
178}; 244};
179 245
180int ftrace_force_update(void); 246int ftrace_force_update(void);
181void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 247int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
182 int len, int reset); 248 int len, int reset);
183void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 249int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
184 int len, int reset); 250 int len, int reset);
185void ftrace_set_global_filter(unsigned char *buf, int len, int reset); 251void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
186void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); 252void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
253void ftrace_free_filter(struct ftrace_ops *ops);
187 254
188int register_ftrace_command(struct ftrace_func_command *cmd); 255int register_ftrace_command(struct ftrace_func_command *cmd);
189int unregister_ftrace_command(struct ftrace_func_command *cmd); 256int unregister_ftrace_command(struct ftrace_func_command *cmd);
@@ -314,9 +381,6 @@ extern void ftrace_enable_daemon(void);
314#else 381#else
315static inline int skip_trace(unsigned long ip) { return 0; } 382static inline int skip_trace(unsigned long ip) { return 0; }
316static inline int ftrace_force_update(void) { return 0; } 383static inline int ftrace_force_update(void) { return 0; }
317static inline void ftrace_set_filter(unsigned char *buf, int len, int reset)
318{
319}
320static inline void ftrace_disable_daemon(void) { } 384static inline void ftrace_disable_daemon(void) { }
321static inline void ftrace_enable_daemon(void) { } 385static inline void ftrace_enable_daemon(void) { }
322static inline void ftrace_release_mod(struct module *mod) {} 386static inline void ftrace_release_mod(struct module *mod) {}
@@ -340,6 +404,9 @@ static inline int ftrace_text_reserved(void *start, void *end)
340 */ 404 */
341#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; }) 405#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
342#define ftrace_set_early_filter(ops, buf, enable) do { } while (0) 406#define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
407#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
408#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
409#define ftrace_free_filter(ops) do { } while (0)
343 410
344static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, 411static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
345 size_t cnt, loff_t *ppos) { return -ENODEV; } 412 size_t cnt, loff_t *ppos) { return -ENODEV; }
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c3da42dd22b..dd478fc8f9f 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -146,6 +146,10 @@ enum trace_reg {
146 TRACE_REG_UNREGISTER, 146 TRACE_REG_UNREGISTER,
147 TRACE_REG_PERF_REGISTER, 147 TRACE_REG_PERF_REGISTER,
148 TRACE_REG_PERF_UNREGISTER, 148 TRACE_REG_PERF_UNREGISTER,
149 TRACE_REG_PERF_OPEN,
150 TRACE_REG_PERF_CLOSE,
151 TRACE_REG_PERF_ADD,
152 TRACE_REG_PERF_DEL,
149}; 153};
150 154
151struct ftrace_event_call; 155struct ftrace_event_call;
@@ -157,7 +161,7 @@ struct ftrace_event_class {
157 void *perf_probe; 161 void *perf_probe;
158#endif 162#endif
159 int (*reg)(struct ftrace_event_call *event, 163 int (*reg)(struct ftrace_event_call *event,
160 enum trace_reg type); 164 enum trace_reg type, void *data);
161 int (*define_fields)(struct ftrace_event_call *); 165 int (*define_fields)(struct ftrace_event_call *);
162 struct list_head *(*get_fields)(struct ftrace_event_call *); 166 struct list_head *(*get_fields)(struct ftrace_event_call *);
163 struct list_head fields; 167 struct list_head fields;
@@ -165,7 +169,7 @@ struct ftrace_event_class {
165}; 169};
166 170
167extern int ftrace_event_reg(struct ftrace_event_call *event, 171extern int ftrace_event_reg(struct ftrace_event_call *event,
168 enum trace_reg type); 172 enum trace_reg type, void *data);
169 173
170enum { 174enum {
171 TRACE_EVENT_FL_ENABLED_BIT, 175 TRACE_EVENT_FL_ENABLED_BIT,
@@ -241,6 +245,7 @@ enum {
241 FILTER_STATIC_STRING, 245 FILTER_STATIC_STRING,
242 FILTER_DYN_STRING, 246 FILTER_DYN_STRING,
243 FILTER_PTR_STRING, 247 FILTER_PTR_STRING,
248 FILTER_TRACE_FN,
244}; 249};
245 250
246#define EVENT_STORAGE_SIZE 128 251#define EVENT_STORAGE_SIZE 128
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index fe23ee76858..e61d3192448 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -596,6 +596,7 @@ extern char *disk_name (struct gendisk *hd, int partno, char *buf);
596 596
597extern int disk_expand_part_tbl(struct gendisk *disk, int target); 597extern int disk_expand_part_tbl(struct gendisk *disk, int target);
598extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 598extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
599extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev);
599extern struct hd_struct * __must_check add_partition(struct gendisk *disk, 600extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
600 int partno, sector_t start, 601 int partno, sector_t start,
601 sector_t len, int flags, 602 sector_t len, int flags,
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index b5ca4b2c08e..004ff33ab38 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -1,6 +1,8 @@
1#ifndef _GPIO_KEYS_H 1#ifndef _GPIO_KEYS_H
2#define _GPIO_KEYS_H 2#define _GPIO_KEYS_H
3 3
4struct device;
5
4struct gpio_keys_button { 6struct gpio_keys_button {
5 /* Configuration parameters */ 7 /* Configuration parameters */
6 unsigned int code; /* input event code (KEY_*, SW_*) */ 8 unsigned int code; /* input event code (KEY_*, SW_*) */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 3a93f73a8ac..6549ed75e0a 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -55,12 +55,12 @@ static inline void kunmap(struct page *page)
55{ 55{
56} 56}
57 57
58static inline void *__kmap_atomic(struct page *page) 58static inline void *kmap_atomic(struct page *page)
59{ 59{
60 pagefault_disable(); 60 pagefault_disable();
61 return page_address(page); 61 return page_address(page);
62} 62}
63#define kmap_atomic_prot(page, prot) __kmap_atomic(page) 63#define kmap_atomic_prot(page, prot) kmap_atomic(page)
64 64
65static inline void __kunmap_atomic(void *addr) 65static inline void __kunmap_atomic(void *addr)
66{ 66{
@@ -109,27 +109,62 @@ static inline void kmap_atomic_idx_pop(void)
109#endif 109#endif
110 110
111/* 111/*
112 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. 112 * NOTE:
113 * kmap_atomic() and kunmap_atomic() with two arguments are deprecated.
114 * We only keep them for backward compatibility, any usage of them
115 * are now warned.
113 */ 116 */
114#define kmap_atomic(page, args...) __kmap_atomic(page) 117
118#define PASTE(a, b) a ## b
119#define PASTE2(a, b) PASTE(a, b)
120
121#define NARG_(_2, _1, n, ...) n
122#define NARG(...) NARG_(__VA_ARGS__, 2, 1, :)
123
124static inline void __deprecated *kmap_atomic_deprecated(struct page *page,
125 enum km_type km)
126{
127 return kmap_atomic(page);
128}
129
130#define kmap_atomic1(...) kmap_atomic(__VA_ARGS__)
131#define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__)
132#define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
133
134static inline void __deprecated __kunmap_atomic_deprecated(void *addr,
135 enum km_type km)
136{
137 __kunmap_atomic(addr);
138}
115 139
116/* 140/*
117 * Prevent people trying to call kunmap_atomic() as if it were kunmap() 141 * Prevent people trying to call kunmap_atomic() as if it were kunmap()
118 * kunmap_atomic() should get the return value of kmap_atomic, not the page. 142 * kunmap_atomic() should get the return value of kmap_atomic, not the page.
119 */ 143 */
120#define kunmap_atomic(addr, args...) \ 144#define kunmap_atomic_deprecated(addr, km) \
121do { \ 145do { \
122 BUILD_BUG_ON(__same_type((addr), struct page *)); \ 146 BUILD_BUG_ON(__same_type((addr), struct page *)); \
123 __kunmap_atomic(addr); \ 147 __kunmap_atomic_deprecated(addr, km); \
124} while (0) 148} while (0)
125 149
150#define kunmap_atomic_withcheck(addr) \
151do { \
152 BUILD_BUG_ON(__same_type((addr), struct page *)); \
153 __kunmap_atomic(addr); \
154} while (0)
155
156#define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__)
157#define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__)
158#define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
159/**** End of C pre-processor tricks for deprecated macros ****/
160
126/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 161/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
127#ifndef clear_user_highpage 162#ifndef clear_user_highpage
128static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 163static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
129{ 164{
130 void *addr = kmap_atomic(page, KM_USER0); 165 void *addr = kmap_atomic(page);
131 clear_user_page(addr, vaddr, page); 166 clear_user_page(addr, vaddr, page);
132 kunmap_atomic(addr, KM_USER0); 167 kunmap_atomic(addr);
133} 168}
134#endif 169#endif
135 170
@@ -180,16 +215,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
180 215
181static inline void clear_highpage(struct page *page) 216static inline void clear_highpage(struct page *page)
182{ 217{
183 void *kaddr = kmap_atomic(page, KM_USER0); 218 void *kaddr = kmap_atomic(page);
184 clear_page(kaddr); 219 clear_page(kaddr);
185 kunmap_atomic(kaddr, KM_USER0); 220 kunmap_atomic(kaddr);
186} 221}
187 222
188static inline void zero_user_segments(struct page *page, 223static inline void zero_user_segments(struct page *page,
189 unsigned start1, unsigned end1, 224 unsigned start1, unsigned end1,
190 unsigned start2, unsigned end2) 225 unsigned start2, unsigned end2)
191{ 226{
192 void *kaddr = kmap_atomic(page, KM_USER0); 227 void *kaddr = kmap_atomic(page);
193 228
194 BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); 229 BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE);
195 230
@@ -199,7 +234,7 @@ static inline void zero_user_segments(struct page *page,
199 if (end2 > start2) 234 if (end2 > start2)
200 memset(kaddr + start2, 0, end2 - start2); 235 memset(kaddr + start2, 0, end2 - start2);
201 236
202 kunmap_atomic(kaddr, KM_USER0); 237 kunmap_atomic(kaddr);
203 flush_dcache_page(page); 238 flush_dcache_page(page);
204} 239}
205 240
@@ -228,11 +263,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from,
228{ 263{
229 char *vfrom, *vto; 264 char *vfrom, *vto;
230 265
231 vfrom = kmap_atomic(from, KM_USER0); 266 vfrom = kmap_atomic(from);
232 vto = kmap_atomic(to, KM_USER1); 267 vto = kmap_atomic(to);
233 copy_user_page(vto, vfrom, vaddr, to); 268 copy_user_page(vto, vfrom, vaddr, to);
234 kunmap_atomic(vto, KM_USER1); 269 kunmap_atomic(vto);
235 kunmap_atomic(vfrom, KM_USER0); 270 kunmap_atomic(vfrom);
236} 271}
237 272
238#endif 273#endif
@@ -241,11 +276,11 @@ static inline void copy_highpage(struct page *to, struct page *from)
241{ 276{
242 char *vfrom, *vto; 277 char *vfrom, *vto;
243 278
244 vfrom = kmap_atomic(from, KM_USER0); 279 vfrom = kmap_atomic(from);
245 vto = kmap_atomic(to, KM_USER1); 280 vto = kmap_atomic(to);
246 copy_page(vto, vfrom); 281 copy_page(vto, vfrom);
247 kunmap_atomic(vto, KM_USER1); 282 kunmap_atomic(vto);
248 kunmap_atomic(vfrom, KM_USER0); 283 kunmap_atomic(vfrom);
249} 284}
250 285
251#endif /* _LINUX_HIGHMEM_H */ 286#endif /* _LINUX_HIGHMEM_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 62b908e0e59..5852545e6bb 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -25,6 +25,173 @@
25#ifndef _HYPERV_H 25#ifndef _HYPERV_H
26#define _HYPERV_H 26#define _HYPERV_H
27 27
28#include <linux/types.h>
29
30/*
31 * An implementation of HyperV key value pair (KVP) functionality for Linux.
32 *
33 *
34 * Copyright (C) 2010, Novell, Inc.
35 * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
36 *
37 */
38
39/*
40 * Maximum value size - used for both key names and value data, and includes
41 * any applicable NULL terminators.
42 *
43 * Note: This limit is somewhat arbitrary, but falls easily within what is
44 * supported for all native guests (back to Win 2000) and what is reasonable
45 * for the IC KVP exchange functionality. Note that Windows Me/98/95 are
46 * limited to 255 character key names.
47 *
48 * MSDN recommends not storing data values larger than 2048 bytes in the
49 * registry.
50 *
51 * Note: This value is used in defining the KVP exchange message - this value
52 * cannot be modified without affecting the message size and compatibility.
53 */
54
55/*
56 * bytes, including any null terminators
57 */
58#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
59
60
61/*
62 * Maximum key size - the registry limit for the length of an entry name
63 * is 256 characters, including the null terminator
64 */
65
66#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
67
68/*
69 * In Linux, we implement the KVP functionality in two components:
70 * 1) The kernel component which is packaged as part of the hv_utils driver
71 * is responsible for communicating with the host and responsible for
72 * implementing the host/guest protocol. 2) A user level daemon that is
73 * responsible for data gathering.
74 *
75 * Host/Guest Protocol: The host iterates over an index and expects the guest
76 * to assign a key name to the index and also return the value corresponding to
77 * the key. The host will have atmost one KVP transaction outstanding at any
78 * given point in time. The host side iteration stops when the guest returns
79 * an error. Microsoft has specified the following mapping of key names to
80 * host specified index:
81 *
82 * Index Key Name
83 * 0 FullyQualifiedDomainName
84 * 1 IntegrationServicesVersion
85 * 2 NetworkAddressIPv4
86 * 3 NetworkAddressIPv6
87 * 4 OSBuildNumber
88 * 5 OSName
89 * 6 OSMajorVersion
90 * 7 OSMinorVersion
91 * 8 OSVersion
92 * 9 ProcessorArchitecture
93 *
94 * The Windows host expects the Key Name and Key Value to be encoded in utf16.
95 *
96 * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
97 * data gathering functionality in a user mode daemon. The user level daemon
98 * is also responsible for binding the key name to the index as well. The
99 * kernel and user-level daemon communicate using a connector channel.
100 *
101 * The user mode component first registers with the
102 * the kernel component. Subsequently, the kernel component requests, data
103 * for the specified keys. In response to this message the user mode component
104 * fills in the value corresponding to the specified key. We overload the
105 * sequence field in the cn_msg header to define our KVP message types.
106 *
107 *
108 * The kernel component simply acts as a conduit for communication between the
109 * Windows host and the user-level daemon. The kernel component passes up the
110 * index received from the Host to the user-level daemon. If the index is
111 * valid (supported), the corresponding key as well as its
112 * value (both are strings) is returned. If the index is invalid
113 * (not supported), a NULL key string is returned.
114 */
115
116
117/*
118 * Registry value types.
119 */
120
121#define REG_SZ 1
122#define REG_U32 4
123#define REG_U64 8
124
125enum hv_kvp_exchg_op {
126 KVP_OP_GET = 0,
127 KVP_OP_SET,
128 KVP_OP_DELETE,
129 KVP_OP_ENUMERATE,
130 KVP_OP_REGISTER,
131 KVP_OP_COUNT /* Number of operations, must be last. */
132};
133
134enum hv_kvp_exchg_pool {
135 KVP_POOL_EXTERNAL = 0,
136 KVP_POOL_GUEST,
137 KVP_POOL_AUTO,
138 KVP_POOL_AUTO_EXTERNAL,
139 KVP_POOL_AUTO_INTERNAL,
140 KVP_POOL_COUNT /* Number of pools, must be last. */
141};
142
143struct hv_kvp_hdr {
144 __u8 operation;
145 __u8 pool;
146 __u16 pad;
147} __attribute__((packed));
148
149struct hv_kvp_exchg_msg_value {
150 __u32 value_type;
151 __u32 key_size;
152 __u32 value_size;
153 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
154 union {
155 __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
156 __u32 value_u32;
157 __u64 value_u64;
158 };
159} __attribute__((packed));
160
161struct hv_kvp_msg_enumerate {
162 __u32 index;
163 struct hv_kvp_exchg_msg_value data;
164} __attribute__((packed));
165
166struct hv_kvp_msg_get {
167 struct hv_kvp_exchg_msg_value data;
168};
169
170struct hv_kvp_msg_set {
171 struct hv_kvp_exchg_msg_value data;
172};
173
174struct hv_kvp_msg_delete {
175 __u32 key_size;
176 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
177};
178
179struct hv_kvp_register {
180 __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
181};
182
183struct hv_kvp_msg {
184 struct hv_kvp_hdr kvp_hdr;
185 union {
186 struct hv_kvp_msg_get kvp_get;
187 struct hv_kvp_msg_set kvp_set;
188 struct hv_kvp_msg_delete kvp_delete;
189 struct hv_kvp_msg_enumerate kvp_enum_data;
190 struct hv_kvp_register kvp_register;
191 } body;
192} __attribute__((packed));
193
194#ifdef __KERNEL__
28#include <linux/scatterlist.h> 195#include <linux/scatterlist.h>
29#include <linux/list.h> 196#include <linux/list.h>
30#include <linux/uuid.h> 197#include <linux/uuid.h>
@@ -35,7 +202,7 @@
35#include <linux/mod_devicetable.h> 202#include <linux/mod_devicetable.h>
36 203
37 204
38#define MAX_PAGE_BUFFER_COUNT 18 205#define MAX_PAGE_BUFFER_COUNT 19
39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 206#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
40 207
41#pragma pack(push, 1) 208#pragma pack(push, 1)
@@ -785,6 +952,7 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
785 952
786#define HV_S_OK 0x00000000 953#define HV_S_OK 0x00000000
787#define HV_E_FAIL 0x80004005 954#define HV_E_FAIL 0x80004005
955#define HV_S_CONT 0x80070103
788#define HV_ERROR_NOT_SUPPORTED 0x80070032 956#define HV_ERROR_NOT_SUPPORTED 0x80070032
789#define HV_ERROR_MACHINE_LOCKED 0x800704F7 957#define HV_ERROR_MACHINE_LOCKED 0x800704F7
790 958
@@ -870,4 +1038,9 @@ struct hyperv_service_callback {
870extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1038extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *,
871 struct icmsg_negotiate *, u8 *); 1039 struct icmsg_negotiate *, u8 *);
872 1040
1041int hv_kvp_init(struct hv_util_service *);
1042void hv_kvp_deinit(void);
1043void hv_kvp_onchannelcallback(void *);
1044
1045#endif /* __KERNEL__ */
873#endif /* _HYPERV_H */ 1046#endif /* _HYPERV_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 06b6ef60c82..f995c663c49 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -80,6 +80,8 @@
80 * skbs on transmit */ 80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */ 82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84
83 85
84#define IF_GET_IFACE 0x0001 /* for querying only */ 86#define IF_GET_IFACE 0x0001 /* for querying only */
85#define IF_GET_PROTO 0x0002 87#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c52d4b5f872..4b24ff453ae 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -137,6 +137,7 @@ enum {
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
140 __IFLA_MAX 141 __IFLA_MAX
141}; 142};
142 143
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index c9ad3832257..9048fabb7a4 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -1,173 +1 @@
1/* #include <linux/ppp-ioctl.h>
2 * if_ppp.h - Point-to-Point Protocol definitions.
3 *
4 * Copyright (c) 1989 Carnegie Mellon University.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 */
20
21/*
22 * ==FILEVERSION 20050812==
23 *
24 * NOTE TO MAINTAINERS:
25 * If you modify this file at all, please set the above date.
26 * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
27 * if everyone increases the FILEVERSION number above, then scripts
28 * can do the right thing when deciding whether to install a new if_ppp.h
29 * file. Don't change the format of that line otherwise, so the
30 * installation script can recognize it.
31 */
32
33#ifndef _IF_PPP_H_
34#define _IF_PPP_H_
35
36#include <linux/types.h>
37#include <linux/compiler.h>
38
39/*
40 * Packet sizes
41 */
42
43#define PPP_MTU 1500 /* Default MTU (size of Info field) */
44#define PPP_MAXMRU 65000 /* Largest MRU we allow */
45#define PROTO_IPX 0x002b /* protocol numbers */
46#define PROTO_DNA_RT 0x0027 /* DNA Routing */
47
48
49/*
50 * Bit definitions for flags.
51 */
52
53#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
54#define SC_COMP_AC 0x00000002 /* header compression (output) */
55#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
56#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
57#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
58#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
59#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
60#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
61#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
62#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
63#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
64#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */
65#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
66#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
67#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */
68#define SC_DEBUG 0x00010000 /* enable debug messages */
69#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
70#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
71#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
72#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
73#define SC_SYNC 0x00200000 /* synchronous serial mode */
74#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */
75#define SC_MASK 0x0f600fff /* bits that user can change */
76
77/* state bits */
78#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
79#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
80#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
81#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
82#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
83#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
84#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
85
86/*
87 * Ioctl definitions.
88 */
89
90struct npioctl {
91 int protocol; /* PPP protocol, e.g. PPP_IP */
92 enum NPmode mode;
93};
94
95/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
96struct ppp_option_data {
97 __u8 __user *ptr;
98 __u32 length;
99 int transmit;
100};
101
102struct ifpppstatsreq {
103 struct ifreq b;
104 struct ppp_stats stats; /* statistic information */
105};
106
107struct ifpppcstatsreq {
108 struct ifreq b;
109 struct ppp_comp_stats stats;
110};
111
112/* For PPPIOCGL2TPSTATS */
113struct pppol2tp_ioc_stats {
114 __u16 tunnel_id; /* redundant */
115 __u16 session_id; /* if zero, get tunnel stats */
116 __u32 using_ipsec:1; /* valid only for session_id == 0 */
117 __aligned_u64 tx_packets;
118 __aligned_u64 tx_bytes;
119 __aligned_u64 tx_errors;
120 __aligned_u64 rx_packets;
121 __aligned_u64 rx_bytes;
122 __aligned_u64 rx_seq_discards;
123 __aligned_u64 rx_oos_packets;
124 __aligned_u64 rx_errors;
125};
126
127#define ifr__name b.ifr_ifrn.ifrn_name
128#define stats_ptr b.ifr_ifru.ifru_data
129
130/*
131 * Ioctl definitions.
132 */
133
134#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
135#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
136#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
137#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
138#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
139#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
140#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
141#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
142#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
143#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
144#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
145#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
146#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
147#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
148#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
149#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
150#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */
151#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */
152#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
153#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
154#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
155#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
156#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
157#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */
158#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
159#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
160#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
161#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */
162#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */
163#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
164
165#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
166#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
167#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
168
169#if !defined(ifr_mtu)
170#define ifr_mtu ifr_ifru.ifru_metric
171#endif
172
173#endif /* _IF_PPP_H_ */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 828181fbad5..58404b0c501 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -46,6 +46,10 @@ struct team_port {
46 u32 speed; 46 u32 speed;
47 u8 duplex; 47 u8 duplex;
48 48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
49 struct rcu_head rcu; 53 struct rcu_head rcu;
50}; 54};
51 55
@@ -72,6 +76,10 @@ struct team_option {
72 enum team_option_type type; 76 enum team_option_type type;
73 int (*getter)(struct team *team, void *arg); 77 int (*getter)(struct team *team, void *arg);
74 int (*setter)(struct team *team, void *arg); 78 int (*setter)(struct team *team, void *arg);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
75}; 83};
76 84
77struct team_mode { 85struct team_mode {
@@ -207,6 +215,7 @@ enum {
207 TEAM_ATTR_OPTION_CHANGED, /* flag */ 215 TEAM_ATTR_OPTION_CHANGED, /* flag */
208 TEAM_ATTR_OPTION_TYPE, /* u8 */ 216 TEAM_ATTR_OPTION_TYPE, /* u8 */
209 TEAM_ATTR_OPTION_DATA, /* dynamic */ 217 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */
210 219
211 __TEAM_ATTR_OPTION_MAX, 220 __TEAM_ATTR_OPTION_MAX,
212 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
@@ -227,6 +236,7 @@ enum {
227 TEAM_ATTR_PORT_LINKUP, /* flag */ 236 TEAM_ATTR_PORT_LINKUP, /* flag */
228 TEAM_ATTR_PORT_SPEED, /* u32 */ 237 TEAM_ATTR_PORT_SPEED, /* u32 */
229 TEAM_ATTR_PORT_DUPLEX, /* u8 */ 238 TEAM_ATTR_PORT_DUPLEX, /* u8 */
239 TEAM_ATTR_PORT_REMOVED, /* flag */
230 240
231 __TEAM_ATTR_PORT_MAX, 241 __TEAM_ATTR_PORT_MAX,
232 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1, 242 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 13aff1e2183..33a6e1951d4 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -18,10 +18,9 @@
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
20 20
21#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) 21#define VLAN_HLEN 4 /* The additional bytes required by VLAN
22 * that VLAN requires. 22 * (in addition to the Ethernet header)
23 */ 23 */
24#define VLAN_ETH_ALEN 6 /* Octets in one ethernet addr */
25#define VLAN_ETH_HLEN 18 /* Total octets in header. */ 24#define VLAN_ETH_HLEN 18 /* Total octets in header. */
26#define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ 25#define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */
27 26
@@ -177,7 +176,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
177 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 176 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
178 177
179 /* Move the mac addresses to the beginning of the new header. */ 178 /* Move the mac addresses to the beginning of the new header. */
180 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); 179 memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
181 skb->mac_header -= VLAN_HLEN; 180 skb->mac_header -= VLAN_HLEN;
182 181
183 /* first, the ethernet type */ 182 /* first, the ethernet type */
diff --git a/include/linux/in.h b/include/linux/in.h
index 01129c0ea87..e0337f11d92 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -111,6 +111,7 @@ struct in_addr {
111#define MCAST_LEAVE_SOURCE_GROUP 47 111#define MCAST_LEAVE_SOURCE_GROUP 47
112#define MCAST_MSFILTER 48 112#define MCAST_MSFILTER 48
113#define IP_MULTICAST_ALL 49 113#define IP_MULTICAST_ALL 49
114#define IP_UNICAST_IF 50
114 115
115#define MCAST_EXCLUDE 0 116#define MCAST_EXCLUDE 0
116#define MCAST_INCLUDE 1 117#define MCAST_INCLUDE 1
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 097a34b5556..5c83d9e3eb8 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -271,6 +271,7 @@ struct in6_flowlabel_req {
271#define IPV6_ORIGDSTADDR 74 271#define IPV6_ORIGDSTADDR 74
272#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR 272#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
273#define IPV6_TRANSPARENT 75 273#define IPV6_TRANSPARENT 75
274#define IPV6_UNICAST_IF 76
274 275
275/* 276/*
276 * Multicast Routing: 277 * Multicast Routing:
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5f8146695b7..597f4a9f324 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -139,6 +139,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
139 IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) 139 IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS)))
140 140
141#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) 141#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER)
142#define IN_DEV_ARP_ACCEPT(in_dev) IN_DEV_ORCONF((in_dev), ARP_ACCEPT)
142#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) 143#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
143#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) 144#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 145#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 9c66b1ada9d..f994d51f70f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -149,7 +149,7 @@ extern struct cred init_cred;
149 }, \ 149 }, \
150 .rt = { \ 150 .rt = { \
151 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ 151 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
152 .time_slice = HZ, \ 152 .time_slice = RR_TIMESLICE, \
153 .nr_cpus_allowed = NR_CPUS, \ 153 .nr_cpus_allowed = NR_CPUS, \
154 }, \ 154 }, \
155 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 155 .tasks = LIST_HEAD_INIT(tsk.tasks), \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a64b00e286f..3f830e00511 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -20,7 +20,6 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <trace/events/irq.h>
24 23
25/* 24/*
26 * These correspond to the IORESOURCE_IRQ_* defines in 25 * These correspond to the IORESOURCE_IRQ_* defines in
@@ -456,11 +455,7 @@ asmlinkage void do_softirq(void);
456asmlinkage void __do_softirq(void); 455asmlinkage void __do_softirq(void);
457extern void open_softirq(int nr, void (*action)(struct softirq_action *)); 456extern void open_softirq(int nr, void (*action)(struct softirq_action *));
458extern void softirq_init(void); 457extern void softirq_init(void);
459static inline void __raise_softirq_irqoff(unsigned int nr) 458extern void __raise_softirq_irqoff(unsigned int nr);
460{
461 trace_softirq_raise(nr);
462 or_softirq_pending(1UL << nr);
463}
464 459
465extern void raise_softirq_irqoff(unsigned int nr); 460extern void raise_softirq_irqoff(unsigned int nr);
466extern void raise_softirq(unsigned int nr); 461extern void raise_softirq(unsigned int nr);
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 7e1371c4bcc..1a301806303 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -6,8 +6,11 @@
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7 7
8enum { 8enum {
9 ICQ_IOPRIO_CHANGED, 9 ICQ_IOPRIO_CHANGED = 1 << 0,
10 ICQ_CGROUP_CHANGED, 10 ICQ_CGROUP_CHANGED = 1 << 1,
11 ICQ_EXITED = 1 << 2,
12
13 ICQ_CHANGED_MASK = ICQ_IOPRIO_CHANGED | ICQ_CGROUP_CHANGED,
11}; 14};
12 15
13/* 16/*
@@ -88,7 +91,7 @@ struct io_cq {
88 struct rcu_head __rcu_head; 91 struct rcu_head __rcu_head;
89 }; 92 };
90 93
91 unsigned long changed; 94 unsigned int flags;
92}; 95};
93 96
94/* 97/*
@@ -133,16 +136,16 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
133 136
134struct task_struct; 137struct task_struct;
135#ifdef CONFIG_BLOCK 138#ifdef CONFIG_BLOCK
136void put_io_context(struct io_context *ioc, struct request_queue *locked_q); 139void put_io_context(struct io_context *ioc);
137void exit_io_context(struct task_struct *task); 140void exit_io_context(struct task_struct *task);
138struct io_context *get_task_io_context(struct task_struct *task, 141struct io_context *get_task_io_context(struct task_struct *task,
139 gfp_t gfp_flags, int node); 142 gfp_t gfp_flags, int node);
140void ioc_ioprio_changed(struct io_context *ioc, int ioprio); 143void ioc_ioprio_changed(struct io_context *ioc, int ioprio);
141void ioc_cgroup_changed(struct io_context *ioc); 144void ioc_cgroup_changed(struct io_context *ioc);
145unsigned int icq_get_changed(struct io_cq *icq);
142#else 146#else
143struct io_context; 147struct io_context;
144static inline void put_io_context(struct io_context *ioc, 148static inline void put_io_context(struct io_context *ioc) { }
145 struct request_queue *locked_q) { }
146static inline void exit_io_context(struct task_struct *task) { } 149static inline void exit_io_context(struct task_struct *task) { }
147#endif 150#endif
148 151
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 6318268dcaf..8260ef77976 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
233 return (struct ipv6hdr *)skb_transport_header(skb); 233 return (struct ipv6hdr *)skb_transport_header(skb);
234} 234}
235 235
236static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
237{
238 return (ntohl(*(__be32 *)iph) >> 20) & 0xff;
239}
240
236/* 241/*
237 This structure contains results of exthdrs parsing 242 This structure contains results of exthdrs parsing
238 as offsets from skb->nh. 243 as offsets from skb->nh.
@@ -324,6 +329,7 @@ struct ipv6_pinfo {
324 __unused_2:6; 329 __unused_2:6;
325 __s16 mcast_hops:9; 330 __s16 mcast_hops:9;
326#endif 331#endif
332 int ucast_oif;
327 int mcast_oif; 333 int mcast_oif;
328 334
329 /* pktoption flags */ 335 /* pktoption flags */
@@ -360,7 +366,7 @@ struct ipv6_pinfo {
360 dontfrag:1; 366 dontfrag:1;
361 __u8 min_hopcount; 367 __u8 min_hopcount;
362 __u8 tclass; 368 __u8 tclass;
363 __u8 padding; 369 __u8 rcv_tclass;
364 370
365 __u32 dst_cookie; 371 __u32 dst_cookie;
366 372
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index bd4272b61a1..ead4a421579 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -9,99 +9,182 @@
9 * representation into a hardware irq number that can be mapped back to a 9 * representation into a hardware irq number that can be mapped back to a
10 * Linux irq number without any extra platform support code. 10 * Linux irq number without any extra platform support code.
11 * 11 *
12 * irq_domain is expected to be embedded in an interrupt controller's private 12 * Interrupt controller "domain" data structure. This could be defined as a
13 * data structure. 13 * irq domain controller. That is, it handles the mapping between hardware
14 * and virtual interrupt numbers for a given interrupt domain. The domain
15 * structure is generally created by the PIC code for a given PIC instance
16 * (though a domain can cover more than one PIC if they have a flat number
17 * model). It's the domain callbacks that are responsible for setting the
18 * irq_chip on a given irq_desc after it's been mapped.
19 *
20 * The host code and data structures are agnostic to whether or not
21 * we use an open firmware device-tree. We do have references to struct
22 * device_node in two places: in irq_find_host() to find the host matching
23 * a given interrupt controller node, and of course as an argument to its
24 * counterpart domain->ops->match() callback. However, those are treated as
25 * generic pointers by the core and the fact that it's actually a device-node
26 * pointer is purely a convention between callers and implementation. This
27 * code could thus be used on other architectures by replacing those two
28 * by some sort of arch-specific void * "token" used to identify interrupt
29 * controllers.
14 */ 30 */
31
15#ifndef _LINUX_IRQDOMAIN_H 32#ifndef _LINUX_IRQDOMAIN_H
16#define _LINUX_IRQDOMAIN_H 33#define _LINUX_IRQDOMAIN_H
17 34
18#include <linux/irq.h> 35#include <linux/types.h>
19#include <linux/mod_devicetable.h> 36#include <linux/radix-tree.h>
20 37
21#ifdef CONFIG_IRQ_DOMAIN
22struct device_node; 38struct device_node;
23struct irq_domain; 39struct irq_domain;
40struct of_device_id;
41
42/* Number of irqs reserved for a legacy isa controller */
43#define NUM_ISA_INTERRUPTS 16
44
45/* This type is the placeholder for a hardware interrupt number. It has to
46 * be big enough to enclose whatever representation is used by a given
47 * platform.
48 */
49typedef unsigned long irq_hw_number_t;
24 50
25/** 51/**
26 * struct irq_domain_ops - Methods for irq_domain objects 52 * struct irq_domain_ops - Methods for irq_domain objects
27 * @to_irq: (optional) given a local hardware irq number, return the linux 53 * @match: Match an interrupt controller device node to a host, returns
28 * irq number. If to_irq is not implemented, then the irq_domain 54 * 1 on a match
29 * will use this translation: irq = (domain->irq_base + hwirq) 55 * @map: Create or update a mapping between a virtual irq number and a hw
30 * @dt_translate: Given a device tree node and interrupt specifier, decode 56 * irq number. This is called only once for a given mapping.
31 * the hardware irq number and linux irq type value. 57 * @unmap: Dispose of such a mapping
58 * @xlate: Given a device tree node and interrupt specifier, decode
59 * the hardware irq number and linux irq type value.
60 *
61 * Functions below are provided by the driver and called whenever a new mapping
62 * is created or an old mapping is disposed. The driver can then proceed to
63 * whatever internal data structures management is required. It also needs
64 * to setup the irq_desc when returning from map().
32 */ 65 */
33struct irq_domain_ops { 66struct irq_domain_ops {
34 unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); 67 int (*match)(struct irq_domain *d, struct device_node *node);
35 68 int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
36#ifdef CONFIG_OF 69 void (*unmap)(struct irq_domain *d, unsigned int virq);
37 int (*dt_translate)(struct irq_domain *d, struct device_node *node, 70 int (*xlate)(struct irq_domain *d, struct device_node *node,
38 const u32 *intspec, unsigned int intsize, 71 const u32 *intspec, unsigned int intsize,
39 unsigned long *out_hwirq, unsigned int *out_type); 72 unsigned long *out_hwirq, unsigned int *out_type);
40#endif /* CONFIG_OF */
41}; 73};
42 74
43/** 75/**
44 * struct irq_domain - Hardware interrupt number translation object 76 * struct irq_domain - Hardware interrupt number translation object
45 * @list: Element in global irq_domain list. 77 * @link: Element in global irq_domain list.
78 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This
79 * will be one of the IRQ_DOMAIN_MAP_* values.
80 * @revmap_data: Revmap method specific data.
81 * @ops: pointer to irq_domain methods
82 * @host_data: private data pointer for use by owner. Not touched by irq_domain
83 * core code.
46 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 84 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator
47 * of the irq_domain is responsible for allocating the array of 85 * of the irq_domain is responsible for allocating the array of
48 * irq_desc structures. 86 * irq_desc structures.
49 * @nr_irq: Number of irqs managed by the irq domain 87 * @nr_irq: Number of irqs managed by the irq domain
50 * @hwirq_base: Starting number for hwirqs managed by the irq domain 88 * @hwirq_base: Starting number for hwirqs managed by the irq domain
51 * @ops: pointer to irq_domain methods
52 * @priv: private data pointer for use by owner. Not touched by irq_domain
53 * core code.
54 * @of_node: (optional) Pointer to device tree nodes associated with the 89 * @of_node: (optional) Pointer to device tree nodes associated with the
55 * irq_domain. Used when decoding device tree interrupt specifiers. 90 * irq_domain. Used when decoding device tree interrupt specifiers.
56 */ 91 */
57struct irq_domain { 92struct irq_domain {
58 struct list_head list; 93 struct list_head link;
59 unsigned int irq_base; 94
60 unsigned int nr_irq; 95 /* type of reverse mapping_technique */
61 unsigned int hwirq_base; 96 unsigned int revmap_type;
97 union {
98 struct {
99 unsigned int size;
100 unsigned int first_irq;
101 irq_hw_number_t first_hwirq;
102 } legacy;
103 struct {
104 unsigned int size;
105 unsigned int *revmap;
106 } linear;
107 struct radix_tree_root tree;
108 } revmap_data;
62 const struct irq_domain_ops *ops; 109 const struct irq_domain_ops *ops;
63 void *priv; 110 void *host_data;
111 irq_hw_number_t inval_irq;
112
113 /* Optional device node pointer */
64 struct device_node *of_node; 114 struct device_node *of_node;
65}; 115};
66 116
67/** 117#ifdef CONFIG_IRQ_DOMAIN
68 * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number 118struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
69 * 119 unsigned int size,
70 * Returns the linux irq number associated with a hardware irq. By default, 120 unsigned int first_irq,
71 * the mapping is irq == domain->irq_base + hwirq, but this mapping can 121 irq_hw_number_t first_hwirq,
72 * be overridden if the irq_domain implements a .to_irq() hook. 122 const struct irq_domain_ops *ops,
73 */ 123 void *host_data);
74static inline unsigned int irq_domain_to_irq(struct irq_domain *d, 124struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
75 unsigned long hwirq) 125 unsigned int size,
126 const struct irq_domain_ops *ops,
127 void *host_data);
128struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
129 const struct irq_domain_ops *ops,
130 void *host_data);
131struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
132 const struct irq_domain_ops *ops,
133 void *host_data);
134
135extern struct irq_domain *irq_find_host(struct device_node *node);
136extern void irq_set_default_host(struct irq_domain *host);
137extern void irq_set_virq_count(unsigned int count);
138
139static inline struct irq_domain *irq_domain_add_legacy_isa(
140 struct device_node *of_node,
141 const struct irq_domain_ops *ops,
142 void *host_data)
76{ 143{
77 if (d->ops->to_irq) 144 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
78 return d->ops->to_irq(d, hwirq); 145 host_data);
79 if (WARN_ON(hwirq < d->hwirq_base))
80 return 0;
81 return d->irq_base + hwirq - d->hwirq_base;
82} 146}
147extern struct irq_domain *irq_find_host(struct device_node *node);
148extern void irq_set_default_host(struct irq_domain *host);
149extern void irq_set_virq_count(unsigned int count);
83 150
84#define irq_domain_for_each_hwirq(d, hw) \
85 for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++)
86 151
87#define irq_domain_for_each_irq(d, hw, irq) \ 152extern unsigned int irq_create_mapping(struct irq_domain *host,
88 for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ 153 irq_hw_number_t hwirq);
89 hw < d->hwirq_base + d->nr_irq; \ 154extern void irq_dispose_mapping(unsigned int virq);
90 hw++, irq = irq_domain_to_irq(d, hw)) 155extern unsigned int irq_find_mapping(struct irq_domain *host,
156 irq_hw_number_t hwirq);
157extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
158extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq,
159 irq_hw_number_t hwirq);
160extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
161 irq_hw_number_t hwirq);
162extern unsigned int irq_linear_revmap(struct irq_domain *host,
163 irq_hw_number_t hwirq);
91 164
92extern void irq_domain_add(struct irq_domain *domain); 165extern const struct irq_domain_ops irq_domain_simple_ops;
93extern void irq_domain_del(struct irq_domain *domain);
94 166
95extern struct irq_domain_ops irq_domain_simple_ops; 167/* stock xlate functions */
96#endif /* CONFIG_IRQ_DOMAIN */ 168int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr,
169 const u32 *intspec, unsigned int intsize,
170 irq_hw_number_t *out_hwirq, unsigned int *out_type);
171int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr,
172 const u32 *intspec, unsigned int intsize,
173 irq_hw_number_t *out_hwirq, unsigned int *out_type);
174int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
175 const u32 *intspec, unsigned int intsize,
176 irq_hw_number_t *out_hwirq, unsigned int *out_type);
97 177
98#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 178#if defined(CONFIG_OF_IRQ)
99extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
100extern void irq_domain_generate_simple(const struct of_device_id *match, 179extern void irq_domain_generate_simple(const struct of_device_id *match,
101 u64 phys_base, unsigned int irq_start); 180 u64 phys_base, unsigned int irq_start);
102#else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 181#else /* CONFIG_OF_IRQ */
103static inline void irq_domain_generate_simple(const struct of_device_id *match, 182static inline void irq_domain_generate_simple(const struct of_device_id *match,
104 u64 phys_base, unsigned int irq_start) { } 183 u64 phys_base, unsigned int irq_start) { }
105#endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 184#endif /* !CONFIG_OF_IRQ */
185
186#else /* CONFIG_IRQ_DOMAIN */
187static inline void irq_dispose_mapping(unsigned int virq) { }
188#endif /* !CONFIG_IRQ_DOMAIN */
106 189
107#endif /* _LINUX_IRQDOMAIN_H */ 190#endif /* _LINUX_IRQDOMAIN_H */
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 4ccf95d681b..292f27a793d 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -187,7 +187,7 @@ typedef struct {
187#endif 187#endif
188 188
189#include <linux/ppp_defs.h> 189#include <linux/ppp_defs.h>
190#include <linux/if_ppp.h> 190#include <linux/ppp-ioctl.h>
191 191
192#include <linux/isdn_ppp.h> 192#include <linux/isdn_ppp.h>
193#endif 193#endif
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 5ce8b140428..c513a40510f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -1,22 +1,69 @@
1#ifndef _LINUX_JUMP_LABEL_H 1#ifndef _LINUX_JUMP_LABEL_H
2#define _LINUX_JUMP_LABEL_H 2#define _LINUX_JUMP_LABEL_H
3 3
4/*
5 * Jump label support
6 *
7 * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com>
8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com>
9 *
10 * Jump labels provide an interface to generate dynamic branches using
11 * self-modifying code. Assuming toolchain and architecture support the result
12 * of a "if (static_key_false(&key))" statement is a unconditional branch (which
13 * defaults to false - and the true block is placed out of line).
14 *
15 * However at runtime we can change the branch target using
16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key
17 * object and for as long as there are references all branches referring to
18 * that particular key will point to the (out of line) true block.
19 *
20 * Since this relies on modifying code the static_key_slow_{inc,dec}() functions
21 * must be considered absolute slow paths (machine wide synchronization etc.).
22 * OTOH, since the affected branches are unconditional their runtime overhead
23 * will be absolutely minimal, esp. in the default (off) case where the total
24 * effect is a single NOP of appropriate size. The on case will patch in a jump
25 * to the out-of-line block.
26 *
27 * When the control is directly exposed to userspace it is prudent to delay the
28 * decrement to avoid high frequency code modifications which can (and do)
29 * cause significant performance degradation. Struct static_key_deferred and
30 * static_key_slow_dec_deferred() provide for this.
31 *
32 * Lacking toolchain and or architecture support, it falls back to a simple
33 * conditional branch.
34 *
35 * struct static_key my_key = STATIC_KEY_INIT_TRUE;
36 *
37 * if (static_key_true(&my_key)) {
38 * }
39 *
40 * will result in the true case being in-line and starts the key with a single
41 * reference. Mixing static_key_true() and static_key_false() on the same key is not
42 * allowed.
43 *
44 * Not initializing the key (static data is initialized to 0s anyway) is the
45 * same as using STATIC_KEY_INIT_FALSE and static_key_false() is
46 * equivalent with static_branch().
47 *
48*/
49
4#include <linux/types.h> 50#include <linux/types.h>
5#include <linux/compiler.h> 51#include <linux/compiler.h>
6#include <linux/workqueue.h> 52#include <linux/workqueue.h>
7 53
8#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 54#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
9 55
10struct jump_label_key { 56struct static_key {
11 atomic_t enabled; 57 atomic_t enabled;
58/* Set lsb bit to 1 if branch is default true, 0 ot */
12 struct jump_entry *entries; 59 struct jump_entry *entries;
13#ifdef CONFIG_MODULES 60#ifdef CONFIG_MODULES
14 struct jump_label_mod *next; 61 struct static_key_mod *next;
15#endif 62#endif
16}; 63};
17 64
18struct jump_label_key_deferred { 65struct static_key_deferred {
19 struct jump_label_key key; 66 struct static_key key;
20 unsigned long timeout; 67 unsigned long timeout;
21 struct delayed_work work; 68 struct delayed_work work;
22}; 69};
@@ -34,13 +81,34 @@ struct module;
34 81
35#ifdef HAVE_JUMP_LABEL 82#ifdef HAVE_JUMP_LABEL
36 83
37#ifdef CONFIG_MODULES 84#define JUMP_LABEL_TRUE_BRANCH 1UL
38#define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL, NULL} 85
39#else 86static
40#define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL} 87inline struct jump_entry *jump_label_get_entries(struct static_key *key)
41#endif 88{
89 return (struct jump_entry *)((unsigned long)key->entries
90 & ~JUMP_LABEL_TRUE_BRANCH);
91}
42 92
43static __always_inline bool static_branch(struct jump_label_key *key) 93static inline bool jump_label_get_branch_default(struct static_key *key)
94{
95 if ((unsigned long)key->entries & JUMP_LABEL_TRUE_BRANCH)
96 return true;
97 return false;
98}
99
100static __always_inline bool static_key_false(struct static_key *key)
101{
102 return arch_static_branch(key);
103}
104
105static __always_inline bool static_key_true(struct static_key *key)
106{
107 return !static_key_false(key);
108}
109
110/* Deprecated. Please use 'static_key_false() instead. */
111static __always_inline bool static_branch(struct static_key *key)
44{ 112{
45 return arch_static_branch(key); 113 return arch_static_branch(key);
46} 114}
@@ -56,21 +124,23 @@ extern void arch_jump_label_transform(struct jump_entry *entry,
56extern void arch_jump_label_transform_static(struct jump_entry *entry, 124extern void arch_jump_label_transform_static(struct jump_entry *entry,
57 enum jump_label_type type); 125 enum jump_label_type type);
58extern int jump_label_text_reserved(void *start, void *end); 126extern int jump_label_text_reserved(void *start, void *end);
59extern void jump_label_inc(struct jump_label_key *key); 127extern void static_key_slow_inc(struct static_key *key);
60extern void jump_label_dec(struct jump_label_key *key); 128extern void static_key_slow_dec(struct static_key *key);
61extern void jump_label_dec_deferred(struct jump_label_key_deferred *key); 129extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
62extern bool jump_label_enabled(struct jump_label_key *key);
63extern void jump_label_apply_nops(struct module *mod); 130extern void jump_label_apply_nops(struct module *mod);
64extern void jump_label_rate_limit(struct jump_label_key_deferred *key, 131extern void
65 unsigned long rl); 132jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
133
134#define STATIC_KEY_INIT_TRUE ((struct static_key) \
135 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
136#define STATIC_KEY_INIT_FALSE ((struct static_key) \
137 { .enabled = ATOMIC_INIT(0), .entries = (void *)0 })
66 138
67#else /* !HAVE_JUMP_LABEL */ 139#else /* !HAVE_JUMP_LABEL */
68 140
69#include <linux/atomic.h> 141#include <linux/atomic.h>
70 142
71#define JUMP_LABEL_INIT {ATOMIC_INIT(0)} 143struct static_key {
72
73struct jump_label_key {
74 atomic_t enabled; 144 atomic_t enabled;
75}; 145};
76 146
@@ -78,30 +148,45 @@ static __always_inline void jump_label_init(void)
78{ 148{
79} 149}
80 150
81struct jump_label_key_deferred { 151struct static_key_deferred {
82 struct jump_label_key key; 152 struct static_key key;
83}; 153};
84 154
85static __always_inline bool static_branch(struct jump_label_key *key) 155static __always_inline bool static_key_false(struct static_key *key)
156{
157 if (unlikely(atomic_read(&key->enabled)) > 0)
158 return true;
159 return false;
160}
161
162static __always_inline bool static_key_true(struct static_key *key)
86{ 163{
87 if (unlikely(atomic_read(&key->enabled))) 164 if (likely(atomic_read(&key->enabled)) > 0)
88 return true; 165 return true;
89 return false; 166 return false;
90} 167}
91 168
92static inline void jump_label_inc(struct jump_label_key *key) 169/* Deprecated. Please use 'static_key_false() instead. */
170static __always_inline bool static_branch(struct static_key *key)
171{
172 if (unlikely(atomic_read(&key->enabled)) > 0)
173 return true;
174 return false;
175}
176
177static inline void static_key_slow_inc(struct static_key *key)
93{ 178{
94 atomic_inc(&key->enabled); 179 atomic_inc(&key->enabled);
95} 180}
96 181
97static inline void jump_label_dec(struct jump_label_key *key) 182static inline void static_key_slow_dec(struct static_key *key)
98{ 183{
99 atomic_dec(&key->enabled); 184 atomic_dec(&key->enabled);
100} 185}
101 186
102static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key) 187static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
103{ 188{
104 jump_label_dec(&key->key); 189 static_key_slow_dec(&key->key);
105} 190}
106 191
107static inline int jump_label_text_reserved(void *start, void *end) 192static inline int jump_label_text_reserved(void *start, void *end)
@@ -112,23 +197,30 @@ static inline int jump_label_text_reserved(void *start, void *end)
112static inline void jump_label_lock(void) {} 197static inline void jump_label_lock(void) {}
113static inline void jump_label_unlock(void) {} 198static inline void jump_label_unlock(void) {}
114 199
115static inline bool jump_label_enabled(struct jump_label_key *key)
116{
117 return !!atomic_read(&key->enabled);
118}
119
120static inline int jump_label_apply_nops(struct module *mod) 200static inline int jump_label_apply_nops(struct module *mod)
121{ 201{
122 return 0; 202 return 0;
123} 203}
124 204
125static inline void jump_label_rate_limit(struct jump_label_key_deferred *key, 205static inline void
206jump_label_rate_limit(struct static_key_deferred *key,
126 unsigned long rl) 207 unsigned long rl)
127{ 208{
128} 209}
210
211#define STATIC_KEY_INIT_TRUE ((struct static_key) \
212 { .enabled = ATOMIC_INIT(1) })
213#define STATIC_KEY_INIT_FALSE ((struct static_key) \
214 { .enabled = ATOMIC_INIT(0) })
215
129#endif /* HAVE_JUMP_LABEL */ 216#endif /* HAVE_JUMP_LABEL */
130 217
131#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), }) 218#define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
132#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), }) 219#define jump_label_enabled static_key_enabled
220
221static inline bool static_key_enabled(struct static_key *key)
222{
223 return (atomic_read(&key->enabled) > 0);
224}
133 225
134#endif /* _LINUX_JUMP_LABEL_H */ 226#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index ec2d17bc1f1..daf4a3a40ee 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -7,8 +7,6 @@
7 7
8extern struct tasklet_struct keyboard_tasklet; 8extern struct tasklet_struct keyboard_tasklet;
9 9
10extern int shift_state;
11
12extern char *func_table[MAX_NR_FUNC]; 10extern char *func_table[MAX_NR_FUNC];
13extern char func_buf[]; 11extern char func_buf[];
14extern char *funcbufptr; 12extern char *funcbufptr;
@@ -65,8 +63,6 @@ struct kbd_struct {
65#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ 63#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
66}; 64};
67 65
68extern struct kbd_struct kbd_table[];
69
70extern int kbd_init(void); 66extern int kbd_init(void);
71 67
72extern unsigned char getledstate(void); 68extern unsigned char getledstate(void);
@@ -79,6 +75,7 @@ extern void (*kbd_ledfunc)(unsigned int led);
79extern int set_console(int nr); 75extern int set_console(int nr);
80extern void schedule_console_callback(void); 76extern void schedule_console_callback(void);
81 77
78/* FIXME: review locking for vt.c callers */
82static inline void set_leds(void) 79static inline void set_leds(void)
83{ 80{
84 tasklet_schedule(&keyboard_tasklet); 81 tasklet_schedule(&keyboard_tasklet);
@@ -142,8 +139,6 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
142 139
143struct console; 140struct console;
144 141
145int getkeycode(unsigned int scancode);
146int setkeycode(unsigned int scancode, unsigned int keycode);
147void compute_shiftstate(void); 142void compute_shiftstate(void);
148 143
149/* defkeymap.c */ 144/* defkeymap.c */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8343422240..d801acb5e68 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -85,6 +85,19 @@
85} \ 85} \
86) 86)
87 87
88/*
89 * Multiplies an integer by a fraction, while avoiding unnecessary
90 * overflow or loss of precision.
91 */
92#define mult_frac(x, numer, denom)( \
93{ \
94 typeof(x) quot = (x) / (denom); \
95 typeof(x) rem = (x) % (denom); \
96 (quot * (numer)) + ((rem * (numer)) / (denom)); \
97} \
98)
99
100
88#define _RET_IP_ (unsigned long)__builtin_return_address(0) 101#define _RET_IP_ (unsigned long)__builtin_return_address(0)
89#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 102#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
90 103
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2fa0901219d..0d7d6a1b172 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -50,9 +50,11 @@
50 * note header. For kdump, the code in vmcore.c runs in the context 50 * note header. For kdump, the code in vmcore.c runs in the context
51 * of the second kernel to combine them into one note. 51 * of the second kernel to combine them into one note.
52 */ 52 */
53#ifndef KEXEC_NOTE_BYTES
53#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \ 54#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \
54 KEXEC_CORE_NOTE_NAME_BYTES + \ 55 KEXEC_CORE_NOTE_NAME_BYTES + \
55 KEXEC_CORE_NOTE_DESC_BYTES ) 56 KEXEC_CORE_NOTE_DESC_BYTES )
57#endif
56 58
57/* 59/*
58 * This structure is used to hold the arguments that are used when loading 60 * This structure is used to hold the arguments that are used when loading
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 33a63f62d57..86e5214ae73 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -24,8 +24,6 @@
24 24
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26struct notifier_block; 26struct notifier_block;
27extern const int NR_TYPES;
28extern const int max_vals[];
29extern unsigned short *key_maps[MAX_NR_KEYMAPS]; 27extern unsigned short *key_maps[MAX_NR_KEYMAPS];
30extern unsigned short plain_map[NR_KEYS]; 28extern unsigned short plain_map[NR_KEYS];
31 29
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index fee66317e07..35f7237ec97 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -15,13 +15,18 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/list.h> 16#include <linux/list.h>
17 17
18/*
19 * Keep this list arranged in rough order of priority. Anything listed after
20 * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump
21 * is passed to the kernel.
22 */
18enum kmsg_dump_reason { 23enum kmsg_dump_reason {
19 KMSG_DUMP_OOPS,
20 KMSG_DUMP_PANIC, 24 KMSG_DUMP_PANIC,
25 KMSG_DUMP_OOPS,
26 KMSG_DUMP_EMERG,
21 KMSG_DUMP_RESTART, 27 KMSG_DUMP_RESTART,
22 KMSG_DUMP_HALT, 28 KMSG_DUMP_HALT,
23 KMSG_DUMP_POWEROFF, 29 KMSG_DUMP_POWEROFF,
24 KMSG_DUMP_EMERG,
25}; 30};
26 31
27/** 32/**
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
index d21fa2865bf..d21fa2865bf 100755..100644
--- a/include/linux/lp8727.h
+++ b/include/linux/lp8727.h
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 23fcdfcba81..b8ba8554472 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -6,6 +6,8 @@
6 6
7#if BITS_PER_LONG == 64 7#if BITS_PER_LONG == 64
8 8
9#define div64_long(x,y) div64_s64((x),(y))
10
9/** 11/**
10 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder 12 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
11 * 13 *
@@ -45,6 +47,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor)
45 47
46#elif BITS_PER_LONG == 32 48#elif BITS_PER_LONG == 32
47 49
50#define div64_long(x,y) div_s64((x),(y))
51
48#ifndef div_u64_rem 52#ifndef div_u64_rem
49static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) 53static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
50{ 54{
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index b1494aced21..dfb947959ec 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -10,6 +10,7 @@
10#ifndef __LINUX_MDIO_H__ 10#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__ 11#define __LINUX_MDIO_H__
12 12
13#include <linux/types.h>
13#include <linux/mii.h> 14#include <linux/mii.h>
14 15
15/* MDIO Manageable Devices (MMDs). */ 16/* MDIO Manageable Devices (MMDs). */
@@ -273,6 +274,8 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad)
273 return MDIO_PHY_ID_C45 | (prtad << 5) | devad; 274 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
274} 275}
275 276
277#ifdef __KERNEL__
278
276static inline bool mdio_phy_id_is_c45(int phy_id) 279static inline bool mdio_phy_id_is_c45(int phy_id)
277{ 280{
278 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); 281 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
@@ -288,11 +291,6 @@ static inline __u16 mdio_phy_id_devad(int phy_id)
288 return phy_id & MDIO_PHY_ID_DEVAD; 291 return phy_id & MDIO_PHY_ID_DEVAD;
289} 292}
290 293
291#define MDIO_SUPPORTS_C22 1
292#define MDIO_SUPPORTS_C45 2
293
294#ifdef __KERNEL__
295
296/** 294/**
297 * struct mdio_if_info - Ethernet controller MDIO interface 295 * struct mdio_if_info - Ethernet controller MDIO interface
298 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) 296 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
@@ -321,6 +319,8 @@ struct mdio_if_info {
321 319
322#define MDIO_PRTAD_NONE (-1) 320#define MDIO_PRTAD_NONE (-1)
323#define MDIO_DEVAD_NONE (-1) 321#define MDIO_DEVAD_NONE (-1)
322#define MDIO_SUPPORTS_C22 1
323#define MDIO_SUPPORTS_C45 2
324#define MDIO_EMULATE_C22 4 324#define MDIO_EMULATE_C22 4
325 325
326struct ethtool_cmd; 326struct ethtool_cmd;
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 4d34356fe64..b80de520670 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -129,7 +129,6 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
129extern void mem_cgroup_replace_page_cache(struct page *oldpage, 129extern void mem_cgroup_replace_page_cache(struct page *oldpage,
130 struct page *newpage); 130 struct page *newpage);
131 131
132extern void mem_cgroup_reset_owner(struct page *page);
133#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 132#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
134extern int do_swap_account; 133extern int do_swap_account;
135#endif 134#endif
@@ -392,10 +391,6 @@ static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
392 struct page *newpage) 391 struct page *newpage)
393{ 392{
394} 393}
395
396static inline void mem_cgroup_reset_owner(struct page *page)
397{
398}
399#endif /* CONFIG_CGROUP_MEM_CONT */ 394#endif /* CONFIG_CGROUP_MEM_CONT */
400 395
401#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 396#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index 1515e64e366..f88c1cc0cb0 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,7 +10,6 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <linux/mod_devicetable.h>
14#include <mach/dma.h> 13#include <mach/dma.h>
15 14
16struct mcp_ops; 15struct mcp_ops;
@@ -27,7 +26,7 @@ struct mcp {
27 dma_device_t dma_telco_rd; 26 dma_device_t dma_telco_rd;
28 dma_device_t dma_telco_wr; 27 dma_device_t dma_telco_wr;
29 struct device attached_device; 28 struct device attached_device;
30 const char *codec; 29 int gpio_base;
31}; 30};
32 31
33struct mcp_ops { 32struct mcp_ops {
@@ -45,11 +44,10 @@ void mcp_reg_write(struct mcp *, unsigned int, unsigned int);
45unsigned int mcp_reg_read(struct mcp *, unsigned int); 44unsigned int mcp_reg_read(struct mcp *, unsigned int);
46void mcp_enable(struct mcp *); 45void mcp_enable(struct mcp *);
47void mcp_disable(struct mcp *); 46void mcp_disable(struct mcp *);
48const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp);
49#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 47#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
50 48
51struct mcp *mcp_host_alloc(struct device *, size_t); 49struct mcp *mcp_host_alloc(struct device *, size_t);
52int mcp_host_register(struct mcp *, void *); 50int mcp_host_register(struct mcp *);
53void mcp_host_unregister(struct mcp *); 51void mcp_host_unregister(struct mcp *);
54 52
55struct mcp_driver { 53struct mcp_driver {
@@ -58,7 +56,6 @@ struct mcp_driver {
58 void (*remove)(struct mcp *); 56 void (*remove)(struct mcp *);
59 int (*suspend)(struct mcp *, pm_message_t); 57 int (*suspend)(struct mcp *, pm_message_t);
60 int (*resume)(struct mcp *); 58 int (*resume)(struct mcp *);
61 const struct mcp_device_id *id_table;
62}; 59};
63 60
64int mcp_driver_register(struct mcp_driver *); 61int mcp_driver_register(struct mcp_driver *);
@@ -67,6 +64,9 @@ void mcp_driver_unregister(struct mcp_driver *);
67#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device) 64#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device)
68#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d) 65#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d)
69 66
70#define mcp_priv(mcp) ((void *)((mcp)+1)) 67static inline void *mcp_priv(struct mcp *mcp)
68{
69 return mcp + 1;
70}
71 71
72#endif 72#endif
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 2463c261959..9bc9ac651da 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -187,8 +187,10 @@ struct twl6040 {
187 int rev; 187 int rev;
188 u8 vibra_ctrl_cache[2]; 188 u8 vibra_ctrl_cache[2];
189 189
190 /* PLL configuration */
190 int pll; 191 int pll;
191 unsigned int sysclk; 192 unsigned int sysclk;
193 unsigned int mclk;
192 194
193 unsigned int irq; 195 unsigned int irq;
194 unsigned int irq_base; 196 unsigned int irq_base;
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index bc19e5fb7ea..4321f044d1e 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -104,9 +104,6 @@
104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
105#define UCB_MODE_AUD_OFF_CAN (1 << 13) 105#define UCB_MODE_AUD_OFF_CAN (1 << 13)
106 106
107struct ucb1x00_plat_data {
108 int gpio_base;
109};
110 107
111struct ucb1x00_irq { 108struct ucb1x00_irq {
112 void *devid; 109 void *devid;
@@ -119,7 +116,7 @@ struct ucb1x00 {
119 unsigned int irq; 116 unsigned int irq;
120 struct semaphore adc_sem; 117 struct semaphore adc_sem;
121 spinlock_t io_lock; 118 spinlock_t io_lock;
122 const struct mcp_device_id *id; 119 u16 id;
123 u16 io_dir; 120 u16 io_dir;
124 u16 io_out; 121 u16 io_out;
125 u16 adc_cr; 122 u16 adc_cr;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index eaf867412f7..05ed2828a55 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,22 +3,10 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/migrate_mode.h>
6 7
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 9
9/*
10 * MIGRATE_ASYNC means never block
11 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
12 * on most operations but not ->writepage as the potential stall time
13 * is too significant
14 * MIGRATE_SYNC will block when migrating pages
15 */
16enum migrate_mode {
17 MIGRATE_ASYNC,
18 MIGRATE_SYNC_LIGHT,
19 MIGRATE_SYNC,
20};
21
22#ifdef CONFIG_MIGRATION 10#ifdef CONFIG_MIGRATION
23#define PAGE_MIGRATION 1 11#define PAGE_MIGRATION 1
24 12
diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
new file mode 100644
index 00000000000..ebf3d89a391
--- /dev/null
+++ b/include/linux/migrate_mode.h
@@ -0,0 +1,16 @@
1#ifndef MIGRATE_MODE_H_INCLUDED
2#define MIGRATE_MODE_H_INCLUDED
3/*
4 * MIGRATE_ASYNC means never block
5 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
6 * on most operations but not ->writepage as the potential stall time
7 * is too significant
8 * MIGRATE_SYNC will block when migrating pages
9 */
10enum migrate_mode {
11 MIGRATE_ASYNC,
12 MIGRATE_SYNC_LIGHT,
13 MIGRATE_SYNC,
14};
15
16#endif /* MIGRATE_MODE_H_INCLUDED */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 5c4fe8e5bfe..44d8144e9ae 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -621,7 +621,11 @@ void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); 622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); 623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
624 624void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
625int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
626 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
627int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
628 u8 promisc);
625int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 629int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
626int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 630int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
627void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 631void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bee8fa23127..091f9e7dc8b 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg {
212 * [1] SE (solicited event) 212 * [1] SE (solicited event)
213 * [0] FL (force loopback) 213 * [0] FL (force loopback)
214 */ 214 */
215 __be32 srcrb_flags; 215 union {
216 __be32 srcrb_flags;
217 __be16 srcrb_flags16[2];
218 };
216 /* 219 /*
217 * imm is immediate data for send/RDMA write w/ immediate; 220 * imm is immediate data for send/RDMA write w/ immediate;
218 * also invalidation key for send with invalidate; input 221 * also invalidation key for send with invalidate; input
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 9f22ba572de..19a41d1737a 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -217,6 +217,7 @@ struct mmc_card {
217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */ 218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */ 219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
220#define MMC_STATE_SLEEP (1<<9) /* card is in sleep state */
220 unsigned int quirks; /* card quirks */ 221 unsigned int quirks; /* card quirks */
221#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 222#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
222#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 223#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -382,6 +383,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
382#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 383#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
383#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 384#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
384#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) 385#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
386#define mmc_card_is_sleep(c) ((c)->state & MMC_STATE_SLEEP)
385 387
386#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 388#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
387#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 389#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
@@ -393,7 +395,9 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
393#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 395#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
394#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 396#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
395#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED) 397#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
398#define mmc_card_set_sleep(c) ((c)->state |= MMC_STATE_SLEEP)
396 399
400#define mmc_card_clr_sleep(c) ((c)->state &= ~MMC_STATE_SLEEP)
397/* 401/*
398 * Quirk add/remove for MMC products. 402 * Quirk add/remove for MMC products.
399 */ 403 */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index e8779c6d175..aae5d1f1bb3 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -14,6 +14,8 @@
14#ifndef LINUX_MMC_DW_MMC_H 14#ifndef LINUX_MMC_DW_MMC_H
15#define LINUX_MMC_DW_MMC_H 15#define LINUX_MMC_DW_MMC_H
16 16
17#include <linux/scatterlist.h>
18
17#define MAX_MCI_SLOTS 2 19#define MAX_MCI_SLOTS 2
18 20
19enum dw_mci_state { 21enum dw_mci_state {
@@ -40,7 +42,7 @@ struct mmc_data;
40 * @lock: Spinlock protecting the queue and associated data. 42 * @lock: Spinlock protecting the queue and associated data.
41 * @regs: Pointer to MMIO registers. 43 * @regs: Pointer to MMIO registers.
42 * @sg: Scatterlist entry currently being processed by PIO code, if any. 44 * @sg: Scatterlist entry currently being processed by PIO code, if any.
43 * @pio_offset: Offset into the current scatterlist entry. 45 * @sg_miter: PIO mapping scatterlist iterator.
44 * @cur_slot: The slot which is currently using the controller. 46 * @cur_slot: The slot which is currently using the controller.
45 * @mrq: The request currently being processed on @cur_slot, 47 * @mrq: The request currently being processed on @cur_slot,
46 * or NULL if the controller is idle. 48 * or NULL if the controller is idle.
@@ -115,7 +117,7 @@ struct dw_mci {
115 void __iomem *regs; 117 void __iomem *regs;
116 118
117 struct scatterlist *sg; 119 struct scatterlist *sg;
118 unsigned int pio_offset; 120 struct sg_mapping_iter sg_miter;
119 121
120 struct dw_mci_slot *cur_slot; 122 struct dw_mci_slot *cur_slot;
121 struct mmc_request *mrq; 123 struct mmc_request *mrq;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0beba1e5e1e..ee2b0363c04 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -257,6 +257,7 @@ struct mmc_host {
257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR) 259 MMC_CAP2_HS200_1_2V_SDR)
260#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
260 261
261 mmc_pm_flag_t pm_caps; /* supported pm features */ 262 mmc_pm_flag_t pm_caps; /* supported pm features */
262 unsigned int power_notify_type; 263 unsigned int power_notify_type;
@@ -444,4 +445,23 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
444 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 445 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
445} 446}
446 447
448#ifdef CONFIG_MMC_CLKGATE
449void mmc_host_clk_hold(struct mmc_host *host);
450void mmc_host_clk_release(struct mmc_host *host);
451unsigned int mmc_host_clk_rate(struct mmc_host *host);
452
453#else
454static inline void mmc_host_clk_hold(struct mmc_host *host)
455{
456}
457
458static inline void mmc_host_clk_release(struct mmc_host *host)
459{
460}
461
462static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
463{
464 return host->ios.clock;
465}
466#endif
447#endif /* LINUX_MMC_HOST_H */ 467#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index b29e7f6f8fa..fb69ad191ad 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -436,17 +436,6 @@ struct spi_device_id {
436 __attribute__((aligned(sizeof(kernel_ulong_t)))); 436 __attribute__((aligned(sizeof(kernel_ulong_t))));
437}; 437};
438 438
439/* mcp */
440
441#define MCP_NAME_SIZE 20
442#define MCP_MODULE_PREFIX "mcp:"
443
444struct mcp_device_id {
445 char name[MCP_NAME_SIZE];
446 kernel_ulong_t driver_data /* Data private to the driver */
447 __attribute__((aligned(sizeof(kernel_ulong_t))));
448};
449
450/* dmi */ 439/* dmi */
451enum dmi_field { 440enum dmi_field {
452 DMI_NONE, 441 DMI_NONE,
@@ -571,4 +560,25 @@ struct amba_id {
571#endif 560#endif
572}; 561};
573 562
563/*
564 * Match x86 CPUs for CPU specific drivers.
565 * See documentation of "x86_match_cpu" for details.
566 */
567
568struct x86_cpu_id {
569 __u16 vendor;
570 __u16 family;
571 __u16 model;
572 __u16 feature; /* bit index */
573 kernel_ulong_t driver_data;
574};
575
576#define X86_FEATURE_MATCH(x) \
577 { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
578
579#define X86_VENDOR_ANY 0xffff
580#define X86_FAMILY_ANY 0
581#define X86_MODEL_ANY 0
582#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
583
574#endif /* LINUX_MOD_DEVICETABLE_H */ 584#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mpi.h b/include/linux/mpi.h
index 06f88994cca..d02cca6cc8c 100644
--- a/include/linux/mpi.h
+++ b/include/linux/mpi.h
@@ -57,8 +57,6 @@ struct gcry_mpi {
57 57
58typedef struct gcry_mpi *MPI; 58typedef struct gcry_mpi *MPI;
59 59
60#define MPI_NULL NULL
61
62#define mpi_get_nlimbs(a) ((a)->nlimbs) 60#define mpi_get_nlimbs(a) ((a)->nlimbs)
63#define mpi_is_neg(a) ((a)->sign) 61#define mpi_is_neg(a) ((a)->sign)
64 62
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 1a81fde8f33..d43dc25af82 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -427,9 +427,7 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
427 427
428static inline int mtd_suspend(struct mtd_info *mtd) 428static inline int mtd_suspend(struct mtd_info *mtd)
429{ 429{
430 if (!mtd->suspend) 430 return mtd->suspend ? mtd->suspend(mtd) : 0;
431 return -EOPNOTSUPP;
432 return mtd->suspend(mtd);
433} 431}
434 432
435static inline void mtd_resume(struct mtd_info *mtd) 433static inline void mtd_resume(struct mtd_info *mtd)
@@ -441,7 +439,7 @@ static inline void mtd_resume(struct mtd_info *mtd)
441static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) 439static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
442{ 440{
443 if (!mtd->block_isbad) 441 if (!mtd->block_isbad)
444 return -EOPNOTSUPP; 442 return 0;
445 return mtd->block_isbad(mtd, ofs); 443 return mtd->block_isbad(mtd, ofs);
446} 444}
447 445
diff --git a/include/linux/net.h b/include/linux/net.h
index b29923006b1..be60c7f5e14 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -206,6 +206,7 @@ struct proto_ops {
206 int offset, size_t size, int flags); 206 int offset, size_t size, int flags);
207 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, 207 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
208 struct pipe_inode_info *pipe, size_t len, unsigned int flags); 208 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
209 void (*set_peek_off)(struct sock *sk, int val);
209}; 210};
210 211
211#define DECLARE_SOCKADDR(type, dst, src) \ 212#define DECLARE_SOCKADDR(type, dst, src) \
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 77f5202977c..5ac32123035 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -54,6 +54,8 @@ enum {
54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ 54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ 55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */ 56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57 NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */
58 NETIF_F_RXALL_BIT, /* Receive errored frames too */
57 59
58 /* 60 /*
59 * Add your fresh new feature above and remember to update 61 * Add your fresh new feature above and remember to update
@@ -98,6 +100,8 @@ enum {
98#define NETIF_F_TSO __NETIF_F(TSO) 100#define NETIF_F_TSO __NETIF_F(TSO)
99#define NETIF_F_UFO __NETIF_F(UFO) 101#define NETIF_F_UFO __NETIF_F(UFO)
100#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) 102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
103#define NETIF_F_RXFCS __NETIF_F(RXFCS)
104#define NETIF_F_RXALL __NETIF_F(RXALL)
101 105
102/* Features valid for ethtool to change */ 106/* Features valid for ethtool to change */
103/* = all defined minus driver/device-class-related */ 107/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0eac07c9525..8debe299676 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -214,8 +214,8 @@ enum {
214#include <linux/skbuff.h> 214#include <linux/skbuff.h>
215 215
216#ifdef CONFIG_RPS 216#ifdef CONFIG_RPS
217#include <linux/jump_label.h> 217#include <linux/static_key.h>
218extern struct jump_label_key rps_needed; 218extern struct static_key rps_needed;
219#endif 219#endif
220 220
221struct neighbour; 221struct neighbour;
@@ -417,7 +417,7 @@ typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
417 417
418extern void __napi_schedule(struct napi_struct *n); 418extern void __napi_schedule(struct napi_struct *n);
419 419
420static inline int napi_disable_pending(struct napi_struct *n) 420static inline bool napi_disable_pending(struct napi_struct *n)
421{ 421{
422 return test_bit(NAPI_STATE_DISABLE, &n->state); 422 return test_bit(NAPI_STATE_DISABLE, &n->state);
423} 423}
@@ -431,7 +431,7 @@ static inline int napi_disable_pending(struct napi_struct *n)
431 * insure only one NAPI poll instance runs. We also make 431 * insure only one NAPI poll instance runs. We also make
432 * sure there is no pending NAPI disable. 432 * sure there is no pending NAPI disable.
433 */ 433 */
434static inline int napi_schedule_prep(struct napi_struct *n) 434static inline bool napi_schedule_prep(struct napi_struct *n)
435{ 435{
436 return !napi_disable_pending(n) && 436 return !napi_disable_pending(n) &&
437 !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 437 !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
@@ -451,13 +451,13 @@ static inline void napi_schedule(struct napi_struct *n)
451} 451}
452 452
453/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ 453/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
454static inline int napi_reschedule(struct napi_struct *napi) 454static inline bool napi_reschedule(struct napi_struct *napi)
455{ 455{
456 if (napi_schedule_prep(napi)) { 456 if (napi_schedule_prep(napi)) {
457 __napi_schedule(napi); 457 __napi_schedule(napi);
458 return 1; 458 return true;
459 } 459 }
460 return 0; 460 return false;
461} 461}
462 462
463/** 463/**
@@ -1082,7 +1082,8 @@ struct net_device {
1082 const struct header_ops *header_ops; 1082 const struct header_ops *header_ops;
1083 1083
1084 unsigned int flags; /* interface flags (a la BSD) */ 1084 unsigned int flags; /* interface flags (a la BSD) */
1085 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ 1085 unsigned int priv_flags; /* Like 'flags' but invisible to userspace.
1086 * See if.h for definitions. */
1086 unsigned short gflags; 1087 unsigned short gflags;
1087 unsigned short padded; /* How much padding added by alloc_netdev() */ 1088 unsigned short padded; /* How much padding added by alloc_netdev() */
1088 1089
@@ -1867,7 +1868,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
1867 } 1868 }
1868} 1869}
1869 1870
1870static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 1871static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1871{ 1872{
1872 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); 1873 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1873} 1874}
@@ -1878,17 +1879,17 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1878 * 1879 *
1879 * Test if transmit queue on device is currently unable to send. 1880 * Test if transmit queue on device is currently unable to send.
1880 */ 1881 */
1881static inline int netif_queue_stopped(const struct net_device *dev) 1882static inline bool netif_queue_stopped(const struct net_device *dev)
1882{ 1883{
1883 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1884 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1884} 1885}
1885 1886
1886static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue) 1887static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
1887{ 1888{
1888 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 1889 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
1889} 1890}
1890 1891
1891static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 1892static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
1892{ 1893{
1893 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 1894 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
1894} 1895}
@@ -1898,12 +1899,22 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1898{ 1899{
1899#ifdef CONFIG_BQL 1900#ifdef CONFIG_BQL
1900 dql_queued(&dev_queue->dql, bytes); 1901 dql_queued(&dev_queue->dql, bytes);
1901 if (unlikely(dql_avail(&dev_queue->dql) < 0)) { 1902
1902 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); 1903 if (likely(dql_avail(&dev_queue->dql) >= 0))
1903 if (unlikely(dql_avail(&dev_queue->dql) >= 0)) 1904 return;
1904 clear_bit(__QUEUE_STATE_STACK_XOFF, 1905
1905 &dev_queue->state); 1906 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1906 } 1907
1908 /*
1909 * The XOFF flag must be set before checking the dql_avail below,
1910 * because in netdev_tx_completed_queue we update the dql_completed
1911 * before checking the XOFF flag.
1912 */
1913 smp_mb();
1914
1915 /* check again in case another CPU has just made room avail */
1916 if (unlikely(dql_avail(&dev_queue->dql) >= 0))
1917 clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1907#endif 1918#endif
1908} 1919}
1909 1920
@@ -1916,16 +1927,23 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1916 unsigned pkts, unsigned bytes) 1927 unsigned pkts, unsigned bytes)
1917{ 1928{
1918#ifdef CONFIG_BQL 1929#ifdef CONFIG_BQL
1919 if (likely(bytes)) { 1930 if (unlikely(!bytes))
1920 dql_completed(&dev_queue->dql, bytes); 1931 return;
1921 if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF, 1932
1922 &dev_queue->state) && 1933 dql_completed(&dev_queue->dql, bytes);
1923 dql_avail(&dev_queue->dql) >= 0)) { 1934
1924 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, 1935 /*
1925 &dev_queue->state)) 1936 * Without the memory barrier there is a small possiblity that
1926 netif_schedule_queue(dev_queue); 1937 * netdev_tx_sent_queue will miss the update and cause the queue to
1927 } 1938 * be stopped forever
1928 } 1939 */
1940 smp_mb();
1941
1942 if (dql_avail(&dev_queue->dql) < 0)
1943 return;
1944
1945 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state))
1946 netif_schedule_queue(dev_queue);
1929#endif 1947#endif
1930} 1948}
1931 1949
@@ -1938,6 +1956,7 @@ static inline void netdev_completed_queue(struct net_device *dev,
1938static inline void netdev_tx_reset_queue(struct netdev_queue *q) 1956static inline void netdev_tx_reset_queue(struct netdev_queue *q)
1939{ 1957{
1940#ifdef CONFIG_BQL 1958#ifdef CONFIG_BQL
1959 clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state);
1941 dql_reset(&q->dql); 1960 dql_reset(&q->dql);
1942#endif 1961#endif
1943} 1962}
@@ -1953,7 +1972,7 @@ static inline void netdev_reset_queue(struct net_device *dev_queue)
1953 * 1972 *
1954 * Test if the device has been brought up. 1973 * Test if the device has been brought up.
1955 */ 1974 */
1956static inline int netif_running(const struct net_device *dev) 1975static inline bool netif_running(const struct net_device *dev)
1957{ 1976{
1958 return test_bit(__LINK_STATE_START, &dev->state); 1977 return test_bit(__LINK_STATE_START, &dev->state);
1959} 1978}
@@ -2003,16 +2022,16 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
2003 * 2022 *
2004 * Check individual transmit queue of a device with multiple transmit queues. 2023 * Check individual transmit queue of a device with multiple transmit queues.
2005 */ 2024 */
2006static inline int __netif_subqueue_stopped(const struct net_device *dev, 2025static inline bool __netif_subqueue_stopped(const struct net_device *dev,
2007 u16 queue_index) 2026 u16 queue_index)
2008{ 2027{
2009 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2028 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2010 2029
2011 return netif_tx_queue_stopped(txq); 2030 return netif_tx_queue_stopped(txq);
2012} 2031}
2013 2032
2014static inline int netif_subqueue_stopped(const struct net_device *dev, 2033static inline bool netif_subqueue_stopped(const struct net_device *dev,
2015 struct sk_buff *skb) 2034 struct sk_buff *skb)
2016{ 2035{
2017 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2036 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2018} 2037}
@@ -2051,7 +2070,7 @@ static inline u16 skb_tx_hash(const struct net_device *dev,
2051 * 2070 *
2052 * Check if device has multiple transmit queues 2071 * Check if device has multiple transmit queues
2053 */ 2072 */
2054static inline int netif_is_multiqueue(const struct net_device *dev) 2073static inline bool netif_is_multiqueue(const struct net_device *dev)
2055{ 2074{
2056 return dev->num_tx_queues > 1; 2075 return dev->num_tx_queues > 1;
2057} 2076}
@@ -2121,7 +2140,7 @@ extern int netdev_rx_handler_register(struct net_device *dev,
2121 void *rx_handler_data); 2140 void *rx_handler_data);
2122extern void netdev_rx_handler_unregister(struct net_device *dev); 2141extern void netdev_rx_handler_unregister(struct net_device *dev);
2123 2142
2124extern int dev_valid_name(const char *name); 2143extern bool dev_valid_name(const char *name);
2125extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2144extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2126extern int dev_ethtool(struct net *net, struct ifreq *); 2145extern int dev_ethtool(struct net *net, struct ifreq *);
2127extern unsigned dev_get_flags(const struct net_device *); 2146extern unsigned dev_get_flags(const struct net_device *);
@@ -2187,7 +2206,7 @@ extern void linkwatch_forget_dev(struct net_device *dev);
2187 * 2206 *
2188 * Check if carrier is present on device 2207 * Check if carrier is present on device
2189 */ 2208 */
2190static inline int netif_carrier_ok(const struct net_device *dev) 2209static inline bool netif_carrier_ok(const struct net_device *dev)
2191{ 2210{
2192 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2211 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2193} 2212}
@@ -2239,7 +2258,7 @@ static inline void netif_dormant_off(struct net_device *dev)
2239 * 2258 *
2240 * Check if carrier is present on device 2259 * Check if carrier is present on device
2241 */ 2260 */
2242static inline int netif_dormant(const struct net_device *dev) 2261static inline bool netif_dormant(const struct net_device *dev)
2243{ 2262{
2244 return test_bit(__LINK_STATE_DORMANT, &dev->state); 2263 return test_bit(__LINK_STATE_DORMANT, &dev->state);
2245} 2264}
@@ -2251,7 +2270,7 @@ static inline int netif_dormant(const struct net_device *dev)
2251 * 2270 *
2252 * Check if carrier is operational 2271 * Check if carrier is operational
2253 */ 2272 */
2254static inline int netif_oper_up(const struct net_device *dev) 2273static inline bool netif_oper_up(const struct net_device *dev)
2255{ 2274{
2256 return (dev->operstate == IF_OPER_UP || 2275 return (dev->operstate == IF_OPER_UP ||
2257 dev->operstate == IF_OPER_UNKNOWN /* backward compat */); 2276 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
@@ -2263,7 +2282,7 @@ static inline int netif_oper_up(const struct net_device *dev)
2263 * 2282 *
2264 * Check if device has not been removed from system. 2283 * Check if device has not been removed from system.
2265 */ 2284 */
2266static inline int netif_device_present(struct net_device *dev) 2285static inline bool netif_device_present(struct net_device *dev)
2267{ 2286{
2268 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2287 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2269} 2288}
@@ -2333,9 +2352,9 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
2333 txq->xmit_lock_owner = smp_processor_id(); 2352 txq->xmit_lock_owner = smp_processor_id();
2334} 2353}
2335 2354
2336static inline int __netif_tx_trylock(struct netdev_queue *txq) 2355static inline bool __netif_tx_trylock(struct netdev_queue *txq)
2337{ 2356{
2338 int ok = spin_trylock(&txq->_xmit_lock); 2357 bool ok = spin_trylock(&txq->_xmit_lock);
2339 if (likely(ok)) 2358 if (likely(ok))
2340 txq->xmit_lock_owner = smp_processor_id(); 2359 txq->xmit_lock_owner = smp_processor_id();
2341 return ok; 2360 return ok;
@@ -2556,6 +2575,8 @@ extern void dev_load(struct net *net, const char *name);
2556extern void dev_mcast_init(void); 2575extern void dev_mcast_init(void);
2557extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2576extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2558 struct rtnl_link_stats64 *storage); 2577 struct rtnl_link_stats64 *storage);
2578extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2579 const struct net_device_stats *netdev_stats);
2559 2580
2560extern int netdev_max_backlog; 2581extern int netdev_max_backlog;
2561extern int netdev_tstamp_prequeue; 2582extern int netdev_tstamp_prequeue;
@@ -2611,7 +2632,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2611 2632
2612netdev_features_t netif_skb_features(struct sk_buff *skb); 2633netdev_features_t netif_skb_features(struct sk_buff *skb);
2613 2634
2614static inline int net_gso_ok(netdev_features_t features, int gso_type) 2635static inline bool net_gso_ok(netdev_features_t features, int gso_type)
2615{ 2636{
2616 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; 2637 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2617 2638
@@ -2626,17 +2647,18 @@ static inline int net_gso_ok(netdev_features_t features, int gso_type)
2626 return (features & feature) == feature; 2647 return (features & feature) == feature;
2627} 2648}
2628 2649
2629static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features) 2650static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2630{ 2651{
2631 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2652 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2632 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2653 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2633} 2654}
2634 2655
2635static inline int netif_needs_gso(struct sk_buff *skb, 2656static inline bool netif_needs_gso(struct sk_buff *skb,
2636 netdev_features_t features) 2657 netdev_features_t features)
2637{ 2658{
2638 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2659 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2639 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2660 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
2661 (skb->ip_summed != CHECKSUM_UNNECESSARY)));
2640} 2662}
2641 2663
2642static inline void netif_set_gso_max_size(struct net_device *dev, 2664static inline void netif_set_gso_max_size(struct net_device *dev,
@@ -2645,11 +2667,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2645 dev->gso_max_size = size; 2667 dev->gso_max_size = size;
2646} 2668}
2647 2669
2648static inline int netif_is_bond_slave(struct net_device *dev) 2670static inline bool netif_is_bond_slave(struct net_device *dev)
2649{ 2671{
2650 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 2672 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2651} 2673}
2652 2674
2675static inline bool netif_supports_nofcs(struct net_device *dev)
2676{
2677 return dev->priv_flags & IFF_SUPP_NOFCS;
2678}
2679
2653extern struct pernet_operations __net_initdata loopback_net_ops; 2680extern struct pernet_operations __net_initdata loopback_net_ops;
2654 2681
2655/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2682/* Logging, debugging and troubleshooting/diagnostic helpers. */
@@ -2687,14 +2714,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...);
2687#define MODULE_ALIAS_NETDEV(device) \ 2714#define MODULE_ALIAS_NETDEV(device) \
2688 MODULE_ALIAS("netdev-" device) 2715 MODULE_ALIAS("netdev-" device)
2689 2716
2690#if defined(DEBUG) 2717#if defined(CONFIG_DYNAMIC_DEBUG)
2691#define netdev_dbg(__dev, format, args...) \
2692 netdev_printk(KERN_DEBUG, __dev, format, ##args)
2693#elif defined(CONFIG_DYNAMIC_DEBUG)
2694#define netdev_dbg(__dev, format, args...) \ 2718#define netdev_dbg(__dev, format, args...) \
2695do { \ 2719do { \
2696 dynamic_netdev_dbg(__dev, format, ##args); \ 2720 dynamic_netdev_dbg(__dev, format, ##args); \
2697} while (0) 2721} while (0)
2722#elif defined(DEBUG)
2723#define netdev_dbg(__dev, format, args...) \
2724 netdev_printk(KERN_DEBUG, __dev, format, ##args)
2698#else 2725#else
2699#define netdev_dbg(__dev, format, args...) \ 2726#define netdev_dbg(__dev, format, args...) \
2700({ \ 2727({ \
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index b809265607d..29734be334c 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -163,13 +163,13 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 164
165#if defined(CONFIG_JUMP_LABEL) 165#if defined(CONFIG_JUMP_LABEL)
166#include <linux/jump_label.h> 166#include <linux/static_key.h>
167extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 167extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) 168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
169{ 169{
170 if (__builtin_constant_p(pf) && 170 if (__builtin_constant_p(pf) &&
171 __builtin_constant_p(hook)) 171 __builtin_constant_p(hook))
172 return static_branch(&nf_hooks_needed[pf][hook]); 172 return static_key_false(&nf_hooks_needed[pf][hook]);
173 173
174 return !list_empty(&nf_hooks[pf][hook]); 174 return !list_empty(&nf_hooks[pf][hook]);
175} 175}
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index e144f54185c..1697036336b 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -10,6 +10,7 @@ header-y += nfnetlink.h
10header-y += nfnetlink_acct.h 10header-y += nfnetlink_acct.h
11header-y += nfnetlink_compat.h 11header-y += nfnetlink_compat.h
12header-y += nfnetlink_conntrack.h 12header-y += nfnetlink_conntrack.h
13header-y += nfnetlink_cttimeout.h
13header-y += nfnetlink_log.h 14header-y += nfnetlink_log.h
14header-y += nfnetlink_queue.h 15header-y += nfnetlink_queue.h
15header-y += x_tables.h 16header-y += x_tables.h
@@ -22,6 +23,7 @@ header-y += xt_CT.h
22header-y += xt_DSCP.h 23header-y += xt_DSCP.h
23header-y += xt_IDLETIMER.h 24header-y += xt_IDLETIMER.h
24header-y += xt_LED.h 25header-y += xt_LED.h
26header-y += xt_LOG.h
25header-y += xt_MARK.h 27header-y += xt_MARK.h
26header-y += xt_nfacct.h 28header-y += xt_nfacct.h
27header-y += xt_NFLOG.h 29header-y += xt_NFLOG.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 3540c6e262f..2f8e18a2322 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -11,6 +11,8 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14#include <linux/types.h>
15
14/* The protocol version */ 16/* The protocol version */
15#define IPSET_PROTOCOL 6 17#define IPSET_PROTOCOL 6
16 18
@@ -148,6 +150,7 @@ enum ipset_cmd_flags {
148 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), 150 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
149 IPSET_FLAG_BIT_LIST_HEADER = 2, 151 IPSET_FLAG_BIT_LIST_HEADER = 2,
150 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), 152 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
153 IPSET_FLAG_CMD_MAX = 15, /* Lower half */
151}; 154};
152 155
153/* Flags at CADT attribute level */ 156/* Flags at CADT attribute level */
@@ -156,6 +159,9 @@ enum ipset_cadt_flags {
156 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), 159 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
157 IPSET_FLAG_BIT_PHYSDEV = 1, 160 IPSET_FLAG_BIT_PHYSDEV = 1,
158 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), 161 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
162 IPSET_FLAG_BIT_NOMATCH = 2,
163 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
164 IPSET_FLAG_CADT_MAX = 15, /* Upper half */
159}; 165};
160 166
161/* Commands with settype-specific attributes */ 167/* Commands with settype-specific attributes */
@@ -168,19 +174,10 @@ enum ipset_adt {
168 IPSET_CADT_MAX, 174 IPSET_CADT_MAX,
169}; 175};
170 176
171#ifdef __KERNEL__
172#include <linux/ip.h>
173#include <linux/ipv6.h>
174#include <linux/netlink.h>
175#include <linux/netfilter.h>
176#include <linux/netfilter/x_tables.h>
177#include <linux/vmalloc.h>
178#include <net/netlink.h>
179
180/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t 177/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
181 * and IPSET_INVALID_ID if you want to increase the max number of sets. 178 * and IPSET_INVALID_ID if you want to increase the max number of sets.
182 */ 179 */
183typedef u16 ip_set_id_t; 180typedef __u16 ip_set_id_t;
184 181
185#define IPSET_INVALID_ID 65535 182#define IPSET_INVALID_ID 65535
186 183
@@ -203,6 +200,15 @@ enum ip_set_kopt {
203 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), 200 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
204}; 201};
205 202
203#ifdef __KERNEL__
204#include <linux/ip.h>
205#include <linux/ipv6.h>
206#include <linux/netlink.h>
207#include <linux/netfilter.h>
208#include <linux/netfilter/x_tables.h>
209#include <linux/vmalloc.h>
210#include <net/netlink.h>
211
206/* Set features */ 212/* Set features */
207enum ip_set_feature { 213enum ip_set_feature {
208 IPSET_TYPE_IP_FLAG = 0, 214 IPSET_TYPE_IP_FLAG = 0,
@@ -288,7 +294,10 @@ struct ip_set_type {
288 u8 features; 294 u8 features;
289 /* Set type dimension */ 295 /* Set type dimension */
290 u8 dimension; 296 u8 dimension;
291 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ 297 /*
298 * Supported family: may be NFPROTO_UNSPEC for both
299 * NFPROTO_IPV4/NFPROTO_IPV6.
300 */
292 u8 family; 301 u8 family;
293 /* Type revisions */ 302 /* Type revisions */
294 u8 revision_min, revision_max; 303 u8 revision_min, revision_max;
@@ -450,6 +459,8 @@ bitmap_bytes(u32 a, u32 b)
450 return 4 * ((((b - a + 8) / 8) + 3) / 4); 459 return 4 * ((((b - a + 8) / 8) + 3) / 4);
451} 460}
452 461
462#endif /* __KERNEL__ */
463
453/* Interface to iptables/ip6tables */ 464/* Interface to iptables/ip6tables */
454 465
455#define SO_IP_SET 83 466#define SO_IP_SET 83
@@ -475,6 +486,4 @@ struct ip_set_req_version {
475 unsigned version; 486 unsigned version;
476}; 487};
477 488
478#endif /* __KERNEL__ */
479
480#endif /*_IP_SET_H */ 489#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index b89fb79cb44..05a5d72680b 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -113,6 +113,12 @@ htable_bits(u32 hashsize)
113} 113}
114 114
115#ifdef IP_SET_HASH_WITH_NETS 115#ifdef IP_SET_HASH_WITH_NETS
116#ifdef IP_SET_HASH_WITH_NETS_PACKED
117/* When cidr is packed with nomatch, cidr - 1 is stored in the entry */
118#define CIDR(cidr) (cidr + 1)
119#else
120#define CIDR(cidr) (cidr)
121#endif
116 122
117#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) 123#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
118 124
@@ -262,6 +268,12 @@ ip_set_hash_destroy(struct ip_set *set)
262#define type_pf_data_list TOKEN(TYPE, PF, _data_list) 268#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
263#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) 269#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
264#define type_pf_data_next TOKEN(TYPE, PF, _data_next) 270#define type_pf_data_next TOKEN(TYPE, PF, _data_next)
271#define type_pf_data_flags TOKEN(TYPE, PF, _data_flags)
272#ifdef IP_SET_HASH_WITH_NETS
273#define type_pf_data_match TOKEN(TYPE, PF, _data_match)
274#else
275#define type_pf_data_match(d) 1
276#endif
265 277
266#define type_pf_elem TOKEN(TYPE, PF, _elem) 278#define type_pf_elem TOKEN(TYPE, PF, _elem)
267#define type_pf_telem TOKEN(TYPE, PF, _telem) 279#define type_pf_telem TOKEN(TYPE, PF, _telem)
@@ -308,8 +320,10 @@ ip_set_hash_destroy(struct ip_set *set)
308 * we spare the maintenance of the internal counters. */ 320 * we spare the maintenance of the internal counters. */
309static int 321static int
310type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, 322type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
311 u8 ahash_max) 323 u8 ahash_max, u32 cadt_flags)
312{ 324{
325 struct type_pf_elem *data;
326
313 if (n->pos >= n->size) { 327 if (n->pos >= n->size) {
314 void *tmp; 328 void *tmp;
315 329
@@ -330,7 +344,13 @@ type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
330 n->value = tmp; 344 n->value = tmp;
331 n->size += AHASH_INIT_SIZE; 345 n->size += AHASH_INIT_SIZE;
332 } 346 }
333 type_pf_data_copy(ahash_data(n, n->pos++), value); 347 data = ahash_data(n, n->pos++);
348 type_pf_data_copy(data, value);
349#ifdef IP_SET_HASH_WITH_NETS
350 /* Resizing won't overwrite stored flags */
351 if (cadt_flags)
352 type_pf_data_flags(data, cadt_flags);
353#endif
334 return 0; 354 return 0;
335} 355}
336 356
@@ -353,9 +373,12 @@ retry:
353 htable_bits++; 373 htable_bits++;
354 pr_debug("attempt to resize set %s from %u to %u, t %p\n", 374 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
355 set->name, orig->htable_bits, htable_bits, orig); 375 set->name, orig->htable_bits, htable_bits, orig);
356 if (!htable_bits) 376 if (!htable_bits) {
357 /* In case we have plenty of memory :-) */ 377 /* In case we have plenty of memory :-) */
378 pr_warning("Cannot increase the hashsize of set %s further\n",
379 set->name);
358 return -IPSET_ERR_HASH_FULL; 380 return -IPSET_ERR_HASH_FULL;
381 }
359 t = ip_set_alloc(sizeof(*t) 382 t = ip_set_alloc(sizeof(*t)
360 + jhash_size(htable_bits) * sizeof(struct hbucket)); 383 + jhash_size(htable_bits) * sizeof(struct hbucket));
361 if (!t) 384 if (!t)
@@ -368,7 +391,7 @@ retry:
368 for (j = 0; j < n->pos; j++) { 391 for (j = 0; j < n->pos; j++) {
369 data = ahash_data(n, j); 392 data = ahash_data(n, j);
370 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 393 m = hbucket(t, HKEY(data, h->initval, htable_bits));
371 ret = type_pf_elem_add(m, data, AHASH_MAX(h)); 394 ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0);
372 if (ret < 0) { 395 if (ret < 0) {
373 read_unlock_bh(&set->lock); 396 read_unlock_bh(&set->lock);
374 ahash_destroy(t); 397 ahash_destroy(t);
@@ -406,9 +429,14 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
406 struct hbucket *n; 429 struct hbucket *n;
407 int i, ret = 0; 430 int i, ret = 0;
408 u32 key, multi = 0; 431 u32 key, multi = 0;
432 u32 cadt_flags = flags >> 16;
409 433
410 if (h->elements >= h->maxelem) 434 if (h->elements >= h->maxelem) {
435 if (net_ratelimit())
436 pr_warning("Set %s is full, maxelem %u reached\n",
437 set->name, h->maxelem);
411 return -IPSET_ERR_HASH_FULL; 438 return -IPSET_ERR_HASH_FULL;
439 }
412 440
413 rcu_read_lock_bh(); 441 rcu_read_lock_bh();
414 t = rcu_dereference_bh(h->table); 442 t = rcu_dereference_bh(h->table);
@@ -416,11 +444,17 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
416 n = hbucket(t, key); 444 n = hbucket(t, key);
417 for (i = 0; i < n->pos; i++) 445 for (i = 0; i < n->pos; i++)
418 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { 446 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) {
447#ifdef IP_SET_HASH_WITH_NETS
448 if (flags & IPSET_FLAG_EXIST)
449 /* Support overwriting just the flags */
450 type_pf_data_flags(ahash_data(n, i),
451 cadt_flags);
452#endif
419 ret = -IPSET_ERR_EXIST; 453 ret = -IPSET_ERR_EXIST;
420 goto out; 454 goto out;
421 } 455 }
422 TUNE_AHASH_MAX(h, multi); 456 TUNE_AHASH_MAX(h, multi);
423 ret = type_pf_elem_add(n, value, AHASH_MAX(h)); 457 ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags);
424 if (ret != 0) { 458 if (ret != 0) {
425 if (ret == -EAGAIN) 459 if (ret == -EAGAIN)
426 type_pf_data_next(h, d); 460 type_pf_data_next(h, d);
@@ -428,7 +462,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
428 } 462 }
429 463
430#ifdef IP_SET_HASH_WITH_NETS 464#ifdef IP_SET_HASH_WITH_NETS
431 add_cidr(h, d->cidr, HOST_MASK); 465 add_cidr(h, CIDR(d->cidr), HOST_MASK);
432#endif 466#endif
433 h->elements++; 467 h->elements++;
434out: 468out:
@@ -463,7 +497,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
463 n->pos--; 497 n->pos--;
464 h->elements--; 498 h->elements--;
465#ifdef IP_SET_HASH_WITH_NETS 499#ifdef IP_SET_HASH_WITH_NETS
466 del_cidr(h, d->cidr, HOST_MASK); 500 del_cidr(h, CIDR(d->cidr), HOST_MASK);
467#endif 501#endif
468 if (n->pos + AHASH_INIT_SIZE < n->size) { 502 if (n->pos + AHASH_INIT_SIZE < n->size) {
469 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 503 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -506,7 +540,7 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
506 for (i = 0; i < n->pos; i++) { 540 for (i = 0; i < n->pos; i++) {
507 data = ahash_data(n, i); 541 data = ahash_data(n, i);
508 if (type_pf_data_equal(data, d, &multi)) 542 if (type_pf_data_equal(data, d, &multi))
509 return 1; 543 return type_pf_data_match(data);
510 } 544 }
511 } 545 }
512 return 0; 546 return 0;
@@ -528,7 +562,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
528#ifdef IP_SET_HASH_WITH_NETS 562#ifdef IP_SET_HASH_WITH_NETS
529 /* If we test an IP address and not a network address, 563 /* If we test an IP address and not a network address,
530 * try all possible network sizes */ 564 * try all possible network sizes */
531 if (d->cidr == SET_HOST_MASK(set->family)) 565 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
532 return type_pf_test_cidrs(set, d, timeout); 566 return type_pf_test_cidrs(set, d, timeout);
533#endif 567#endif
534 568
@@ -537,7 +571,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
537 for (i = 0; i < n->pos; i++) { 571 for (i = 0; i < n->pos; i++) {
538 data = ahash_data(n, i); 572 data = ahash_data(n, i);
539 if (type_pf_data_equal(data, d, &multi)) 573 if (type_pf_data_equal(data, d, &multi))
540 return 1; 574 return type_pf_data_match(data);
541 } 575 }
542 return 0; 576 return 0;
543} 577}
@@ -693,7 +727,7 @@ type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
693 727
694static int 728static int
695type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, 729type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
696 u8 ahash_max, u32 timeout) 730 u8 ahash_max, u32 cadt_flags, u32 timeout)
697{ 731{
698 struct type_pf_elem *data; 732 struct type_pf_elem *data;
699 733
@@ -720,6 +754,11 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
720 data = ahash_tdata(n, n->pos++); 754 data = ahash_tdata(n, n->pos++);
721 type_pf_data_copy(data, value); 755 type_pf_data_copy(data, value);
722 type_pf_data_timeout_set(data, timeout); 756 type_pf_data_timeout_set(data, timeout);
757#ifdef IP_SET_HASH_WITH_NETS
758 /* Resizing won't overwrite stored flags */
759 if (cadt_flags)
760 type_pf_data_flags(data, cadt_flags);
761#endif
723 return 0; 762 return 0;
724} 763}
725 764
@@ -740,7 +779,7 @@ type_pf_expire(struct ip_set_hash *h)
740 if (type_pf_data_expired(data)) { 779 if (type_pf_data_expired(data)) {
741 pr_debug("expired %u/%u\n", i, j); 780 pr_debug("expired %u/%u\n", i, j);
742#ifdef IP_SET_HASH_WITH_NETS 781#ifdef IP_SET_HASH_WITH_NETS
743 del_cidr(h, data->cidr, HOST_MASK); 782 del_cidr(h, CIDR(data->cidr), HOST_MASK);
744#endif 783#endif
745 if (j != n->pos - 1) 784 if (j != n->pos - 1)
746 /* Not last one */ 785 /* Not last one */
@@ -790,9 +829,12 @@ type_pf_tresize(struct ip_set *set, bool retried)
790retry: 829retry:
791 ret = 0; 830 ret = 0;
792 htable_bits++; 831 htable_bits++;
793 if (!htable_bits) 832 if (!htable_bits) {
794 /* In case we have plenty of memory :-) */ 833 /* In case we have plenty of memory :-) */
834 pr_warning("Cannot increase the hashsize of set %s further\n",
835 set->name);
795 return -IPSET_ERR_HASH_FULL; 836 return -IPSET_ERR_HASH_FULL;
837 }
796 t = ip_set_alloc(sizeof(*t) 838 t = ip_set_alloc(sizeof(*t)
797 + jhash_size(htable_bits) * sizeof(struct hbucket)); 839 + jhash_size(htable_bits) * sizeof(struct hbucket));
798 if (!t) 840 if (!t)
@@ -805,7 +847,7 @@ retry:
805 for (j = 0; j < n->pos; j++) { 847 for (j = 0; j < n->pos; j++) {
806 data = ahash_tdata(n, j); 848 data = ahash_tdata(n, j);
807 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 849 m = hbucket(t, HKEY(data, h->initval, htable_bits));
808 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 850 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0,
809 type_pf_data_timeout(data)); 851 type_pf_data_timeout(data));
810 if (ret < 0) { 852 if (ret < 0) {
811 read_unlock_bh(&set->lock); 853 read_unlock_bh(&set->lock);
@@ -839,12 +881,17 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
839 int ret = 0, i, j = AHASH_MAX(h) + 1; 881 int ret = 0, i, j = AHASH_MAX(h) + 1;
840 bool flag_exist = flags & IPSET_FLAG_EXIST; 882 bool flag_exist = flags & IPSET_FLAG_EXIST;
841 u32 key, multi = 0; 883 u32 key, multi = 0;
884 u32 cadt_flags = flags >> 16;
842 885
843 if (h->elements >= h->maxelem) 886 if (h->elements >= h->maxelem)
844 /* FIXME: when set is full, we slow down here */ 887 /* FIXME: when set is full, we slow down here */
845 type_pf_expire(h); 888 type_pf_expire(h);
846 if (h->elements >= h->maxelem) 889 if (h->elements >= h->maxelem) {
890 if (net_ratelimit())
891 pr_warning("Set %s is full, maxelem %u reached\n",
892 set->name, h->maxelem);
847 return -IPSET_ERR_HASH_FULL; 893 return -IPSET_ERR_HASH_FULL;
894 }
848 895
849 rcu_read_lock_bh(); 896 rcu_read_lock_bh();
850 t = rcu_dereference_bh(h->table); 897 t = rcu_dereference_bh(h->table);
@@ -854,6 +901,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
854 data = ahash_tdata(n, i); 901 data = ahash_tdata(n, i);
855 if (type_pf_data_equal(data, d, &multi)) { 902 if (type_pf_data_equal(data, d, &multi)) {
856 if (type_pf_data_expired(data) || flag_exist) 903 if (type_pf_data_expired(data) || flag_exist)
904 /* Just timeout value may be updated */
857 j = i; 905 j = i;
858 else { 906 else {
859 ret = -IPSET_ERR_EXIST; 907 ret = -IPSET_ERR_EXIST;
@@ -866,15 +914,18 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
866 if (j != AHASH_MAX(h) + 1) { 914 if (j != AHASH_MAX(h) + 1) {
867 data = ahash_tdata(n, j); 915 data = ahash_tdata(n, j);
868#ifdef IP_SET_HASH_WITH_NETS 916#ifdef IP_SET_HASH_WITH_NETS
869 del_cidr(h, data->cidr, HOST_MASK); 917 del_cidr(h, CIDR(data->cidr), HOST_MASK);
870 add_cidr(h, d->cidr, HOST_MASK); 918 add_cidr(h, CIDR(d->cidr), HOST_MASK);
871#endif 919#endif
872 type_pf_data_copy(data, d); 920 type_pf_data_copy(data, d);
873 type_pf_data_timeout_set(data, timeout); 921 type_pf_data_timeout_set(data, timeout);
922#ifdef IP_SET_HASH_WITH_NETS
923 type_pf_data_flags(data, cadt_flags);
924#endif
874 goto out; 925 goto out;
875 } 926 }
876 TUNE_AHASH_MAX(h, multi); 927 TUNE_AHASH_MAX(h, multi);
877 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), timeout); 928 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout);
878 if (ret != 0) { 929 if (ret != 0) {
879 if (ret == -EAGAIN) 930 if (ret == -EAGAIN)
880 type_pf_data_next(h, d); 931 type_pf_data_next(h, d);
@@ -882,7 +933,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
882 } 933 }
883 934
884#ifdef IP_SET_HASH_WITH_NETS 935#ifdef IP_SET_HASH_WITH_NETS
885 add_cidr(h, d->cidr, HOST_MASK); 936 add_cidr(h, CIDR(d->cidr), HOST_MASK);
886#endif 937#endif
887 h->elements++; 938 h->elements++;
888out: 939out:
@@ -916,7 +967,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
916 n->pos--; 967 n->pos--;
917 h->elements--; 968 h->elements--;
918#ifdef IP_SET_HASH_WITH_NETS 969#ifdef IP_SET_HASH_WITH_NETS
919 del_cidr(h, d->cidr, HOST_MASK); 970 del_cidr(h, CIDR(d->cidr), HOST_MASK);
920#endif 971#endif
921 if (n->pos + AHASH_INIT_SIZE < n->size) { 972 if (n->pos + AHASH_INIT_SIZE < n->size) {
922 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 973 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -954,8 +1005,17 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
954 n = hbucket(t, key); 1005 n = hbucket(t, key);
955 for (i = 0; i < n->pos; i++) { 1006 for (i = 0; i < n->pos; i++) {
956 data = ahash_tdata(n, i); 1007 data = ahash_tdata(n, i);
957 if (type_pf_data_equal(data, d, &multi)) 1008#ifdef IP_SET_HASH_WITH_MULTI
958 return !type_pf_data_expired(data); 1009 if (type_pf_data_equal(data, d, &multi)) {
1010 if (!type_pf_data_expired(data))
1011 return type_pf_data_match(data);
1012 multi = 0;
1013 }
1014#else
1015 if (type_pf_data_equal(data, d, &multi) &&
1016 !type_pf_data_expired(data))
1017 return type_pf_data_match(data);
1018#endif
959 } 1019 }
960 } 1020 }
961 return 0; 1021 return 0;
@@ -973,15 +1033,16 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags)
973 u32 key, multi = 0; 1033 u32 key, multi = 0;
974 1034
975#ifdef IP_SET_HASH_WITH_NETS 1035#ifdef IP_SET_HASH_WITH_NETS
976 if (d->cidr == SET_HOST_MASK(set->family)) 1036 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
977 return type_pf_ttest_cidrs(set, d, timeout); 1037 return type_pf_ttest_cidrs(set, d, timeout);
978#endif 1038#endif
979 key = HKEY(d, h->initval, t->htable_bits); 1039 key = HKEY(d, h->initval, t->htable_bits);
980 n = hbucket(t, key); 1040 n = hbucket(t, key);
981 for (i = 0; i < n->pos; i++) { 1041 for (i = 0; i < n->pos; i++) {
982 data = ahash_tdata(n, i); 1042 data = ahash_tdata(n, i);
983 if (type_pf_data_equal(data, d, &multi)) 1043 if (type_pf_data_equal(data, d, &multi) &&
984 return !type_pf_data_expired(data); 1044 !type_pf_data_expired(data))
1045 return type_pf_data_match(data);
985 } 1046 }
986 return 0; 1047 return 0;
987} 1048}
@@ -1094,14 +1155,17 @@ type_pf_gc_init(struct ip_set *set)
1094#undef type_pf_data_isnull 1155#undef type_pf_data_isnull
1095#undef type_pf_data_copy 1156#undef type_pf_data_copy
1096#undef type_pf_data_zero_out 1157#undef type_pf_data_zero_out
1158#undef type_pf_data_netmask
1097#undef type_pf_data_list 1159#undef type_pf_data_list
1098#undef type_pf_data_tlist 1160#undef type_pf_data_tlist
1161#undef type_pf_data_next
1162#undef type_pf_data_flags
1163#undef type_pf_data_match
1099 1164
1100#undef type_pf_elem 1165#undef type_pf_elem
1101#undef type_pf_telem 1166#undef type_pf_telem
1102#undef type_pf_data_timeout 1167#undef type_pf_data_timeout
1103#undef type_pf_data_expired 1168#undef type_pf_data_expired
1104#undef type_pf_data_netmask
1105#undef type_pf_data_timeout_set 1169#undef type_pf_data_timeout_set
1106 1170
1107#undef type_pf_elem_add 1171#undef type_pf_elem_add
@@ -1111,6 +1175,7 @@ type_pf_gc_init(struct ip_set *set)
1111#undef type_pf_test 1175#undef type_pf_test
1112 1176
1113#undef type_pf_elem_tadd 1177#undef type_pf_elem_tadd
1178#undef type_pf_del_telem
1114#undef type_pf_expire 1179#undef type_pf_expire
1115#undef type_pf_tadd 1180#undef type_pf_tadd
1116#undef type_pf_tdel 1181#undef type_pf_tdel
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 6e135f97e59..e59868ae12d 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -18,7 +18,10 @@ enum tcp_conntrack {
18 TCP_CONNTRACK_LISTEN, /* obsolete */ 18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN 19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
20 TCP_CONNTRACK_MAX, 20 TCP_CONNTRACK_MAX,
21 TCP_CONNTRACK_IGNORE 21 TCP_CONNTRACK_IGNORE,
22 TCP_CONNTRACK_RETRANS,
23 TCP_CONNTRACK_UNACK,
24 TCP_CONNTRACK_TIMEOUT_MAX
22}; 25};
23 26
24/* Window scaling is advertised by the sender */ 27/* Window scaling is advertised by the sender */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index b64454c2f79..6fd1f0d07e6 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -49,7 +49,8 @@ struct nfgenmsg {
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_ACCT 7 51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_COUNT 8 52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_COUNT 9
53 54
54#ifdef __KERNEL__ 55#ifdef __KERNEL__
55 56
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index debf1aefd75..e58e4b93c10 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -43,6 +43,7 @@ enum ctattr_type {
43 CTA_ZONE, 43 CTA_ZONE,
44 CTA_SECCTX, 44 CTA_SECCTX,
45 CTA_TIMESTAMP, 45 CTA_TIMESTAMP,
46 CTA_MARK_MASK,
46 __CTA_MAX 47 __CTA_MAX
47}; 48};
48#define CTA_MAX (__CTA_MAX - 1) 49#define CTA_MAX (__CTA_MAX - 1)
@@ -172,10 +173,21 @@ enum ctattr_expect {
172 CTA_EXPECT_HELP_NAME, 173 CTA_EXPECT_HELP_NAME,
173 CTA_EXPECT_ZONE, 174 CTA_EXPECT_ZONE,
174 CTA_EXPECT_FLAGS, 175 CTA_EXPECT_FLAGS,
176 CTA_EXPECT_CLASS,
177 CTA_EXPECT_NAT,
178 CTA_EXPECT_FN,
175 __CTA_EXPECT_MAX 179 __CTA_EXPECT_MAX
176}; 180};
177#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) 181#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
178 182
183enum ctattr_expect_nat {
184 CTA_EXPECT_NAT_UNSPEC,
185 CTA_EXPECT_NAT_DIR,
186 CTA_EXPECT_NAT_TUPLE,
187 __CTA_EXPECT_NAT_MAX
188};
189#define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1)
190
179enum ctattr_help { 191enum ctattr_help {
180 CTA_HELP_UNSPEC, 192 CTA_HELP_UNSPEC,
181 CTA_HELP_NAME, 193 CTA_HELP_NAME,
diff --git a/include/linux/netfilter/nfnetlink_cttimeout.h b/include/linux/netfilter/nfnetlink_cttimeout.h
new file mode 100644
index 00000000000..a2810a7c5e3
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_cttimeout.h
@@ -0,0 +1,114 @@
1#ifndef _CTTIMEOUT_NETLINK_H
2#define _CTTIMEOUT_NETLINK_H
3#include <linux/netfilter/nfnetlink.h>
4
5enum ctnl_timeout_msg_types {
6 IPCTNL_MSG_TIMEOUT_NEW,
7 IPCTNL_MSG_TIMEOUT_GET,
8 IPCTNL_MSG_TIMEOUT_DELETE,
9
10 IPCTNL_MSG_TIMEOUT_MAX
11};
12
13enum ctattr_timeout {
14 CTA_TIMEOUT_UNSPEC,
15 CTA_TIMEOUT_NAME,
16 CTA_TIMEOUT_L3PROTO,
17 CTA_TIMEOUT_L4PROTO,
18 CTA_TIMEOUT_DATA,
19 CTA_TIMEOUT_USE,
20 __CTA_TIMEOUT_MAX
21};
22#define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1)
23
24enum ctattr_timeout_generic {
25 CTA_TIMEOUT_GENERIC_UNSPEC,
26 CTA_TIMEOUT_GENERIC_TIMEOUT,
27 __CTA_TIMEOUT_GENERIC_MAX
28};
29#define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1)
30
31enum ctattr_timeout_tcp {
32 CTA_TIMEOUT_TCP_UNSPEC,
33 CTA_TIMEOUT_TCP_SYN_SENT,
34 CTA_TIMEOUT_TCP_SYN_RECV,
35 CTA_TIMEOUT_TCP_ESTABLISHED,
36 CTA_TIMEOUT_TCP_FIN_WAIT,
37 CTA_TIMEOUT_TCP_CLOSE_WAIT,
38 CTA_TIMEOUT_TCP_LAST_ACK,
39 CTA_TIMEOUT_TCP_TIME_WAIT,
40 CTA_TIMEOUT_TCP_CLOSE,
41 CTA_TIMEOUT_TCP_SYN_SENT2,
42 CTA_TIMEOUT_TCP_RETRANS,
43 CTA_TIMEOUT_TCP_UNACK,
44 __CTA_TIMEOUT_TCP_MAX
45};
46#define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1)
47
48enum ctattr_timeout_udp {
49 CTA_TIMEOUT_UDP_UNSPEC,
50 CTA_TIMEOUT_UDP_UNREPLIED,
51 CTA_TIMEOUT_UDP_REPLIED,
52 __CTA_TIMEOUT_UDP_MAX
53};
54#define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1)
55
56enum ctattr_timeout_udplite {
57 CTA_TIMEOUT_UDPLITE_UNSPEC,
58 CTA_TIMEOUT_UDPLITE_UNREPLIED,
59 CTA_TIMEOUT_UDPLITE_REPLIED,
60 __CTA_TIMEOUT_UDPLITE_MAX
61};
62#define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1)
63
64enum ctattr_timeout_icmp {
65 CTA_TIMEOUT_ICMP_UNSPEC,
66 CTA_TIMEOUT_ICMP_TIMEOUT,
67 __CTA_TIMEOUT_ICMP_MAX
68};
69#define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1)
70
71enum ctattr_timeout_dccp {
72 CTA_TIMEOUT_DCCP_UNSPEC,
73 CTA_TIMEOUT_DCCP_REQUEST,
74 CTA_TIMEOUT_DCCP_RESPOND,
75 CTA_TIMEOUT_DCCP_PARTOPEN,
76 CTA_TIMEOUT_DCCP_OPEN,
77 CTA_TIMEOUT_DCCP_CLOSEREQ,
78 CTA_TIMEOUT_DCCP_CLOSING,
79 CTA_TIMEOUT_DCCP_TIMEWAIT,
80 __CTA_TIMEOUT_DCCP_MAX
81};
82#define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1)
83
84enum ctattr_timeout_sctp {
85 CTA_TIMEOUT_SCTP_UNSPEC,
86 CTA_TIMEOUT_SCTP_CLOSED,
87 CTA_TIMEOUT_SCTP_COOKIE_WAIT,
88 CTA_TIMEOUT_SCTP_COOKIE_ECHOED,
89 CTA_TIMEOUT_SCTP_ESTABLISHED,
90 CTA_TIMEOUT_SCTP_SHUTDOWN_SENT,
91 CTA_TIMEOUT_SCTP_SHUTDOWN_RECD,
92 CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT,
93 __CTA_TIMEOUT_SCTP_MAX
94};
95#define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1)
96
97enum ctattr_timeout_icmpv6 {
98 CTA_TIMEOUT_ICMPV6_UNSPEC,
99 CTA_TIMEOUT_ICMPV6_TIMEOUT,
100 __CTA_TIMEOUT_ICMPV6_MAX
101};
102#define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1)
103
104enum ctattr_timeout_gre {
105 CTA_TIMEOUT_GRE_UNSPEC,
106 CTA_TIMEOUT_GRE_UNREPLIED,
107 CTA_TIMEOUT_GRE_REPLIED,
108 __CTA_TIMEOUT_GRE_MAX
109};
110#define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1)
111
112#define CTNL_TIMEOUT_NAME_MAX 32
113
114#endif
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index b56e76811c0..a064b8af360 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -16,4 +16,16 @@ struct xt_ct_target_info {
16 struct nf_conn *ct __attribute__((aligned(8))); 16 struct nf_conn *ct __attribute__((aligned(8)));
17}; 17};
18 18
19struct xt_ct_target_info_v1 {
20 __u16 flags;
21 __u16 zone;
22 __u32 ct_events;
23 __u32 exp_events;
24 char helper[16];
25 char timeout[32];
26
27 /* Used internally by the kernel */
28 struct nf_conn *ct __attribute__((aligned(8)));
29};
30
19#endif /* _XT_CT_H */ 31#endif /* _XT_CT_H */
diff --git a/include/linux/netfilter/xt_LOG.h b/include/linux/netfilter/xt_LOG.h
new file mode 100644
index 00000000000..cac07909530
--- /dev/null
+++ b/include/linux/netfilter/xt_LOG.h
@@ -0,0 +1,19 @@
1#ifndef _XT_LOG_H
2#define _XT_LOG_H
3
4/* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */
5#define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define XT_LOG_TCPOPT 0x02 /* Log TCP options */
7#define XT_LOG_IPOPT 0x04 /* Log IP options */
8#define XT_LOG_UID 0x08 /* Log UID owning local socket */
9#define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define XT_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define XT_LOG_MASK 0x2f
12
13struct xt_log_info {
14 unsigned char level;
15 unsigned char logflags;
16 char prefix[30];
17};
18
19#endif /* _XT_LOG_H */
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 8797ed16feb..4dd5bd6994a 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -285,8 +285,8 @@ struct ebt_table {
285 struct module *me; 285 struct module *me;
286}; 286};
287 287
288#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 288#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
289 ~(__alignof__(struct ebt_replace)-1)) 289 ~(__alignof__(struct _xt_align)-1))
290extern struct ebt_table *ebt_register_table(struct net *net, 290extern struct ebt_table *ebt_register_table(struct net *net,
291 const struct ebt_table *table); 291 const struct ebt_table *table);
292extern void ebt_unregister_table(struct net *net, struct ebt_table *table); 292extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index f9930c87fff..31f8bec9565 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -4,11 +4,9 @@ header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h 4header-y += ipt_ECN.h
5header-y += ipt_LOG.h 5header-y += ipt_LOG.h
6header-y += ipt_REJECT.h 6header-y += ipt_REJECT.h
7header-y += ipt_SAME.h
8header-y += ipt_TTL.h 7header-y += ipt_TTL.h
9header-y += ipt_ULOG.h 8header-y += ipt_ULOG.h
10header-y += ipt_addrtype.h 9header-y += ipt_addrtype.h
11header-y += ipt_ah.h 10header-y += ipt_ah.h
12header-y += ipt_ecn.h 11header-y += ipt_ecn.h
13header-y += ipt_realm.h
14header-y += ipt_ttl.h 12header-y += ipt_ttl.h
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index dcdbadf9fd4..5d8152077d7 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_LOG_H 1#ifndef _IPT_LOG_H
2#define _IPT_LOG_H 2#define _IPT_LOG_H
3 3
4#warning "Please update iptables, this file will be removed soon!"
5
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ 6/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
5#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 7#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ 8#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
deleted file mode 100644
index 5bca78267af..00000000000
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IPT_SAME_H
2#define _IPT_SAME_H
3
4#include <linux/types.h>
5
6#define IPT_SAME_MAX_RANGE 10
7
8#define IPT_SAME_NODST 0x01
9
10struct ipt_same_info {
11 unsigned char info;
12 __u32 rangesize;
13 __u32 ipnum;
14 __u32 *iparray;
15
16 /* hangs off end. */
17 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
18};
19
20#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h
deleted file mode 100644
index b3996eaa018..00000000000
--- a/include/linux/netfilter_ipv4/ipt_realm.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_REALM_H
2#define _IPT_REALM_H
3
4#include <linux/netfilter/xt_realm.h>
5#define ipt_realm_info xt_realm_info
6
7#endif /* _IPT_REALM_H */
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 9dd5579e02e..3dd0bc4e073 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_LOG_H 1#ifndef _IP6T_LOG_H
2#define _IP6T_LOG_H 2#define _IP6T_LOG_H
3 3
4#warning "Please update iptables, this file will be removed soon!"
5
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ 6/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
5#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 7#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ 8#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 52e48959cfa..a2092f582a7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -225,6 +225,7 @@ struct netlink_callback {
225 int (*dump)(struct sk_buff * skb, 225 int (*dump)(struct sk_buff * skb,
226 struct netlink_callback *cb); 226 struct netlink_callback *cb);
227 int (*done)(struct netlink_callback *cb); 227 int (*done)(struct netlink_callback *cb);
228 void *data;
228 u16 family; 229 u16 family;
229 u16 min_dump_alloc; 230 u16 min_dump_alloc;
230 unsigned int prev_seq, seq; 231 unsigned int prev_seq, seq;
@@ -237,22 +238,8 @@ struct netlink_notify {
237 int protocol; 238 int protocol;
238}; 239};
239 240
240static __inline__ struct nlmsghdr * 241struct nlmsghdr *
241__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) 242__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags);
242{
243 struct nlmsghdr *nlh;
244 int size = NLMSG_LENGTH(len);
245
246 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
247 nlh->nlmsg_type = type;
248 nlh->nlmsg_len = size;
249 nlh->nlmsg_flags = flags;
250 nlh->nlmsg_pid = pid;
251 nlh->nlmsg_seq = seq;
252 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
253 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
254 return nlh;
255}
256 243
257#define NLMSG_NEW(skb, pid, seq, type, len, flags) \ 244#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
258({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ 245({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
@@ -262,11 +249,16 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
262#define NLMSG_PUT(skb, pid, seq, type, len) \ 249#define NLMSG_PUT(skb, pid, seq, type, len) \
263 NLMSG_NEW(skb, pid, seq, type, len, 0) 250 NLMSG_NEW(skb, pid, seq, type, len, 0)
264 251
252struct netlink_dump_control {
253 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
254 int (*done)(struct netlink_callback*);
255 void *data;
256 u16 min_dump_alloc;
257};
258
265extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 259extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
266 const struct nlmsghdr *nlh, 260 const struct nlmsghdr *nlh,
267 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 261 struct netlink_dump_control *control);
268 int (*done)(struct netlink_callback*),
269 u16 min_dump_alloc);
270 262
271 263
272#define NL_NONROOT_RECV 0x1 264#define NL_NONROOT_RECV 0x1
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 01d4e5d6032..39c1fcf089c 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -89,6 +89,8 @@ enum nfc_commands {
89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
90 * target is not NFC-Forum compliant) 90 * target is not NFC-Forum compliant)
91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes 91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
92 * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes
93 * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes
92 * @NFC_ATTR_COMM_MODE: Passive or active mode 94 * @NFC_ATTR_COMM_MODE: Passive or active mode
93 * @NFC_ATTR_RF_MODE: Initiator or target 95 * @NFC_ATTR_RF_MODE: Initiator or target
94 */ 96 */
@@ -101,14 +103,20 @@ enum nfc_attrs {
101 NFC_ATTR_TARGET_SENS_RES, 103 NFC_ATTR_TARGET_SENS_RES,
102 NFC_ATTR_TARGET_SEL_RES, 104 NFC_ATTR_TARGET_SEL_RES,
103 NFC_ATTR_TARGET_NFCID1, 105 NFC_ATTR_TARGET_NFCID1,
106 NFC_ATTR_TARGET_SENSB_RES,
107 NFC_ATTR_TARGET_SENSF_RES,
104 NFC_ATTR_COMM_MODE, 108 NFC_ATTR_COMM_MODE,
105 NFC_ATTR_RF_MODE, 109 NFC_ATTR_RF_MODE,
110 NFC_ATTR_DEVICE_POWERED,
106/* private: internal use only */ 111/* private: internal use only */
107 __NFC_ATTR_AFTER_LAST 112 __NFC_ATTR_AFTER_LAST
108}; 113};
109#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) 114#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1)
110 115
111#define NFC_DEVICE_NAME_MAXSIZE 8 116#define NFC_DEVICE_NAME_MAXSIZE 8
117#define NFC_NFCID1_MAXSIZE 10
118#define NFC_SENSB_RES_MAXSIZE 12
119#define NFC_SENSF_RES_MAXSIZE 18
112 120
113/* NFC protocols */ 121/* NFC protocols */
114#define NFC_PROTO_JEWEL 1 122#define NFC_PROTO_JEWEL 1
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a764cef06b7..d6ba9a12591 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -614,7 +614,6 @@ struct nfs_getaclargs {
614 size_t acl_len; 614 size_t acl_len;
615 unsigned int acl_pgbase; 615 unsigned int acl_pgbase;
616 struct page ** acl_pages; 616 struct page ** acl_pages;
617 struct page * acl_scratch;
618 struct nfs4_sequence_args seq_args; 617 struct nfs4_sequence_args seq_args;
619}; 618};
620 619
@@ -624,6 +623,7 @@ struct nfs_getaclres {
624 size_t acl_len; 623 size_t acl_len;
625 size_t acl_data_offset; 624 size_t acl_data_offset;
626 int acl_flags; 625 int acl_flags;
626 struct page * acl_scratch;
627 struct nfs4_sequence_res seq_res; 627 struct nfs4_sequence_res seq_res;
628}; 628};
629 629
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 0f5ff373982..e474f6e780c 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -156,21 +156,23 @@
156 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 156 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
157 * or %NL80211_ATTR_MAC. 157 * or %NL80211_ATTR_MAC.
158 * 158 *
159 * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a 159 * @NL80211_CMD_GET_BEACON: (not used)
160 * %NL80222_CMD_NEW_BEACON message) 160 * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
161 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface 161 * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL
162 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, 162 * attributes. For drivers that generate the beacon and probe responses
163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. 163 * internally, the following attributes must be provided: %NL80211_ATTR_IE,
164 * Following attributes are provided for drivers that generate full Beacon 164 * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP.
165 * and Probe Response frames internally: %NL80211_ATTR_SSID, 165 * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters
166 * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that
167 * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL,
168 * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID,
166 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, 169 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
167 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, 170 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
168 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, 171 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
169 * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, 172 * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
170 * %NL80211_ATTR_IE_ASSOC_RESP. 173 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
171 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 174 * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
172 * parameters are like for %NL80211_CMD_SET_BEACON. 175 * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
173 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
174 * 176 *
175 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by 177 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
176 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. 178 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
@@ -367,6 +369,11 @@
367 * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, 369 * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
368 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and 370 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
369 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. 371 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
372 * Background scan period can optionally be
373 * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
374 * if not specified default background scan configuration
375 * in driver is used and if period value is 0, bg scan will be disabled.
376 * This attribute is ignored if driver does not support roam scan.
370 * It is also sent as an event, with the BSSID and response IEs when the 377 * It is also sent as an event, with the BSSID and response IEs when the
371 * connection is established or failed to be established. This can be 378 * connection is established or failed to be established. This can be
372 * determined by the STATUS_CODE attribute. 379 * determined by the STATUS_CODE attribute.
@@ -565,8 +572,10 @@ enum nl80211_commands {
565 572
566 NL80211_CMD_GET_BEACON, 573 NL80211_CMD_GET_BEACON,
567 NL80211_CMD_SET_BEACON, 574 NL80211_CMD_SET_BEACON,
568 NL80211_CMD_NEW_BEACON, 575 NL80211_CMD_START_AP,
569 NL80211_CMD_DEL_BEACON, 576 NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP,
577 NL80211_CMD_STOP_AP,
578 NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP,
570 579
571 NL80211_CMD_GET_STATION, 580 NL80211_CMD_GET_STATION,
572 NL80211_CMD_SET_STATION, 581 NL80211_CMD_SET_STATION,
@@ -1193,6 +1202,19 @@ enum nl80211_commands {
1193 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of 1202 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
1194 * up to 16 TIDs. 1203 * up to 16 TIDs.
1195 * 1204 *
1205 * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be
1206 * used by the drivers which has MLME in firmware and does not have support
1207 * to report per station tx/rx activity to free up the staion entry from
1208 * the list. This needs to be used when the driver advertises the
1209 * capability to timeout the stations.
1210 *
1211 * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int);
1212 * this attribute is (depending on the driver capabilities) added to
1213 * received frames indicated with %NL80211_CMD_FRAME.
1214 *
1215 * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
1216 * or 0 to disable background scan.
1217 *
1196 * @NL80211_ATTR_MAX: highest attribute number currently defined 1218 * @NL80211_ATTR_MAX: highest attribute number currently defined
1197 * @__NL80211_ATTR_AFTER_LAST: internal use 1219 * @__NL80211_ATTR_AFTER_LAST: internal use
1198 */ 1220 */
@@ -1438,6 +1460,12 @@ enum nl80211_attrs {
1438 1460
1439 NL80211_ATTR_NOACK_MAP, 1461 NL80211_ATTR_NOACK_MAP,
1440 1462
1463 NL80211_ATTR_INACTIVITY_TIMEOUT,
1464
1465 NL80211_ATTR_RX_SIGNAL_DBM,
1466
1467 NL80211_ATTR_BG_SCAN_PERIOD,
1468
1441 /* add attributes here, update the policy in nl80211.c */ 1469 /* add attributes here, update the policy in nl80211.c */
1442 1470
1443 __NL80211_ATTR_AFTER_LAST, 1471 __NL80211_ATTR_AFTER_LAST,
@@ -1475,6 +1503,7 @@ enum nl80211_attrs {
1475#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS 1503#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1476 1504
1477#define NL80211_MAX_SUPP_RATES 32 1505#define NL80211_MAX_SUPP_RATES 32
1506#define NL80211_MAX_SUPP_HT_RATES 77
1478#define NL80211_MAX_SUPP_REG_RULES 32 1507#define NL80211_MAX_SUPP_REG_RULES 32
1479#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 1508#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
1480#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 1509#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
@@ -2104,6 +2133,13 @@ enum nl80211_mntr_flags {
2104 * TUs) during which a mesh STA can send only one Action frame containing a 2133 * TUs) during which a mesh STA can send only one Action frame containing a
2105 * PERR element. 2134 * PERR element.
2106 * 2135 *
2136 * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding
2137 * or forwarding entity (default is TRUE - forwarding entity)
2138 *
2139 * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the
2140 * threshold for average signal strength of candidate station to establish
2141 * a peer link.
2142 *
2107 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2143 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
2108 * 2144 *
2109 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2145 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -2128,6 +2164,8 @@ enum nl80211_meshconf_params {
2128 NL80211_MESHCONF_HWMP_RANN_INTERVAL, 2164 NL80211_MESHCONF_HWMP_RANN_INTERVAL,
2129 NL80211_MESHCONF_GATE_ANNOUNCEMENTS, 2165 NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
2130 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, 2166 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2167 NL80211_MESHCONF_FORWARDING,
2168 NL80211_MESHCONF_RSSI_THRESHOLD,
2131 2169
2132 /* keep last */ 2170 /* keep last */
2133 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2171 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2401,12 +2439,15 @@ enum nl80211_key_attributes {
2401 * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with 2439 * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
2402 * 1 = 500 kbps) but without the IE length restriction (at most 2440 * 1 = 500 kbps) but without the IE length restriction (at most
2403 * %NL80211_MAX_SUPP_RATES in a single array). 2441 * %NL80211_MAX_SUPP_RATES in a single array).
2442 * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection
2443 * in an array of MCS numbers.
2404 * @__NL80211_TXRATE_AFTER_LAST: internal 2444 * @__NL80211_TXRATE_AFTER_LAST: internal
2405 * @NL80211_TXRATE_MAX: highest TX rate attribute 2445 * @NL80211_TXRATE_MAX: highest TX rate attribute
2406 */ 2446 */
2407enum nl80211_tx_rate_attributes { 2447enum nl80211_tx_rate_attributes {
2408 __NL80211_TXRATE_INVALID, 2448 __NL80211_TXRATE_INVALID,
2409 NL80211_TXRATE_LEGACY, 2449 NL80211_TXRATE_LEGACY,
2450 NL80211_TXRATE_MCS,
2410 2451
2411 /* keep last */ 2452 /* keep last */
2412 __NL80211_TXRATE_AFTER_LAST, 2453 __NL80211_TXRATE_AFTER_LAST,
@@ -2792,10 +2833,13 @@ enum nl80211_ap_sme_features {
2792 * TX status to the socket error queue when requested with the 2833 * TX status to the socket error queue when requested with the
2793 * socket option. 2834 * socket option.
2794 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. 2835 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
2836 * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
2837 * the connected inactive stations in AP mode.
2795 */ 2838 */
2796enum nl80211_feature_flags { 2839enum nl80211_feature_flags {
2797 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 2840 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2798 NL80211_FEATURE_HT_IBSS = 1 << 1, 2841 NL80211_FEATURE_HT_IBSS = 1 << 1,
2842 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
2799}; 2843};
2800 2844
2801/** 2845/**
diff --git a/include/linux/of.h b/include/linux/of.h
index a75a831e205..f02d8b2f799 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -72,19 +72,17 @@ struct of_phandle_args {
72 uint32_t args[MAX_PHANDLE_ARGS]; 72 uint32_t args[MAX_PHANDLE_ARGS];
73}; 73};
74 74
75#if defined(CONFIG_SPARC) || !defined(CONFIG_OF) 75#ifdef CONFIG_OF_DYNAMIC
76extern struct device_node *of_node_get(struct device_node *node);
77extern void of_node_put(struct device_node *node);
78#else /* CONFIG_OF_DYNAMIC */
76/* Dummy ref counting routines - to be implemented later */ 79/* Dummy ref counting routines - to be implemented later */
77static inline struct device_node *of_node_get(struct device_node *node) 80static inline struct device_node *of_node_get(struct device_node *node)
78{ 81{
79 return node; 82 return node;
80} 83}
81static inline void of_node_put(struct device_node *node) 84static inline void of_node_put(struct device_node *node) { }
82{ 85#endif /* !CONFIG_OF_DYNAMIC */
83}
84#else
85extern struct device_node *of_node_get(struct device_node *node);
86extern void of_node_put(struct device_node *node);
87#endif
88 86
89#ifdef CONFIG_OF 87#ifdef CONFIG_OF
90 88
@@ -217,6 +215,9 @@ extern int of_property_read_string(struct device_node *np,
217extern int of_property_read_string_index(struct device_node *np, 215extern int of_property_read_string_index(struct device_node *np,
218 const char *propname, 216 const char *propname,
219 int index, const char **output); 217 int index, const char **output);
218extern int of_property_match_string(struct device_node *np,
219 const char *propname,
220 const char *string);
220extern int of_property_count_strings(struct device_node *np, 221extern int of_property_count_strings(struct device_node *np,
221 const char *propname); 222 const char *propname);
222extern int of_device_is_compatible(const struct device_node *device, 223extern int of_device_is_compatible(const struct device_node *device,
@@ -281,6 +282,14 @@ static inline struct property *of_find_property(const struct device_node *np,
281 return NULL; 282 return NULL;
282} 283}
283 284
285static inline struct device_node *of_find_compatible_node(
286 struct device_node *from,
287 const char *type,
288 const char *compat)
289{
290 return NULL;
291}
292
284static inline int of_property_read_u32_array(const struct device_node *np, 293static inline int of_property_read_u32_array(const struct device_node *np,
285 const char *propname, 294 const char *propname,
286 u32 *out_values, size_t sz) 295 u32 *out_values, size_t sz)
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 3118623c2c1..01b925ad8d7 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,7 @@
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/of.h> 5#include <linux/of.h>
6 6
7#ifdef CONFIG_OF_ADDRESS
7extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 8extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
8extern int of_address_to_resource(struct device_node *dev, int index, 9extern int of_address_to_resource(struct device_node *dev, int index,
9 struct resource *r); 10 struct resource *r);
@@ -25,12 +26,37 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
25#define pci_address_to_pio pci_address_to_pio 26#define pci_address_to_pio pci_address_to_pio
26#endif 27#endif
27 28
28#ifdef CONFIG_PCI 29#else /* CONFIG_OF_ADDRESS */
30static inline int of_address_to_resource(struct device_node *dev, int index,
31 struct resource *r)
32{
33 return -EINVAL;
34}
35static inline struct device_node *of_find_matching_node_by_address(
36 struct device_node *from,
37 const struct of_device_id *matches,
38 u64 base_address)
39{
40 return NULL;
41}
42static inline void __iomem *of_iomap(struct device_node *device, int index)
43{
44 return NULL;
45}
46static inline const u32 *of_get_address(struct device_node *dev, int index,
47 u64 *size, unsigned int *flags)
48{
49 return NULL;
50}
51#endif /* CONFIG_OF_ADDRESS */
52
53
54#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
29extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 55extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
30 u64 *size, unsigned int *flags); 56 u64 *size, unsigned int *flags);
31extern int of_pci_address_to_resource(struct device_node *dev, int bar, 57extern int of_pci_address_to_resource(struct device_node *dev, int bar,
32 struct resource *r); 58 struct resource *r);
33#else /* CONFIG_PCI */ 59#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
34static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 60static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
35 struct resource *r) 61 struct resource *r)
36{ 62{
@@ -42,8 +68,7 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
42{ 68{
43 return NULL; 69 return NULL;
44} 70}
45#endif /* CONFIG_PCI */ 71#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
46
47 72
48#endif /* __OF_ADDRESS_H */ 73#endif /* __OF_ADDRESS_H */
49 74
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index ae5638480ef..cbc42143fa5 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -34,7 +34,8 @@ extern void of_device_unregister(struct platform_device *ofdev);
34extern ssize_t of_device_get_modalias(struct device *dev, 34extern ssize_t of_device_get_modalias(struct device *dev,
35 char *str, ssize_t len); 35 char *str, ssize_t len);
36 36
37extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); 37extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
38extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
38 39
39static inline void of_device_node_put(struct device *dev) 40static inline void of_device_node_put(struct device *dev)
40{ 41{
@@ -49,7 +50,10 @@ static inline int of_driver_match_device(struct device *dev,
49 return 0; 50 return 0;
50} 51}
51 52
52static inline int of_device_uevent(struct device *dev, 53static inline void of_device_uevent(struct device *dev,
54 struct kobj_uevent_env *env) { }
55
56static inline int of_device_uevent_modalias(struct device *dev,
53 struct kobj_uevent_env *env) 57 struct kobj_uevent_env *env)
54{ 58{
55 return -ENODEV; 59 return -ENODEV;
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d0307eed20c..d229ad3edee 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -6,6 +6,7 @@ struct of_irq;
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/errno.h> 7#include <linux/errno.h>
8#include <linux/irq.h> 8#include <linux/irq.h>
9#include <linux/irqdomain.h>
9#include <linux/ioport.h> 10#include <linux/ioport.h>
10#include <linux/of.h> 11#include <linux/of.h>
11 12
@@ -65,9 +66,6 @@ extern int of_irq_map_one(struct device_node *device, int index,
65extern unsigned int irq_create_of_mapping(struct device_node *controller, 66extern unsigned int irq_create_of_mapping(struct device_node *controller,
66 const u32 *intspec, 67 const u32 *intspec,
67 unsigned int intsize); 68 unsigned int intsize);
68#ifdef CONFIG_IRQ_DOMAIN
69extern void irq_dispose_mapping(unsigned int irq);
70#endif
71extern int of_irq_to_resource(struct device_node *dev, int index, 69extern int of_irq_to_resource(struct device_node *dev, int index,
72 struct resource *r); 70 struct resource *r);
73extern int of_irq_count(struct device_node *dev); 71extern int of_irq_count(struct device_node *dev);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 040ce2f6e8d..b47d2040c9f 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
81 struct device *parent); 81 struct device *parent);
82extern struct platform_device *of_find_device_by_node(struct device_node *np); 82extern struct platform_device *of_find_device_by_node(struct device_node *np);
83 83
84#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ 84#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
85/* Platform devices and busses creation */ 85/* Platform devices and busses creation */
86extern struct platform_device *of_platform_device_create(struct device_node *np, 86extern struct platform_device *of_platform_device_create(struct device_node *np,
87 const char *bus_id, 87 const char *bus_id,
@@ -94,8 +94,19 @@ extern int of_platform_populate(struct device_node *root,
94 const struct of_device_id *matches, 94 const struct of_device_id *matches,
95 const struct of_dev_auxdata *lookup, 95 const struct of_dev_auxdata *lookup,
96 struct device *parent); 96 struct device *parent);
97#endif /* !CONFIG_SPARC */ 97#endif /* CONFIG_OF_ADDRESS */
98 98
99#endif /* CONFIG_OF_DEVICE */ 99#endif /* CONFIG_OF_DEVICE */
100 100
101#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata;
103static inline int of_platform_populate(struct device_node *root,
104 const struct of_device_id *matches,
105 const struct of_dev_auxdata *lookup,
106 struct device *parent)
107{
108 return -ENODEV;
109}
110#endif /* !CONFIG_OF_ADDRESS */
111
101#endif /* _LINUX_OF_PLATFORM_H */ 112#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a16b1df3def..b843fe79583 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -746,28 +746,28 @@ int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
746 int where, u32 val); 746 int where, u32 val);
747struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); 747struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops);
748 748
749static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 749static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
750{ 750{
751 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); 751 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
752} 752}
753static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) 753static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
754{ 754{
755 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); 755 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
756} 756}
757static inline int pci_read_config_dword(struct pci_dev *dev, int where, 757static inline int pci_read_config_dword(const struct pci_dev *dev, int where,
758 u32 *val) 758 u32 *val)
759{ 759{
760 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); 760 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
761} 761}
762static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) 762static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
763{ 763{
764 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); 764 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
765} 765}
766static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) 766static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
767{ 767{
768 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); 768 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
769} 769}
770static inline int pci_write_config_dword(struct pci_dev *dev, int where, 770static inline int pci_write_config_dword(const struct pci_dev *dev, int where,
771 u32 val) 771 u32 val)
772{ 772{
773 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); 773 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
@@ -946,6 +946,19 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *,
946 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 946 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
947 947
948void pci_unregister_driver(struct pci_driver *dev); 948void pci_unregister_driver(struct pci_driver *dev);
949
950/**
951 * module_pci_driver() - Helper macro for registering a PCI driver
952 * @__pci_driver: pci_driver struct
953 *
954 * Helper macro for PCI drivers which do not do anything special in module
955 * init/exit. This eliminates a lot of boilerplate. Each module may only
956 * use this macro once, and calling it replaces module_init() and module_exit()
957 */
958#define module_pci_driver(__pci_driver) \
959 module_driver(__pci_driver, pci_register_driver, \
960 pci_unregister_driver)
961
949void pci_remove_behind_bridge(struct pci_dev *dev); 962void pci_remove_behind_bridge(struct pci_dev *dev);
950struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 963struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
951int pci_add_dynid(struct pci_driver *drv, 964int pci_add_dynid(struct pci_driver *drv,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 31d77af2ef4..3329965ed63 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2105,6 +2105,7 @@
2105#define PCI_DEVICE_ID_NX2_57711E 0x1650 2105#define PCI_DEVICE_ID_NX2_57711E 0x1650
2106#define PCI_DEVICE_ID_TIGON3_5705 0x1653 2106#define PCI_DEVICE_ID_TIGON3_5705 0x1653
2107#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 2107#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
2108#define PCI_DEVICE_ID_TIGON3_5719 0x1657
2108#define PCI_DEVICE_ID_TIGON3_5721 0x1659 2109#define PCI_DEVICE_ID_TIGON3_5721 0x1659
2109#define PCI_DEVICE_ID_TIGON3_5722 0x165a 2110#define PCI_DEVICE_ID_TIGON3_5722 0x165a
2110#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2111#define PCI_DEVICE_ID_TIGON3_5723 0x165b
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 32cd1f67462..21638ae14e0 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -348,9 +348,9 @@ do { \
348#define _this_cpu_generic_to_op(pcp, val, op) \ 348#define _this_cpu_generic_to_op(pcp, val, op) \
349do { \ 349do { \
350 unsigned long flags; \ 350 unsigned long flags; \
351 local_irq_save(flags); \ 351 raw_local_irq_save(flags); \
352 *__this_cpu_ptr(&(pcp)) op val; \ 352 *__this_cpu_ptr(&(pcp)) op val; \
353 local_irq_restore(flags); \ 353 raw_local_irq_restore(flags); \
354} while (0) 354} while (0)
355 355
356#ifndef this_cpu_write 356#ifndef this_cpu_write
@@ -449,10 +449,10 @@ do { \
449({ \ 449({ \
450 typeof(pcp) ret__; \ 450 typeof(pcp) ret__; \
451 unsigned long flags; \ 451 unsigned long flags; \
452 local_irq_save(flags); \ 452 raw_local_irq_save(flags); \
453 __this_cpu_add(pcp, val); \ 453 __this_cpu_add(pcp, val); \
454 ret__ = __this_cpu_read(pcp); \ 454 ret__ = __this_cpu_read(pcp); \
455 local_irq_restore(flags); \ 455 raw_local_irq_restore(flags); \
456 ret__; \ 456 ret__; \
457}) 457})
458 458
@@ -479,10 +479,10 @@ do { \
479#define _this_cpu_generic_xchg(pcp, nval) \ 479#define _this_cpu_generic_xchg(pcp, nval) \
480({ typeof(pcp) ret__; \ 480({ typeof(pcp) ret__; \
481 unsigned long flags; \ 481 unsigned long flags; \
482 local_irq_save(flags); \ 482 raw_local_irq_save(flags); \
483 ret__ = __this_cpu_read(pcp); \ 483 ret__ = __this_cpu_read(pcp); \
484 __this_cpu_write(pcp, nval); \ 484 __this_cpu_write(pcp, nval); \
485 local_irq_restore(flags); \ 485 raw_local_irq_restore(flags); \
486 ret__; \ 486 ret__; \
487}) 487})
488 488
@@ -507,11 +507,11 @@ do { \
507({ \ 507({ \
508 typeof(pcp) ret__; \ 508 typeof(pcp) ret__; \
509 unsigned long flags; \ 509 unsigned long flags; \
510 local_irq_save(flags); \ 510 raw_local_irq_save(flags); \
511 ret__ = __this_cpu_read(pcp); \ 511 ret__ = __this_cpu_read(pcp); \
512 if (ret__ == (oval)) \ 512 if (ret__ == (oval)) \
513 __this_cpu_write(pcp, nval); \ 513 __this_cpu_write(pcp, nval); \
514 local_irq_restore(flags); \ 514 raw_local_irq_restore(flags); \
515 ret__; \ 515 ret__; \
516}) 516})
517 517
@@ -544,10 +544,10 @@ do { \
544({ \ 544({ \
545 int ret__; \ 545 int ret__; \
546 unsigned long flags; \ 546 unsigned long flags; \
547 local_irq_save(flags); \ 547 raw_local_irq_save(flags); \
548 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 548 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
549 oval1, oval2, nval1, nval2); \ 549 oval1, oval2, nval1, nval2); \
550 local_irq_restore(flags); \ 550 raw_local_irq_restore(flags); \
551 ret__; \ 551 ret__; \
552}) 552})
553 553
@@ -718,12 +718,13 @@ do { \
718# ifndef __this_cpu_add_return_8 718# ifndef __this_cpu_add_return_8
719# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) 719# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val)
720# endif 720# endif
721# define __this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) 721# define __this_cpu_add_return(pcp, val) \
722 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
722#endif 723#endif
723 724
724#define __this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) 725#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val))
725#define __this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) 726#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
726#define __this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) 727#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
727 728
728#define __this_cpu_generic_xchg(pcp, nval) \ 729#define __this_cpu_generic_xchg(pcp, nval) \
729({ typeof(pcp) ret__; \ 730({ typeof(pcp) ret__; \
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 08855613ceb..bd9f55a5958 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -129,11 +129,40 @@ enum perf_event_sample_format {
129 PERF_SAMPLE_PERIOD = 1U << 8, 129 PERF_SAMPLE_PERIOD = 1U << 8,
130 PERF_SAMPLE_STREAM_ID = 1U << 9, 130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10, 131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
132 133
133 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ 134 PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */
134}; 135};
135 136
136/* 137/*
138 * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
139 *
140 * If the user does not pass priv level information via branch_sample_type,
141 * the kernel uses the event's priv level. Branch and event priv levels do
142 * not have to match. Branch priv level is checked for permissions.
143 *
144 * The branch types can be combined, however BRANCH_ANY covers all types
145 * of branches and therefore it supersedes all the other types.
146 */
147enum perf_branch_sample_type {
148 PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */
149 PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */
150 PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */
151
152 PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */
153 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
154 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
155 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
156
157 PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */
158};
159
160#define PERF_SAMPLE_BRANCH_PLM_ALL \
161 (PERF_SAMPLE_BRANCH_USER|\
162 PERF_SAMPLE_BRANCH_KERNEL|\
163 PERF_SAMPLE_BRANCH_HV)
164
165/*
137 * The format of the data returned by read() on a perf event fd, 166 * The format of the data returned by read() on a perf event fd,
138 * as specified by attr.read_format: 167 * as specified by attr.read_format:
139 * 168 *
@@ -163,6 +192,8 @@ enum perf_event_read_format {
163}; 192};
164 193
165#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ 194#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
195#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
196#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
166 197
167/* 198/*
168 * Hardware event_id to monitor via a performance monitoring event: 199 * Hardware event_id to monitor via a performance monitoring event:
@@ -240,6 +271,7 @@ struct perf_event_attr {
240 __u64 bp_len; 271 __u64 bp_len;
241 __u64 config2; /* extension of config1 */ 272 __u64 config2; /* extension of config1 */
242 }; 273 };
274 __u64 branch_sample_type; /* enum branch_sample_type */
243}; 275};
244 276
245/* 277/*
@@ -291,12 +323,14 @@ struct perf_event_mmap_page {
291 __s64 offset; /* add to hardware event value */ 323 __s64 offset; /* add to hardware event value */
292 __u64 time_enabled; /* time event active */ 324 __u64 time_enabled; /* time event active */
293 __u64 time_running; /* time event on cpu */ 325 __u64 time_running; /* time event on cpu */
326 __u32 time_mult, time_shift;
327 __u64 time_offset;
294 328
295 /* 329 /*
296 * Hole for extension of the self monitor capabilities 330 * Hole for extension of the self monitor capabilities
297 */ 331 */
298 332
299 __u64 __reserved[123]; /* align to 1k */ 333 __u64 __reserved[121]; /* align to 1k */
300 334
301 /* 335 /*
302 * Control data for the mmap() data buffer. 336 * Control data for the mmap() data buffer.
@@ -456,6 +490,8 @@ enum perf_event_type {
456 * 490 *
457 * { u32 size; 491 * { u32 size;
458 * char data[size];}&& PERF_SAMPLE_RAW 492 * char data[size];}&& PERF_SAMPLE_RAW
493 *
494 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
459 * }; 495 * };
460 */ 496 */
461 PERF_RECORD_SAMPLE = 9, 497 PERF_RECORD_SAMPLE = 9,
@@ -512,7 +548,7 @@ struct perf_guest_info_callbacks {
512#include <linux/ftrace.h> 548#include <linux/ftrace.h>
513#include <linux/cpu.h> 549#include <linux/cpu.h>
514#include <linux/irq_work.h> 550#include <linux/irq_work.h>
515#include <linux/jump_label.h> 551#include <linux/static_key.h>
516#include <linux/atomic.h> 552#include <linux/atomic.h>
517#include <asm/local.h> 553#include <asm/local.h>
518 554
@@ -528,12 +564,34 @@ struct perf_raw_record {
528 void *data; 564 void *data;
529}; 565};
530 566
567/*
568 * single taken branch record layout:
569 *
570 * from: source instruction (may not always be a branch insn)
571 * to: branch target
572 * mispred: branch target was mispredicted
573 * predicted: branch target was predicted
574 *
575 * support for mispred, predicted is optional. In case it
576 * is not supported mispred = predicted = 0.
577 */
531struct perf_branch_entry { 578struct perf_branch_entry {
532 __u64 from; 579 __u64 from;
533 __u64 to; 580 __u64 to;
534 __u64 flags; 581 __u64 mispred:1, /* target mispredicted */
582 predicted:1,/* target predicted */
583 reserved:62;
535}; 584};
536 585
586/*
587 * branch stack layout:
588 * nr: number of taken branches stored in entries[]
589 *
590 * Note that nr can vary from sample to sample
591 * branches (to, from) are stored from most recent
592 * to least recent, i.e., entries[0] contains the most
593 * recent branch.
594 */
537struct perf_branch_stack { 595struct perf_branch_stack {
538 __u64 nr; 596 __u64 nr;
539 struct perf_branch_entry entries[0]; 597 struct perf_branch_entry entries[0];
@@ -564,7 +622,9 @@ struct hw_perf_event {
564 unsigned long event_base; 622 unsigned long event_base;
565 int idx; 623 int idx;
566 int last_cpu; 624 int last_cpu;
625
567 struct hw_perf_event_extra extra_reg; 626 struct hw_perf_event_extra extra_reg;
627 struct hw_perf_event_extra branch_reg;
568 }; 628 };
569 struct { /* software */ 629 struct { /* software */
570 struct hrtimer hrtimer; 630 struct hrtimer hrtimer;
@@ -587,6 +647,7 @@ struct hw_perf_event {
587 u64 sample_period; 647 u64 sample_period;
588 u64 last_period; 648 u64 last_period;
589 local64_t period_left; 649 local64_t period_left;
650 u64 interrupts_seq;
590 u64 interrupts; 651 u64 interrupts;
591 652
592 u64 freq_time_stamp; 653 u64 freq_time_stamp;
@@ -615,6 +676,7 @@ struct pmu {
615 struct list_head entry; 676 struct list_head entry;
616 677
617 struct device *dev; 678 struct device *dev;
679 const struct attribute_group **attr_groups;
618 char *name; 680 char *name;
619 int type; 681 int type;
620 682
@@ -680,6 +742,17 @@ struct pmu {
680 * for each successful ->add() during the transaction. 742 * for each successful ->add() during the transaction.
681 */ 743 */
682 void (*cancel_txn) (struct pmu *pmu); /* optional */ 744 void (*cancel_txn) (struct pmu *pmu); /* optional */
745
746 /*
747 * Will return the value for perf_event_mmap_page::index for this event,
748 * if no implementation is provided it will default to: event->hw.idx + 1.
749 */
750 int (*event_idx) (struct perf_event *event); /*optional */
751
752 /*
753 * flush branch stack on context-switches (needed in cpu-wide mode)
754 */
755 void (*flush_branch_stack) (void);
683}; 756};
684 757
685/** 758/**
@@ -849,6 +922,9 @@ struct perf_event {
849#ifdef CONFIG_EVENT_TRACING 922#ifdef CONFIG_EVENT_TRACING
850 struct ftrace_event_call *tp_event; 923 struct ftrace_event_call *tp_event;
851 struct event_filter *filter; 924 struct event_filter *filter;
925#ifdef CONFIG_FUNCTION_TRACER
926 struct ftrace_ops ftrace_ops;
927#endif
852#endif 928#endif
853 929
854#ifdef CONFIG_CGROUP_PERF 930#ifdef CONFIG_CGROUP_PERF
@@ -910,7 +986,8 @@ struct perf_event_context {
910 u64 parent_gen; 986 u64 parent_gen;
911 u64 generation; 987 u64 generation;
912 int pin_count; 988 int pin_count;
913 int nr_cgroups; /* cgroup events present */ 989 int nr_cgroups; /* cgroup evts */
990 int nr_branch_stack; /* branch_stack evt */
914 struct rcu_head rcu_head; 991 struct rcu_head rcu_head;
915}; 992};
916 993
@@ -975,6 +1052,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr,
975extern u64 perf_event_read_value(struct perf_event *event, 1052extern u64 perf_event_read_value(struct perf_event *event,
976 u64 *enabled, u64 *running); 1053 u64 *enabled, u64 *running);
977 1054
1055
978struct perf_sample_data { 1056struct perf_sample_data {
979 u64 type; 1057 u64 type;
980 1058
@@ -994,12 +1072,14 @@ struct perf_sample_data {
994 u64 period; 1072 u64 period;
995 struct perf_callchain_entry *callchain; 1073 struct perf_callchain_entry *callchain;
996 struct perf_raw_record *raw; 1074 struct perf_raw_record *raw;
1075 struct perf_branch_stack *br_stack;
997}; 1076};
998 1077
999static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1078static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
1000{ 1079{
1001 data->addr = addr; 1080 data->addr = addr;
1002 data->raw = NULL; 1081 data->raw = NULL;
1082 data->br_stack = NULL;
1003} 1083}
1004 1084
1005extern void perf_output_sample(struct perf_output_handle *handle, 1085extern void perf_output_sample(struct perf_output_handle *handle,
@@ -1028,7 +1108,7 @@ static inline int is_software_event(struct perf_event *event)
1028 return event->pmu->task_ctx_nr == perf_sw_context; 1108 return event->pmu->task_ctx_nr == perf_sw_context;
1029} 1109}
1030 1110
1031extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; 1111extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
1032 1112
1033extern void __perf_sw_event(u32, u64, struct pt_regs *, u64); 1113extern void __perf_sw_event(u32, u64, struct pt_regs *, u64);
1034 1114
@@ -1056,7 +1136,7 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1056{ 1136{
1057 struct pt_regs hot_regs; 1137 struct pt_regs hot_regs;
1058 1138
1059 if (static_branch(&perf_swevent_enabled[event_id])) { 1139 if (static_key_false(&perf_swevent_enabled[event_id])) {
1060 if (!regs) { 1140 if (!regs) {
1061 perf_fetch_caller_regs(&hot_regs); 1141 perf_fetch_caller_regs(&hot_regs);
1062 regs = &hot_regs; 1142 regs = &hot_regs;
@@ -1065,12 +1145,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1065 } 1145 }
1066} 1146}
1067 1147
1068extern struct jump_label_key_deferred perf_sched_events; 1148extern struct static_key_deferred perf_sched_events;
1069 1149
1070static inline void perf_event_task_sched_in(struct task_struct *prev, 1150static inline void perf_event_task_sched_in(struct task_struct *prev,
1071 struct task_struct *task) 1151 struct task_struct *task)
1072{ 1152{
1073 if (static_branch(&perf_sched_events.key)) 1153 if (static_key_false(&perf_sched_events.key))
1074 __perf_event_task_sched_in(prev, task); 1154 __perf_event_task_sched_in(prev, task);
1075} 1155}
1076 1156
@@ -1079,7 +1159,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
1079{ 1159{
1080 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1160 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1081 1161
1082 if (static_branch(&perf_sched_events.key)) 1162 if (static_key_false(&perf_sched_events.key))
1083 __perf_event_task_sched_out(prev, next); 1163 __perf_event_task_sched_out(prev, next);
1084} 1164}
1085 1165
@@ -1138,6 +1218,11 @@ extern void perf_bp_event(struct perf_event *event, void *data);
1138# define perf_instruction_pointer(regs) instruction_pointer(regs) 1218# define perf_instruction_pointer(regs) instruction_pointer(regs)
1139#endif 1219#endif
1140 1220
1221static inline bool has_branch_stack(struct perf_event *event)
1222{
1223 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK;
1224}
1225
1141extern int perf_output_begin(struct perf_output_handle *handle, 1226extern int perf_output_begin(struct perf_output_handle *handle,
1142 struct perf_event *event, unsigned int size); 1227 struct perf_event *event, unsigned int size);
1143extern void perf_output_end(struct perf_output_handle *handle); 1228extern void perf_output_end(struct perf_output_handle *handle);
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 0d5b79365d0..410b33d014d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -127,6 +127,27 @@ struct tc_multiq_qopt {
127 __u16 max_bands; /* Maximum number of queues */ 127 __u16 max_bands; /* Maximum number of queues */
128}; 128};
129 129
130/* PLUG section */
131
132#define TCQ_PLUG_BUFFER 0
133#define TCQ_PLUG_RELEASE_ONE 1
134#define TCQ_PLUG_RELEASE_INDEFINITE 2
135#define TCQ_PLUG_LIMIT 3
136
137struct tc_plug_qopt {
138 /* TCQ_PLUG_BUFFER: Inset a plug into the queue and
139 * buffer any incoming packets
140 * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head
141 * to beginning of the next plug.
142 * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue.
143 * Stop buffering packets until the next TCQ_PLUG_BUFFER
144 * command is received (just act as a pass-thru queue).
145 * TCQ_PLUG_LIMIT: Increase/decrease queue size
146 */
147 int action;
148 __u32 limit;
149};
150
130/* TBF section */ 151/* TBF section */
131 152
132struct tc_tbf_qopt { 153struct tc_tbf_qopt {
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
new file mode 100644
index 00000000000..c4e23d02949
--- /dev/null
+++ b/include/linux/platform_data/cpsw.h
@@ -0,0 +1,55 @@
1/*
2 * Texas Instruments Ethernet Switch Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
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#ifndef __CPSW_H__
16#define __CPSW_H__
17
18#include <linux/if_ether.h>
19
20struct cpsw_slave_data {
21 u32 slave_reg_ofs;
22 u32 sliver_reg_ofs;
23 const char *phy_id;
24 int phy_if;
25 u8 mac_addr[ETH_ALEN];
26};
27
28struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 cpdma_reg_ofs; /* cpdma register offset */
32 u32 cpdma_sram_ofs; /* cpdma sram offset */
33
34 u32 slaves; /* number of slave cpgmac ports */
35 struct cpsw_slave_data *slave_data;
36
37 u32 ale_reg_ofs; /* address lookup engine reg offset */
38 u32 ale_entries; /* ale table size */
39
40 u32 host_port_reg_ofs; /* cpsw cpdma host port registers */
41 u32 host_port_num; /* The port number for the host port */
42
43 u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */
44
45 u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/
46 u32 bd_ram_size; /*buffer descriptor ram size */
47 u32 hw_ram_addr; /*if the HW address for BD RAM is different */
48 bool no_bd_ram; /* no embedded BD ram*/
49
50 u32 rx_descs; /* Number of Rx Descriptios */
51
52 u32 mac_control; /* Mac control register */
53};
54
55#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h
new file mode 100644
index 00000000000..5eb7da9b377
--- /dev/null
+++ b/include/linux/platform_data/dwc3-exynos.h
@@ -0,0 +1,24 @@
1/**
2 * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header.
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Anton Tikhomirov <av.tikhomirov@samsung.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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef _DWC3_EXYNOS_H_
16#define _DWC3_EXYNOS_H_
17
18struct dwc3_exynos_data {
19 int phy_type;
20 int (*phy_init)(struct platform_device *pdev, int type);
21 int (*phy_exit)(struct platform_device *pdev, int type);
22};
23
24#endif /* _DWC3_EXYNOS_H_ */
diff --git a/include/linux/platform_data/efm32-uart.h b/include/linux/platform_data/efm32-uart.h
new file mode 100644
index 00000000000..ed0e975b3c5
--- /dev/null
+++ b/include/linux/platform_data/efm32-uart.h
@@ -0,0 +1,18 @@
1/*
2 *
3 *
4 */
5#ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__
6#define __LINUX_PLATFORM_DATA_EFM32_UART_H__
7
8#include <linux/types.h>
9
10/**
11 * struct efm32_uart_pdata
12 * @location: pinmux location for the I/O pins (to be written to the ROUTE
13 * register)
14 */
15struct efm32_uart_pdata {
16 u8 location;
17};
18#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e4982ac3fbb..715305e0512 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -110,6 +110,10 @@ typedef struct pm_message {
110 * Subsystem-level @suspend() is executed for all devices after invoking 110 * Subsystem-level @suspend() is executed for all devices after invoking
111 * subsystem-level @prepare() for all of them. 111 * subsystem-level @prepare() for all of them.
112 * 112 *
113 * @suspend_late: Continue operations started by @suspend(). For a number of
114 * devices @suspend_late() may point to the same callback routine as the
115 * runtime suspend callback.
116 *
113 * @resume: Executed after waking the system up from a sleep state in which the 117 * @resume: Executed after waking the system up from a sleep state in which the
114 * contents of main memory were preserved. The exact action to perform 118 * contents of main memory were preserved. The exact action to perform
115 * depends on the device's subsystem, but generally the driver is expected 119 * depends on the device's subsystem, but generally the driver is expected
@@ -122,6 +126,10 @@ typedef struct pm_message {
122 * Subsystem-level @resume() is executed for all devices after invoking 126 * Subsystem-level @resume() is executed for all devices after invoking
123 * subsystem-level @resume_noirq() for all of them. 127 * subsystem-level @resume_noirq() for all of them.
124 * 128 *
129 * @resume_early: Prepare to execute @resume(). For a number of devices
130 * @resume_early() may point to the same callback routine as the runtime
131 * resume callback.
132 *
125 * @freeze: Hibernation-specific, executed before creating a hibernation image. 133 * @freeze: Hibernation-specific, executed before creating a hibernation image.
126 * Analogous to @suspend(), but it should not enable the device to signal 134 * Analogous to @suspend(), but it should not enable the device to signal
127 * wakeup events or change its power state. The majority of subsystems 135 * wakeup events or change its power state. The majority of subsystems
@@ -131,6 +139,10 @@ typedef struct pm_message {
131 * Subsystem-level @freeze() is executed for all devices after invoking 139 * Subsystem-level @freeze() is executed for all devices after invoking
132 * subsystem-level @prepare() for all of them. 140 * subsystem-level @prepare() for all of them.
133 * 141 *
142 * @freeze_late: Continue operations started by @freeze(). Analogous to
143 * @suspend_late(), but it should not enable the device to signal wakeup
144 * events or change its power state.
145 *
134 * @thaw: Hibernation-specific, executed after creating a hibernation image OR 146 * @thaw: Hibernation-specific, executed after creating a hibernation image OR
135 * if the creation of an image has failed. Also executed after a failing 147 * if the creation of an image has failed. Also executed after a failing
136 * attempt to restore the contents of main memory from such an image. 148 * attempt to restore the contents of main memory from such an image.
@@ -140,15 +152,23 @@ typedef struct pm_message {
140 * subsystem-level @thaw_noirq() for all of them. It also may be executed 152 * subsystem-level @thaw_noirq() for all of them. It also may be executed
141 * directly after @freeze() in case of a transition error. 153 * directly after @freeze() in case of a transition error.
142 * 154 *
155 * @thaw_early: Prepare to execute @thaw(). Undo the changes made by the
156 * preceding @freeze_late().
157 *
143 * @poweroff: Hibernation-specific, executed after saving a hibernation image. 158 * @poweroff: Hibernation-specific, executed after saving a hibernation image.
144 * Analogous to @suspend(), but it need not save the device's settings in 159 * Analogous to @suspend(), but it need not save the device's settings in
145 * memory. 160 * memory.
146 * Subsystem-level @poweroff() is executed for all devices after invoking 161 * Subsystem-level @poweroff() is executed for all devices after invoking
147 * subsystem-level @prepare() for all of them. 162 * subsystem-level @prepare() for all of them.
148 * 163 *
164 * @poweroff_late: Continue operations started by @poweroff(). Analogous to
165 * @suspend_late(), but it need not save the device's settings in memory.
166 *
149 * @restore: Hibernation-specific, executed after restoring the contents of main 167 * @restore: Hibernation-specific, executed after restoring the contents of main
150 * memory from a hibernation image, analogous to @resume(). 168 * memory from a hibernation image, analogous to @resume().
151 * 169 *
170 * @restore_early: Prepare to execute @restore(), analogous to @resume_early().
171 *
152 * @suspend_noirq: Complete the actions started by @suspend(). Carry out any 172 * @suspend_noirq: Complete the actions started by @suspend(). Carry out any
153 * additional operations required for suspending the device that might be 173 * additional operations required for suspending the device that might be
154 * racing with its driver's interrupt handler, which is guaranteed not to 174 * racing with its driver's interrupt handler, which is guaranteed not to
@@ -158,9 +178,10 @@ typedef struct pm_message {
158 * @suspend_noirq() has returned successfully. If the device can generate 178 * @suspend_noirq() has returned successfully. If the device can generate
159 * system wakeup signals and is enabled to wake up the system, it should be 179 * system wakeup signals and is enabled to wake up the system, it should be
160 * configured to do so at that time. However, depending on the platform 180 * configured to do so at that time. However, depending on the platform
161 * and device's subsystem, @suspend() may be allowed to put the device into 181 * and device's subsystem, @suspend() or @suspend_late() may be allowed to
162 * the low-power state and configure it to generate wakeup signals, in 182 * put the device into the low-power state and configure it to generate
163 * which case it generally is not necessary to define @suspend_noirq(). 183 * wakeup signals, in which case it generally is not necessary to define
184 * @suspend_noirq().
164 * 185 *
165 * @resume_noirq: Prepare for the execution of @resume() by carrying out any 186 * @resume_noirq: Prepare for the execution of @resume() by carrying out any
166 * operations required for resuming the device that might be racing with 187 * operations required for resuming the device that might be racing with
@@ -171,9 +192,9 @@ typedef struct pm_message {
171 * additional operations required for freezing the device that might be 192 * additional operations required for freezing the device that might be
172 * racing with its driver's interrupt handler, which is guaranteed not to 193 * racing with its driver's interrupt handler, which is guaranteed not to
173 * run while @freeze_noirq() is being executed. 194 * run while @freeze_noirq() is being executed.
174 * The power state of the device should not be changed by either @freeze() 195 * The power state of the device should not be changed by either @freeze(),
175 * or @freeze_noirq() and it should not be configured to signal system 196 * or @freeze_late(), or @freeze_noirq() and it should not be configured to
176 * wakeup by any of these callbacks. 197 * signal system wakeup by any of these callbacks.
177 * 198 *
178 * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any 199 * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any
179 * operations required for thawing the device that might be racing with its 200 * operations required for thawing the device that might be racing with its
@@ -249,6 +270,12 @@ struct dev_pm_ops {
249 int (*thaw)(struct device *dev); 270 int (*thaw)(struct device *dev);
250 int (*poweroff)(struct device *dev); 271 int (*poweroff)(struct device *dev);
251 int (*restore)(struct device *dev); 272 int (*restore)(struct device *dev);
273 int (*suspend_late)(struct device *dev);
274 int (*resume_early)(struct device *dev);
275 int (*freeze_late)(struct device *dev);
276 int (*thaw_early)(struct device *dev);
277 int (*poweroff_late)(struct device *dev);
278 int (*restore_early)(struct device *dev);
252 int (*suspend_noirq)(struct device *dev); 279 int (*suspend_noirq)(struct device *dev);
253 int (*resume_noirq)(struct device *dev); 280 int (*resume_noirq)(struct device *dev);
254 int (*freeze_noirq)(struct device *dev); 281 int (*freeze_noirq)(struct device *dev);
@@ -293,6 +320,15 @@ const struct dev_pm_ops name = { \
293/* 320/*
294 * Use this for defining a set of PM operations to be used in all situations 321 * Use this for defining a set of PM operations to be used in all situations
295 * (sustem suspend, hibernation or runtime PM). 322 * (sustem suspend, hibernation or runtime PM).
323 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should
324 * be different from the corresponding runtime PM callbacks, .runtime_suspend(),
325 * and .runtime_resume(), because .runtime_suspend() always works on an already
326 * quiescent device, while .suspend() should assume that the device may be doing
327 * something when it is called (it should ensure that the device will be
328 * quiescent after it has returned). Therefore it's better to point the "late"
329 * suspend and "early" resume callback pointers, .suspend_late() and
330 * .resume_early(), to the same routines as .runtime_suspend() and
331 * .runtime_resume(), respectively (and analogously for hibernation).
296 */ 332 */
297#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ 333#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
298const struct dev_pm_ops name = { \ 334const struct dev_pm_ops name = { \
@@ -510,6 +546,7 @@ struct dev_pm_info {
510 unsigned long accounting_timestamp; 546 unsigned long accounting_timestamp;
511 ktime_t suspend_time; 547 ktime_t suspend_time;
512 s64 max_time_suspended_ns; 548 s64 max_time_suspended_ns;
549 struct dev_pm_qos_request *pq_req;
513#endif 550#endif
514 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
515 struct pm_qos_constraints *constraints; 552 struct pm_qos_constraints *constraints;
@@ -584,13 +621,13 @@ struct dev_pm_domain {
584 621
585#ifdef CONFIG_PM_SLEEP 622#ifdef CONFIG_PM_SLEEP
586extern void device_pm_lock(void); 623extern void device_pm_lock(void);
587extern void dpm_resume_noirq(pm_message_t state); 624extern void dpm_resume_start(pm_message_t state);
588extern void dpm_resume_end(pm_message_t state); 625extern void dpm_resume_end(pm_message_t state);
589extern void dpm_resume(pm_message_t state); 626extern void dpm_resume(pm_message_t state);
590extern void dpm_complete(pm_message_t state); 627extern void dpm_complete(pm_message_t state);
591 628
592extern void device_pm_unlock(void); 629extern void device_pm_unlock(void);
593extern int dpm_suspend_noirq(pm_message_t state); 630extern int dpm_suspend_end(pm_message_t state);
594extern int dpm_suspend_start(pm_message_t state); 631extern int dpm_suspend_start(pm_message_t state);
595extern int dpm_suspend(pm_message_t state); 632extern int dpm_suspend(pm_message_t state);
596extern int dpm_prepare(pm_message_t state); 633extern int dpm_prepare(pm_message_t state);
@@ -605,17 +642,23 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
605extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); 642extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
606 643
607extern int pm_generic_prepare(struct device *dev); 644extern int pm_generic_prepare(struct device *dev);
645extern int pm_generic_suspend_late(struct device *dev);
608extern int pm_generic_suspend_noirq(struct device *dev); 646extern int pm_generic_suspend_noirq(struct device *dev);
609extern int pm_generic_suspend(struct device *dev); 647extern int pm_generic_suspend(struct device *dev);
648extern int pm_generic_resume_early(struct device *dev);
610extern int pm_generic_resume_noirq(struct device *dev); 649extern int pm_generic_resume_noirq(struct device *dev);
611extern int pm_generic_resume(struct device *dev); 650extern int pm_generic_resume(struct device *dev);
612extern int pm_generic_freeze_noirq(struct device *dev); 651extern int pm_generic_freeze_noirq(struct device *dev);
652extern int pm_generic_freeze_late(struct device *dev);
613extern int pm_generic_freeze(struct device *dev); 653extern int pm_generic_freeze(struct device *dev);
614extern int pm_generic_thaw_noirq(struct device *dev); 654extern int pm_generic_thaw_noirq(struct device *dev);
655extern int pm_generic_thaw_early(struct device *dev);
615extern int pm_generic_thaw(struct device *dev); 656extern int pm_generic_thaw(struct device *dev);
616extern int pm_generic_restore_noirq(struct device *dev); 657extern int pm_generic_restore_noirq(struct device *dev);
658extern int pm_generic_restore_early(struct device *dev);
617extern int pm_generic_restore(struct device *dev); 659extern int pm_generic_restore(struct device *dev);
618extern int pm_generic_poweroff_noirq(struct device *dev); 660extern int pm_generic_poweroff_noirq(struct device *dev);
661extern int pm_generic_poweroff_late(struct device *dev);
619extern int pm_generic_poweroff(struct device *dev); 662extern int pm_generic_poweroff(struct device *dev);
620extern void pm_generic_complete(struct device *dev); 663extern void pm_generic_complete(struct device *dev);
621 664
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index a03a0ad998b..1236d262b3e 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/of.h>
14 15
15enum gpd_status { 16enum gpd_status {
16 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 17 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,6 +71,7 @@ struct generic_pm_domain {
70 s64 break_even_ns; /* Power break even for the entire domain. */ 71 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 72 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time; 73 ktime_t power_off_time;
74 struct device_node *of_node; /* Node in device tree */
73}; 75};
74 76
75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 77static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -97,14 +99,15 @@ struct generic_pm_domain_data {
97 struct gpd_dev_ops ops; 99 struct gpd_dev_ops ops;
98 struct gpd_timing_data td; 100 struct gpd_timing_data td;
99 bool need_restore; 101 bool need_restore;
102 bool always_on;
100}; 103};
101 104
105#ifdef CONFIG_PM_GENERIC_DOMAINS
102static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) 106static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
103{ 107{
104 return container_of(pdd, struct generic_pm_domain_data, base); 108 return container_of(pdd, struct generic_pm_domain_data, base);
105} 109}
106 110
107#ifdef CONFIG_PM_GENERIC_DOMAINS
108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) 111static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
109{ 112{
110 return to_gpd_data(dev->power.subsys_data->domain_data); 113 return to_gpd_data(dev->power.subsys_data->domain_data);
@@ -117,14 +120,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev, 120 struct device *dev,
118 struct gpd_timing_data *td); 121 struct gpd_timing_data *td);
119 122
123extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
124 struct device *dev,
125 struct gpd_timing_data *td);
126
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 127static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev) 128 struct device *dev)
122{ 129{
123 return __pm_genpd_add_device(genpd, dev, NULL); 130 return __pm_genpd_add_device(genpd, dev, NULL);
124} 131}
125 132
133static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
134 struct device *dev)
135{
136 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
137}
138
126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 139extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
127 struct device *dev); 140 struct device *dev);
141extern void pm_genpd_dev_always_on(struct device *dev, bool val);
128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 142extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
129 struct generic_pm_domain *new_subdomain); 143 struct generic_pm_domain *new_subdomain);
130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 144extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -143,6 +157,10 @@ extern bool default_stop_ok(struct device *dev);
143extern struct dev_power_governor pm_domain_always_on_gov; 157extern struct dev_power_governor pm_domain_always_on_gov;
144#else 158#else
145 159
160static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
161{
162 return ERR_PTR(-ENOSYS);
163}
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 164static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{ 165{
148 return ERR_PTR(-ENOSYS); 166 return ERR_PTR(-ENOSYS);
@@ -163,6 +181,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
163{ 181{
164 return -ENOSYS; 182 return -ENOSYS;
165} 183}
184static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
166static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 185static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
167 struct generic_pm_domain *new_sd) 186 struct generic_pm_domain *new_sd)
168{ 187{
@@ -183,7 +202,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{ 202{
184 return -ENOSYS; 203 return -ENOSYS;
185} 204}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) 205static inline void pm_genpd_init(struct generic_pm_domain *genpd,
206 struct dev_power_governor *gov, bool is_off)
187{ 207{
188} 208}
189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 209static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
@@ -194,6 +214,7 @@ static inline bool default_stop_ok(struct device *dev)
194{ 214{
195 return false; 215 return false;
196} 216}
217#define simple_qos_governor NULL
197#define pm_domain_always_on_gov NULL 218#define pm_domain_always_on_gov NULL
198#endif 219#endif
199 220
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index e5bbcbaa6f5..2e9191a712f 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -9,12 +9,16 @@
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10#include <linux/device.h> 10#include <linux/device.h>
11 11
12#define PM_QOS_RESERVED 0 12enum {
13#define PM_QOS_CPU_DMA_LATENCY 1 13 PM_QOS_RESERVED = 0,
14#define PM_QOS_NETWORK_LATENCY 2 14 PM_QOS_CPU_DMA_LATENCY,
15#define PM_QOS_NETWORK_THROUGHPUT 3 15 PM_QOS_NETWORK_LATENCY,
16 PM_QOS_NETWORK_THROUGHPUT,
17
18 /* insert new class ID */
19 PM_QOS_NUM_CLASSES,
20};
16 21
17#define PM_QOS_NUM_CLASSES 4
18#define PM_QOS_DEFAULT_VALUE -1 22#define PM_QOS_DEFAULT_VALUE -1
19 23
20#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 24#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
@@ -63,7 +67,6 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
63 return req->dev != 0; 67 return req->dev != 0;
64} 68}
65 69
66#ifdef CONFIG_PM
67int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, 70int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
68 enum pm_qos_req_action action, int value); 71 enum pm_qos_req_action action, int value);
69void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, 72void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
@@ -78,6 +81,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
78int pm_qos_request_active(struct pm_qos_request *req); 81int pm_qos_request_active(struct pm_qos_request *req);
79s32 pm_qos_read_value(struct pm_qos_constraints *c); 82s32 pm_qos_read_value(struct pm_qos_constraints *c);
80 83
84#ifdef CONFIG_PM
81s32 __dev_pm_qos_read_value(struct device *dev); 85s32 __dev_pm_qos_read_value(struct device *dev);
82s32 dev_pm_qos_read_value(struct device *dev); 86s32 dev_pm_qos_read_value(struct device *dev);
83int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 87int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
@@ -95,33 +99,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev);
95int dev_pm_qos_add_ancestor_request(struct device *dev, 99int dev_pm_qos_add_ancestor_request(struct device *dev,
96 struct dev_pm_qos_request *req, s32 value); 100 struct dev_pm_qos_request *req, s32 value);
97#else 101#else
98static inline int pm_qos_update_target(struct pm_qos_constraints *c,
99 struct plist_node *node,
100 enum pm_qos_req_action action,
101 int value)
102 { return 0; }
103static inline void pm_qos_add_request(struct pm_qos_request *req,
104 int pm_qos_class, s32 value)
105 { return; }
106static inline void pm_qos_update_request(struct pm_qos_request *req,
107 s32 new_value)
108 { return; }
109static inline void pm_qos_remove_request(struct pm_qos_request *req)
110 { return; }
111
112static inline int pm_qos_request(int pm_qos_class)
113 { return 0; }
114static inline int pm_qos_add_notifier(int pm_qos_class,
115 struct notifier_block *notifier)
116 { return 0; }
117static inline int pm_qos_remove_notifier(int pm_qos_class,
118 struct notifier_block *notifier)
119 { return 0; }
120static inline int pm_qos_request_active(struct pm_qos_request *req)
121 { return 0; }
122static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
123 { return 0; }
124
125static inline s32 __dev_pm_qos_read_value(struct device *dev) 102static inline s32 __dev_pm_qos_read_value(struct device *dev)
126 { return 0; } 103 { return 0; }
127static inline s32 dev_pm_qos_read_value(struct device *dev) 104static inline s32 dev_pm_qos_read_value(struct device *dev)
@@ -160,4 +137,13 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
160 { return 0; } 137 { return 0; }
161#endif 138#endif
162 139
140#ifdef CONFIG_PM_RUNTIME
141int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
142void dev_pm_qos_hide_latency_limit(struct device *dev);
143#else
144static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
145 { return 0; }
146static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
147#endif
148
163#endif 149#endif
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index a32da962d69..d9f05113e5f 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -41,7 +41,7 @@
41 * @active: Status of the wakeup source. 41 * @active: Status of the wakeup source.
42 */ 42 */
43struct wakeup_source { 43struct wakeup_source {
44 char *name; 44 const char *name;
45 struct list_head entry; 45 struct list_head entry;
46 spinlock_t lock; 46 spinlock_t lock;
47 struct timer_list timer; 47 struct timer_list timer;
@@ -73,7 +73,9 @@ static inline bool device_may_wakeup(struct device *dev)
73} 73}
74 74
75/* drivers/base/power/wakeup.c */ 75/* drivers/base/power/wakeup.c */
76extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name);
76extern struct wakeup_source *wakeup_source_create(const char *name); 77extern struct wakeup_source *wakeup_source_create(const char *name);
78extern void wakeup_source_drop(struct wakeup_source *ws);
77extern void wakeup_source_destroy(struct wakeup_source *ws); 79extern void wakeup_source_destroy(struct wakeup_source *ws);
78extern void wakeup_source_add(struct wakeup_source *ws); 80extern void wakeup_source_add(struct wakeup_source *ws);
79extern void wakeup_source_remove(struct wakeup_source *ws); 81extern void wakeup_source_remove(struct wakeup_source *ws);
@@ -103,11 +105,16 @@ static inline bool device_can_wakeup(struct device *dev)
103 return dev->power.can_wakeup; 105 return dev->power.can_wakeup;
104} 106}
105 107
108static inline void wakeup_source_prepare(struct wakeup_source *ws,
109 const char *name) {}
110
106static inline struct wakeup_source *wakeup_source_create(const char *name) 111static inline struct wakeup_source *wakeup_source_create(const char *name)
107{ 112{
108 return NULL; 113 return NULL;
109} 114}
110 115
116static inline void wakeup_source_drop(struct wakeup_source *ws) {}
117
111static inline void wakeup_source_destroy(struct wakeup_source *ws) {} 118static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
112 119
113static inline void wakeup_source_add(struct wakeup_source *ws) {} 120static inline void wakeup_source_add(struct wakeup_source *ws) {}
@@ -165,4 +172,17 @@ static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
165 172
166#endif /* !CONFIG_PM_SLEEP */ 173#endif /* !CONFIG_PM_SLEEP */
167 174
175static inline void wakeup_source_init(struct wakeup_source *ws,
176 const char *name)
177{
178 wakeup_source_prepare(ws, name);
179 wakeup_source_add(ws);
180}
181
182static inline void wakeup_source_trash(struct wakeup_source *ws)
183{
184 wakeup_source_remove(ws);
185 wakeup_source_drop(ws);
186}
187
168#endif /* _LINUX_PM_WAKEUP_H */ 188#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index b8d4ddd2273..e53ff65935d 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -1,42 +1,12 @@
1/* 1/*
2 * ppp-comp.h - Definitions for doing PPP packet compression. 2 * ppp-comp.h - Definitions for doing PPP packet compression.
3 * 3 *
4 * Copyright (c) 1994 The Australian National University. 4 * Copyright 1994-1998 Paul Mackerras.
5 * All rights reserved.
6 * 5 *
7 * Permission to use, copy, modify, and distribute this software and its 6 * This program is free software; you can redistribute it and/or
8 * documentation is hereby granted, provided that the above copyright 7 * modify it under the terms of the GNU General Public License
9 * notice appears in all copies. This software is provided without any 8 * version 2 as published by the Free Software Foundation.
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
12 * any purpose.
13 *
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18 * OF SUCH DAMAGE.
19 *
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS.
26 */ 9 */
27
28/*
29 * ==FILEVERSION 980319==
30 *
31 * NOTE TO MAINTAINERS:
32 * If you modify this file at all, please set the above date.
33 * ppp-comp.h is shipped with a PPP distribution as well as with the kernel;
34 * if everyone increases the FILEVERSION number above, then scripts
35 * can do the right thing when deciding whether to install a new ppp-comp.h
36 * file. Don't change the format of that line otherwise, so the
37 * installation script can recognize it.
38 */
39
40#ifndef _NET_PPP_COMP_H 10#ifndef _NET_PPP_COMP_H
41#define _NET_PPP_COMP_H 11#define _NET_PPP_COMP_H
42 12
diff --git a/include/linux/ppp-ioctl.h b/include/linux/ppp-ioctl.h
new file mode 100644
index 00000000000..2d9a8859550
--- /dev/null
+++ b/include/linux/ppp-ioctl.h
@@ -0,0 +1,119 @@
1/*
2 * ppp-ioctl.h - PPP ioctl definitions.
3 *
4 * Copyright 1999-2002 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10#ifndef _PPP_IOCTL_H
11#define _PPP_IOCTL_H
12
13#include <linux/types.h>
14#include <linux/compiler.h>
15
16/*
17 * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS.
18 */
19#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
20#define SC_COMP_AC 0x00000002 /* header compression (output) */
21#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
22#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
23#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
24#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
25#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
26#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
27#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
28#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
29#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
30#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */
31#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
32#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
33#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */
34#define SC_DEBUG 0x00010000 /* enable debug messages */
35#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
36#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
37#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
38#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
39#define SC_SYNC 0x00200000 /* synchronous serial mode */
40#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */
41#define SC_MASK 0x0f600fff /* bits that user can change */
42
43/* state bits */
44#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
45#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
46#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
47#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
48#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
49#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
50#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
51
52/* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */
53struct npioctl {
54 int protocol; /* PPP protocol, e.g. PPP_IP */
55 enum NPmode mode;
56};
57
58/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
59struct ppp_option_data {
60 __u8 __user *ptr;
61 __u32 length;
62 int transmit;
63};
64
65/* For PPPIOCGL2TPSTATS */
66struct pppol2tp_ioc_stats {
67 __u16 tunnel_id; /* redundant */
68 __u16 session_id; /* if zero, get tunnel stats */
69 __u32 using_ipsec:1; /* valid only for session_id == 0 */
70 __aligned_u64 tx_packets;
71 __aligned_u64 tx_bytes;
72 __aligned_u64 tx_errors;
73 __aligned_u64 rx_packets;
74 __aligned_u64 rx_bytes;
75 __aligned_u64 rx_seq_discards;
76 __aligned_u64 rx_oos_packets;
77 __aligned_u64 rx_errors;
78};
79
80/*
81 * Ioctl definitions.
82 */
83
84#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
85#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
86#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
87#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
88#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
89#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
90#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
91#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
92#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
93#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
94#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
95#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
96#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
97#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
98#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
99#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
100#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */
101#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */
102#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
103#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
104#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
105#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
106#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
107#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */
108#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
109#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
110#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
111#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */
112#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */
113#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
114
115#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
116#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
117#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
118
119#endif /* _PPP_IOCTL_H */
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index 0f93ed6b4a8..ba416f67eb6 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -1,44 +1,14 @@
1/* 1/*
2 * ppp_defs.h - PPP definitions. 2 * ppp_defs.h - PPP definitions.
3 * 3 *
4 * Copyright (c) 1994 The Australian National University. 4 * Copyright 1994-2000 Paul Mackerras.
5 * All rights reserved.
6 * 5 *
7 * Permission to use, copy, modify, and distribute this software and its 6 * This program is free software; you can redistribute it and/or
8 * documentation is hereby granted, provided that the above copyright 7 * modify it under the terms of the GNU General Public License
9 * notice appears in all copies. This software is provided without any 8 * version 2 as published by the Free Software Foundation.
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
12 * any purpose.
13 *
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18 * OF SUCH DAMAGE.
19 *
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS.
26 */ 9 */
27
28#include <linux/types.h> 10#include <linux/types.h>
29 11
30/*
31 * ==FILEVERSION 20000114==
32 *
33 * NOTE TO MAINTAINERS:
34 * If you modify this file at all, please set the above date.
35 * ppp_defs.h is shipped with a PPP distribution as well as with the kernel;
36 * if everyone increases the FILEVERSION number above, then scripts
37 * can do the right thing when deciding whether to install a new ppp_defs.h
38 * file. Don't change the format of that line otherwise, so the
39 * installation script can recognize it.
40 */
41
42#ifndef _PPP_DEFS_H_ 12#ifndef _PPP_DEFS_H_
43#define _PPP_DEFS_H_ 13#define _PPP_DEFS_H_
44 14
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 58969b2a8a8..5a710b9c578 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -48,12 +48,14 @@ do { \
48 barrier(); \ 48 barrier(); \
49} while (0) 49} while (0)
50 50
51#define preempt_enable_no_resched() \ 51#define sched_preempt_enable_no_resched() \
52do { \ 52do { \
53 barrier(); \ 53 barrier(); \
54 dec_preempt_count(); \ 54 dec_preempt_count(); \
55} while (0) 55} while (0)
56 56
57#define preempt_enable_no_resched() sched_preempt_enable_no_resched()
58
57#define preempt_enable() \ 59#define preempt_enable() \
58do { \ 60do { \
59 preempt_enable_no_resched(); \ 61 preempt_enable_no_resched(); \
@@ -92,6 +94,7 @@ do { \
92#else /* !CONFIG_PREEMPT_COUNT */ 94#else /* !CONFIG_PREEMPT_COUNT */
93 95
94#define preempt_disable() do { } while (0) 96#define preempt_disable() do { } while (0)
97#define sched_preempt_enable_no_resched() do { } while (0)
95#define preempt_enable_no_resched() do { } while (0) 98#define preempt_enable_no_resched() do { } while (0)
96#define preempt_enable() do { } while (0) 99#define preempt_enable() do { } while (0)
97 100
diff --git a/include/linux/printk.h b/include/linux/printk.h
index f0e22f75143..0525927f203 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -101,6 +101,11 @@ asmlinkage __printf(1, 2) __cold
101int printk(const char *fmt, ...); 101int printk(const char *fmt, ...);
102 102
103/* 103/*
104 * Special printk facility for scheduler use only, _DO_NOT_USE_ !
105 */
106__printf(1, 2) __cold int printk_sched(const char *fmt, ...);
107
108/*
104 * Please don't use printk_ratelimit(), because it shares ratelimiting state 109 * Please don't use printk_ratelimit(), because it shares ratelimiting state
105 * with all other unrelated printk_ratelimit() callsites. Instead use 110 * with all other unrelated printk_ratelimit() callsites. Instead use
106 * printk_ratelimited() or plain old __ratelimit(). 111 * printk_ratelimited() or plain old __ratelimit().
@@ -127,6 +132,11 @@ int printk(const char *s, ...)
127{ 132{
128 return 0; 133 return 0;
129} 134}
135static inline __printf(1, 2) __cold
136int printk_sched(const char *s, ...)
137{
138 return 0;
139}
130static inline int printk_ratelimit(void) 140static inline int printk_ratelimit(void)
131{ 141{
132 return 0; 142 return 0;
@@ -180,13 +190,13 @@ extern void dump_stack(void) __cold;
180#endif 190#endif
181 191
182/* If you are writing a driver, please use dev_dbg instead */ 192/* If you are writing a driver, please use dev_dbg instead */
183#if defined(DEBUG) 193#if defined(CONFIG_DYNAMIC_DEBUG)
184#define pr_debug(fmt, ...) \
185 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
186#elif defined(CONFIG_DYNAMIC_DEBUG)
187/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 194/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
188#define pr_debug(fmt, ...) \ 195#define pr_debug(fmt, ...) \
189 dynamic_pr_debug(fmt, ##__VA_ARGS__) 196 dynamic_pr_debug(fmt, ##__VA_ARGS__)
197#elif defined(DEBUG)
198#define pr_debug(fmt, ...) \
199 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
190#else 200#else
191#define pr_debug(fmt, ...) \ 201#define pr_debug(fmt, ...) \
192 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 202 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index ef35bb73f69..26a8a4ed9b0 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -81,7 +81,11 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
81 * Limit the time part in order to ensure there are some bits left for the 81 * Limit the time part in order to ensure there are some bits left for the
82 * cycle counter and fraction multiply. 82 * cycle counter and fraction multiply.
83 */ 83 */
84#if BITS_PER_LONG == 32
84#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4) 85#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
86#else
87#define PROP_MAX_SHIFT (BITS_PER_LONG/2)
88#endif
85 89
86#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1) 90#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1)
87#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT) 91#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cb785569903..c09fa042b5e 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -230,7 +230,11 @@ struct mem_dqinfo {
230struct super_block; 230struct super_block;
231 231
232#define DQF_MASK 0xffff /* Mask for format specific flags */ 232#define DQF_MASK 0xffff /* Mask for format specific flags */
233#define DQF_INFO_DIRTY_B 16 233#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
234#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
235#define DQF_SYS_FILE_B 16
236#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
237#define DQF_INFO_DIRTY_B 31
234#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ 238#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
235 239
236extern void mark_info_dirty(struct super_block *sb, int type); 240extern void mark_info_dirty(struct super_block *sb, int type);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 81c04f4348e..937217425c4 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -190,6 +190,33 @@ extern void rcu_idle_exit(void);
190extern void rcu_irq_enter(void); 190extern void rcu_irq_enter(void);
191extern void rcu_irq_exit(void); 191extern void rcu_irq_exit(void);
192 192
193/**
194 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
195 * @a: Code that RCU needs to pay attention to.
196 *
197 * RCU, RCU-bh, and RCU-sched read-side critical sections are forbidden
198 * in the inner idle loop, that is, between the rcu_idle_enter() and
199 * the rcu_idle_exit() -- RCU will happily ignore any such read-side
200 * critical sections. However, things like powertop need tracepoints
201 * in the inner idle loop.
202 *
203 * This macro provides the way out: RCU_NONIDLE(do_something_with_RCU())
204 * will tell RCU that it needs to pay attending, invoke its argument
205 * (in this example, a call to the do_something_with_RCU() function),
206 * and then tell RCU to go back to ignoring this CPU. It is permissible
207 * to nest RCU_NONIDLE() wrappers, but the nesting level is currently
208 * quite limited. If deeper nesting is required, it will be necessary
209 * to adjust DYNTICK_TASK_NESTING_VALUE accordingly.
210 *
211 * This macro may be used from process-level code only.
212 */
213#define RCU_NONIDLE(a) \
214 do { \
215 rcu_idle_exit(); \
216 do { a; } while (0); \
217 rcu_idle_enter(); \
218 } while (0)
219
193/* 220/*
194 * Infrastructure to implement the synchronize_() primitives in 221 * Infrastructure to implement the synchronize_() primitives in
195 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 222 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
@@ -226,6 +253,15 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
226} 253}
227#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 254#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
228 255
256#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU)
257bool rcu_lockdep_current_cpu_online(void);
258#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
259static inline bool rcu_lockdep_current_cpu_online(void)
260{
261 return 1;
262}
263#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
264
229#ifdef CONFIG_DEBUG_LOCK_ALLOC 265#ifdef CONFIG_DEBUG_LOCK_ALLOC
230 266
231#ifdef CONFIG_PROVE_RCU 267#ifdef CONFIG_PROVE_RCU
@@ -239,13 +275,11 @@ static inline int rcu_is_cpu_idle(void)
239 275
240static inline void rcu_lock_acquire(struct lockdep_map *map) 276static inline void rcu_lock_acquire(struct lockdep_map *map)
241{ 277{
242 WARN_ON_ONCE(rcu_is_cpu_idle());
243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); 278 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244} 279}
245 280
246static inline void rcu_lock_release(struct lockdep_map *map) 281static inline void rcu_lock_release(struct lockdep_map *map)
247{ 282{
248 WARN_ON_ONCE(rcu_is_cpu_idle());
249 lock_release(map, 1, _THIS_IP_); 283 lock_release(map, 1, _THIS_IP_);
250} 284}
251 285
@@ -270,6 +304,9 @@ extern int debug_lockdep_rcu_enabled(void);
270 * occur in the same context, for example, it is illegal to invoke 304 * occur in the same context, for example, it is illegal to invoke
271 * rcu_read_unlock() in process context if the matching rcu_read_lock() 305 * rcu_read_unlock() in process context if the matching rcu_read_lock()
272 * was invoked from within an irq handler. 306 * was invoked from within an irq handler.
307 *
308 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
309 * offline from an RCU perspective, so check for those as well.
273 */ 310 */
274static inline int rcu_read_lock_held(void) 311static inline int rcu_read_lock_held(void)
275{ 312{
@@ -277,6 +314,8 @@ static inline int rcu_read_lock_held(void)
277 return 1; 314 return 1;
278 if (rcu_is_cpu_idle()) 315 if (rcu_is_cpu_idle())
279 return 0; 316 return 0;
317 if (!rcu_lockdep_current_cpu_online())
318 return 0;
280 return lock_is_held(&rcu_lock_map); 319 return lock_is_held(&rcu_lock_map);
281} 320}
282 321
@@ -313,6 +352,9 @@ extern int rcu_read_lock_bh_held(void);
313 * notice an extended quiescent state to other CPUs that started a grace 352 * notice an extended quiescent state to other CPUs that started a grace
314 * period. Otherwise we would delay any grace period as long as we run in 353 * period. Otherwise we would delay any grace period as long as we run in
315 * the idle task. 354 * the idle task.
355 *
356 * Similarly, we avoid claiming an SRCU read lock held if the current
357 * CPU is offline.
316 */ 358 */
317#ifdef CONFIG_PREEMPT_COUNT 359#ifdef CONFIG_PREEMPT_COUNT
318static inline int rcu_read_lock_sched_held(void) 360static inline int rcu_read_lock_sched_held(void)
@@ -323,6 +365,8 @@ static inline int rcu_read_lock_sched_held(void)
323 return 1; 365 return 1;
324 if (rcu_is_cpu_idle()) 366 if (rcu_is_cpu_idle())
325 return 0; 367 return 0;
368 if (!rcu_lockdep_current_cpu_online())
369 return 0;
326 if (debug_locks) 370 if (debug_locks)
327 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 371 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
328 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 372 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
@@ -381,8 +425,22 @@ extern int rcu_my_thread_group_empty(void);
381 } \ 425 } \
382 } while (0) 426 } while (0)
383 427
428#if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
429static inline void rcu_preempt_sleep_check(void)
430{
431 rcu_lockdep_assert(!lock_is_held(&rcu_lock_map),
432 "Illegal context switch in RCU read-side "
433 "critical section");
434}
435#else /* #ifdef CONFIG_PROVE_RCU */
436static inline void rcu_preempt_sleep_check(void)
437{
438}
439#endif /* #else #ifdef CONFIG_PROVE_RCU */
440
384#define rcu_sleep_check() \ 441#define rcu_sleep_check() \
385 do { \ 442 do { \
443 rcu_preempt_sleep_check(); \
386 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ 444 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \
387 "Illegal context switch in RCU-bh" \ 445 "Illegal context switch in RCU-bh" \
388 " read-side critical section"); \ 446 " read-side critical section"); \
@@ -470,6 +528,13 @@ extern int rcu_my_thread_group_empty(void);
470 * NULL. Although rcu_access_pointer() may also be used in cases where 528 * NULL. Although rcu_access_pointer() may also be used in cases where
471 * update-side locks prevent the value of the pointer from changing, you 529 * update-side locks prevent the value of the pointer from changing, you
472 * should instead use rcu_dereference_protected() for this use case. 530 * should instead use rcu_dereference_protected() for this use case.
531 *
532 * It is also permissible to use rcu_access_pointer() when read-side
533 * access to the pointer was removed at least one grace period ago, as
534 * is the case in the context of the RCU callback that is freeing up
535 * the data, or after a synchronize_rcu() returns. This can be useful
536 * when tearing down multi-linked structures after a grace period
537 * has elapsed.
473 */ 538 */
474#define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) 539#define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu)
475 540
@@ -659,6 +724,8 @@ static inline void rcu_read_lock(void)
659 __rcu_read_lock(); 724 __rcu_read_lock();
660 __acquire(RCU); 725 __acquire(RCU);
661 rcu_lock_acquire(&rcu_lock_map); 726 rcu_lock_acquire(&rcu_lock_map);
727 rcu_lockdep_assert(!rcu_is_cpu_idle(),
728 "rcu_read_lock() used illegally while idle");
662} 729}
663 730
664/* 731/*
@@ -678,6 +745,8 @@ static inline void rcu_read_lock(void)
678 */ 745 */
679static inline void rcu_read_unlock(void) 746static inline void rcu_read_unlock(void)
680{ 747{
748 rcu_lockdep_assert(!rcu_is_cpu_idle(),
749 "rcu_read_unlock() used illegally while idle");
681 rcu_lock_release(&rcu_lock_map); 750 rcu_lock_release(&rcu_lock_map);
682 __release(RCU); 751 __release(RCU);
683 __rcu_read_unlock(); 752 __rcu_read_unlock();
@@ -705,6 +774,8 @@ static inline void rcu_read_lock_bh(void)
705 local_bh_disable(); 774 local_bh_disable();
706 __acquire(RCU_BH); 775 __acquire(RCU_BH);
707 rcu_lock_acquire(&rcu_bh_lock_map); 776 rcu_lock_acquire(&rcu_bh_lock_map);
777 rcu_lockdep_assert(!rcu_is_cpu_idle(),
778 "rcu_read_lock_bh() used illegally while idle");
708} 779}
709 780
710/* 781/*
@@ -714,6 +785,8 @@ static inline void rcu_read_lock_bh(void)
714 */ 785 */
715static inline void rcu_read_unlock_bh(void) 786static inline void rcu_read_unlock_bh(void)
716{ 787{
788 rcu_lockdep_assert(!rcu_is_cpu_idle(),
789 "rcu_read_unlock_bh() used illegally while idle");
717 rcu_lock_release(&rcu_bh_lock_map); 790 rcu_lock_release(&rcu_bh_lock_map);
718 __release(RCU_BH); 791 __release(RCU_BH);
719 local_bh_enable(); 792 local_bh_enable();
@@ -737,6 +810,8 @@ static inline void rcu_read_lock_sched(void)
737 preempt_disable(); 810 preempt_disable();
738 __acquire(RCU_SCHED); 811 __acquire(RCU_SCHED);
739 rcu_lock_acquire(&rcu_sched_lock_map); 812 rcu_lock_acquire(&rcu_sched_lock_map);
813 rcu_lockdep_assert(!rcu_is_cpu_idle(),
814 "rcu_read_lock_sched() used illegally while idle");
740} 815}
741 816
742/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 817/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -753,6 +828,8 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
753 */ 828 */
754static inline void rcu_read_unlock_sched(void) 829static inline void rcu_read_unlock_sched(void)
755{ 830{
831 rcu_lockdep_assert(!rcu_is_cpu_idle(),
832 "rcu_read_unlock_sched() used illegally while idle");
756 rcu_lock_release(&rcu_sched_lock_map); 833 rcu_lock_release(&rcu_sched_lock_map);
757 __release(RCU_SCHED); 834 __release(RCU_SCHED);
758 preempt_enable(); 835 preempt_enable();
@@ -841,7 +918,7 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
841 /* See the kfree_rcu() header comment. */ 918 /* See the kfree_rcu() header comment. */
842 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); 919 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));
843 920
844 call_rcu(head, (rcu_callback)offset); 921 kfree_call_rcu(head, (rcu_callback)offset);
845} 922}
846 923
847/** 924/**
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 00b7a5e493d..e93df77176d 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -27,13 +27,9 @@
27 27
28#include <linux/cache.h> 28#include <linux/cache.h>
29 29
30#ifdef CONFIG_RCU_BOOST
31static inline void rcu_init(void) 30static inline void rcu_init(void)
32{ 31{
33} 32}
34#else /* #ifdef CONFIG_RCU_BOOST */
35void rcu_init(void);
36#endif /* #else #ifdef CONFIG_RCU_BOOST */
37 33
38static inline void rcu_barrier_bh(void) 34static inline void rcu_barrier_bh(void)
39{ 35{
@@ -83,6 +79,12 @@ static inline void synchronize_sched_expedited(void)
83 synchronize_sched(); 79 synchronize_sched();
84} 80}
85 81
82static inline void kfree_call_rcu(struct rcu_head *head,
83 void (*func)(struct rcu_head *rcu))
84{
85 call_rcu(head, func);
86}
87
86#ifdef CONFIG_TINY_RCU 88#ifdef CONFIG_TINY_RCU
87 89
88static inline void rcu_preempt_note_context_switch(void) 90static inline void rcu_preempt_note_context_switch(void)
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 67458468f1a..e8ee5dd0854 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -61,6 +61,24 @@ extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void); 61extern void synchronize_sched_expedited(void);
62extern void synchronize_rcu_expedited(void); 62extern void synchronize_rcu_expedited(void);
63 63
64void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
65
66/**
67 * synchronize_rcu_bh_expedited - Brute-force RCU-bh grace period
68 *
69 * Wait for an RCU-bh grace period to elapse, but use a "big hammer"
70 * approach to force the grace period to end quickly. This consumes
71 * significant time on all CPUs and is unfriendly to real-time workloads,
72 * so is thus not recommended for any sort of common-case code. In fact,
73 * if you are using synchronize_rcu_bh_expedited() in a loop, please
74 * restructure your code to batch your updates, and then use a single
75 * synchronize_rcu_bh() instead.
76 *
77 * Note that it is illegal to call this function while holding any lock
78 * that is acquired by a CPU-hotplug notifier. And yes, it is also illegal
79 * to call this function from a CPU-hotplug notifier. Failing to observe
80 * these restriction will result in deadlock.
81 */
64static inline void synchronize_rcu_bh_expedited(void) 82static inline void synchronize_rcu_bh_expedited(void)
65{ 83{
66 synchronize_sched_expedited(); 84 synchronize_sched_expedited();
@@ -83,6 +101,7 @@ extern void rcu_sched_force_quiescent_state(void);
83/* A context switch is a grace period for RCU-sched and RCU-bh. */ 101/* A context switch is a grace period for RCU-sched and RCU-bh. */
84static inline int rcu_blocking_is_gp(void) 102static inline int rcu_blocking_is_gp(void)
85{ 103{
104 might_sleep(); /* Check for RCU read-side critical section. */
86 return num_online_cpus() == 1; 105 return num_online_cpus() == 1;
87} 106}
88 107
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 8abee655622..686f37327a4 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -335,8 +335,11 @@ static inline int copy_regset_to_user(struct task_struct *target,
335{ 335{
336 const struct user_regset *regset = &view->regsets[setno]; 336 const struct user_regset *regset = &view->regsets[setno];
337 337
338 if (!regset->get)
339 return -EOPNOTSUPP;
340
338 if (!access_ok(VERIFY_WRITE, data, size)) 341 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO; 342 return -EFAULT;
340 343
341 return regset->get(target, regset, offset, size, NULL, data); 344 return regset->get(target, regset, offset, size, NULL, data);
342} 345}
@@ -358,8 +361,11 @@ static inline int copy_regset_from_user(struct task_struct *target,
358{ 361{
359 const struct user_regset *regset = &view->regsets[setno]; 362 const struct user_regset *regset = &view->regsets[setno];
360 363
364 if (!regset->set)
365 return -EOPNOTSUPP;
366
361 if (!access_ok(VERIFY_READ, data, size)) 367 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO; 368 return -EFAULT;
363 369
364 return regset->set(target, regset, offset, size, NULL, data); 370 return regset->set(target, regset, offset, size, NULL, data);
365} 371}
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index c9d625ca659..da81af086ea 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -109,12 +109,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
109 * 109 *
110 * returns 0 on success and <0 if the counter->usage will exceed the 110 * returns 0 on success and <0 if the counter->usage will exceed the
111 * counter->limit _locked call expects the counter->lock to be taken 111 * counter->limit _locked call expects the counter->lock to be taken
112 *
113 * charge_nofail works the same, except that it charges the resource
114 * counter unconditionally, and returns < 0 if the after the current
115 * charge we are over limit.
112 */ 116 */
113 117
114int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val); 119 unsigned long val);
116int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter,
123 unsigned long val, struct res_counter **limit_fail_at);
118 124
119/* 125/*
120 * uncharge - tell that some portion of the resource is released 126 * uncharge - tell that some portion of the resource is released
@@ -142,7 +148,10 @@ static inline unsigned long long res_counter_margin(struct res_counter *cnt)
142 unsigned long flags; 148 unsigned long flags;
143 149
144 spin_lock_irqsave(&cnt->lock, flags); 150 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage; 151 if (cnt->limit > cnt->usage)
152 margin = cnt->limit - cnt->usage;
153 else
154 margin = 0;
146 spin_unlock_irqrestore(&cnt->lock, flags); 155 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin; 156 return margin;
148} 157}
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 8e872ead88b..577592ea0ea 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,6 +602,9 @@ struct tcamsg {
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */ 602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1 603#define TCAA_MAX 1
604 604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
605/* End of information exported to user level */ 608/* End of information exported to user level */
606 609
607#ifdef __KERNEL__ 610#ifdef __KERNEL__
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4032ec1cf83..e074e1e54f8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -361,6 +361,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout);
361extern signed long schedule_timeout_killable(signed long timeout); 361extern signed long schedule_timeout_killable(signed long timeout);
362extern signed long schedule_timeout_uninterruptible(signed long timeout); 362extern signed long schedule_timeout_uninterruptible(signed long timeout);
363asmlinkage void schedule(void); 363asmlinkage void schedule(void);
364extern void schedule_preempt_disabled(void);
364extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); 365extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
365 366
366struct nsproxy; 367struct nsproxy;
@@ -905,6 +906,7 @@ struct sched_group_power {
905 * single CPU. 906 * single CPU.
906 */ 907 */
907 unsigned int power, power_orig; 908 unsigned int power, power_orig;
909 unsigned long next_update;
908 /* 910 /*
909 * Number of busy cpus in this group. 911 * Number of busy cpus in this group.
910 */ 912 */
@@ -1052,6 +1054,8 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
1052unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); 1054unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
1053unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); 1055unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
1054 1056
1057bool cpus_share_cache(int this_cpu, int that_cpu);
1058
1055#else /* CONFIG_SMP */ 1059#else /* CONFIG_SMP */
1056 1060
1057struct sched_domain_attr; 1061struct sched_domain_attr;
@@ -1061,6 +1065,12 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
1061 struct sched_domain_attr *dattr_new) 1065 struct sched_domain_attr *dattr_new)
1062{ 1066{
1063} 1067}
1068
1069static inline bool cpus_share_cache(int this_cpu, int that_cpu)
1070{
1071 return true;
1072}
1073
1064#endif /* !CONFIG_SMP */ 1074#endif /* !CONFIG_SMP */
1065 1075
1066 1076
@@ -1225,6 +1235,12 @@ struct sched_rt_entity {
1225#endif 1235#endif
1226}; 1236};
1227 1237
1238/*
1239 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
1240 * Timeslices get refilled after they expire.
1241 */
1242#define RR_TIMESLICE (100 * HZ / 1000)
1243
1228struct rcu_node; 1244struct rcu_node;
1229 1245
1230enum perf_event_task_context { 1246enum perf_event_task_context {
@@ -1319,6 +1335,11 @@ struct task_struct {
1319 unsigned sched_reset_on_fork:1; 1335 unsigned sched_reset_on_fork:1;
1320 unsigned sched_contributes_to_load:1; 1336 unsigned sched_contributes_to_load:1;
1321 1337
1338#ifdef CONFIG_GENERIC_HARDIRQS
1339 /* IRQ handler threads */
1340 unsigned irq_thread:1;
1341#endif
1342
1322 pid_t pid; 1343 pid_t pid;
1323 pid_t tgid; 1344 pid_t tgid;
1324 1345
@@ -1427,11 +1448,6 @@ struct task_struct {
1427 * mempolicy */ 1448 * mempolicy */
1428 spinlock_t alloc_lock; 1449 spinlock_t alloc_lock;
1429 1450
1430#ifdef CONFIG_GENERIC_HARDIRQS
1431 /* IRQ handler threads */
1432 struct irqaction *irqaction;
1433#endif
1434
1435 /* Protection of the PI data structures: */ 1451 /* Protection of the PI data structures: */
1436 raw_spinlock_t pi_lock; 1452 raw_spinlock_t pi_lock;
1437 1453
@@ -1777,7 +1793,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1777/* 1793/*
1778 * Per process flags 1794 * Per process flags
1779 */ 1795 */
1780#define PF_STARTING 0x00000002 /* being created */
1781#define PF_EXITING 0x00000004 /* getting shut down */ 1796#define PF_EXITING 0x00000004 /* getting shut down */
1782#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1797#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1783#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1798#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
@@ -1864,8 +1879,7 @@ extern void task_clear_jobctl_pending(struct task_struct *task,
1864#ifdef CONFIG_PREEMPT_RCU 1879#ifdef CONFIG_PREEMPT_RCU
1865 1880
1866#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ 1881#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1867#define RCU_READ_UNLOCK_BOOSTED (1 << 1) /* boosted while in RCU read-side. */ 1882#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1868#define RCU_READ_UNLOCK_NEED_QS (1 << 2) /* RCU core needs CPU response. */
1869 1883
1870static inline void rcu_copy_process(struct task_struct *p) 1884static inline void rcu_copy_process(struct task_struct *p)
1871{ 1885{
@@ -2049,7 +2063,7 @@ extern void sched_autogroup_fork(struct signal_struct *sig);
2049extern void sched_autogroup_exit(struct signal_struct *sig); 2063extern void sched_autogroup_exit(struct signal_struct *sig);
2050#ifdef CONFIG_PROC_FS 2064#ifdef CONFIG_PROC_FS
2051extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); 2065extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m);
2052extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice); 2066extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice);
2053#endif 2067#endif
2054#else 2068#else
2055static inline void sched_autogroup_create_attach(struct task_struct *p) { } 2069static inline void sched_autogroup_create_attach(struct task_struct *p) { }
@@ -2066,12 +2080,20 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice;
2066extern int rt_mutex_getprio(struct task_struct *p); 2080extern int rt_mutex_getprio(struct task_struct *p);
2067extern void rt_mutex_setprio(struct task_struct *p, int prio); 2081extern void rt_mutex_setprio(struct task_struct *p, int prio);
2068extern void rt_mutex_adjust_pi(struct task_struct *p); 2082extern void rt_mutex_adjust_pi(struct task_struct *p);
2083static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2084{
2085 return tsk->pi_blocked_on != NULL;
2086}
2069#else 2087#else
2070static inline int rt_mutex_getprio(struct task_struct *p) 2088static inline int rt_mutex_getprio(struct task_struct *p)
2071{ 2089{
2072 return p->normal_prio; 2090 return p->normal_prio;
2073} 2091}
2074# define rt_mutex_adjust_pi(p) do { } while (0) 2092# define rt_mutex_adjust_pi(p) do { } while (0)
2093static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2094{
2095 return false;
2096}
2075#endif 2097#endif
2076 2098
2077extern bool yield_to(struct task_struct *p, bool preempt); 2099extern bool yield_to(struct task_struct *p, bool preempt);
@@ -2088,9 +2110,9 @@ extern int sched_setscheduler_nocheck(struct task_struct *, int,
2088extern struct task_struct *idle_task(int cpu); 2110extern struct task_struct *idle_task(int cpu);
2089/** 2111/**
2090 * is_idle_task - is the specified task an idle task? 2112 * is_idle_task - is the specified task an idle task?
2091 * @tsk: the task in question. 2113 * @p: the task in question.
2092 */ 2114 */
2093static inline bool is_idle_task(struct task_struct *p) 2115static inline bool is_idle_task(const struct task_struct *p)
2094{ 2116{
2095 return p->pid == 0; 2117 return p->pid == 0;
2096} 2118}
@@ -2259,6 +2281,12 @@ static inline void mmdrop(struct mm_struct * mm)
2259extern void mmput(struct mm_struct *); 2281extern void mmput(struct mm_struct *);
2260/* Grab a reference to a task's mm, if it is not already going away */ 2282/* Grab a reference to a task's mm, if it is not already going away */
2261extern struct mm_struct *get_task_mm(struct task_struct *task); 2283extern struct mm_struct *get_task_mm(struct task_struct *task);
2284/*
2285 * Grab a reference to a task's mm, if it is not already going away
2286 * and ptrace_may_access with the mode parameter passed to it
2287 * succeeds.
2288 */
2289extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode);
2262/* Remove the current tasks stale references to the old mm_struct */ 2290/* Remove the current tasks stale references to the old mm_struct */
2263extern void mm_release(struct task_struct *, struct mm_struct *); 2291extern void mm_release(struct task_struct *, struct mm_struct *);
2264/* Allocate a new mm structure and copy contents from tsk->mm */ 2292/* Allocate a new mm structure and copy contents from tsk->mm */
@@ -2365,7 +2393,7 @@ static inline int thread_group_empty(struct task_struct *p)
2365 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2393 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2366 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2394 * subscriptions and synchronises with wait4(). Also used in procfs. Also
2367 * pins the final release of task.io_context. Also protects ->cpuset and 2395 * pins the final release of task.io_context. Also protects ->cpuset and
2368 * ->cgroup.subsys[]. 2396 * ->cgroup.subsys[]. And ->vfork_done.
2369 * 2397 *
2370 * Nests both inside and outside of read_lock(&tasklist_lock). 2398 * Nests both inside and outside of read_lock(&tasklist_lock).
2371 * It must not be nested with write_lock_irq(&tasklist_lock), 2399 * It must not be nested with write_lock_irq(&tasklist_lock),
@@ -2384,12 +2412,15 @@ static inline void task_unlock(struct task_struct *p)
2384extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, 2412extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
2385 unsigned long *flags); 2413 unsigned long *flags);
2386 2414
2387#define lock_task_sighand(tsk, flags) \ 2415static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
2388({ struct sighand_struct *__ss; \ 2416 unsigned long *flags)
2389 __cond_lock(&(tsk)->sighand->siglock, \ 2417{
2390 (__ss = __lock_task_sighand(tsk, flags))); \ 2418 struct sighand_struct *ret;
2391 __ss; \ 2419
2392}) \ 2420 ret = __lock_task_sighand(tsk, flags);
2421 (void)__cond_lock(&tsk->sighand->siglock, ret);
2422 return ret;
2423}
2393 2424
2394static inline void unlock_task_sighand(struct task_struct *tsk, 2425static inline void unlock_task_sighand(struct task_struct *tsk,
2395 unsigned long *flags) 2426 unsigned long *flags)
diff --git a/include/linux/security.h b/include/linux/security.h
index 83c18e8c846..c8949385e56 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -812,7 +812,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
812 * Check permissions before connecting or sending datagrams from @sock to 812 * Check permissions before connecting or sending datagrams from @sock to
813 * @other. 813 * @other.
814 * @sock contains the socket structure. 814 * @sock contains the socket structure.
815 * @sock contains the peer socket structure. 815 * @other contains the peer socket structure.
816 * Return 0 if permission is granted. 816 * Return 0 if permission is granted.
817 * 817 *
818 * The @unix_stream_connect and @unix_may_send hooks were necessary because 818 * The @unix_stream_connect and @unix_may_send hooks were necessary because
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 3d86517fe7d..441980ecc4e 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -152,8 +152,8 @@ struct serial_uart_config {
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 153
154#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) 154#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 155#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 156 ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
158#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) 158#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
159#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) 159#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
deleted file mode 100644
index e811a615f69..00000000000
--- a/include/linux/serialP.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * Private header file for the (dumb) serial driver
3 *
4 * Copyright (C) 1997 by Theodore Ts'o.
5 *
6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL)
8 */
9
10#ifndef _LINUX_SERIALP_H
11#define _LINUX_SERIALP_H
12
13/*
14 * This is our internal structure for each serial port's state.
15 *
16 * Many fields are paralleled by the structure used by the serial_struct
17 * structure.
18 *
19 * For definitions of the flags field, see tty.h
20 */
21
22#include <linux/termios.h>
23#include <linux/workqueue.h>
24#include <linux/interrupt.h>
25#include <linux/circ_buf.h>
26#include <linux/wait.h>
27
28struct serial_state {
29 int magic;
30 int baud_base;
31 unsigned long port;
32 int irq;
33 int flags;
34 int hub6;
35 int type;
36 int line;
37 int revision; /* Chip revision (950) */
38 int xmit_fifo_size;
39 int custom_divisor;
40 int count;
41 u8 *iomem_base;
42 u16 iomem_reg_shift;
43 unsigned short close_delay;
44 unsigned short closing_wait; /* time to wait before closing */
45 struct async_icount icount;
46 int io_type;
47 struct async_struct *info;
48 struct pci_dev *dev;
49};
50
51struct async_struct {
52 int magic;
53 unsigned long port;
54 int hub6;
55 int flags;
56 int xmit_fifo_size;
57 struct serial_state *state;
58 struct tty_struct *tty;
59 int read_status_mask;
60 int ignore_status_mask;
61 int timeout;
62 int quot;
63 int x_char; /* xon/xoff character */
64 int close_delay;
65 unsigned short closing_wait;
66 unsigned short closing_wait2; /* obsolete */
67 int IER; /* Interrupt Enable Register */
68 int MCR; /* Modem control register */
69 int LCR; /* Line control register */
70 int ACR; /* 16950 Additional Control Reg. */
71 unsigned long event;
72 unsigned long last_active;
73 int line;
74 int blocked_open; /* # of blocked opens */
75 struct circ_buf xmit;
76 spinlock_t xmit_lock;
77 u8 *iomem_base;
78 u16 iomem_reg_shift;
79 int io_type;
80 struct work_struct work;
81 struct tasklet_struct tlet;
82#ifdef DECLARE_WAITQUEUE
83 wait_queue_head_t open_wait;
84 wait_queue_head_t close_wait;
85 wait_queue_head_t delta_msr_wait;
86#else
87 struct wait_queue *open_wait;
88 struct wait_queue *close_wait;
89 struct wait_queue *delta_msr_wait;
90#endif
91 struct async_struct *next_port; /* For the linked list */
92 struct async_struct *prev_port;
93};
94
95#define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
96
97#define SERIAL_MAGIC 0x5301
98#define SSTATE_MAGIC 0x5302
99
100/*
101 * Events are used to schedule things to happen at timer-interrupt
102 * time, instead of at rs interrupt time.
103 */
104#define RS_EVENT_WRITE_WAKEUP 0
105
106/*
107 * Multiport serial configuration structure --- internal structure
108 */
109struct rs_multiport_struct {
110 int port1;
111 unsigned char mask1, match1;
112 int port2;
113 unsigned char mask2, match2;
114 int port3;
115 unsigned char mask3, match3;
116 int port4;
117 unsigned char mask4, match4;
118 int port_monitor;
119};
120
121#if defined(__alpha__) && !defined(CONFIG_PCI)
122/*
123 * Digital did something really horribly wrong with the OUT1 and OUT2
124 * lines on at least some ALPHA's. The failure mode is that if either
125 * is cleared, the machine locks up with endless interrupts.
126 *
127 * This is still used by arch/mips/au1000/common/serial.c for some weird
128 * reason (mips != alpha!)
129 */
130#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
131#elif defined(CONFIG_SBC8560)
132/*
133 * WindRiver did something similarly broken on their SBC8560 board. The
134 * UART tristates its IRQ output while OUT2 is clear, but they pulled
135 * the interrupt line _up_ instead of down, so if we register the IRQ
136 * while the UART is in that state, we die in an IRQ storm. */
137#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2)
138#else
139#define ALPHA_KLUDGE_MCR 0
140#endif
141
142#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c91ace70c21..f51bf2e70c6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -210,6 +210,8 @@
210/* Atheros AR933X SoC */ 210/* Atheros AR933X SoC */
211#define PORT_AR933X 99 211#define PORT_AR933X 99
212 212
213/* Energy Micro efm32 SoC */
214#define PORT_EFMUART 100
213 215
214#ifdef __KERNEL__ 216#ifdef __KERNEL__
215 217
@@ -381,6 +383,16 @@ struct uart_port {
381 void *private_data; /* generic platform data pointer */ 383 void *private_data; /* generic platform data pointer */
382}; 384};
383 385
386static inline int serial_port_in(struct uart_port *up, int offset)
387{
388 return up->serial_in(up, offset);
389}
390
391static inline void serial_port_out(struct uart_port *up, int offset, int value)
392{
393 up->serial_out(up, offset, value);
394}
395
384/* 396/*
385 * This is the state information which is persistent across opens. 397 * This is the state information which is persistent across opens.
386 */ 398 */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index 8cd7fe59cf1..425450b980b 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -70,6 +70,7 @@ struct sh_dmae_pdata {
70 unsigned int needs_tend_set:1; 70 unsigned int needs_tend_set:1;
71 unsigned int no_dmars:1; 71 unsigned int no_dmars:1;
72 unsigned int chclr_present:1; 72 unsigned int chclr_present:1;
73 unsigned int slave_only:1;
73}; 74};
74 75
75/* DMA register */ 76/* DMA register */
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index 2076acf8294..b17d765ded8 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -20,6 +20,7 @@ struct sh_eth_plat_data {
20 unsigned char mac_addr[6]; 20 unsigned char mac_addr[6];
21 unsigned no_ether_link:1; 21 unsigned no_ether_link:1;
22 unsigned ether_link_active_low:1; 22 unsigned ether_link_active_low:1;
23 unsigned needs_init:1;
23}; 24};
24 25
25#endif 26#endif
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index e4c711c6f32..79ab2555b3b 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -48,6 +48,7 @@ extern struct file *shmem_file_setup(const char *name,
48 loff_t size, unsigned long flags); 48 loff_t size, unsigned long flags);
49extern int shmem_zero_setup(struct vm_area_struct *); 49extern int shmem_zero_setup(struct vm_area_struct *);
50extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 50extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
51extern void shmem_unlock_mapping(struct address_space *mapping);
51extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 52extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
52 pgoff_t index, gfp_t gfp_mask); 53 pgoff_t index, gfp_t gfp_mask);
53extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); 54extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 3ff4961da9b..247399b2979 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -61,13 +61,16 @@ static inline void signalfd_notify(struct task_struct *tsk, int sig)
61 wake_up(&tsk->sighand->signalfd_wqh); 61 wake_up(&tsk->sighand->signalfd_wqh);
62} 62}
63 63
64extern void signalfd_cleanup(struct sighand_struct *sighand);
65
64#else /* CONFIG_SIGNALFD */ 66#else /* CONFIG_SIGNALFD */
65 67
66static inline void signalfd_notify(struct task_struct *tsk, int sig) { } 68static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
67 69
70static inline void signalfd_cleanup(struct sighand_struct *sighand) { }
71
68#endif /* CONFIG_SIGNALFD */ 72#endif /* CONFIG_SIGNALFD */
69 73
70#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
71 75
72#endif /* _LINUX_SIGNALFD_H */ 76#endif /* _LINUX_SIGNALFD_H */
73
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 50db9b04a55..a2b9953b582 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -94,6 +94,13 @@
94 * about CHECKSUM_UNNECESSARY. 8) 94 * about CHECKSUM_UNNECESSARY. 8)
95 * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. 95 * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead.
96 * 96 *
97 * UNNECESSARY: device will do per protocol specific csum. Protocol drivers
98 * that do not want net to perform the checksum calculation should use
99 * this flag in their outgoing skbs.
100 * NETIF_F_FCOE_CRC this indicates the device can do FCoE FC CRC
101 * offload. Correspondingly, the FCoE protocol driver
102 * stack should use CHECKSUM_UNNECESSARY.
103 *
97 * Any questions? No questions, good. --ANK 104 * Any questions? No questions, good. --ANK
98 */ 105 */
99 106
@@ -361,6 +368,7 @@ typedef unsigned char *sk_buff_data_t;
361 * ports. 368 * ports.
362 * @wifi_acked_valid: wifi_acked was set 369 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not 370 * @wifi_acked: whether frame was acked on wifi or not
371 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
364 * @dma_cookie: a cookie to one of several possible DMA operations 372 * @dma_cookie: a cookie to one of several possible DMA operations
365 * done by skb DMA functions 373 * done by skb DMA functions
366 * @secmark: security marking 374 * @secmark: security marking
@@ -438,6 +446,11 @@ struct sk_buff {
438#endif 446#endif
439 447
440 int skb_iif; 448 int skb_iif;
449
450 __u32 rxhash;
451
452 __u16 vlan_tci;
453
441#ifdef CONFIG_NET_SCHED 454#ifdef CONFIG_NET_SCHED
442 __u16 tc_index; /* traffic control index */ 455 __u16 tc_index; /* traffic control index */
443#ifdef CONFIG_NET_CLS_ACT 456#ifdef CONFIG_NET_CLS_ACT
@@ -445,8 +458,6 @@ struct sk_buff {
445#endif 458#endif
446#endif 459#endif
447 460
448 __u32 rxhash;
449
450 __u16 queue_mapping; 461 __u16 queue_mapping;
451 kmemcheck_bitfield_begin(flags2); 462 kmemcheck_bitfield_begin(flags2);
452#ifdef CONFIG_IPV6_NDISC_NODETYPE 463#ifdef CONFIG_IPV6_NDISC_NODETYPE
@@ -456,7 +467,8 @@ struct sk_buff {
456 __u8 l4_rxhash:1; 467 __u8 l4_rxhash:1;
457 __u8 wifi_acked_valid:1; 468 __u8 wifi_acked_valid:1;
458 __u8 wifi_acked:1; 469 __u8 wifi_acked:1;
459 /* 10/12 bit hole (depending on ndisc_nodetype presence) */ 470 __u8 no_fcs:1;
471 /* 9/11 bit hole (depending on ndisc_nodetype presence) */
460 kmemcheck_bitfield_end(flags2); 472 kmemcheck_bitfield_end(flags2);
461 473
462#ifdef CONFIG_NET_DMA 474#ifdef CONFIG_NET_DMA
@@ -470,8 +482,6 @@ struct sk_buff {
470 __u32 dropcount; 482 __u32 dropcount;
471 }; 483 };
472 484
473 __u16 vlan_tci;
474
475 sk_buff_data_t transport_header; 485 sk_buff_data_t transport_header;
476 sk_buff_data_t network_header; 486 sk_buff_data_t network_header;
477 sk_buff_data_t mac_header; 487 sk_buff_data_t mac_header;
@@ -876,6 +886,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
876} 886}
877 887
878/** 888/**
889 * skb_peek_next - peek skb following the given one from a queue
890 * @skb: skb to start from
891 * @list_: list to peek at
892 *
893 * Returns %NULL when the end of the list is met or a pointer to the
894 * next element. The reference count is not incremented and the
895 * reference is therefore volatile. Use with caution.
896 */
897static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
898 const struct sk_buff_head *list_)
899{
900 struct sk_buff *next = skb->next;
901 if (next == (struct sk_buff *)list_)
902 next = NULL;
903 return next;
904}
905
906/**
879 * skb_peek_tail - peek at the tail of an &sk_buff_head 907 * skb_peek_tail - peek at the tail of an &sk_buff_head
880 * @list_: list to peek at 908 * @list_: list to peek at
881 * 909 *
@@ -1152,7 +1180,7 @@ static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
1152} 1180}
1153 1181
1154 1182
1155static inline int skb_is_nonlinear(const struct sk_buff *skb) 1183static inline bool skb_is_nonlinear(const struct sk_buff *skb)
1156{ 1184{
1157 return skb->data_len; 1185 return skb->data_len;
1158} 1186}
@@ -1465,6 +1493,16 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1465} 1493}
1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1494#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1467 1495
1496static inline void skb_mac_header_rebuild(struct sk_buff *skb)
1497{
1498 if (skb_mac_header_was_set(skb)) {
1499 const unsigned char *old_mac = skb_mac_header(skb);
1500
1501 skb_set_mac_header(skb, -skb->mac_len);
1502 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
1503 }
1504}
1505
1468static inline int skb_checksum_start_offset(const struct sk_buff *skb) 1506static inline int skb_checksum_start_offset(const struct sk_buff *skb)
1469{ 1507{
1470 return skb->csum_start - skb_headroom(skb); 1508 return skb->csum_start - skb_headroom(skb);
@@ -2045,7 +2083,7 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
2045 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2083 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2046 2084
2047extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2085extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2048 int *peeked, int *err); 2086 int *peeked, int *off, int *err);
2049extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 2087extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
2050 int noblock, int *err); 2088 int noblock, int *err);
2051extern unsigned int datagram_poll(struct file *file, struct socket *sock, 2089extern unsigned int datagram_poll(struct file *file, struct socket *sock,
@@ -2438,12 +2476,12 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2438} 2476}
2439#endif 2477#endif
2440 2478
2441static inline int skb_is_gso(const struct sk_buff *skb) 2479static inline bool skb_is_gso(const struct sk_buff *skb)
2442{ 2480{
2443 return skb_shinfo(skb)->gso_size; 2481 return skb_shinfo(skb)->gso_size;
2444} 2482}
2445 2483
2446static inline int skb_is_gso_v6(const struct sk_buff *skb) 2484static inline bool skb_is_gso_v6(const struct sk_buff *skb)
2447{ 2485{
2448 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 2486 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
2449} 2487}
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index e16557a357e..2e68f5ba038 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -192,7 +192,6 @@ enum
192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ 192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */
193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ 193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */
194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ 194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */
195 LINUX_MIB_TCPLOSS, /* TCPLoss */
196 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ 195 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */
197 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ 196 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */
198 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ 197 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */
@@ -233,6 +232,8 @@ enum
233 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ 232 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */
234 LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ 233 LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */
235 LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ 234 LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */
235 LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */
236 LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */
236 __LINUX_MIB_MAX 237 __LINUX_MIB_MAX
237}; 238};
238 239
diff --git a/include/linux/socket.h b/include/linux/socket.h
index d0e77f607a7..da2d3e2543f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -326,11 +326,11 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
326 int offset, 326 int offset,
327 unsigned int len, __wsum *csump); 327 unsigned int len, __wsum *csump);
328 328
329extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 329extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
330extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 330extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
331extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 331extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
332 int offset, int len); 332 int offset, int len);
333extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); 333extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
334extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 334extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
335 335
336struct timespec; 336struct timespec;
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index e1b005918bb..d3d5fa54f25 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -99,15 +99,18 @@ long srcu_batches_completed(struct srcu_struct *sp);
99 * power mode. This way we can notice an extended quiescent state to 99 * power mode. This way we can notice an extended quiescent state to
100 * other CPUs that started a grace period. Otherwise we would delay any 100 * other CPUs that started a grace period. Otherwise we would delay any
101 * grace period as long as we run in the idle task. 101 * grace period as long as we run in the idle task.
102 *
103 * Similarly, we avoid claiming an SRCU read lock held if the current
104 * CPU is offline.
102 */ 105 */
103static inline int srcu_read_lock_held(struct srcu_struct *sp) 106static inline int srcu_read_lock_held(struct srcu_struct *sp)
104{ 107{
105 if (rcu_is_cpu_idle())
106 return 0;
107
108 if (!debug_lockdep_rcu_enabled()) 108 if (!debug_lockdep_rcu_enabled())
109 return 1; 109 return 1;
110 110 if (rcu_is_cpu_idle())
111 return 0;
112 if (!rcu_lockdep_current_cpu_online())
113 return 0;
111 return lock_is_held(&sp->dep_map); 114 return lock_is_held(&sp->dep_map);
112} 115}
113 116
@@ -169,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
169 int retval = __srcu_read_lock(sp); 172 int retval = __srcu_read_lock(sp);
170 173
171 rcu_lock_acquire(&(sp)->dep_map); 174 rcu_lock_acquire(&(sp)->dep_map);
175 rcu_lockdep_assert(!rcu_is_cpu_idle(),
176 "srcu_read_lock() used illegally while idle");
172 return retval; 177 return retval;
173} 178}
174 179
@@ -182,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
182static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 187static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
183 __releases(sp) 188 __releases(sp)
184{ 189{
190 rcu_lockdep_assert(!rcu_is_cpu_idle(),
191 "srcu_read_unlock() used illegally while idle");
185 rcu_lock_release(&(sp)->dep_map); 192 rcu_lock_release(&(sp)->dep_map);
186 __srcu_read_unlock(sp, idx); 193 __srcu_read_unlock(sp, idx);
187} 194}
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index dcf35b0f303..d2768318002 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -16,6 +16,12 @@ struct pcmcia_device;
16struct ssb_bus; 16struct ssb_bus;
17struct ssb_driver; 17struct ssb_driver;
18 18
19struct ssb_sprom_core_pwr_info {
20 u8 itssi_2g, itssi_5g;
21 u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh;
22 u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4];
23};
24
19struct ssb_sprom { 25struct ssb_sprom {
20 u8 revision; 26 u8 revision;
21 u8 il0mac[6]; /* MAC address for 802.11b/g */ 27 u8 il0mac[6]; /* MAC address for 802.11b/g */
@@ -26,9 +32,12 @@ struct ssb_sprom {
26 u8 et0mdcport; /* MDIO for enet0 */ 32 u8 et0mdcport; /* MDIO for enet0 */
27 u8 et1mdcport; /* MDIO for enet1 */ 33 u8 et1mdcport; /* MDIO for enet1 */
28 u16 board_rev; /* Board revision number from SPROM. */ 34 u16 board_rev; /* Board revision number from SPROM. */
35 u16 board_num; /* Board number from SPROM. */
36 u16 board_type; /* Board type from SPROM. */
29 u8 country_code; /* Country Code */ 37 u8 country_code; /* Country Code */
30 u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */ 38 char alpha2[2]; /* Country Code as two chars like EU or US */
31 u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ 39 u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */
40 u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */
32 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ 41 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
33 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ 42 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
34 u16 pa0b0; 43 u16 pa0b0;
@@ -47,10 +56,10 @@ struct ssb_sprom {
47 u8 gpio1; /* GPIO pin 1 */ 56 u8 gpio1; /* GPIO pin 1 */
48 u8 gpio2; /* GPIO pin 2 */ 57 u8 gpio2; /* GPIO pin 2 */
49 u8 gpio3; /* GPIO pin 3 */ 58 u8 gpio3; /* GPIO pin 3 */
50 u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ 59 u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
51 u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ 60 u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
52 u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ 61 u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
53 u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ 62 u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
54 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 63 u8 itssi_a; /* Idle TSSI Target for A-PHY */
55 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 64 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
56 u8 tri2g; /* 2.4GHz TX isolation */ 65 u8 tri2g; /* 2.4GHz TX isolation */
@@ -61,8 +70,8 @@ struct ssb_sprom {
61 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ 70 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
62 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ 71 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
63 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ 72 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
64 u8 rxpo2g; /* 2GHz RX power offset */ 73 s8 rxpo2g; /* 2GHz RX power offset */
65 u8 rxpo5g; /* 5GHz RX power offset */ 74 s8 rxpo5g; /* 5GHz RX power offset */
66 u8 rssisav2g; /* 2GHz RSSI params */ 75 u8 rssisav2g; /* 2GHz RSSI params */
67 u8 rssismc2g; 76 u8 rssismc2g;
68 u8 rssismf2g; 77 u8 rssismf2g;
@@ -82,16 +91,13 @@ struct ssb_sprom {
82 u16 boardflags2_hi; /* Board flags (bits 48-63) */ 91 u16 boardflags2_hi; /* Board flags (bits 48-63) */
83 /* TODO store board flags in a single u64 */ 92 /* TODO store board flags in a single u64 */
84 93
94 struct ssb_sprom_core_pwr_info core_pwr_info[4];
95
85 /* Antenna gain values for up to 4 antennas 96 /* Antenna gain values for up to 4 antennas
86 * on each band. Values in dBm/4 (Q5.2). Negative gain means the 97 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
87 * loss in the connectors is bigger than the gain. */ 98 * loss in the connectors is bigger than the gain. */
88 struct { 99 struct {
89 struct { 100 s8 a0, a1, a2, a3;
90 s8 a0, a1, a2, a3;
91 } ghz24; /* 2.4GHz band */
92 struct {
93 s8 a0, a1, a2, a3;
94 } ghz5; /* 5GHz band */
95 } antenna_gain; 101 } antenna_gain;
96 102
97 struct { 103 struct {
@@ -103,7 +109,79 @@ struct ssb_sprom {
103 } ghz5; 109 } ghz5;
104 } fem; 110 } fem;
105 111
106 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ 112 u16 mcs2gpo[8];
113 u16 mcs5gpo[8];
114 u16 mcs5glpo[8];
115 u16 mcs5ghpo[8];
116 u8 opo;
117
118 u8 rxgainerr2ga[3];
119 u8 rxgainerr5gla[3];
120 u8 rxgainerr5gma[3];
121 u8 rxgainerr5gha[3];
122 u8 rxgainerr5gua[3];
123
124 u8 noiselvl2ga[3];
125 u8 noiselvl5gla[3];
126 u8 noiselvl5gma[3];
127 u8 noiselvl5gha[3];
128 u8 noiselvl5gua[3];
129
130 u8 regrev;
131 u8 txchain;
132 u8 rxchain;
133 u8 antswitch;
134 u16 cddpo;
135 u16 stbcpo;
136 u16 bw40po;
137 u16 bwduppo;
138
139 u8 tempthresh;
140 u8 tempoffset;
141 u16 rawtempsense;
142 u8 measpower;
143 u8 tempsense_slope;
144 u8 tempcorrx;
145 u8 tempsense_option;
146 u8 freqoffset_corr;
147 u8 iqcal_swp_dis;
148 u8 hw_iqcal_en;
149 u8 elna2g;
150 u8 elna5g;
151 u8 phycal_tempdelta;
152 u8 temps_period;
153 u8 temps_hysteresis;
154 u8 measpower1;
155 u8 measpower2;
156 u8 pcieingress_war;
157
158 /* power per rate from sromrev 9 */
159 u16 cckbw202gpo;
160 u16 cckbw20ul2gpo;
161 u32 legofdmbw202gpo;
162 u32 legofdmbw20ul2gpo;
163 u32 legofdmbw205glpo;
164 u32 legofdmbw20ul5glpo;
165 u32 legofdmbw205gmpo;
166 u32 legofdmbw20ul5gmpo;
167 u32 legofdmbw205ghpo;
168 u32 legofdmbw20ul5ghpo;
169 u32 mcsbw202gpo;
170 u32 mcsbw20ul2gpo;
171 u32 mcsbw402gpo;
172 u32 mcsbw205glpo;
173 u32 mcsbw20ul5glpo;
174 u32 mcsbw405glpo;
175 u32 mcsbw205gmpo;
176 u32 mcsbw20ul5gmpo;
177 u32 mcsbw405gmpo;
178 u32 mcsbw205ghpo;
179 u32 mcsbw20ul5ghpo;
180 u32 mcsbw405ghpo;
181 u16 mcs32po;
182 u16 legofdm40duppo;
183 u8 sar2g;
184 u8 sar5g;
107}; 185};
108 186
109/* Information about the PCB the circuitry is soldered on. */ 187/* Information about the PCB the circuitry is soldered on. */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index c814ae6eeb2..40b1ef8595e 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -449,6 +449,39 @@
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA 451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
452
453/* There are 4 blocks with power info sharing the same layout */
454#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
455#define SSB_SROM8_PWR_INFO_CORE1 0x00E0
456#define SSB_SROM8_PWR_INFO_CORE2 0x0100
457#define SSB_SROM8_PWR_INFO_CORE3 0x0120
458
459#define SSB_SROM8_2G_MAXP_ITSSI 0x00
460#define SSB_SPROM8_2G_MAXP 0x00FF
461#define SSB_SPROM8_2G_ITSSI 0xFF00
462#define SSB_SPROM8_2G_ITSSI_SHIFT 8
463#define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */
464#define SSB_SROM8_2G_PA_1 0x04
465#define SSB_SROM8_2G_PA_2 0x06
466#define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */
467#define SSB_SPROM8_5G_MAXP 0x00FF
468#define SSB_SPROM8_5G_ITSSI 0xFF00
469#define SSB_SPROM8_5G_ITSSI_SHIFT 8
470#define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */
471#define SSB_SPROM8_5GH_MAXP 0x00FF
472#define SSB_SPROM8_5GL_MAXP 0xFF00
473#define SSB_SPROM8_5GL_MAXP_SHIFT 8
474#define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */
475#define SSB_SROM8_5G_PA_1 0x0E
476#define SSB_SROM8_5G_PA_2 0x10
477#define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */
478#define SSB_SROM8_5GL_PA_1 0x14
479#define SSB_SROM8_5GL_PA_2 0x16
480#define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */
481#define SSB_SROM8_5GH_PA_1 0x1A
482#define SSB_SROM8_5GH_PA_2 0x1C
483
484/* TODO: Make it deprecated */
452#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ 485#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
453#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 486#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
454#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 487#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
@@ -473,6 +506,7 @@
473#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ 506#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
474#define SSB_SPROM8_PA1HIB1 0x00DA 507#define SSB_SPROM8_PA1HIB1 0x00DA
475#define SSB_SPROM8_PA1HIB2 0x00DC 508#define SSB_SPROM8_PA1HIB2 0x00DC
509
476#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ 510#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
477#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ 511#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
478#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ 512#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
diff --git a/include/linux/static_key.h b/include/linux/static_key.h
new file mode 100644
index 00000000000..27bd3f8a085
--- /dev/null
+++ b/include/linux/static_key.h
@@ -0,0 +1 @@
#include <linux/jump_label.h>
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h
new file mode 100644
index 00000000000..68e7430bb0f
--- /dev/null
+++ b/include/linux/sunserialcore.h
@@ -0,0 +1,33 @@
1/* sunserialcore.h
2 *
3 * Generic SUN serial/kbd/ms layer. Based entirely
4 * upon drivers/sbus/char/sunserial.h which is:
5 *
6 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
7 *
8 * Port to new UART layer is:
9 *
10 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
11 */
12
13#ifndef _SERIAL_SUN_H
14#define _SERIAL_SUN_H
15
16/* Serial keyboard defines for L1-A processing... */
17#define SUNKBD_RESET 0xff
18#define SUNKBD_L1 0x01
19#define SUNKBD_UP 0x80
20#define SUNKBD_A 0x4d
21
22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *);
23extern int suncore_mouse_baud_detection(unsigned char, int);
24
25extern int sunserial_register_minors(struct uart_driver *, int);
26extern void sunserial_unregister_minors(struct uart_driver *, int);
27
28extern int sunserial_console_match(struct console *, struct device_node *,
29 struct uart_driver *, int, bool);
30extern void sunserial_console_termios(struct console *,
31 struct device_node *);
32
33#endif /* !(_SERIAL_SUN_H) */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 95040cc3310..ac1c114c499 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -42,8 +42,10 @@ enum suspend_stat_step {
42 SUSPEND_FREEZE = 1, 42 SUSPEND_FREEZE = 1,
43 SUSPEND_PREPARE, 43 SUSPEND_PREPARE,
44 SUSPEND_SUSPEND, 44 SUSPEND_SUSPEND,
45 SUSPEND_SUSPEND_LATE,
45 SUSPEND_SUSPEND_NOIRQ, 46 SUSPEND_SUSPEND_NOIRQ,
46 SUSPEND_RESUME_NOIRQ, 47 SUSPEND_RESUME_NOIRQ,
48 SUSPEND_RESUME_EARLY,
47 SUSPEND_RESUME 49 SUSPEND_RESUME
48}; 50};
49 51
@@ -53,8 +55,10 @@ struct suspend_stats {
53 int failed_freeze; 55 int failed_freeze;
54 int failed_prepare; 56 int failed_prepare;
55 int failed_suspend; 57 int failed_suspend;
58 int failed_suspend_late;
56 int failed_suspend_noirq; 59 int failed_suspend_noirq;
57 int failed_resume; 60 int failed_resume;
61 int failed_resume_early;
58 int failed_resume_noirq; 62 int failed_resume_noirq;
59#define REC_FAILED_NUM 2 63#define REC_FAILED_NUM 2
60 int last_failed_dev; 64 int last_failed_dev;
@@ -357,14 +361,29 @@ extern bool pm_save_wakeup_count(unsigned int count);
357 361
358static inline void lock_system_sleep(void) 362static inline void lock_system_sleep(void)
359{ 363{
360 freezer_do_not_count(); 364 current->flags |= PF_FREEZER_SKIP;
361 mutex_lock(&pm_mutex); 365 mutex_lock(&pm_mutex);
362} 366}
363 367
364static inline void unlock_system_sleep(void) 368static inline void unlock_system_sleep(void)
365{ 369{
370 /*
371 * Don't use freezer_count() because we don't want the call to
372 * try_to_freeze() here.
373 *
374 * Reason:
375 * Fundamentally, we just don't need it, because freezing condition
376 * doesn't come into effect until we release the pm_mutex lock,
377 * since the freezer always works with pm_mutex held.
378 *
379 * More importantly, in the case of hibernation,
380 * unlock_system_sleep() gets called in snapshot_read() and
381 * snapshot_write() when the freezing condition is still in effect.
382 * Which means, if we use try_to_freeze() here, it would make them
383 * enter the refrigerator, thus causing hibernation to lockup.
384 */
385 current->flags &= ~PF_FREEZER_SKIP;
366 mutex_unlock(&pm_mutex); 386 mutex_unlock(&pm_mutex);
367 freezer_count();
368} 387}
369 388
370#else /* !CONFIG_PM_SLEEP */ 389#else /* !CONFIG_PM_SLEEP */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 06061a7f8e6..3e60228e729 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -273,7 +273,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
273#endif 273#endif
274 274
275extern int page_evictable(struct page *page, struct vm_area_struct *vma); 275extern int page_evictable(struct page *page, struct vm_area_struct *vma);
276extern void scan_mapping_unevictable_pages(struct address_space *); 276extern void check_move_unevictable_pages(struct page **, int nr_pages);
277 277
278extern unsigned long scan_unevictable_pages; 278extern unsigned long scan_unevictable_pages;
279extern int scan_unevictable_handler(struct ctl_table *, int, 279extern int scan_unevictable_handler(struct ctl_table *, int,
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
new file mode 100644
index 00000000000..2739ccb6957
--- /dev/null
+++ b/include/linux/sys_soc.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson.
4 * License terms: GNU General Public License (GPL), version 2
5 */
6#ifndef __SOC_BUS_H
7#define __SOC_BUS_H
8
9#include <linux/device.h>
10
11struct soc_device_attribute {
12 const char *machine;
13 const char *family;
14 const char *revision;
15 const char *soc_id;
16};
17
18/**
19 * soc_device_register - register SoC as a device
20 * @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC
21 */
22struct soc_device *soc_device_register(
23 struct soc_device_attribute *soc_plat_dev_attr);
24
25/**
26 * soc_device_unregister - unregister SoC device
27 * @dev: SoC device to be unregistered
28 */
29void soc_device_unregister(struct soc_device *soc_dev);
30
31/**
32 * soc_device_to_device - helper function to fetch struct device
33 * @soc: Previously registered SoC device container
34 */
35struct device *soc_device_to_device(struct soc_device *soc);
36
37#endif /* __SOC_BUS_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 515669fa3c1..8ec1153ff57 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -624,7 +624,7 @@ asmlinkage long sys_socketpair(int, int, int, int __user *);
624asmlinkage long sys_socketcall(int call, unsigned long __user *args); 624asmlinkage long sys_socketcall(int call, unsigned long __user *args);
625asmlinkage long sys_listen(int, int); 625asmlinkage long sys_listen(int, int);
626asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 626asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
627 long timeout); 627 int timeout);
628asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 628asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
629 fd_set __user *exp, struct timeval __user *tvp); 629 fd_set __user *exp, struct timeval __user *tvp);
630asmlinkage long sys_old_select(struct sel_arg_struct __user *arg); 630asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
deleted file mode 100644
index 20f63d3e614..00000000000
--- a/include/linux/sysdev.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/**
2 * System devices follow a slightly different driver model.
3 * They don't need to do dynammic driver binding, can't be probed,
4 * and don't reside on any type of peripheral bus.
5 * So, we represent and treat them a little differently.
6 *
7 * We still have a notion of a driver for a system device, because we still
8 * want to perform basic operations on these devices.
9 *
10 * We also support auxiliary drivers binding to devices of a certain class.
11 *
12 * This allows configurable drivers to register themselves for devices of
13 * a certain type. And, it allows class definitions to reside in generic
14 * code while arch-specific code can register specific drivers.
15 *
16 * Auxiliary drivers registered with a NULL cls are registered as drivers
17 * for all system devices, and get notification calls for each device.
18 */
19
20
21#ifndef _SYSDEV_H_
22#define _SYSDEV_H_
23
24#include <linux/kobject.h>
25#include <linux/pm.h>
26
27
28struct sys_device;
29struct sysdev_class_attribute;
30
31struct sysdev_class {
32 const char *name;
33 struct list_head drivers;
34 struct sysdev_class_attribute **attrs;
35 struct kset kset;
36};
37
38struct sysdev_class_attribute {
39 struct attribute attr;
40 ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
41 char *);
42 ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
43 const char *, size_t);
44};
45
46#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
47{ \
48 .attr = {.name = __stringify(_name), .mode = _mode }, \
49 .show = _show, \
50 .store = _store, \
51}
52
53#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
54 struct sysdev_class_attribute attr_##_name = \
55 _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)
56
57
58extern int sysdev_class_register(struct sysdev_class *);
59extern void sysdev_class_unregister(struct sysdev_class *);
60
61extern int sysdev_class_create_file(struct sysdev_class *,
62 struct sysdev_class_attribute *);
63extern void sysdev_class_remove_file(struct sysdev_class *,
64 struct sysdev_class_attribute *);
65/**
66 * Auxiliary system device drivers.
67 */
68
69struct sysdev_driver {
70 struct list_head entry;
71 int (*add)(struct sys_device *);
72 int (*remove)(struct sys_device *);
73};
74
75
76extern int sysdev_driver_register(struct sysdev_class *, struct sysdev_driver *);
77extern void sysdev_driver_unregister(struct sysdev_class *, struct sysdev_driver *);
78
79
80/**
81 * sys_devices can be simplified a lot from regular devices, because they're
82 * simply not as versatile.
83 */
84
85struct sys_device {
86 u32 id;
87 struct sysdev_class * cls;
88 struct kobject kobj;
89};
90
91extern int sysdev_register(struct sys_device *);
92extern void sysdev_unregister(struct sys_device *);
93
94
95struct sysdev_attribute {
96 struct attribute attr;
97 ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *);
98 ssize_t (*store)(struct sys_device *, struct sysdev_attribute *,
99 const char *, size_t);
100};
101
102
103#define _SYSDEV_ATTR(_name, _mode, _show, _store) \
104{ \
105 .attr = { .name = __stringify(_name), .mode = _mode }, \
106 .show = _show, \
107 .store = _store, \
108}
109
110#define SYSDEV_ATTR(_name, _mode, _show, _store) \
111 struct sysdev_attribute attr_##_name = \
112 _SYSDEV_ATTR(_name, _mode, _show, _store);
113
114extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
115extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
116
117/* Create/remove NULL terminated attribute list */
118static inline int
119sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a)
120{
121 return sysfs_create_files(&d->kobj, (const struct attribute **)a);
122}
123
124static inline void
125sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a)
126{
127 return sysfs_remove_files(&d->kobj, (const struct attribute **)a);
128}
129
130struct sysdev_ext_attribute {
131 struct sysdev_attribute attr;
132 void *var;
133};
134
135/*
136 * Support for simple variable sysdev attributes.
137 * The pointer to the variable is stored in a sysdev_ext_attribute
138 */
139
140/* Add more types as needed */
141
142extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *,
143 char *);
144extern ssize_t sysdev_store_ulong(struct sys_device *,
145 struct sysdev_attribute *, const char *, size_t);
146extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *,
147 char *);
148extern ssize_t sysdev_store_int(struct sys_device *,
149 struct sysdev_attribute *, const char *, size_t);
150
151#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \
152 { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \
153 &(_var) }
154#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \
155 struct sysdev_ext_attribute attr_##_name = \
156 _SYSDEV_ULONG_ATTR(_name, _mode, _var);
157#define _SYSDEV_INT_ATTR(_name, _mode, _var) \
158 { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \
159 &(_var) }
160#define SYSDEV_INT_ATTR(_name, _mode, _var) \
161 struct sysdev_ext_attribute attr_##_name = \
162 _SYSDEV_INT_ATTR(_name, _mode, _var);
163
164#endif /* _SYSDEV_H_ */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 46a85c9e1f2..b6c62d29438 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -412,7 +412,8 @@ struct tcp_sock {
412 412
413 struct tcp_sack_block recv_sack_cache[4]; 413 struct tcp_sack_block recv_sack_cache[4];
414 414
415 struct sk_buff *highest_sack; /* highest skb with SACK received 415 struct sk_buff *highest_sack; /* skb just after the highest
416 * skb with SACKed bit set
416 * (validity guaranteed only if 417 * (validity guaranteed only if
417 * sacked_out > 0) 418 * sacked_out > 0)
418 */ 419 */
@@ -463,7 +464,7 @@ struct tcp_sock {
463 const struct tcp_sock_af_ops *af_specific; 464 const struct tcp_sock_af_ops *af_specific;
464 465
465/* TCP MD5 Signature Option information */ 466/* TCP MD5 Signature Option information */
466 struct tcp_md5sig_info *md5sig_info; 467 struct tcp_md5sig_info __rcu *md5sig_info;
467#endif 468#endif
468 469
469 /* When the cookie options are generated and exchanged, then this 470 /* When the cookie options are generated and exchanged, then this
@@ -486,8 +487,7 @@ struct tcp_timewait_sock {
486 u32 tw_ts_recent; 487 u32 tw_ts_recent;
487 long tw_ts_recent_stamp; 488 long tw_ts_recent_stamp;
488#ifdef CONFIG_TCP_MD5SIG 489#ifdef CONFIG_TCP_MD5SIG
489 u16 tw_md5_keylen; 490 struct tcp_md5sig_key *tw_md5_key;
490 u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN];
491#endif 491#endif
492 /* Few sockets in timewait have cookies; in that case, then this 492 /* Few sockets in timewait have cookies; in that case, then this
493 * object holds a reference to them (tw_cookie_values->kref). 493 * object holds a reference to them (tw_cookie_values->kref).
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 47b4a27e6e9..796f1ff0388 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -152,9 +152,9 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
152void thermal_cooling_device_unregister(struct thermal_cooling_device *); 152void thermal_cooling_device_unregister(struct thermal_cooling_device *);
153 153
154#ifdef CONFIG_NET 154#ifdef CONFIG_NET
155extern int generate_netlink_event(u32 orig, enum events event); 155extern int thermal_generate_netlink_event(u32 orig, enum events event);
156#else 156#else
157static inline int generate_netlink_event(u32 orig, enum events event) 157static inline int thermal_generate_netlink_event(u32 orig, enum events event)
158{ 158{
159 return 0; 159 return 0;
160} 160}
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa60fe7b6ed..b75e1864ed1 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -234,23 +234,9 @@ struct timex {
234extern unsigned long tick_usec; /* USER_HZ period (usec) */ 234extern unsigned long tick_usec; /* USER_HZ period (usec) */
235extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 235extern unsigned long tick_nsec; /* ACTHZ period (nsec) */
236 236
237/*
238 * phase-lock loop variables
239 */
240extern int time_status; /* clock synchronization status bits */
241
242extern void ntp_init(void); 237extern void ntp_init(void);
243extern void ntp_clear(void); 238extern void ntp_clear(void);
244 239
245/**
246 * ntp_synced - Returns 1 if the NTP status is not UNSYNC
247 *
248 */
249static inline int ntp_synced(void)
250{
251 return !(time_status & STA_UNSYNC);
252}
253
254/* Required to safely shift negative values */ 240/* Required to safely shift negative values */
255#define shift_right(x, s) ({ \ 241#define shift_right(x, s) ({ \
256 __typeof__(x) __x = (x); \ 242 __typeof__(x) __x = (x); \
@@ -264,10 +250,9 @@ static inline int ntp_synced(void)
264#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 250#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
265 251
266/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
267extern u64 tick_length; 253extern u64 ntp_tick_length(void);
268 254
269extern void second_overflow(void); 255extern void second_overflow(void);
270extern void update_ntp_one_tick(void);
271extern int do_adjtimex(struct timex *); 256extern int do_adjtimex(struct timex *);
272extern void hardpps(const struct timespec *, const struct timespec *); 257extern void hardpps(const struct timespec *, const struct timespec *);
273 258
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index df0a779c1bb..bd96ecd0e05 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
20#include <linux/jump_label.h> 20#include <linux/static_key.h>
21 21
22struct module; 22struct module;
23struct tracepoint; 23struct tracepoint;
@@ -29,7 +29,7 @@ struct tracepoint_func {
29 29
30struct tracepoint { 30struct tracepoint {
31 const char *name; /* Tracepoint name */ 31 const char *name; /* Tracepoint name */
32 struct jump_label_key key; 32 struct static_key key;
33 void (*regfunc)(void); 33 void (*regfunc)(void);
34 void (*unregfunc)(void); 34 void (*unregfunc)(void);
35 struct tracepoint_func __rcu *funcs; 35 struct tracepoint_func __rcu *funcs;
@@ -114,7 +114,7 @@ static inline void tracepoint_synchronize_unregister(void)
114 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just 114 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
115 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". 115 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
116 */ 116 */
117#define __DO_TRACE(tp, proto, args, cond) \ 117#define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) \
118 do { \ 118 do { \
119 struct tracepoint_func *it_func_ptr; \ 119 struct tracepoint_func *it_func_ptr; \
120 void *it_func; \ 120 void *it_func; \
@@ -122,6 +122,7 @@ static inline void tracepoint_synchronize_unregister(void)
122 \ 122 \
123 if (!(cond)) \ 123 if (!(cond)) \
124 return; \ 124 return; \
125 prercu; \
125 rcu_read_lock_sched_notrace(); \ 126 rcu_read_lock_sched_notrace(); \
126 it_func_ptr = rcu_dereference_sched((tp)->funcs); \ 127 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
127 if (it_func_ptr) { \ 128 if (it_func_ptr) { \
@@ -132,6 +133,7 @@ static inline void tracepoint_synchronize_unregister(void)
132 } while ((++it_func_ptr)->func); \ 133 } while ((++it_func_ptr)->func); \
133 } \ 134 } \
134 rcu_read_unlock_sched_notrace(); \ 135 rcu_read_unlock_sched_notrace(); \
136 postrcu; \
135 } while (0) 137 } while (0)
136 138
137/* 139/*
@@ -139,15 +141,25 @@ static inline void tracepoint_synchronize_unregister(void)
139 * not add unwanted padding between the beginning of the section and the 141 * not add unwanted padding between the beginning of the section and the
140 * structure. Force alignment to the same alignment as the section start. 142 * structure. Force alignment to the same alignment as the section start.
141 */ 143 */
142#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 144#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
143 extern struct tracepoint __tracepoint_##name; \ 145 extern struct tracepoint __tracepoint_##name; \
144 static inline void trace_##name(proto) \ 146 static inline void trace_##name(proto) \
145 { \ 147 { \
148 if (static_key_false(&__tracepoint_##name.key)) \
149 __DO_TRACE(&__tracepoint_##name, \
150 TP_PROTO(data_proto), \
151 TP_ARGS(data_args), \
152 TP_CONDITION(cond),,); \
153 } \
154 static inline void trace_##name##_rcuidle(proto) \
155 { \
146 if (static_branch(&__tracepoint_##name.key)) \ 156 if (static_branch(&__tracepoint_##name.key)) \
147 __DO_TRACE(&__tracepoint_##name, \ 157 __DO_TRACE(&__tracepoint_##name, \
148 TP_PROTO(data_proto), \ 158 TP_PROTO(data_proto), \
149 TP_ARGS(data_args), \ 159 TP_ARGS(data_args), \
150 TP_CONDITION(cond)); \ 160 TP_CONDITION(cond), \
161 rcu_idle_exit(), \
162 rcu_idle_enter()); \
151 } \ 163 } \
152 static inline int \ 164 static inline int \
153 register_trace_##name(void (*probe)(data_proto), void *data) \ 165 register_trace_##name(void (*probe)(data_proto), void *data) \
@@ -176,7 +188,7 @@ static inline void tracepoint_synchronize_unregister(void)
176 __attribute__((section("__tracepoints_strings"))) = #name; \ 188 __attribute__((section("__tracepoints_strings"))) = #name; \
177 struct tracepoint __tracepoint_##name \ 189 struct tracepoint __tracepoint_##name \
178 __attribute__((section("__tracepoints"))) = \ 190 __attribute__((section("__tracepoints"))) = \
179 { __tpstrtab_##name, JUMP_LABEL_INIT, reg, unreg, NULL };\ 191 { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
180 static struct tracepoint * const __tracepoint_ptr_##name __used \ 192 static struct tracepoint * const __tracepoint_ptr_##name __used \
181 __attribute__((section("__tracepoints_ptrs"))) = \ 193 __attribute__((section("__tracepoints_ptrs"))) = \
182 &__tracepoint_##name; 194 &__tracepoint_##name;
@@ -190,9 +202,11 @@ static inline void tracepoint_synchronize_unregister(void)
190 EXPORT_SYMBOL(__tracepoint_##name) 202 EXPORT_SYMBOL(__tracepoint_##name)
191 203
192#else /* !CONFIG_TRACEPOINTS */ 204#else /* !CONFIG_TRACEPOINTS */
193#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 205#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
194 static inline void trace_##name(proto) \ 206 static inline void trace_##name(proto) \
195 { } \ 207 { } \
208 static inline void trace_##name##_rcuidle(proto) \
209 { } \
196 static inline int \ 210 static inline int \
197 register_trace_##name(void (*probe)(data_proto), \ 211 register_trace_##name(void (*probe)(data_proto), \
198 void *data) \ 212 void *data) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5dbb3cb05a8..a91ff403b3b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -52,6 +52,7 @@
52 * hardcoded at present.) 52 * hardcoded at present.)
53 */ 53 */
54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
55#define NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */
55#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 56#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
56 57
57/* 58/*
@@ -480,10 +481,11 @@ extern void free_tty_struct(struct tty_struct *tty);
480extern void initialize_tty_struct(struct tty_struct *tty, 481extern void initialize_tty_struct(struct tty_struct *tty,
481 struct tty_driver *driver, int idx); 482 struct tty_driver *driver, int idx);
482extern void deinitialize_tty_struct(struct tty_struct *tty); 483extern void deinitialize_tty_struct(struct tty_struct *tty);
483extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, 484extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
484 int first_ok);
485extern int tty_release(struct inode *inode, struct file *filp); 485extern int tty_release(struct inode *inode, struct file *filp);
486extern int tty_init_termios(struct tty_struct *tty); 486extern int tty_init_termios(struct tty_struct *tty);
487extern int tty_standard_install(struct tty_driver *driver,
488 struct tty_struct *tty);
487 489
488extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); 490extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
489extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); 491extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 5cf685086dd..6e6dbb7447b 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -50,6 +50,8 @@
50 * Note that tty_shutdown() is not called if ops->shutdown is defined. 50 * Note that tty_shutdown() is not called if ops->shutdown is defined.
51 * This means one is responsible to take care of calling ops->remove (e.g. 51 * This means one is responsible to take care of calling ops->remove (e.g.
52 * via tty_driver_remove_tty) and releasing tty->termios. 52 * via tty_driver_remove_tty) and releasing tty->termios.
53 * Note that this hook may be called from *all* the contexts where one
54 * uses tty refcounting (e.g. tty_port_tty_get).
53 * 55 *
54 * 56 *
55 * void (*cleanup)(struct tty_struct * tty); 57 * void (*cleanup)(struct tty_struct * tty);
@@ -234,6 +236,7 @@
234 * if provided (otherwise EINVAL will be returned). 236 * if provided (otherwise EINVAL will be returned).
235 */ 237 */
236 238
239#include <linux/export.h>
237#include <linux/fs.h> 240#include <linux/fs.h>
238#include <linux/list.h> 241#include <linux/list.h>
239#include <linux/cdev.h> 242#include <linux/cdev.h>
@@ -298,7 +301,6 @@ struct tty_driver {
298 int name_base; /* offset of printed name */ 301 int name_base; /* offset of printed name */
299 int major; /* major device number */ 302 int major; /* major device number */
300 int minor_start; /* start of minor device number */ 303 int minor_start; /* start of minor device number */
301 int minor_num; /* number of *possible* devices */
302 int num; /* number of devices allocated */ 304 int num; /* number of devices allocated */
303 short type; /* type of tty driver */ 305 short type; /* type of tty driver */
304 short subtype; /* subtype of tty driver */ 306 short subtype; /* subtype of tty driver */
@@ -324,7 +326,7 @@ struct tty_driver {
324 326
325extern struct list_head tty_drivers; 327extern struct list_head tty_drivers;
326 328
327extern struct tty_driver *alloc_tty_driver(int lines); 329extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner);
328extern void put_tty_driver(struct tty_driver *driver); 330extern void put_tty_driver(struct tty_driver *driver);
329extern void tty_set_operations(struct tty_driver *driver, 331extern void tty_set_operations(struct tty_driver *driver,
330 const struct tty_operations *op); 332 const struct tty_operations *op);
@@ -332,6 +334,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
332 334
333extern void tty_driver_kref_put(struct tty_driver *driver); 335extern void tty_driver_kref_put(struct tty_driver *driver);
334 336
337#define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE)
338
335static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 339static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
336{ 340{
337 kref_get(&d->kref); 341 kref_get(&d->kref);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 27a4e16d2bf..73b68d1f2cb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -376,6 +376,12 @@ struct usb_bus {
376 376
377struct usb_tt; 377struct usb_tt;
378 378
379enum usb_device_removable {
380 USB_DEVICE_REMOVABLE_UNKNOWN = 0,
381 USB_DEVICE_REMOVABLE,
382 USB_DEVICE_FIXED,
383};
384
379/** 385/**
380 * struct usb_device - kernel's representation of a USB device 386 * struct usb_device - kernel's representation of a USB device
381 * @devnum: device number; address on a USB bus 387 * @devnum: device number; address on a USB bus
@@ -432,6 +438,7 @@ struct usb_tt;
432 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 438 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
433 * specific data for the device. 439 * specific data for the device.
434 * @slot_id: Slot ID assigned by xHCI 440 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port
435 * 442 *
436 * Notes: 443 * Notes:
437 * Usbcore drivers should not set usbdev->state directly. Instead use 444 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -494,7 +501,7 @@ struct usb_device {
494#endif 501#endif
495 502
496 int maxchild; 503 int maxchild;
497 struct usb_device *children[USB_MAXCHILDREN]; 504 struct usb_device **children;
498 505
499 u32 quirks; 506 u32 quirks;
500 atomic_t urbnum; 507 atomic_t urbnum;
@@ -509,6 +516,7 @@ struct usb_device {
509#endif 516#endif
510 struct wusb_dev *wusb_dev; 517 struct wusb_dev *wusb_dev;
511 int slot_id; 518 int slot_id;
519 enum usb_device_removable removable;
512}; 520};
513#define to_usb_device(d) container_of(d, struct usb_device, dev) 521#define to_usb_device(d) container_of(d, struct usb_device, dev)
514 522
@@ -1073,6 +1081,7 @@ typedef void (*usb_complete_t)(struct urb *);
1073 * which the host controller driver should use in preference to the 1081 * which the host controller driver should use in preference to the
1074 * transfer_buffer. 1082 * transfer_buffer.
1075 * @sg: scatter gather buffer list 1083 * @sg: scatter gather buffer list
1084 * @num_mapped_sgs: (internal) number of mapped sg entries
1076 * @num_sgs: number of entries in the sg list 1085 * @num_sgs: number of entries in the sg list
1077 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1086 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
1078 * be broken up into chunks according to the current maximum packet 1087 * be broken up into chunks according to the current maximum packet
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index 964cb603f7c..ed13053153f 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -43,6 +43,27 @@ static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
43 return (bmControls >> (control * 2)) & 0x2; 43 return (bmControls >> (control * 2)) & 0x2;
44} 44}
45 45
46/* 4.7.2 Class-Specific AC Interface Descriptor */
47struct uac2_ac_header_descriptor {
48 __u8 bLength; /* 9 */
49 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
50 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
51 __le16 bcdADC; /* 0x0200 */
52 __u8 bCategory;
53 __le16 wTotalLength; /* includes Unit and Terminal desc. */
54 __u8 bmControls;
55} __packed;
56
57/* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/
58struct uac2_format_type_i_descriptor {
59 __u8 bLength; /* in bytes: 6 */
60 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
61 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
62 __u8 bFormatType; /* FORMAT_TYPE_1 */
63 __u8 bSubslotSize; /* {1,2,3,4} */
64 __u8 bBitResolution;
65} __packed;
66
46/* 4.7.2.1 Clock Source Descriptor */ 67/* 4.7.2.1 Clock Source Descriptor */
47 68
48struct uac_clock_source_descriptor { 69struct uac_clock_source_descriptor {
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h
new file mode 100644
index 00000000000..719c332620f
--- /dev/null
+++ b/include/linux/usb/cdc-wdm.h
@@ -0,0 +1,19 @@
1/*
2 * USB CDC Device Management subdriver
3 *
4 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_USB_CDC_WDM_H
12#define __LINUX_USB_CDC_WDM_H
13
14extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
15 struct usb_endpoint_descriptor *ep,
16 int bufsize,
17 int (*manage_power)(struct usb_interface *, int));
18
19#endif /* __LINUX_USB_CDC_WDM_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 31fdb4c6ee3..f1d26b6067f 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -61,12 +61,6 @@
61#define USB_PORT_FEAT_TEST 21 61#define USB_PORT_FEAT_TEST 21
62#define USB_PORT_FEAT_INDICATOR 22 62#define USB_PORT_FEAT_INDICATOR 22
63#define USB_PORT_FEAT_C_PORT_L1 23 63#define USB_PORT_FEAT_C_PORT_L1 23
64#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
65#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
66#define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27
67#define USB_PORT_FEAT_BH_PORT_RESET 28
68#define USB_PORT_FEAT_C_BH_PORT_RESET 29
69#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
70 64
71/* 65/*
72 * Port feature selectors added by USB 3.0 spec. 66 * Port feature selectors added by USB 3.0 spec.
@@ -75,13 +69,18 @@
75#define USB_PORT_FEAT_LINK_STATE 5 69#define USB_PORT_FEAT_LINK_STATE 5
76#define USB_PORT_FEAT_U1_TIMEOUT 23 70#define USB_PORT_FEAT_U1_TIMEOUT 23
77#define USB_PORT_FEAT_U2_TIMEOUT 24 71#define USB_PORT_FEAT_U2_TIMEOUT 24
78#define USB_PORT_FEAT_C_LINK_STATE 25 72#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
79#define USB_PORT_FEAT_C_CONFIG_ERR 26 73#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
80#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 74#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
81#define USB_PORT_FEAT_BH_PORT_RESET 28 75#define USB_PORT_FEAT_BH_PORT_RESET 28
82#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
83#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
84 78
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
82#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
83
85/* 84/*
86 * Hub Status and Hub Change results 85 * Hub Status and Hub Change results
87 * See USB 2.0 spec Table 11-19 and Table 11-20 86 * See USB 2.0 spec Table 11-19 and Table 11-20
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 61b29057b05..af21f311591 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -589,7 +589,7 @@ static inline int usb_endpoint_is_isoc_out(
589 */ 589 */
590static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) 590static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
591{ 591{
592 return le16_to_cpu(epd->wMaxPacketSize); 592 return __le16_to_cpu(epd->wMaxPacketSize);
593} 593}
594 594
595/*-------------------------------------------------------------------------*/ 595/*-------------------------------------------------------------------------*/
@@ -789,6 +789,11 @@ struct usb_ext_cap_descriptor { /* Link Power Management */
789 __u8 bDevCapabilityType; 789 __u8 bDevCapabilityType;
790 __le32 bmAttributes; 790 __le32 bmAttributes;
791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ 791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
792#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
793#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
794#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
795#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
796#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
792} __attribute__((packed)); 797} __attribute__((packed));
793 798
794#define USB_DT_USB_EXT_CAP_SIZE 7 799#define USB_DT_USB_EXT_CAP_SIZE 7
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
new file mode 100644
index 00000000000..1894f42fe3f
--- /dev/null
+++ b/include/linux/usb/ehci_pdriver.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_EHCI_PDRIVER_H
20#define __USB_CORE_EHCI_PDRIVER_H
21
22/**
23 * struct usb_ehci_pdata - platform_data for generic ehci driver
24 *
25 * @caps_offset: offset of the EHCI Capability Registers to the start of
26 * the io memory region provided to the driver.
27 * @has_tt: set to 1 if TT is integrated in root hub.
28 * @port_power_on: set to 1 if the controller needs a power up after
29 * initialization.
30 * @port_power_off: set to 1 if the controller needs to be powered down
31 * after initialization.
32 *
33 * These are general configuration options for the EHCI controller. All of
34 * these options are activating more or less workarounds for some hardware.
35 */
36struct usb_ehci_pdata {
37 int caps_offset;
38 unsigned has_tt:1;
39 unsigned has_synopsys_hc_bug:1;
40 unsigned big_endian_desc:1;
41 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1;
43 unsigned port_power_off:1;
44};
45
46#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index da653b5c713..9517466abab 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -950,6 +950,16 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
950 950
951/*-------------------------------------------------------------------------*/ 951/*-------------------------------------------------------------------------*/
952 952
953/* utility to simplify map/unmap of usb_requests to/from DMA */
954
955extern int usb_gadget_map_request(struct usb_gadget *gadget,
956 struct usb_request *req, int is_in);
957
958extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
959 struct usb_request *req, int is_in);
960
961/*-------------------------------------------------------------------------*/
962
953/* utility wrapping a simple endpoint selection policy */ 963/* utility wrapping a simple endpoint selection policy */
954 964
955extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 965extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b2f62f3a32a..5de415707c2 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -127,7 +127,7 @@ struct usb_hcd {
127 unsigned authorized_default:1; 127 unsigned authorized_default:1;
128 unsigned has_tt:1; /* Integrated TT in root hub */ 128 unsigned has_tt:1; /* Integrated TT in root hub */
129 129
130 int irq; /* irq allocated */ 130 unsigned int irq; /* irq allocated */
131 void __iomem *regs; /* device memory/io */ 131 void __iomem *regs; /* device memory/io */
132 u64 rsrc_start; /* memory/io resource start */ 132 u64 rsrc_start; /* memory/io resource start */
133 u64 rsrc_len; /* memory/io resource length */ 133 u64 rsrc_len; /* memory/io resource length */
@@ -412,6 +412,8 @@ extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
412 412
413extern void usb_hc_died(struct usb_hcd *hcd); 413extern void usb_hc_died(struct usb_hcd *hcd);
414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); 414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
415extern void usb_wakeup_notification(struct usb_device *hdev,
416 unsigned int portnum);
415 417
416/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 418/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
417#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 419#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
index a0ccf795f36..756cf5543ff 100644
--- a/include/linux/usb/intel_mid_otg.h
+++ b/include/linux/usb/intel_mid_otg.h
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops {
104/* 104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact 105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More 106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on otg_transceiver data structure for this 107 * function members are added based on usb_phy data structure for this
108 * purpose. 108 * purpose.
109 */ 109 */
110struct intel_mid_otg_xceiv { 110struct intel_mid_otg_xceiv {
111 struct otg_transceiver otg; 111 struct usb_phy otg;
112 struct otg_hsm hsm; 112 struct otg_hsm hsm;
113 113
114 /* base address */ 114 /* base address */
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv {
147 147
148}; 148};
149static inline 149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) 150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{ 151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg); 152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153} 153}
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
deleted file mode 100644
index 51f17b16d31..00000000000
--- a/include/linux/usb/langwell_otg.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008 - 2010, 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#include <linux/usb/intel_mid_otg.h>
24
25#define CI_USBCMD 0x30
26# define USBCMD_RST BIT(1)
27# define USBCMD_RS BIT(0)
28#define CI_USBSTS 0x34
29# define USBSTS_SLI BIT(8)
30# define USBSTS_URI BIT(6)
31# define USBSTS_PCI BIT(2)
32#define CI_PORTSC1 0x74
33# define PORTSC_PP BIT(12)
34# define PORTSC_LS (BIT(11) | BIT(10))
35# define PORTSC_SUSP BIT(7)
36# define PORTSC_CCS BIT(0)
37#define CI_HOSTPC1 0xb4
38# define HOSTPC1_PHCD BIT(22)
39#define CI_OTGSC 0xf4
40# define OTGSC_DPIE BIT(30)
41# define OTGSC_1MSE BIT(29)
42# define OTGSC_BSEIE BIT(28)
43# define OTGSC_BSVIE BIT(27)
44# define OTGSC_ASVIE BIT(26)
45# define OTGSC_AVVIE BIT(25)
46# define OTGSC_IDIE BIT(24)
47# define OTGSC_DPIS BIT(22)
48# define OTGSC_1MSS BIT(21)
49# define OTGSC_BSEIS BIT(20)
50# define OTGSC_BSVIS BIT(19)
51# define OTGSC_ASVIS BIT(18)
52# define OTGSC_AVVIS BIT(17)
53# define OTGSC_IDIS BIT(16)
54# define OTGSC_DPS BIT(14)
55# define OTGSC_1MST BIT(13)
56# define OTGSC_BSE BIT(12)
57# define OTGSC_BSV BIT(11)
58# define OTGSC_ASV BIT(10)
59# define OTGSC_AVV BIT(9)
60# define OTGSC_ID BIT(8)
61# define OTGSC_HABA BIT(7)
62# define OTGSC_HADP BIT(6)
63# define OTGSC_IDPU BIT(5)
64# define OTGSC_DP BIT(4)
65# define OTGSC_OT BIT(3)
66# define OTGSC_HAAR BIT(2)
67# define OTGSC_VC BIT(1)
68# define OTGSC_VD BIT(0)
69# define OTGSC_INTEN_MASK (0x7f << 24)
70# define OTGSC_INT_MASK (0x5f << 24)
71# define OTGSC_INTSTS_MASK (0x7f << 16)
72#define CI_USBMODE 0xf8
73# define USBMODE_CM (BIT(1) | BIT(0))
74# define USBMODE_IDLE 0
75# define USBMODE_DEVICE 0x2
76# define USBMODE_HOST 0x3
77#define USBCFG_ADDR 0xff10801c
78#define USBCFG_LEN 4
79# define USBCFG_VBUSVAL BIT(14)
80# define USBCFG_AVALID BIT(13)
81# define USBCFG_BVALID BIT(12)
82# define USBCFG_SESEND BIT(11)
83
84#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
85
86enum langwell_otg_timer_type {
87 TA_WAIT_VRISE_TMR,
88 TA_WAIT_BCON_TMR,
89 TA_AIDL_BDIS_TMR,
90 TB_ASE0_BRST_TMR,
91 TB_SE0_SRP_TMR,
92 TB_SRP_INIT_TMR,
93 TB_SRP_FAIL_TMR,
94 TB_BUS_SUSPEND_TMR
95};
96
97#define TA_WAIT_VRISE 100
98#define TA_WAIT_BCON 30000
99#define TA_AIDL_BDIS 15000
100#define TB_ASE0_BRST 5000
101#define TB_SE0_SRP 2
102#define TB_SRP_INIT 100
103#define TB_SRP_FAIL 5500
104#define TB_BUS_SUSPEND 500
105
106struct langwell_otg_timer {
107 unsigned long expires; /* Number of count increase to timeout */
108 unsigned long count; /* Tick counter */
109 void (*function)(unsigned long); /* Timeout function */
110 unsigned long data; /* Data passed to function */
111 struct list_head list;
112};
113
114struct langwell_otg {
115 struct intel_mid_otg_xceiv iotg;
116 struct device *dev;
117
118 void __iomem *usbcfg; /* SCCBUSB config Reg */
119
120 unsigned region;
121 unsigned cfg_region;
122
123 struct work_struct work;
124 struct workqueue_struct *qwork;
125 struct timer_list hsm_timer;
126
127 spinlock_t lock;
128 spinlock_t wq_lock;
129
130 struct notifier_block iotg_notifier;
131};
132
133static inline
134struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg)
135{
136 return container_of(iotg, struct langwell_otg, iotg);
137}
138
139#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 00311fe9d0d..22a396c13f3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -160,7 +160,7 @@ struct msm_otg_platform_data {
160 * detection process. 160 * detection process.
161 */ 161 */
162struct msm_otg { 162struct msm_otg {
163 struct otg_transceiver otg; 163 struct usb_phy phy;
164 struct msm_otg_platform_data *pdata; 164 struct msm_otg_platform_data *pdata;
165 int irq; 165 int irq;
166 struct clk *clk; 166 struct clk *clk;
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
new file mode 100644
index 00000000000..2808f2a9cce
--- /dev/null
+++ b/include/linux/usb/ohci_pdriver.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_OHCI_PDRIVER_H
20#define __USB_CORE_OHCI_PDRIVER_H
21
22/**
23 * struct usb_ohci_pdata - platform_data for generic ohci driver
24 *
25 * @big_endian_desc: BE descriptors
26 * @big_endian_mmio: BE registers
27 * @no_big_frame_no: no big endian frame_no shift
28 *
29 * These are general configuration options for the OHCI controller. All of
30 * these options are activating more or less workarounds for some hardware.
31 */
32struct usb_ohci_pdata {
33 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1;
36};
37
38#endif /* __USB_CORE_OHCI_PDRIVER_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index d87f44f5b04..f67810f8f21 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -35,7 +35,7 @@ enum usb_otg_state {
35 OTG_STATE_A_VBUS_ERR, 35 OTG_STATE_A_VBUS_ERR,
36}; 36};
37 37
38enum usb_xceiv_events { 38enum usb_phy_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */ 39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */ 40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */ 41 USB_EVENT_ID, /* id was grounded */
@@ -43,14 +43,39 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46struct otg_transceiver; 46struct usb_phy;
47 47
48/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
49 * provide access ops 49 * provide access ops
50 */ 50 */
51struct otg_io_access_ops { 51struct usb_phy_io_ops {
52 int (*read)(struct otg_transceiver *otg, u32 reg); 52 int (*read)(struct usb_phy *x, u32 reg);
53 int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); 53 int (*write)(struct usb_phy *x, u32 val, u32 reg);
54};
55
56struct usb_otg {
57 u8 default_a;
58
59 struct usb_phy *phy;
60 struct usb_bus *host;
61 struct usb_gadget *gadget;
62
63 /* bind/unbind the host controller */
64 int (*set_host)(struct usb_otg *otg, struct usb_bus *host);
65
66 /* bind/unbind the peripheral controller */
67 int (*set_peripheral)(struct usb_otg *otg,
68 struct usb_gadget *gadget);
69
70 /* effective for A-peripheral, ignored for B devices */
71 int (*set_vbus)(struct usb_otg *otg, bool enabled);
72
73 /* for B devices only: start session with A-Host */
74 int (*start_srp)(struct usb_otg *otg);
75
76 /* start or continue HNP role switch */
77 int (*start_hnp)(struct usb_otg *otg);
78
54}; 79};
55 80
56/* 81/*
@@ -59,22 +84,20 @@ struct otg_io_access_ops {
59 * moment, using the transceiver, ID signal, HNP and sometimes static 84 * moment, using the transceiver, ID signal, HNP and sometimes static
60 * configuration information (including "board isn't wired for otg"). 85 * configuration information (including "board isn't wired for otg").
61 */ 86 */
62struct otg_transceiver { 87struct usb_phy {
63 struct device *dev; 88 struct device *dev;
64 const char *label; 89 const char *label;
65 unsigned int flags; 90 unsigned int flags;
66 91
67 u8 default_a;
68 enum usb_otg_state state; 92 enum usb_otg_state state;
69 enum usb_xceiv_events last_event; 93 enum usb_phy_events last_event;
70 94
71 struct usb_bus *host; 95 struct usb_otg *otg;
72 struct usb_gadget *gadget;
73 96
74 struct otg_io_access_ops *io_ops; 97 struct usb_phy_io_ops *io_ops;
75 void __iomem *io_priv; 98 void __iomem *io_priv;
76 99
77 /* for notification of usb_xceiv_events */ 100 /* for notification of usb_phy_events */
78 struct atomic_notifier_head notifier; 101 struct atomic_notifier_head notifier;
79 102
80 /* to pass extra port status to the root hub */ 103 /* to pass extra port status to the root hub */
@@ -82,40 +105,22 @@ struct otg_transceiver {
82 u16 port_change; 105 u16 port_change;
83 106
84 /* initialize/shutdown the OTG controller */ 107 /* initialize/shutdown the OTG controller */
85 int (*init)(struct otg_transceiver *otg); 108 int (*init)(struct usb_phy *x);
86 void (*shutdown)(struct otg_transceiver *otg); 109 void (*shutdown)(struct usb_phy *x);
87
88 /* bind/unbind the host controller */
89 int (*set_host)(struct otg_transceiver *otg,
90 struct usb_bus *host);
91
92 /* bind/unbind the peripheral controller */
93 int (*set_peripheral)(struct otg_transceiver *otg,
94 struct usb_gadget *gadget);
95 110
96 /* effective for B devices, ignored for A-peripheral */ 111 /* effective for B devices, ignored for A-peripheral */
97 int (*set_power)(struct otg_transceiver *otg, 112 int (*set_power)(struct usb_phy *x,
98 unsigned mA); 113 unsigned mA);
99 114
100 /* effective for A-peripheral, ignored for B devices */
101 int (*set_vbus)(struct otg_transceiver *otg,
102 bool enabled);
103
104 /* for non-OTG B devices: set transceiver into suspend mode */ 115 /* for non-OTG B devices: set transceiver into suspend mode */
105 int (*set_suspend)(struct otg_transceiver *otg, 116 int (*set_suspend)(struct usb_phy *x,
106 int suspend); 117 int suspend);
107 118
108 /* for B devices only: start session with A-Host */
109 int (*start_srp)(struct otg_transceiver *otg);
110
111 /* start or continue HNP role switch */
112 int (*start_hnp)(struct otg_transceiver *otg);
113
114}; 119};
115 120
116 121
117/* for board-specific init logic */ 122/* for board-specific init logic */
118extern int otg_set_transceiver(struct otg_transceiver *); 123extern int usb_set_transceiver(struct usb_phy *);
119 124
120#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 125#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
121/* sometimes transceivers are accessed only through e.g. ULPI */ 126/* sometimes transceivers are accessed only through e.g. ULPI */
@@ -132,50 +137,50 @@ static inline void usb_nop_xceiv_unregister(void)
132#endif 137#endif
133 138
134/* helpers for direct access thru low-level io interface */ 139/* helpers for direct access thru low-level io interface */
135static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) 140static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
136{ 141{
137 if (otg->io_ops && otg->io_ops->read) 142 if (x->io_ops && x->io_ops->read)
138 return otg->io_ops->read(otg, reg); 143 return x->io_ops->read(x, reg);
139 144
140 return -EINVAL; 145 return -EINVAL;
141} 146}
142 147
143static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) 148static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
144{ 149{
145 if (otg->io_ops && otg->io_ops->write) 150 if (x->io_ops && x->io_ops->write)
146 return otg->io_ops->write(otg, val, reg); 151 return x->io_ops->write(x, val, reg);
147 152
148 return -EINVAL; 153 return -EINVAL;
149} 154}
150 155
151static inline int 156static inline int
152otg_init(struct otg_transceiver *otg) 157usb_phy_init(struct usb_phy *x)
153{ 158{
154 if (otg->init) 159 if (x->init)
155 return otg->init(otg); 160 return x->init(x);
156 161
157 return 0; 162 return 0;
158} 163}
159 164
160static inline void 165static inline void
161otg_shutdown(struct otg_transceiver *otg) 166usb_phy_shutdown(struct usb_phy *x)
162{ 167{
163 if (otg->shutdown) 168 if (x->shutdown)
164 otg->shutdown(otg); 169 x->shutdown(x);
165} 170}
166 171
167/* for usb host and peripheral controller drivers */ 172/* for usb host and peripheral controller drivers */
168#ifdef CONFIG_USB_OTG_UTILS 173#ifdef CONFIG_USB_OTG_UTILS
169extern struct otg_transceiver *otg_get_transceiver(void); 174extern struct usb_phy *usb_get_transceiver(void);
170extern void otg_put_transceiver(struct otg_transceiver *); 175extern void usb_put_transceiver(struct usb_phy *);
171extern const char *otg_state_string(enum usb_otg_state state); 176extern const char *otg_state_string(enum usb_otg_state state);
172#else 177#else
173static inline struct otg_transceiver *otg_get_transceiver(void) 178static inline struct usb_phy *usb_get_transceiver(void)
174{ 179{
175 return NULL; 180 return NULL;
176} 181}
177 182
178static inline void otg_put_transceiver(struct otg_transceiver *x) 183static inline void usb_put_transceiver(struct usb_phy *x)
179{ 184{
180} 185}
181 186
@@ -187,67 +192,84 @@ static inline const char *otg_state_string(enum usb_otg_state state)
187 192
188/* Context: can sleep */ 193/* Context: can sleep */
189static inline int 194static inline int
190otg_start_hnp(struct otg_transceiver *otg) 195otg_start_hnp(struct usb_otg *otg)
191{ 196{
192 return otg->start_hnp(otg); 197 if (otg && otg->start_hnp)
198 return otg->start_hnp(otg);
199
200 return -ENOTSUPP;
193} 201}
194 202
195/* Context: can sleep */ 203/* Context: can sleep */
196static inline int 204static inline int
197otg_set_vbus(struct otg_transceiver *otg, bool enabled) 205otg_set_vbus(struct usb_otg *otg, bool enabled)
198{ 206{
199 return otg->set_vbus(otg, enabled); 207 if (otg && otg->set_vbus)
208 return otg->set_vbus(otg, enabled);
209
210 return -ENOTSUPP;
200} 211}
201 212
202/* for HCDs */ 213/* for HCDs */
203static inline int 214static inline int
204otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) 215otg_set_host(struct usb_otg *otg, struct usb_bus *host)
205{ 216{
206 return otg->set_host(otg, host); 217 if (otg && otg->set_host)
218 return otg->set_host(otg, host);
219
220 return -ENOTSUPP;
207} 221}
208 222
209/* for usb peripheral controller drivers */ 223/* for usb peripheral controller drivers */
210 224
211/* Context: can sleep */ 225/* Context: can sleep */
212static inline int 226static inline int
213otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 227otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph)
214{ 228{
215 return otg->set_peripheral(otg, periph); 229 if (otg && otg->set_peripheral)
230 return otg->set_peripheral(otg, periph);
231
232 return -ENOTSUPP;
216} 233}
217 234
218static inline int 235static inline int
219otg_set_power(struct otg_transceiver *otg, unsigned mA) 236usb_phy_set_power(struct usb_phy *x, unsigned mA)
220{ 237{
221 return otg->set_power(otg, mA); 238 if (x && x->set_power)
239 return x->set_power(x, mA);
240 return 0;
222} 241}
223 242
224/* Context: can sleep */ 243/* Context: can sleep */
225static inline int 244static inline int
226otg_set_suspend(struct otg_transceiver *otg, int suspend) 245usb_phy_set_suspend(struct usb_phy *x, int suspend)
227{ 246{
228 if (otg->set_suspend != NULL) 247 if (x->set_suspend != NULL)
229 return otg->set_suspend(otg, suspend); 248 return x->set_suspend(x, suspend);
230 else 249 else
231 return 0; 250 return 0;
232} 251}
233 252
234static inline int 253static inline int
235otg_start_srp(struct otg_transceiver *otg) 254otg_start_srp(struct usb_otg *otg)
236{ 255{
237 return otg->start_srp(otg); 256 if (otg && otg->start_srp)
257 return otg->start_srp(otg);
258
259 return -ENOTSUPP;
238} 260}
239 261
240/* notifiers */ 262/* notifiers */
241static inline int 263static inline int
242otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 264usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
243{ 265{
244 return atomic_notifier_chain_register(&otg->notifier, nb); 266 return atomic_notifier_chain_register(&x->notifier, nb);
245} 267}
246 268
247static inline void 269static inline void
248otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 270usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
249{ 271{
250 atomic_notifier_chain_unregister(&otg->notifier, nb); 272 atomic_notifier_chain_unregister(&x->notifier, nb);
251} 273}
252 274
253/* for OTG controller drivers (and maybe other stuff) */ 275/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 0d3f9887925..547e59cc00e 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -149,6 +149,7 @@ struct renesas_usbhs_driver_param {
149 * option: 149 * option:
150 */ 150 */
151 u32 has_otg:1; /* for controlling PWEN/EXTLP */ 151 u32 has_otg:1; /* for controlling PWEN/EXTLP */
152 u32 has_sudmac:1; /* for SUDMAC */
152}; 153};
153 154
154/* 155/*
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 4267a9c717b..fbb666b1b67 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -300,8 +300,10 @@ struct usb_serial_driver {
300#define to_usb_serial_driver(d) \ 300#define to_usb_serial_driver(d) \
301 container_of(d, struct usb_serial_driver, driver) 301 container_of(d, struct usb_serial_driver, driver)
302 302
303extern int usb_serial_register(struct usb_serial_driver *driver); 303extern int usb_serial_register_drivers(struct usb_driver *udriver,
304extern void usb_serial_deregister(struct usb_serial_driver *driver); 304 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_deregister_drivers(struct usb_driver *udriver,
306 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_port_softint(struct usb_serial_port *port); 307extern void usb_serial_port_softint(struct usb_serial_port *port);
306 308
307extern int usb_serial_probe(struct usb_interface *iface, 309extern int usb_serial_probe(struct usb_interface *iface,
@@ -389,5 +391,35 @@ do { \
389 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ 391 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
390} while (0) 392} while (0)
391 393
394/*
395 * Macro for reporting errors in write path to avoid inifinite loop
396 * when port is used as a console.
397 */
398#define dev_err_console(usport, fmt, ...) \
399do { \
400 static bool __print_once; \
401 struct usb_serial_port *__port = (usport); \
402 \
403 if (!__port->port.console || !__print_once) { \
404 __print_once = true; \
405 dev_err(&__port->dev, fmt, ##__VA_ARGS__); \
406 } \
407} while (0)
408
409/*
410 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
411 * @__usb_driver: usb_driver struct to register
412 * @__serial_drivers: list of usb_serial drivers to register
413 *
414 * Helper macro for USB serial drivers which do not do anything special
415 * in module init/exit. This eliminates a lot of boilerplate. Each
416 * module may only use this macro once, and calling it replaces
417 * module_init() and module_exit()
418 *
419 */
420#define module_usb_serial_driver(__usb_driver, __serial_drivers) \
421 module_driver(__usb_driver, usb_serial_register_drivers, \
422 usb_serial_deregister_drivers, __serial_drivers)
423
392#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
393 425
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h
index d7fc910f1dc..cb33fff2ba0 100644
--- a/include/linux/usb/storage.h
+++ b/include/linux/usb/storage.h
@@ -45,4 +45,42 @@
45 45
46#define USB_PR_DEVICE 0xff /* Use device's value */ 46#define USB_PR_DEVICE 0xff /* Use device's value */
47 47
48 /*
49 * Bulk only data structures
50 */
51
52/* command block wrapper */
53struct bulk_cb_wrap {
54 __le32 Signature; /* contains 'USBC' */
55 __u32 Tag; /* unique per command id */
56 __le32 DataTransferLength; /* size of data */
57 __u8 Flags; /* direction in bit 0 */
58 __u8 Lun; /* LUN normally 0 */
59 __u8 Length; /* of of the CDB */
60 __u8 CDB[16]; /* max command */
61};
62
63#define US_BULK_CB_WRAP_LEN 31
64#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */
65#define US_BULK_FLAG_IN (1 << 7)
66#define US_BULK_FLAG_OUT 0
67
68/* command status wrapper */
69struct bulk_cs_wrap {
70 __le32 Signature; /* should = 'USBS' */
71 __u32 Tag; /* same as original command */
72 __le32 Residue; /* amount not transferred */
73 __u8 Status; /* see below */
74};
75
76#define US_BULK_CS_WRAP_LEN 13
77#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
78#define US_BULK_STAT_OK 0
79#define US_BULK_STAT_FAIL 1
80#define US_BULK_STAT_PHASE 2
81
82/* bulk-only class specific requests */
83#define US_BULK_RESET_REQUEST 0xff
84#define US_BULK_GET_MAX_LUN 0xfe
85
48#endif 86#endif
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
new file mode 100644
index 00000000000..9a988e41369
--- /dev/null
+++ b/include/linux/usb/uas.h
@@ -0,0 +1,69 @@
1#ifndef __USB_UAS_H__
2#define __USB_UAS_H__
3
4#include <scsi/scsi.h>
5#include <scsi/scsi_cmnd.h>
6
7/* Common header for all IUs */
8struct iu {
9 __u8 iu_id;
10 __u8 rsvd1;
11 __be16 tag;
12};
13
14enum {
15 IU_ID_COMMAND = 0x01,
16 IU_ID_STATUS = 0x03,
17 IU_ID_RESPONSE = 0x04,
18 IU_ID_TASK_MGMT = 0x05,
19 IU_ID_READ_READY = 0x06,
20 IU_ID_WRITE_READY = 0x07,
21};
22
23struct command_iu {
24 __u8 iu_id;
25 __u8 rsvd1;
26 __be16 tag;
27 __u8 prio_attr;
28 __u8 rsvd5;
29 __u8 len;
30 __u8 rsvd7;
31 struct scsi_lun lun;
32 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
33};
34
35/*
36 * Also used for the Read Ready and Write Ready IUs since they have the
37 * same first four bytes
38 */
39struct sense_iu {
40 __u8 iu_id;
41 __u8 rsvd1;
42 __be16 tag;
43 __be16 status_qual;
44 __u8 status;
45 __u8 rsvd7[7];
46 __be16 len;
47 __u8 sense[SCSI_SENSE_BUFFERSIZE];
48};
49
50struct usb_pipe_usage_descriptor {
51 __u8 bLength;
52 __u8 bDescriptorType;
53
54 __u8 bPipeID;
55 __u8 Reserved;
56} __attribute__((__packed__));
57
58enum {
59 CMD_PIPE_ID = 1,
60 STATUS_PIPE_ID = 2,
61 DATA_IN_PIPE_ID = 3,
62 DATA_OUT_PIPE_ID = 4,
63
64 UAS_SIMPLE_TAG = 0,
65 UAS_HEAD_TAG = 1,
66 UAS_ORDERED_TAG = 2,
67 UAS_ACA = 4,
68};
69#endif
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 9595796d62e..6f033a415ec 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -181,12 +181,12 @@
181 181
182/*-------------------------------------------------------------------------*/ 182/*-------------------------------------------------------------------------*/
183 183
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT 187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */ 188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops; 189extern struct usb_phy_io_ops ulpi_viewport_access_ops;
190#endif 190#endif
191 191
192#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index c2164fad008..e33d77f15bd 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -167,4 +167,30 @@ extern int unregister_vt_notifier(struct notifier_block *nb);
167 167
168extern void hide_boot_cursor(bool hide); 168extern void hide_boot_cursor(bool hide);
169 169
170/* keyboard provided interfaces */
171extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
172extern int vt_do_kdskbmode(int console, unsigned int arg);
173extern int vt_do_kdskbmeta(int console, unsigned int arg);
174extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
175 int perm);
176extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe,
177 int perm, int console);
178extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb,
179 int perm);
180extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);
181extern int vt_do_kdgkbmode(int console);
182extern int vt_do_kdgkbmeta(int console);
183extern void vt_reset_unicode(int console);
184extern int vt_get_shift_state(void);
185extern void vt_reset_keyboard(int console);
186extern int vt_get_leds(int console, int flag);
187extern int vt_get_kbd_mode_bit(int console, int bit);
188extern void vt_set_kbd_mode_bit(int console, int bit);
189extern void vt_clr_kbd_mode_bit(int console, int bit);
190extern void vt_set_led_state(int console, int leds);
191extern void vt_set_led_state(int console, int leds);
192extern void vt_kbd_con_start(int console);
193extern void vt_kbd_con_stop(int console);
194
195
170#endif /* _VT_KERN_H */ 196#endif /* _VT_KERN_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a9ce45e8501..7d9a9e990ce 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -157,7 +157,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
157void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 157void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
158void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 158void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr,
159 void *key); 159 void *key);
160void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); 160void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
161void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 161void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
162void __wake_up_bit(wait_queue_head_t *, void *, int); 162void __wake_up_bit(wait_queue_head_t *, void *, int);
163int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 163int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
@@ -170,7 +170,8 @@ wait_queue_head_t *bit_waitqueue(void *, int);
170#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 170#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
171#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) 171#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
172#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) 172#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL)
173#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL) 173#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL, 1)
174#define wake_up_all_locked(x) __wake_up_locked((x), TASK_NORMAL, 0)
174 175
175#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) 176#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
176#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) 177#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index eb8b9f15f2e..af155450cab 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -289,12 +289,16 @@ enum {
289 * 289 *
290 * system_freezable_wq is equivalent to system_wq except that it's 290 * system_freezable_wq is equivalent to system_wq except that it's
291 * freezable. 291 * freezable.
292 *
293 * system_nrt_freezable_wq is equivalent to system_nrt_wq except that
294 * it's freezable.
292 */ 295 */
293extern struct workqueue_struct *system_wq; 296extern struct workqueue_struct *system_wq;
294extern struct workqueue_struct *system_long_wq; 297extern struct workqueue_struct *system_long_wq;
295extern struct workqueue_struct *system_nrt_wq; 298extern struct workqueue_struct *system_nrt_wq;
296extern struct workqueue_struct *system_unbound_wq; 299extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq; 300extern struct workqueue_struct *system_freezable_wq;
301extern struct workqueue_struct *system_nrt_freezable_wq;
298 302
299extern struct workqueue_struct * 303extern struct workqueue_struct *
300__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, 304__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 995b8bf630a..a2b84f598e2 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -64,7 +64,7 @@ struct writeback_control {
64 long pages_skipped; /* Pages which were not written */ 64 long pages_skipped; /* Pages which were not written */
65 65
66 /* 66 /*
67 * For a_ops->writepages(): is start or end are non-zero then this is 67 * For a_ops->writepages(): if start or end are non-zero then this is
68 * a hint that the filesystem need only write out the pages inside that 68 * a hint that the filesystem need only write out the pages inside that
69 * byterange. The byte at `end' is included in the writeout request. 69 * byterange. The byte at `end' is included in the writeout request.
70 */ 70 */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index f68dce2d8d8..757a17638b1 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -160,7 +160,6 @@ extern void addrconf_prefix_rcv(struct net_device *dev,
160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); 160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr);
161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); 161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr);
162extern void ipv6_sock_ac_close(struct sock *sk); 162extern void ipv6_sock_ac_close(struct sock *sk);
163extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex);
164 163
165extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
166extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
diff --git a/include/net/arp.h b/include/net/arp.h
index 0013dc87940..4a1f3fb562e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -15,14 +15,14 @@ static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd
15 return val * hash_rnd; 15 return val * hash_rnd;
16} 16}
17 17
18static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) 18static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
19{ 19{
20 struct neigh_hash_table *nht; 20 struct neigh_hash_table *nht;
21 struct neighbour *n; 21 struct neighbour *n;
22 u32 hash_val; 22 u32 hash_val;
23 23
24 rcu_read_lock_bh(); 24 rcu_read_lock_bh();
25 nht = rcu_dereference_bh(tbl->nht); 25 nht = rcu_dereference_bh(arp_tbl.nht);
26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); 26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
28 n != NULL; 28 n != NULL;
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index abaad6ed9b8..262ebd1747d 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -109,12 +109,14 @@ struct bt_power {
109 */ 109 */
110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2 110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
111 111
112__printf(2, 3) 112__printf(1, 2)
113int bt_printk(const char *level, const char *fmt, ...); 113int bt_info(const char *fmt, ...);
114__printf(1, 2)
115int bt_err(const char *fmt, ...);
114 116
115#define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) 117#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__)
116#define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) 118#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__)
117#define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) 119#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)
118 120
119/* Connection and socket states */ 121/* Connection and socket states */
120enum { 122enum {
@@ -129,6 +131,33 @@ enum {
129 BT_CLOSED 131 BT_CLOSED
130}; 132};
131 133
134/* If unused will be removed by compiler */
135static inline const char *state_to_string(int state)
136{
137 switch (state) {
138 case BT_CONNECTED:
139 return "BT_CONNECTED";
140 case BT_OPEN:
141 return "BT_OPEN";
142 case BT_BOUND:
143 return "BT_BOUND";
144 case BT_LISTEN:
145 return "BT_LISTEN";
146 case BT_CONNECT:
147 return "BT_CONNECT";
148 case BT_CONNECT2:
149 return "BT_CONNECT2";
150 case BT_CONFIG:
151 return "BT_CONFIG";
152 case BT_DISCONN:
153 return "BT_DISCONN";
154 case BT_CLOSED:
155 return "BT_CLOSED";
156 }
157
158 return "invalid state";
159}
160
132/* BD Address */ 161/* BD Address */
133typedef struct { 162typedef struct {
134 __u8 b[6]; 163 __u8 b[6];
@@ -193,7 +222,6 @@ struct bt_skb_cb {
193 __u16 tx_seq; 222 __u16 tx_seq;
194 __u8 retries; 223 __u8 retries;
195 __u8 sar; 224 __u8 sar;
196 unsigned short channel;
197 __u8 force_active; 225 __u8 force_active;
198}; 226};
199#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 227#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
@@ -256,4 +284,6 @@ void l2cap_exit(void);
256int sco_init(void); 284int sco_init(void);
257void sco_exit(void); 285void sco_exit(void);
258 286
287void bt_sock_reclassify_lock(struct sock *sk, int proto);
288
259#endif /* __BLUETOOTH_H */ 289#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5b2fed5eebf..344b0f97282 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -77,14 +77,6 @@ enum {
77 77
78 HCI_RAW, 78 HCI_RAW,
79 79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
87
88 HCI_RESET, 80 HCI_RESET,
89}; 81};
90 82
@@ -93,7 +85,22 @@ enum {
93 * states from the controller. 85 * states from the controller.
94 */ 86 */
95enum { 87enum {
88 HCI_SETUP,
89 HCI_AUTO_OFF,
90 HCI_MGMT,
91 HCI_PAIRABLE,
92 HCI_SERVICE_CACHE,
93 HCI_LINK_KEYS,
94 HCI_DEBUG_KEYS,
95
96 HCI_LE_SCAN, 96 HCI_LE_SCAN,
97 HCI_SSP_ENABLED,
98 HCI_HS_ENABLED,
99 HCI_LE_ENABLED,
100 HCI_CONNECTABLE,
101 HCI_DISCOVERABLE,
102 HCI_LINK_SECURITY,
103 HCI_PENDING_CLASS,
97}; 104};
98 105
99/* HCI ioctl defines */ 106/* HCI ioctl defines */
@@ -130,6 +137,7 @@ enum {
130#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 137#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
131#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 138#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
132#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 139#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
140#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
133 141
134/* HCI data types */ 142/* HCI data types */
135#define HCI_COMMAND_PKT 0x01 143#define HCI_COMMAND_PKT 0x01
@@ -229,7 +237,9 @@ enum {
229#define LMP_EXTFEATURES 0x80 237#define LMP_EXTFEATURES 0x80
230 238
231/* Extended LMP features */ 239/* Extended LMP features */
232#define LMP_HOST_LE 0x02 240#define LMP_HOST_SSP 0x01
241#define LMP_HOST_LE 0x02
242#define LMP_HOST_LE_BREDR 0x04
233 243
234/* Connection modes */ 244/* Connection modes */
235#define HCI_CM_ACTIVE 0x0000 245#define HCI_CM_ACTIVE 0x0000
@@ -268,10 +278,11 @@ enum {
268#define HCI_LK_UNAUTH_COMBINATION 0x04 278#define HCI_LK_UNAUTH_COMBINATION 0x04
269#define HCI_LK_AUTH_COMBINATION 0x05 279#define HCI_LK_AUTH_COMBINATION 0x05
270#define HCI_LK_CHANGED_COMBINATION 0x06 280#define HCI_LK_CHANGED_COMBINATION 0x06
271/* The spec doesn't define types for SMP keys */ 281/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
272#define HCI_LK_SMP_LTK 0x81 282#define HCI_SMP_STK 0x80
273#define HCI_LK_SMP_IRK 0x82 283#define HCI_SMP_STK_SLAVE 0x81
274#define HCI_LK_SMP_CSRK 0x83 284#define HCI_SMP_LTK 0x82
285#define HCI_SMP_LTK_SLAVE 0x83
275 286
276/* ---- HCI Error Codes ---- */ 287/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05 288#define HCI_ERROR_AUTH_FAILURE 0x05
@@ -284,6 +295,22 @@ enum {
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 295#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 296#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286 297
298/* Extended Inquiry Response field types */
299#define EIR_FLAGS 0x01 /* flags */
300#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
301#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
302#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
303#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
304#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
305#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
306#define EIR_NAME_SHORT 0x08 /* shortened local name */
307#define EIR_NAME_COMPLETE 0x09 /* complete local name */
308#define EIR_TX_POWER 0x0A /* transmit power level */
309#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
310#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
311#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
312#define EIR_DEVICE_ID 0x10 /* device ID */
313
287/* ----- HCI Commands ---- */ 314/* ----- HCI Commands ---- */
288#define HCI_OP_NOP 0x0000 315#define HCI_OP_NOP 0x0000
289 316
@@ -666,8 +693,8 @@ struct hci_cp_host_buffer_size {
666 693
667#define HCI_OP_WRITE_EIR 0x0c52 694#define HCI_OP_WRITE_EIR 0x0c52
668struct hci_cp_write_eir { 695struct hci_cp_write_eir {
669 uint8_t fec; 696 __u8 fec;
670 uint8_t data[HCI_MAX_EIR_LENGTH]; 697 __u8 data[HCI_MAX_EIR_LENGTH];
671} __packed; 698} __packed;
672 699
673#define HCI_OP_READ_SSP_MODE 0x0c55 700#define HCI_OP_READ_SSP_MODE 0x0c55
@@ -698,8 +725,8 @@ struct hci_rp_read_flow_control_mode {
698 725
699#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 726#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
700struct hci_cp_write_le_host_supported { 727struct hci_cp_write_le_host_supported {
701 __u8 le; 728 __u8 le;
702 __u8 simul; 729 __u8 simul;
703} __packed; 730} __packed;
704 731
705#define HCI_OP_READ_LOCAL_VERSION 0x1001 732#define HCI_OP_READ_LOCAL_VERSION 0x1001
@@ -1155,6 +1182,19 @@ struct hci_ev_le_meta {
1155 __u8 subevent; 1182 __u8 subevent;
1156} __packed; 1183} __packed;
1157 1184
1185#define HCI_EV_NUM_COMP_BLOCKS 0x48
1186struct hci_comp_blocks_info {
1187 __le16 handle;
1188 __le16 pkts;
1189 __le16 blocks;
1190} __packed;
1191
1192struct hci_ev_num_comp_blocks {
1193 __le16 num_blocks;
1194 __u8 num_hndl;
1195 struct hci_comp_blocks_info handles[0];
1196} __packed;
1197
1158/* Low energy meta events */ 1198/* Low energy meta events */
1159#define HCI_EV_LE_CONN_COMPLETE 0x01 1199#define HCI_EV_LE_CONN_COMPLETE 0x01
1160struct hci_ev_le_conn_complete { 1200struct hci_ev_le_conn_complete {
@@ -1288,6 +1328,7 @@ struct sockaddr_hci {
1288 1328
1289#define HCI_CHANNEL_RAW 0 1329#define HCI_CHANNEL_RAW 0
1290#define HCI_CHANNEL_CONTROL 1 1330#define HCI_CHANNEL_CONTROL 1
1331#define HCI_CHANNEL_MONITOR 2
1291 1332
1292struct hci_filter { 1333struct hci_filter {
1293 unsigned long type_mask; 1334 unsigned long type_mask;
@@ -1388,6 +1429,7 @@ struct hci_inquiry_req {
1388}; 1429};
1389#define IREQ_CACHE_FLUSH 0x0001 1430#define IREQ_CACHE_FLUSH 0x0001
1390 1431
1391extern int enable_hs; 1432extern bool enable_hs;
1433extern bool enable_le;
1392 1434
1393#endif /* __HCI_H */ 1435#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ea9231f4935..daefaac5113 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -44,14 +44,31 @@ struct inquiry_data {
44}; 44};
45 45
46struct inquiry_entry { 46struct inquiry_entry {
47 struct inquiry_entry *next; 47 struct list_head all; /* inq_cache.all */
48 struct list_head list; /* unknown or resolve */
49 enum {
50 NAME_NOT_KNOWN,
51 NAME_NEEDED,
52 NAME_PENDING,
53 NAME_KNOWN,
54 } name_state;
48 __u32 timestamp; 55 __u32 timestamp;
49 struct inquiry_data data; 56 struct inquiry_data data;
50}; 57};
51 58
52struct inquiry_cache { 59struct discovery_state {
60 int type;
61 enum {
62 DISCOVERY_STOPPED,
63 DISCOVERY_STARTING,
64 DISCOVERY_FINDING,
65 DISCOVERY_RESOLVING,
66 DISCOVERY_STOPPING,
67 } state;
68 struct list_head all; /* All devices found during inquiry */
69 struct list_head unknown; /* Name state not known */
70 struct list_head resolve; /* Name needs to be resolved */
53 __u32 timestamp; 71 __u32 timestamp;
54 struct inquiry_entry *list;
55}; 72};
56 73
57struct hci_conn_hash { 74struct hci_conn_hash {
@@ -72,18 +89,16 @@ struct bt_uuid {
72 u8 svc_hint; 89 u8 svc_hint;
73}; 90};
74 91
75struct key_master_id { 92struct smp_ltk {
76 __le16 ediv; 93 struct list_head list;
77 u8 rand[8];
78} __packed;
79
80struct link_key_data {
81 bdaddr_t bdaddr; 94 bdaddr_t bdaddr;
95 u8 bdaddr_type;
96 u8 authenticated;
82 u8 type; 97 u8 type;
98 u8 enc_size;
99 __le16 ediv;
100 u8 rand[8];
83 u8 val[16]; 101 u8 val[16];
84 u8 pin_len;
85 u8 dlen;
86 u8 data[0];
87} __packed; 102} __packed;
88 103
89struct link_key { 104struct link_key {
@@ -92,8 +107,6 @@ struct link_key {
92 u8 type; 107 u8 type;
93 u8 val[16]; 108 u8 val[16];
94 u8 pin_len; 109 u8 pin_len;
95 u8 dlen;
96 u8 data[0];
97}; 110};
98 111
99struct oob_data { 112struct oob_data {
@@ -109,11 +122,19 @@ struct adv_entry {
109 u8 bdaddr_type; 122 u8 bdaddr_type;
110}; 123};
111 124
125struct le_scan_params {
126 u8 type;
127 u16 interval;
128 u16 window;
129 int timeout;
130};
131
132#define HCI_MAX_SHORT_NAME_LENGTH 10
133
112#define NUM_REASSEMBLY 4 134#define NUM_REASSEMBLY 4
113struct hci_dev { 135struct hci_dev {
114 struct list_head list; 136 struct list_head list;
115 struct mutex lock; 137 struct mutex lock;
116 atomic_t refcnt;
117 138
118 char name[8]; 139 char name[8];
119 unsigned long flags; 140 unsigned long flags;
@@ -122,6 +143,7 @@ struct hci_dev {
122 __u8 dev_type; 143 __u8 dev_type;
123 bdaddr_t bdaddr; 144 bdaddr_t bdaddr;
124 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 145 __u8 dev_name[HCI_MAX_NAME_LENGTH];
146 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
125 __u8 eir[HCI_MAX_EIR_LENGTH]; 147 __u8 eir[HCI_MAX_EIR_LENGTH];
126 __u8 dev_class[3]; 148 __u8 dev_class[3];
127 __u8 major_class; 149 __u8 major_class;
@@ -129,7 +151,6 @@ struct hci_dev {
129 __u8 features[8]; 151 __u8 features[8];
130 __u8 host_features[8]; 152 __u8 host_features[8];
131 __u8 commands[64]; 153 __u8 commands[64];
132 __u8 ssp_mode;
133 __u8 hci_ver; 154 __u8 hci_ver;
134 __u16 hci_rev; 155 __u16 hci_rev;
135 __u8 lmp_ver; 156 __u8 lmp_ver;
@@ -217,7 +238,7 @@ struct hci_dev {
217 238
218 struct list_head mgmt_pending; 239 struct list_head mgmt_pending;
219 240
220 struct inquiry_cache inq_cache; 241 struct discovery_state discovery;
221 struct hci_conn_hash conn_hash; 242 struct hci_conn_hash conn_hash;
222 struct list_head blacklist; 243 struct list_head blacklist;
223 244
@@ -225,6 +246,8 @@ struct hci_dev {
225 246
226 struct list_head link_keys; 247 struct list_head link_keys;
227 248
249 struct list_head long_term_keys;
250
228 struct list_head remote_oob_data; 251 struct list_head remote_oob_data;
229 252
230 struct list_head adv_entries; 253 struct list_head adv_entries;
@@ -234,7 +257,6 @@ struct hci_dev {
234 257
235 struct sk_buff_head driver_init; 258 struct sk_buff_head driver_init;
236 259
237 void *driver_data;
238 void *core_data; 260 void *core_data;
239 261
240 atomic_t promisc; 262 atomic_t promisc;
@@ -246,15 +268,17 @@ struct hci_dev {
246 268
247 struct rfkill *rfkill; 269 struct rfkill *rfkill;
248 270
249 struct module *owner;
250
251 unsigned long dev_flags; 271 unsigned long dev_flags;
252 272
273 struct delayed_work le_scan_disable;
274
275 struct work_struct le_scan;
276 struct le_scan_params le_scan_params;
277
253 int (*open)(struct hci_dev *hdev); 278 int (*open)(struct hci_dev *hdev);
254 int (*close)(struct hci_dev *hdev); 279 int (*close)(struct hci_dev *hdev);
255 int (*flush)(struct hci_dev *hdev); 280 int (*flush)(struct hci_dev *hdev);
256 int (*send)(struct sk_buff *skb); 281 int (*send)(struct sk_buff *skb);
257 void (*destruct)(struct hci_dev *hdev);
258 void (*notify)(struct hci_dev *hdev, unsigned int evt); 282 void (*notify)(struct hci_dev *hdev, unsigned int evt);
259 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 283 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
260}; 284};
@@ -270,11 +294,10 @@ struct hci_conn {
270 __u16 state; 294 __u16 state;
271 __u8 mode; 295 __u8 mode;
272 __u8 type; 296 __u8 type;
273 __u8 out; 297 bool out;
274 __u8 attempt; 298 __u8 attempt;
275 __u8 dev_class[3]; 299 __u8 dev_class[3];
276 __u8 features[8]; 300 __u8 features[8];
277 __u8 ssp_mode;
278 __u16 interval; 301 __u16 interval;
279 __u16 pkt_type; 302 __u16 pkt_type;
280 __u16 link_policy; 303 __u16 link_policy;
@@ -286,12 +309,10 @@ struct hci_conn {
286 __u8 pin_length; 309 __u8 pin_length;
287 __u8 enc_key_size; 310 __u8 enc_key_size;
288 __u8 io_capability; 311 __u8 io_capability;
289 __u8 power_save;
290 __u16 disc_timeout; 312 __u16 disc_timeout;
291 unsigned long pend; 313 unsigned long flags;
292 314
293 __u8 remote_cap; 315 __u8 remote_cap;
294 __u8 remote_oob;
295 __u8 remote_auth; 316 __u8 remote_auth;
296 317
297 unsigned int sent; 318 unsigned int sent;
@@ -348,21 +369,26 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
348#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 369#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
349#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ 370#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */
350 371
351static inline void inquiry_cache_init(struct hci_dev *hdev) 372static inline void discovery_init(struct hci_dev *hdev)
352{ 373{
353 struct inquiry_cache *c = &hdev->inq_cache; 374 hdev->discovery.state = DISCOVERY_STOPPED;
354 c->list = NULL; 375 INIT_LIST_HEAD(&hdev->discovery.all);
376 INIT_LIST_HEAD(&hdev->discovery.unknown);
377 INIT_LIST_HEAD(&hdev->discovery.resolve);
355} 378}
356 379
380bool hci_discovery_active(struct hci_dev *hdev);
381
382void hci_discovery_set_state(struct hci_dev *hdev, int state);
383
357static inline int inquiry_cache_empty(struct hci_dev *hdev) 384static inline int inquiry_cache_empty(struct hci_dev *hdev)
358{ 385{
359 struct inquiry_cache *c = &hdev->inq_cache; 386 return list_empty(&hdev->discovery.all);
360 return c->list == NULL;
361} 387}
362 388
363static inline long inquiry_cache_age(struct hci_dev *hdev) 389static inline long inquiry_cache_age(struct hci_dev *hdev)
364{ 390{
365 struct inquiry_cache *c = &hdev->inq_cache; 391 struct discovery_state *c = &hdev->discovery;
366 return jiffies - c->timestamp; 392 return jiffies - c->timestamp;
367} 393}
368 394
@@ -372,8 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
372} 398}
373 399
374struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, 400struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
375 bdaddr_t *bdaddr); 401 bdaddr_t *bdaddr);
376void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); 402struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
403 bdaddr_t *bdaddr);
404struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
405 bdaddr_t *bdaddr,
406 int state);
407void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
408 struct inquiry_entry *ie);
409bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
410 bool name_known, bool *ssp);
377 411
378/* ----- HCI Connections ----- */ 412/* ----- HCI Connections ----- */
379enum { 413enum {
@@ -384,8 +418,19 @@ enum {
384 HCI_CONN_MODE_CHANGE_PEND, 418 HCI_CONN_MODE_CHANGE_PEND,
385 HCI_CONN_SCO_SETUP_PEND, 419 HCI_CONN_SCO_SETUP_PEND,
386 HCI_CONN_LE_SMP_PEND, 420 HCI_CONN_LE_SMP_PEND,
421 HCI_CONN_MGMT_CONNECTED,
422 HCI_CONN_SSP_ENABLED,
423 HCI_CONN_POWER_SAVE,
424 HCI_CONN_REMOTE_OOB,
387}; 425};
388 426
427static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
428{
429 struct hci_dev *hdev = conn->hdev;
430 return (test_bit(HCI_SSP_ENABLED, &hdev->flags) &&
431 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags));
432}
433
389static inline void hci_conn_hash_init(struct hci_dev *hdev) 434static inline void hci_conn_hash_init(struct hci_dev *hdev)
390{ 435{
391 struct hci_conn_hash *h = &hdev->conn_hash; 436 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -540,7 +585,7 @@ void hci_conn_put_device(struct hci_conn *conn);
540static inline void hci_conn_hold(struct hci_conn *conn) 585static inline void hci_conn_hold(struct hci_conn *conn)
541{ 586{
542 atomic_inc(&conn->refcnt); 587 atomic_inc(&conn->refcnt);
543 cancel_delayed_work_sync(&conn->disc_work); 588 cancel_delayed_work(&conn->disc_work);
544} 589}
545 590
546static inline void hci_conn_put(struct hci_conn *conn) 591static inline void hci_conn_put(struct hci_conn *conn)
@@ -559,43 +604,40 @@ static inline void hci_conn_put(struct hci_conn *conn)
559 } else { 604 } else {
560 timeo = msecs_to_jiffies(10); 605 timeo = msecs_to_jiffies(10);
561 } 606 }
562 cancel_delayed_work_sync(&conn->disc_work); 607 cancel_delayed_work(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue, 608 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo); 609 &conn->disc_work, timeo);
565 } 610 }
566} 611}
567 612
568/* ----- HCI Devices ----- */ 613/* ----- HCI Devices ----- */
569static inline void __hci_dev_put(struct hci_dev *d) 614static inline void hci_dev_put(struct hci_dev *d)
570{ 615{
571 if (atomic_dec_and_test(&d->refcnt)) 616 put_device(&d->dev);
572 d->destruct(d);
573} 617}
574 618
575/* 619static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
576 * hci_dev_put and hci_dev_hold are macros to avoid dragging all the
577 * overhead of all the modular infrastructure into this header.
578 */
579#define hci_dev_put(d) \
580do { \
581 __hci_dev_put(d); \
582 module_put(d->owner); \
583} while (0)
584
585static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
586{ 620{
587 atomic_inc(&d->refcnt); 621 get_device(&d->dev);
588 return d; 622 return d;
589} 623}
590 624
591#define hci_dev_hold(d) \
592({ \
593 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \
594})
595
596#define hci_dev_lock(d) mutex_lock(&d->lock) 625#define hci_dev_lock(d) mutex_lock(&d->lock)
597#define hci_dev_unlock(d) mutex_unlock(&d->lock) 626#define hci_dev_unlock(d) mutex_unlock(&d->lock)
598 627
628#define to_hci_dev(d) container_of(d, struct hci_dev, dev)
629#define to_hci_conn(c) container_of(c, struct hci_conn, dev)
630
631static inline void *hci_get_drvdata(struct hci_dev *hdev)
632{
633 return dev_get_drvdata(&hdev->dev);
634}
635
636static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
637{
638 dev_set_drvdata(&hdev->dev, data);
639}
640
599struct hci_dev *hci_dev_get(int index); 641struct hci_dev *hci_dev_get(int index);
600struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 642struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
601 643
@@ -619,20 +661,23 @@ int hci_inquiry(void __user *arg);
619 661
620struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 662struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
621int hci_blacklist_clear(struct hci_dev *hdev); 663int hci_blacklist_clear(struct hci_dev *hdev);
622int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); 664int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
623int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); 665int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
624 666
625int hci_uuids_clear(struct hci_dev *hdev); 667int hci_uuids_clear(struct hci_dev *hdev);
626 668
627int hci_link_keys_clear(struct hci_dev *hdev); 669int hci_link_keys_clear(struct hci_dev *hdev);
628struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 670struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
629int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 671int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
630 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 672 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
631struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 673struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
632struct link_key *hci_find_link_key_type(struct hci_dev *hdev, 674int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
633 bdaddr_t *bdaddr, u8 type); 675 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv,
634int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, 676 u8 rand[8]);
635 u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); 677struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
678 u8 addr_type);
679int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
680int hci_smp_ltks_clear(struct hci_dev *hdev);
636int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 681int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
637 682
638int hci_remote_oob_data_clear(struct hci_dev *hdev); 683int hci_remote_oob_data_clear(struct hci_dev *hdev);
@@ -674,6 +719,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
674#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 719#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
675#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 720#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 721#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
722#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
677 723
678/* ----- Extended LMP capabilities ----- */ 724/* ----- Extended LMP capabilities ----- */
679#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 725#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
@@ -755,7 +801,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
755 if (conn->type != ACL_LINK && conn->type != LE_LINK) 801 if (conn->type != ACL_LINK && conn->type != LE_LINK)
756 return; 802 return;
757 803
758 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 804 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
759 return; 805 return;
760 806
761 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 807 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -796,7 +842,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
796 842
797 hci_proto_auth_cfm(conn, status); 843 hci_proto_auth_cfm(conn, status);
798 844
799 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 845 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
800 return; 846 return;
801 847
802 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 848 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -859,25 +905,71 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
859 read_unlock(&hci_cb_list_lock); 905 read_unlock(&hci_cb_list_lock);
860} 906}
861 907
908static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
909{
910 u8 field_len;
911 size_t parsed;
912
913 for (parsed = 0; parsed < data_len - 1; parsed += field_len) {
914 field_len = data[0];
915
916 if (field_len == 0)
917 break;
918
919 parsed += field_len + 1;
920
921 if (parsed > data_len)
922 break;
923
924 if (data[1] == type)
925 return true;
926
927 data += field_len + 1;
928 }
929
930 return false;
931}
932
933static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
934 u8 data_len)
935{
936 eir[eir_len++] = sizeof(type) + data_len;
937 eir[eir_len++] = type;
938 memcpy(&eir[eir_len], data, data_len);
939 eir_len += data_len;
940
941 return eir_len;
942}
943
862int hci_register_cb(struct hci_cb *hcb); 944int hci_register_cb(struct hci_cb *hcb);
863int hci_unregister_cb(struct hci_cb *hcb); 945int hci_unregister_cb(struct hci_cb *hcb);
864 946
865int hci_register_notifier(struct notifier_block *nb);
866int hci_unregister_notifier(struct notifier_block *nb);
867
868int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 947int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
869void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); 948void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
870void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 949void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
871 950
872void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 951void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
873 952
874void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
875
876/* ----- HCI Sockets ----- */ 953/* ----- HCI Sockets ----- */
877void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, 954void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
878 struct sock *skip_sk); 955void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk);
956void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
957
958void hci_sock_dev_event(struct hci_dev *hdev, int event);
879 959
880/* Management interface */ 960/* Management interface */
961#define MGMT_ADDR_BREDR 0x00
962#define MGMT_ADDR_LE_PUBLIC 0x01
963#define MGMT_ADDR_LE_RANDOM 0x02
964#define MGMT_ADDR_INVALID 0xff
965
966#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR))
967#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
968 BIT(MGMT_ADDR_LE_RANDOM))
969#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
970 BIT(MGMT_ADDR_LE_PUBLIC) | \
971 BIT(MGMT_ADDR_LE_RANDOM))
972
881int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 973int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
882int mgmt_index_added(struct hci_dev *hdev); 974int mgmt_index_added(struct hci_dev *hdev);
883int mgmt_index_removed(struct hci_dev *hdev); 975int mgmt_index_removed(struct hci_dev *hdev);
@@ -886,56 +978,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
886int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 978int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
887int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 979int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
888int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 980int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
889 u8 persistent); 981 u8 persistent);
890int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 982int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
891 u8 addr_type); 983 u8 addr_type, u32 flags, u8 *name, u8 name_len,
892int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 984 u8 *dev_class);
893 u8 addr_type); 985int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
894int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 986 u8 link_type, u8 addr_type);
987int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
988 u8 link_type, u8 addr_type, u8 status);
895int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 989int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
896 u8 addr_type, u8 status); 990 u8 addr_type, u8 status);
897int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 991int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
898int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 992int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
899 u8 status); 993 u8 status);
900int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 994int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
901 u8 status); 995 u8 status);
902int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 996int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 __le32 value, u8 confirm_hint); 997 u8 link_type, u8 addr_type, __le32 value,
998 u8 confirm_hint);
904int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 999int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
905 u8 status); 1000 u8 link_type, u8 addr_type, u8 status);
906int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, 1001int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
907 bdaddr_t *bdaddr, u8 status); 1002 u8 link_type, u8 addr_type, u8 status);
908int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); 1003int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1004 u8 link_type, u8 addr_type);
909int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1005int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
910 u8 status); 1006 u8 link_type, u8 addr_type, u8 status);
911int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, 1007int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
912 bdaddr_t *bdaddr, u8 status); 1008 u8 link_type, u8 addr_type, u8 status);
913int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 1009int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1010 u8 addr_type, u8 status);
1011int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1012int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1013int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1014 u8 status);
914int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1015int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
915int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1016int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
916 u8 *randomizer, u8 status); 1017 u8 *randomizer, u8 status);
1018int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
917int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1019int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
918 u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); 1020 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
919int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); 1021 u8 ssp, u8 *eir, u16 eir_len);
1022int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1023 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
920int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); 1024int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
921int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); 1025int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
922int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1026int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
923int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1027int mgmt_interleaved_discovery(struct hci_dev *hdev);
924int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1028int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1029int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1030
1031int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
925 1032
926/* HCI info for socket */ 1033/* HCI info for socket */
927#define hci_pi(sk) ((struct hci_pinfo *) sk) 1034#define hci_pi(sk) ((struct hci_pinfo *) sk)
928 1035
929/* HCI socket flags */
930#define HCI_PI_MGMT_INIT 0
931
932struct hci_pinfo { 1036struct hci_pinfo {
933 struct bt_sock bt; 1037 struct bt_sock bt;
934 struct hci_dev *hdev; 1038 struct hci_dev *hdev;
935 struct hci_filter filter; 1039 struct hci_filter filter;
936 __u32 cmsg_mask; 1040 __u32 cmsg_mask;
937 unsigned short channel; 1041 unsigned short channel;
938 unsigned long flags;
939}; 1042};
940 1043
941/* HCI security filter */ 1044/* HCI security filter */
@@ -966,5 +1069,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn);
966 1069
967int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1070int hci_do_inquiry(struct hci_dev *hdev, u8 length);
968int hci_cancel_inquiry(struct hci_dev *hdev); 1071int hci_cancel_inquiry(struct hci_dev *hdev);
1072int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1073 int timeout);
969 1074
970#endif /* __HCI_CORE_H */ 1075#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h
new file mode 100644
index 00000000000..77d1e576418
--- /dev/null
+++ b/include/net/bluetooth/hci_mon.h
@@ -0,0 +1,51 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3
4 Copyright (C) 2011-2012 Intel Corporation
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 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED.
22*/
23
24#ifndef __HCI_MON_H
25#define __HCI_MON_H
26
27struct hci_mon_hdr {
28 __le16 opcode;
29 __le16 index;
30 __le16 len;
31} __packed;
32#define HCI_MON_HDR_SIZE 6
33
34#define HCI_MON_NEW_INDEX 0
35#define HCI_MON_DEL_INDEX 1
36#define HCI_MON_COMMAND_PKT 2
37#define HCI_MON_EVENT_PKT 3
38#define HCI_MON_ACL_TX_PKT 4
39#define HCI_MON_ACL_RX_PKT 5
40#define HCI_MON_SCO_TX_PKT 6
41#define HCI_MON_SCO_RX_PKT 7
42
43struct hci_mon_new_index {
44 __u8 type;
45 __u8 bus;
46 bdaddr_t bdaddr;
47 char name[8];
48} __packed;
49#define HCI_MON_NEW_INDEX_SIZE 16
50
51#endif /* __HCI_MON_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 68f58915069..9b242c6bf55 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -45,11 +45,11 @@
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47 47
48#define L2CAP_DISC_TIMEOUT (100) 48#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
49#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ 49#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
50#define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ 50#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
51#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 51#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
52#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 52#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
53 53
54/* L2CAP socket address */ 54/* L2CAP socket address */
55struct sockaddr_l2 { 55struct sockaddr_l2 {
@@ -492,51 +492,56 @@ struct l2cap_chan {
492 struct sk_buff_head srej_q; 492 struct sk_buff_head srej_q;
493 struct list_head srej_l; 493 struct list_head srej_l;
494 494
495 struct list_head list; 495 struct list_head list;
496 struct list_head global_l; 496 struct list_head global_l;
497 497
498 void *data; 498 void *data;
499 struct l2cap_ops *ops; 499 struct l2cap_ops *ops;
500 struct mutex lock;
500}; 501};
501 502
502struct l2cap_ops { 503struct l2cap_ops {
503 char *name; 504 char *name;
504 505
505 struct l2cap_chan *(*new_connection) (void *data); 506 struct l2cap_chan *(*new_connection) (void *data);
506 int (*recv) (void *data, struct sk_buff *skb); 507 int (*recv) (void *data, struct sk_buff *skb);
507 void (*close) (void *data); 508 void (*close) (void *data);
508 void (*state_change) (void *data, int state); 509 void (*state_change) (void *data, int state);
510 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
511 unsigned long len, int nb, int *err);
512
509}; 513};
510 514
511struct l2cap_conn { 515struct l2cap_conn {
512 struct hci_conn *hcon; 516 struct hci_conn *hcon;
513 struct hci_chan *hchan; 517 struct hci_chan *hchan;
514 518
515 bdaddr_t *dst; 519 bdaddr_t *dst;
516 bdaddr_t *src; 520 bdaddr_t *src;
517 521
518 unsigned int mtu; 522 unsigned int mtu;
519 523
520 __u32 feat_mask; 524 __u32 feat_mask;
525 __u8 fixed_chan_mask;
521 526
522 __u8 info_state; 527 __u8 info_state;
523 __u8 info_ident; 528 __u8 info_ident;
524 529
525 struct delayed_work info_timer; 530 struct delayed_work info_timer;
526 531
527 spinlock_t lock; 532 spinlock_t lock;
528 533
529 struct sk_buff *rx_skb; 534 struct sk_buff *rx_skb;
530 __u32 rx_len; 535 __u32 rx_len;
531 __u8 tx_ident; 536 __u8 tx_ident;
532 537
533 __u8 disc_reason; 538 __u8 disc_reason;
534 539
535 struct delayed_work security_timer; 540 struct delayed_work security_timer;
536 struct smp_chan *smp_chan; 541 struct smp_chan *smp_chan;
537 542
538 struct list_head chan_l; 543 struct list_head chan_l;
539 struct mutex chan_lock; 544 struct mutex chan_lock;
540}; 545};
541 546
542#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 547#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -551,9 +556,9 @@ struct l2cap_conn {
551#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 556#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
552 557
553struct l2cap_pinfo { 558struct l2cap_pinfo {
554 struct bt_sock bt; 559 struct bt_sock bt;
555 struct l2cap_chan *chan; 560 struct l2cap_chan *chan;
556 struct sk_buff *rx_busy_skb; 561 struct sk_buff *rx_busy_skb;
557}; 562};
558 563
559enum { 564enum {
@@ -606,33 +611,49 @@ static inline void l2cap_chan_put(struct l2cap_chan *c)
606 kfree(c); 611 kfree(c);
607} 612}
608 613
614static inline void l2cap_chan_lock(struct l2cap_chan *chan)
615{
616 mutex_lock(&chan->lock);
617}
618
619static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
620{
621 mutex_unlock(&chan->lock);
622}
623
609static inline void l2cap_set_timer(struct l2cap_chan *chan, 624static inline void l2cap_set_timer(struct l2cap_chan *chan,
610 struct delayed_work *work, long timeout) 625 struct delayed_work *work, long timeout)
611{ 626{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 627 BT_DBG("chan %p state %s timeout %ld", chan,
628 state_to_string(chan->state), timeout);
613 629
614 if (!__cancel_delayed_work(work)) 630 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 631 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 632 schedule_delayed_work(work, timeout);
617} 633}
618 634
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 635static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 636 struct delayed_work *work)
621{ 637{
622 if (__cancel_delayed_work(work)) 638 bool ret;
639
640 ret = cancel_delayed_work(work);
641 if (ret)
623 l2cap_chan_put(chan); 642 l2cap_chan_put(chan);
643
644 return ret;
624} 645}
625 646
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 647#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 648#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 649#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
629 L2CAP_DEFAULT_RETRANS_TO); 650 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 651#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ 652#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
632 L2CAP_DEFAULT_MONITOR_TO); 653 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 654#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 655#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
635 L2CAP_DEFAULT_ACK_TO); 656 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 657#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
637 658
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 659static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
@@ -834,7 +855,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
834struct l2cap_chan *l2cap_chan_create(struct sock *sk); 855struct l2cap_chan *l2cap_chan_create(struct sock *sk);
835void l2cap_chan_close(struct l2cap_chan *chan, int reason); 856void l2cap_chan_close(struct l2cap_chan *chan, int reason);
836void l2cap_chan_destroy(struct l2cap_chan *chan); 857void l2cap_chan_destroy(struct l2cap_chan *chan);
837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 858int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
838 bdaddr_t *dst); 859 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 860int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority); 861 u32 priority);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index be65d341788..ffc1377e092 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -2,6 +2,7 @@
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 3
4 Copyright (C) 2010 Nokia Corporation 4 Copyright (C) 2010 Nokia Corporation
5 Copyright (C) 2011-2012 Intel Corporation
5 6
6 This program is free software; you can redistribute it and/or modify 7 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 it under the terms of the GNU General Public License version 2 as
@@ -39,29 +40,47 @@
39#define MGMT_STATUS_INVALID_PARAMS 0x0d 40#define MGMT_STATUS_INVALID_PARAMS 0x0d
40#define MGMT_STATUS_DISCONNECTED 0x0e 41#define MGMT_STATUS_DISCONNECTED 0x0e
41#define MGMT_STATUS_NOT_POWERED 0x0f 42#define MGMT_STATUS_NOT_POWERED 0x0f
43#define MGMT_STATUS_CANCELLED 0x10
44#define MGMT_STATUS_INVALID_INDEX 0x11
42 45
43struct mgmt_hdr { 46struct mgmt_hdr {
44 __le16 opcode; 47 __le16 opcode;
45 __le16 index; 48 __le16 index;
46 __le16 len; 49 __le16 len;
47} __packed; 50} __packed;
48 51
52struct mgmt_addr_info {
53 bdaddr_t bdaddr;
54 __u8 type;
55} __packed;
56#define MGMT_ADDR_INFO_SIZE 7
57
49#define MGMT_OP_READ_VERSION 0x0001 58#define MGMT_OP_READ_VERSION 0x0001
59#define MGMT_READ_VERSION_SIZE 0
50struct mgmt_rp_read_version { 60struct mgmt_rp_read_version {
51 __u8 version; 61 __u8 version;
52 __le16 revision; 62 __le16 revision;
63} __packed;
64
65#define MGMT_OP_READ_COMMANDS 0x0002
66#define MGMT_READ_COMMANDS_SIZE 0
67struct mgmt_rp_read_commands {
68 __le16 num_commands;
69 __le16 num_events;
70 __le16 opcodes[0];
53} __packed; 71} __packed;
54 72
55#define MGMT_OP_READ_INDEX_LIST 0x0003 73#define MGMT_OP_READ_INDEX_LIST 0x0003
74#define MGMT_READ_INDEX_LIST_SIZE 0
56struct mgmt_rp_read_index_list { 75struct mgmt_rp_read_index_list {
57 __le16 num_controllers; 76 __le16 num_controllers;
58 __le16 index[0]; 77 __le16 index[0];
59} __packed; 78} __packed;
60 79
61/* Reserve one extra byte for names in management messages so that they 80/* Reserve one extra byte for names in management messages so that they
62 * are always guaranteed to be nul-terminated */ 81 * are always guaranteed to be nul-terminated */
63#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) 82#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
64#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) 83#define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1)
65 84
66#define MGMT_SETTING_POWERED 0x00000001 85#define MGMT_SETTING_POWERED 0x00000001
67#define MGMT_SETTING_CONNECTABLE 0x00000002 86#define MGMT_SETTING_CONNECTABLE 0x00000002
@@ -75,28 +94,32 @@ struct mgmt_rp_read_index_list {
75#define MGMT_SETTING_LE 0x00000200 94#define MGMT_SETTING_LE 0x00000200
76 95
77#define MGMT_OP_READ_INFO 0x0004 96#define MGMT_OP_READ_INFO 0x0004
97#define MGMT_READ_INFO_SIZE 0
78struct mgmt_rp_read_info { 98struct mgmt_rp_read_info {
79 bdaddr_t bdaddr; 99 bdaddr_t bdaddr;
80 __u8 version; 100 __u8 version;
81 __le16 manufacturer; 101 __le16 manufacturer;
82 __le32 supported_settings; 102 __le32 supported_settings;
83 __le32 current_settings; 103 __le32 current_settings;
84 __u8 dev_class[3]; 104 __u8 dev_class[3];
85 __u8 name[MGMT_MAX_NAME_LENGTH]; 105 __u8 name[MGMT_MAX_NAME_LENGTH];
86 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 106 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
87} __packed; 107} __packed;
88 108
89struct mgmt_mode { 109struct mgmt_mode {
90 __u8 val; 110 __u8 val;
91} __packed; 111} __packed;
92 112
113#define MGMT_SETTING_SIZE 1
114
93#define MGMT_OP_SET_POWERED 0x0005 115#define MGMT_OP_SET_POWERED 0x0005
94 116
95#define MGMT_OP_SET_DISCOVERABLE 0x0006 117#define MGMT_OP_SET_DISCOVERABLE 0x0006
96struct mgmt_cp_set_discoverable { 118struct mgmt_cp_set_discoverable {
97 __u8 val; 119 __u8 val;
98 __u16 timeout; 120 __u16 timeout;
99} __packed; 121} __packed;
122#define MGMT_SET_DISCOVERABLE_SIZE 3
100 123
101#define MGMT_OP_SET_CONNECTABLE 0x0007 124#define MGMT_OP_SET_CONNECTABLE 0x0007
102 125
@@ -111,73 +134,76 @@ struct mgmt_cp_set_discoverable {
111#define MGMT_OP_SET_HS 0x000C 134#define MGMT_OP_SET_HS 0x000C
112 135
113#define MGMT_OP_SET_LE 0x000D 136#define MGMT_OP_SET_LE 0x000D
114
115#define MGMT_OP_SET_DEV_CLASS 0x000E 137#define MGMT_OP_SET_DEV_CLASS 0x000E
116struct mgmt_cp_set_dev_class { 138struct mgmt_cp_set_dev_class {
117 __u8 major; 139 __u8 major;
118 __u8 minor; 140 __u8 minor;
119} __packed; 141} __packed;
142#define MGMT_SET_DEV_CLASS_SIZE 2
120 143
121#define MGMT_OP_SET_LOCAL_NAME 0x000F 144#define MGMT_OP_SET_LOCAL_NAME 0x000F
122struct mgmt_cp_set_local_name { 145struct mgmt_cp_set_local_name {
123 __u8 name[MGMT_MAX_NAME_LENGTH]; 146 __u8 name[MGMT_MAX_NAME_LENGTH];
147 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
124} __packed; 148} __packed;
149#define MGMT_SET_LOCAL_NAME_SIZE 260
125 150
126#define MGMT_OP_ADD_UUID 0x0010 151#define MGMT_OP_ADD_UUID 0x0010
127struct mgmt_cp_add_uuid { 152struct mgmt_cp_add_uuid {
128 __u8 uuid[16]; 153 __u8 uuid[16];
129 __u8 svc_hint; 154 __u8 svc_hint;
130} __packed; 155} __packed;
156#define MGMT_ADD_UUID_SIZE 17
131 157
132#define MGMT_OP_REMOVE_UUID 0x0011 158#define MGMT_OP_REMOVE_UUID 0x0011
133struct mgmt_cp_remove_uuid { 159struct mgmt_cp_remove_uuid {
134 __u8 uuid[16]; 160 __u8 uuid[16];
135} __packed; 161} __packed;
162#define MGMT_REMOVE_UUID_SIZE 16
136 163
137struct mgmt_link_key_info { 164struct mgmt_link_key_info {
138 bdaddr_t bdaddr; 165 struct mgmt_addr_info addr;
139 u8 type; 166 __u8 type;
140 u8 val[16]; 167 __u8 val[16];
141 u8 pin_len; 168 __u8 pin_len;
142} __packed; 169} __packed;
143 170
144#define MGMT_OP_LOAD_LINK_KEYS 0x0012 171#define MGMT_OP_LOAD_LINK_KEYS 0x0012
145struct mgmt_cp_load_link_keys { 172struct mgmt_cp_load_link_keys {
146 __u8 debug_keys; 173 __u8 debug_keys;
147 __le16 key_count; 174 __le16 key_count;
148 struct mgmt_link_key_info keys[0]; 175 struct mgmt_link_key_info keys[0];
149} __packed; 176} __packed;
177#define MGMT_LOAD_LINK_KEYS_SIZE 3
150 178
151#define MGMT_OP_REMOVE_KEYS 0x0013 179struct mgmt_ltk_info {
152struct mgmt_cp_remove_keys { 180 struct mgmt_addr_info addr;
153 bdaddr_t bdaddr; 181 __u8 authenticated;
154 __u8 disconnect; 182 __u8 master;
183 __u8 enc_size;
184 __le16 ediv;
185 __u8 rand[8];
186 __u8 val[16];
155} __packed; 187} __packed;
156struct mgmt_rp_remove_keys { 188
157 bdaddr_t bdaddr; 189#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
158 __u8 status; 190struct mgmt_cp_load_long_term_keys {
159}; 191 __le16 key_count;
192 struct mgmt_ltk_info keys[0];
193} __packed;
194#define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2
160 195
161#define MGMT_OP_DISCONNECT 0x0014 196#define MGMT_OP_DISCONNECT 0x0014
162struct mgmt_cp_disconnect { 197struct mgmt_cp_disconnect {
163 bdaddr_t bdaddr; 198 struct mgmt_addr_info addr;
164} __packed; 199} __packed;
200#define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE
165struct mgmt_rp_disconnect { 201struct mgmt_rp_disconnect {
166 bdaddr_t bdaddr; 202 struct mgmt_addr_info addr;
167 __u8 status;
168} __packed;
169
170#define MGMT_ADDR_BREDR 0x00
171#define MGMT_ADDR_LE_PUBLIC 0x01
172#define MGMT_ADDR_LE_RANDOM 0x02
173#define MGMT_ADDR_INVALID 0xff
174
175struct mgmt_addr_info {
176 bdaddr_t bdaddr;
177 __u8 type;
178} __packed; 203} __packed;
179 204
180#define MGMT_OP_GET_CONNECTIONS 0x0015 205#define MGMT_OP_GET_CONNECTIONS 0x0015
206#define MGMT_GET_CONNECTIONS_SIZE 0
181struct mgmt_rp_get_connections { 207struct mgmt_rp_get_connections {
182 __le16 conn_count; 208 __le16 conn_count;
183 struct mgmt_addr_info addr[0]; 209 struct mgmt_addr_info addr[0];
@@ -185,124 +211,152 @@ struct mgmt_rp_get_connections {
185 211
186#define MGMT_OP_PIN_CODE_REPLY 0x0016 212#define MGMT_OP_PIN_CODE_REPLY 0x0016
187struct mgmt_cp_pin_code_reply { 213struct mgmt_cp_pin_code_reply {
188 bdaddr_t bdaddr; 214 struct mgmt_addr_info addr;
189 __u8 pin_len; 215 __u8 pin_len;
190 __u8 pin_code[16]; 216 __u8 pin_code[16];
191} __packed; 217} __packed;
218#define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17)
192struct mgmt_rp_pin_code_reply { 219struct mgmt_rp_pin_code_reply {
193 bdaddr_t bdaddr; 220 struct mgmt_addr_info addr;
194 uint8_t status;
195} __packed; 221} __packed;
196 222
197#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 223#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
198struct mgmt_cp_pin_code_neg_reply { 224struct mgmt_cp_pin_code_neg_reply {
199 bdaddr_t bdaddr; 225 struct mgmt_addr_info addr;
200} __packed; 226} __packed;
227#define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
201 228
202#define MGMT_OP_SET_IO_CAPABILITY 0x0018 229#define MGMT_OP_SET_IO_CAPABILITY 0x0018
203struct mgmt_cp_set_io_capability { 230struct mgmt_cp_set_io_capability {
204 __u8 io_capability; 231 __u8 io_capability;
205} __packed; 232} __packed;
233#define MGMT_SET_IO_CAPABILITY_SIZE 1
206 234
207#define MGMT_OP_PAIR_DEVICE 0x0019 235#define MGMT_OP_PAIR_DEVICE 0x0019
208struct mgmt_cp_pair_device { 236struct mgmt_cp_pair_device {
209 struct mgmt_addr_info addr; 237 struct mgmt_addr_info addr;
210 __u8 io_cap; 238 __u8 io_cap;
211} __packed; 239} __packed;
240#define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
212struct mgmt_rp_pair_device { 241struct mgmt_rp_pair_device {
213 struct mgmt_addr_info addr; 242 struct mgmt_addr_info addr;
214 __u8 status;
215} __packed; 243} __packed;
216 244
217#define MGMT_OP_USER_CONFIRM_REPLY 0x001A 245#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
246#define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
247
248#define MGMT_OP_UNPAIR_DEVICE 0x001B
249struct mgmt_cp_unpair_device {
250 struct mgmt_addr_info addr;
251 __u8 disconnect;
252} __packed;
253#define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
254struct mgmt_rp_unpair_device {
255 struct mgmt_addr_info addr;
256};
257
258#define MGMT_OP_USER_CONFIRM_REPLY 0x001C
218struct mgmt_cp_user_confirm_reply { 259struct mgmt_cp_user_confirm_reply {
219 bdaddr_t bdaddr; 260 struct mgmt_addr_info addr;
220} __packed; 261} __packed;
262#define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE
221struct mgmt_rp_user_confirm_reply { 263struct mgmt_rp_user_confirm_reply {
222 bdaddr_t bdaddr; 264 struct mgmt_addr_info addr;
223 __u8 status;
224} __packed; 265} __packed;
225 266
226#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B 267#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
227struct mgmt_cp_user_confirm_neg_reply { 268struct mgmt_cp_user_confirm_neg_reply {
228 bdaddr_t bdaddr; 269 struct mgmt_addr_info addr;
229} __packed; 270} __packed;
271#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
230 272
231#define MGMT_OP_USER_PASSKEY_REPLY 0x001C 273#define MGMT_OP_USER_PASSKEY_REPLY 0x001E
232struct mgmt_cp_user_passkey_reply { 274struct mgmt_cp_user_passkey_reply {
233 bdaddr_t bdaddr; 275 struct mgmt_addr_info addr;
234 __le32 passkey; 276 __le32 passkey;
235} __packed; 277} __packed;
278#define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4)
236struct mgmt_rp_user_passkey_reply { 279struct mgmt_rp_user_passkey_reply {
237 bdaddr_t bdaddr; 280 struct mgmt_addr_info addr;
238 __u8 status;
239} __packed; 281} __packed;
240 282
241#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D 283#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
242struct mgmt_cp_user_passkey_neg_reply { 284struct mgmt_cp_user_passkey_neg_reply {
243 bdaddr_t bdaddr; 285 struct mgmt_addr_info addr;
244} __packed; 286} __packed;
287#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
245 288
246#define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E 289#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
290#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
247struct mgmt_rp_read_local_oob_data { 291struct mgmt_rp_read_local_oob_data {
248 __u8 hash[16]; 292 __u8 hash[16];
249 __u8 randomizer[16]; 293 __u8 randomizer[16];
250} __packed; 294} __packed;
251 295
252#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F 296#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
253struct mgmt_cp_add_remote_oob_data { 297struct mgmt_cp_add_remote_oob_data {
254 bdaddr_t bdaddr; 298 struct mgmt_addr_info addr;
255 __u8 hash[16]; 299 __u8 hash[16];
256 __u8 randomizer[16]; 300 __u8 randomizer[16];
257} __packed; 301} __packed;
302#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
258 303
259#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 304#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
260struct mgmt_cp_remove_remote_oob_data { 305struct mgmt_cp_remove_remote_oob_data {
261 bdaddr_t bdaddr; 306 struct mgmt_addr_info addr;
262} __packed; 307} __packed;
308#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
263 309
264#define MGMT_OP_START_DISCOVERY 0x0021 310#define MGMT_OP_START_DISCOVERY 0x0023
265struct mgmt_cp_start_discovery { 311struct mgmt_cp_start_discovery {
266 __u8 type; 312 __u8 type;
267} __packed; 313} __packed;
314#define MGMT_START_DISCOVERY_SIZE 1
268 315
269#define MGMT_OP_STOP_DISCOVERY 0x0022 316#define MGMT_OP_STOP_DISCOVERY 0x0024
317struct mgmt_cp_stop_discovery {
318 __u8 type;
319} __packed;
320#define MGMT_STOP_DISCOVERY_SIZE 1
270 321
271#define MGMT_OP_CONFIRM_NAME 0x0023 322#define MGMT_OP_CONFIRM_NAME 0x0025
272struct mgmt_cp_confirm_name { 323struct mgmt_cp_confirm_name {
273 bdaddr_t bdaddr; 324 struct mgmt_addr_info addr;
274 __u8 name_known; 325 __u8 name_known;
275} __packed; 326} __packed;
327#define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1)
276struct mgmt_rp_confirm_name { 328struct mgmt_rp_confirm_name {
277 bdaddr_t bdaddr; 329 struct mgmt_addr_info addr;
278 __u8 status;
279} __packed; 330} __packed;
280 331
281#define MGMT_OP_BLOCK_DEVICE 0x0024 332#define MGMT_OP_BLOCK_DEVICE 0x0026
282struct mgmt_cp_block_device { 333struct mgmt_cp_block_device {
283 bdaddr_t bdaddr; 334 struct mgmt_addr_info addr;
284} __packed; 335} __packed;
336#define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
285 337
286#define MGMT_OP_UNBLOCK_DEVICE 0x0025 338#define MGMT_OP_UNBLOCK_DEVICE 0x0027
287struct mgmt_cp_unblock_device { 339struct mgmt_cp_unblock_device {
288 bdaddr_t bdaddr; 340 struct mgmt_addr_info addr;
289} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
290 343
291#define MGMT_EV_CMD_COMPLETE 0x0001 344#define MGMT_EV_CMD_COMPLETE 0x0001
292struct mgmt_ev_cmd_complete { 345struct mgmt_ev_cmd_complete {
293 __le16 opcode; 346 __le16 opcode;
294 __u8 data[0]; 347 __u8 status;
348 __u8 data[0];
295} __packed; 349} __packed;
296 350
297#define MGMT_EV_CMD_STATUS 0x0002 351#define MGMT_EV_CMD_STATUS 0x0002
298struct mgmt_ev_cmd_status { 352struct mgmt_ev_cmd_status {
299 __u8 status; 353 __le16 opcode;
300 __le16 opcode; 354 __u8 status;
301} __packed; 355} __packed;
302 356
303#define MGMT_EV_CONTROLLER_ERROR 0x0003 357#define MGMT_EV_CONTROLLER_ERROR 0x0003
304struct mgmt_ev_controller_error { 358struct mgmt_ev_controller_error {
305 __u8 error_code; 359 __u8 error_code;
306} __packed; 360} __packed;
307 361
308#define MGMT_EV_INDEX_ADDED 0x0004 362#define MGMT_EV_INDEX_ADDED 0x0004
@@ -313,78 +367,96 @@ struct mgmt_ev_controller_error {
313 367
314#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 368#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
315struct mgmt_ev_class_of_dev_changed { 369struct mgmt_ev_class_of_dev_changed {
316 __u8 dev_class[3]; 370 __u8 dev_class[3];
317}; 371};
318 372
319#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 373#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
320struct mgmt_ev_local_name_changed { 374struct mgmt_ev_local_name_changed {
321 __u8 name[MGMT_MAX_NAME_LENGTH]; 375 __u8 name[MGMT_MAX_NAME_LENGTH];
322 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 376 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
323} __packed; 377} __packed;
324 378
325#define MGMT_EV_NEW_LINK_KEY 0x0009 379#define MGMT_EV_NEW_LINK_KEY 0x0009
326struct mgmt_ev_new_link_key { 380struct mgmt_ev_new_link_key {
327 __u8 store_hint; 381 __u8 store_hint;
328 struct mgmt_link_key_info key; 382 struct mgmt_link_key_info key;
329} __packed; 383} __packed;
330 384
331#define MGMT_EV_CONNECTED 0x000A 385#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
386struct mgmt_ev_new_long_term_key {
387 __u8 store_hint;
388 struct mgmt_ltk_info key;
389} __packed;
332 390
333#define MGMT_EV_DISCONNECTED 0x000B 391#define MGMT_EV_DEVICE_CONNECTED 0x000B
392struct mgmt_ev_device_connected {
393 struct mgmt_addr_info addr;
394 __le32 flags;
395 __le16 eir_len;
396 __u8 eir[0];
397} __packed;
398
399#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
334 400
335#define MGMT_EV_CONNECT_FAILED 0x000C 401#define MGMT_EV_CONNECT_FAILED 0x000D
336struct mgmt_ev_connect_failed { 402struct mgmt_ev_connect_failed {
337 struct mgmt_addr_info addr; 403 struct mgmt_addr_info addr;
338 __u8 status; 404 __u8 status;
339} __packed; 405} __packed;
340 406
341#define MGMT_EV_PIN_CODE_REQUEST 0x000D 407#define MGMT_EV_PIN_CODE_REQUEST 0x000E
342struct mgmt_ev_pin_code_request { 408struct mgmt_ev_pin_code_request {
343 bdaddr_t bdaddr; 409 struct mgmt_addr_info addr;
344 __u8 secure; 410 __u8 secure;
345} __packed; 411} __packed;
346 412
347#define MGMT_EV_USER_CONFIRM_REQUEST 0x000E 413#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
348struct mgmt_ev_user_confirm_request { 414struct mgmt_ev_user_confirm_request {
349 bdaddr_t bdaddr; 415 struct mgmt_addr_info addr;
350 __u8 confirm_hint; 416 __u8 confirm_hint;
351 __le32 value; 417 __le32 value;
352} __packed; 418} __packed;
353 419
354#define MGMT_EV_USER_PASSKEY_REQUEST 0x000F 420#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
355struct mgmt_ev_user_passkey_request { 421struct mgmt_ev_user_passkey_request {
356 bdaddr_t bdaddr; 422 struct mgmt_addr_info addr;
357} __packed; 423} __packed;
358 424
359#define MGMT_EV_AUTH_FAILED 0x0010 425#define MGMT_EV_AUTH_FAILED 0x0011
360struct mgmt_ev_auth_failed { 426struct mgmt_ev_auth_failed {
361 bdaddr_t bdaddr; 427 struct mgmt_addr_info addr;
362 __u8 status; 428 __u8 status;
363} __packed; 429} __packed;
364 430
365#define MGMT_EV_DEVICE_FOUND 0x0011 431#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
432#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
433
434#define MGMT_EV_DEVICE_FOUND 0x0012
366struct mgmt_ev_device_found { 435struct mgmt_ev_device_found {
367 struct mgmt_addr_info addr; 436 struct mgmt_addr_info addr;
368 __u8 dev_class[3]; 437 __s8 rssi;
369 __s8 rssi; 438 __u8 flags[4];
370 __u8 confirm_name; 439 __le16 eir_len;
371 __u8 eir[HCI_MAX_EIR_LENGTH]; 440 __u8 eir[0];
372} __packed;
373
374#define MGMT_EV_REMOTE_NAME 0x0012
375struct mgmt_ev_remote_name {
376 bdaddr_t bdaddr;
377 __u8 name[MGMT_MAX_NAME_LENGTH];
378} __packed; 441} __packed;
379 442
380#define MGMT_EV_DISCOVERING 0x0013 443#define MGMT_EV_DISCOVERING 0x0013
444struct mgmt_ev_discovering {
445 __u8 type;
446 __u8 discovering;
447} __packed;
381 448
382#define MGMT_EV_DEVICE_BLOCKED 0x0014 449#define MGMT_EV_DEVICE_BLOCKED 0x0014
383struct mgmt_ev_device_blocked { 450struct mgmt_ev_device_blocked {
384 bdaddr_t bdaddr; 451 struct mgmt_addr_info addr;
385} __packed; 452} __packed;
386 453
387#define MGMT_EV_DEVICE_UNBLOCKED 0x0015 454#define MGMT_EV_DEVICE_UNBLOCKED 0x0015
388struct mgmt_ev_device_unblocked { 455struct mgmt_ev_device_unblocked {
389 bdaddr_t bdaddr; 456 struct mgmt_addr_info addr;
457} __packed;
458
459#define MGMT_EV_DEVICE_UNPAIRED 0x0016
460struct mgmt_ev_device_unpaired {
461 struct mgmt_addr_info addr;
390} __packed; 462} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index aeaf5fa2b9f..7b3acdd2913 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -127,7 +127,7 @@ struct smp_chan {
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 smp_key_size; 130 u8 enc_key_size;
131 unsigned long smp_flags; 131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm; 132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm; 133 struct work_struct confirm;
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 8d552519ff6..6db8ecf52aa 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -138,6 +138,7 @@ struct cfhsi {
138 u8 *rx_ptr; 138 u8 *rx_ptr;
139 u8 *tx_buf; 139 u8 *tx_buf;
140 u8 *rx_buf; 140 u8 *rx_buf;
141 u8 *rx_flip_buf;
141 spinlock_t lock; 142 spinlock_t lock;
142 int flow_off_sent; 143 int flow_off_sent;
143 u32 q_low_mark; 144 u32 q_low_mark;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 15f4be7d768..69b7ad3a992 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -120,6 +120,7 @@ enum ieee80211_channel_flags {
120 * @band: band this channel belongs to. 120 * @band: band this channel belongs to.
121 * @max_antenna_gain: maximum antenna gain in dBi 121 * @max_antenna_gain: maximum antenna gain in dBi
122 * @max_power: maximum transmission power (in dBm) 122 * @max_power: maximum transmission power (in dBm)
123 * @max_reg_power: maximum regulatory transmission power (in dBm)
123 * @beacon_found: helper to regulatory code to indicate when a beacon 124 * @beacon_found: helper to regulatory code to indicate when a beacon
124 * has been found on this channel. Use regulatory_hint_found_beacon() 125 * has been found on this channel. Use regulatory_hint_found_beacon()
125 * to enable this, this is useful only on 5 GHz band. 126 * to enable this, this is useful only on 5 GHz band.
@@ -133,6 +134,7 @@ struct ieee80211_channel {
133 u32 flags; 134 u32 flags;
134 int max_antenna_gain; 135 int max_antenna_gain;
135 int max_power; 136 int max_power;
137 int max_reg_power;
136 bool beacon_found; 138 bool beacon_found;
137 u32 orig_flags; 139 u32 orig_flags;
138 int orig_mag, orig_mpwr; 140 int orig_mag, orig_mpwr;
@@ -364,25 +366,13 @@ struct cfg80211_crypto_settings {
364}; 366};
365 367
366/** 368/**
367 * struct beacon_parameters - beacon parameters 369 * struct cfg80211_beacon_data - beacon data
368 *
369 * Used to configure the beacon for an interface.
370 *
371 * @head: head portion of beacon (before TIM IE) 370 * @head: head portion of beacon (before TIM IE)
372 * or %NULL if not changed 371 * or %NULL if not changed
373 * @tail: tail portion of beacon (after TIM IE) 372 * @tail: tail portion of beacon (after TIM IE)
374 * or %NULL if not changed 373 * or %NULL if not changed
375 * @interval: beacon interval or zero if not changed
376 * @dtim_period: DTIM period or zero if not changed
377 * @head_len: length of @head 374 * @head_len: length of @head
378 * @tail_len: length of @tail 375 * @tail_len: length of @tail
379 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
380 * user space)
381 * @ssid_len: length of @ssid
382 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
383 * @crypto: crypto settings
384 * @privacy: the BSS uses privacy
385 * @auth_type: Authentication type (algorithm)
386 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 376 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
387 * @beacon_ies_len: length of beacon_ies in octets 377 * @beacon_ies_len: length of beacon_ies in octets
388 * @proberesp_ies: extra information element(s) to add into Probe Response 378 * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -394,24 +384,48 @@ struct cfg80211_crypto_settings {
394 * @probe_resp_len: length of probe response template (@probe_resp) 384 * @probe_resp_len: length of probe response template (@probe_resp)
395 * @probe_resp: probe response template (AP mode only) 385 * @probe_resp: probe response template (AP mode only)
396 */ 386 */
397struct beacon_parameters { 387struct cfg80211_beacon_data {
398 u8 *head, *tail; 388 const u8 *head, *tail;
399 int interval, dtim_period; 389 const u8 *beacon_ies;
400 int head_len, tail_len; 390 const u8 *proberesp_ies;
391 const u8 *assocresp_ies;
392 const u8 *probe_resp;
393
394 size_t head_len, tail_len;
395 size_t beacon_ies_len;
396 size_t proberesp_ies_len;
397 size_t assocresp_ies_len;
398 size_t probe_resp_len;
399};
400
401/**
402 * struct cfg80211_ap_settings - AP configuration
403 *
404 * Used to configure an AP interface.
405 *
406 * @beacon: beacon data
407 * @beacon_interval: beacon interval
408 * @dtim_period: DTIM period
409 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
410 * user space)
411 * @ssid_len: length of @ssid
412 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
413 * @crypto: crypto settings
414 * @privacy: the BSS uses privacy
415 * @auth_type: Authentication type (algorithm)
416 * @inactivity_timeout: time in seconds to determine station's inactivity.
417 */
418struct cfg80211_ap_settings {
419 struct cfg80211_beacon_data beacon;
420
421 int beacon_interval, dtim_period;
401 const u8 *ssid; 422 const u8 *ssid;
402 size_t ssid_len; 423 size_t ssid_len;
403 enum nl80211_hidden_ssid hidden_ssid; 424 enum nl80211_hidden_ssid hidden_ssid;
404 struct cfg80211_crypto_settings crypto; 425 struct cfg80211_crypto_settings crypto;
405 bool privacy; 426 bool privacy;
406 enum nl80211_auth_type auth_type; 427 enum nl80211_auth_type auth_type;
407 const u8 *beacon_ies; 428 int inactivity_timeout;
408 size_t beacon_ies_len;
409 const u8 *proberesp_ies;
410 size_t proberesp_ies_len;
411 const u8 *assocresp_ies;
412 size_t assocresp_ies_len;
413 int probe_resp_len;
414 u8 *probe_resp;
415}; 429};
416 430
417/** 431/**
@@ -796,6 +810,8 @@ struct mesh_config {
796 * mesh gate, but not necessarily using the gate announcement protocol. 810 * mesh gate, but not necessarily using the gate announcement protocol.
797 * Still keeping the same nomenclature to be in sync with the spec. */ 811 * Still keeping the same nomenclature to be in sync with the spec. */
798 bool dot11MeshGateAnnouncementProtocol; 812 bool dot11MeshGateAnnouncementProtocol;
813 bool dot11MeshForwarding;
814 s32 rssi_threshold;
799}; 815};
800 816
801/** 817/**
@@ -1036,10 +1052,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1036 * @key_len: length of WEP key for shared key authentication 1052 * @key_len: length of WEP key for shared key authentication
1037 * @key_idx: index of WEP key for shared key authentication 1053 * @key_idx: index of WEP key for shared key authentication
1038 * @key: WEP key for shared key authentication 1054 * @key: WEP key for shared key authentication
1039 * @local_state_change: This is a request for a local state only, i.e., no
1040 * Authentication frame is to be transmitted and authentication state is
1041 * to be changed without having to wait for a response from the peer STA
1042 * (AP).
1043 */ 1055 */
1044struct cfg80211_auth_request { 1056struct cfg80211_auth_request {
1045 struct cfg80211_bss *bss; 1057 struct cfg80211_bss *bss;
@@ -1048,7 +1060,6 @@ struct cfg80211_auth_request {
1048 enum nl80211_auth_type auth_type; 1060 enum nl80211_auth_type auth_type;
1049 const u8 *key; 1061 const u8 *key;
1050 u8 key_len, key_idx; 1062 u8 key_len, key_idx;
1051 bool local_state_change;
1052}; 1063};
1053 1064
1054/** 1065/**
@@ -1065,7 +1076,11 @@ enum cfg80211_assoc_req_flags {
1065 * 1076 *
1066 * This structure provides information needed to complete IEEE 802.11 1077 * This structure provides information needed to complete IEEE 802.11
1067 * (re)association. 1078 * (re)association.
1068 * @bss: The BSS to associate with. 1079 * @bss: The BSS to associate with. If the call is successful the driver
1080 * is given a reference that it must release, normally via a call to
1081 * cfg80211_send_rx_assoc(), or, if association timed out, with a
1082 * call to cfg80211_put_bss() (in addition to calling
1083 * cfg80211_send_assoc_timeout())
1069 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1084 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1070 * @ie_len: Length of ie buffer in octets 1085 * @ie_len: Length of ie buffer in octets
1071 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1086 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1093,19 +1108,16 @@ struct cfg80211_assoc_request {
1093 * This structure provides information needed to complete IEEE 802.11 1108 * This structure provides information needed to complete IEEE 802.11
1094 * deauthentication. 1109 * deauthentication.
1095 * 1110 *
1096 * @bss: the BSS to deauthenticate from 1111 * @bssid: the BSSID of the BSS to deauthenticate from
1097 * @ie: Extra IEs to add to Deauthentication frame or %NULL 1112 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1098 * @ie_len: Length of ie buffer in octets 1113 * @ie_len: Length of ie buffer in octets
1099 * @reason_code: The reason code for the deauthentication 1114 * @reason_code: The reason code for the deauthentication
1100 * @local_state_change: This is a request for a local state only, i.e., no
1101 * Deauthentication frame is to be transmitted.
1102 */ 1115 */
1103struct cfg80211_deauth_request { 1116struct cfg80211_deauth_request {
1104 struct cfg80211_bss *bss; 1117 const u8 *bssid;
1105 const u8 *ie; 1118 const u8 *ie;
1106 size_t ie_len; 1119 size_t ie_len;
1107 u16 reason_code; 1120 u16 reason_code;
1108 bool local_state_change;
1109}; 1121};
1110 1122
1111/** 1123/**
@@ -1140,6 +1152,7 @@ struct cfg80211_disassoc_request {
1140 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 1152 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
1141 * search for IBSSs with a different BSSID. 1153 * search for IBSSs with a different BSSID.
1142 * @channel: The channel to use if no IBSS can be found to join. 1154 * @channel: The channel to use if no IBSS can be found to join.
1155 * @channel_type: channel type (HT mode)
1143 * @channel_fixed: The channel should be fixed -- do not search for 1156 * @channel_fixed: The channel should be fixed -- do not search for
1144 * IBSSs to join on other channels. 1157 * IBSSs to join on other channels.
1145 * @ie: information element(s) to include in the beacon 1158 * @ie: information element(s) to include in the beacon
@@ -1147,6 +1160,10 @@ struct cfg80211_disassoc_request {
1147 * @beacon_interval: beacon interval to use 1160 * @beacon_interval: beacon interval to use
1148 * @privacy: this is a protected network, keys will be configured 1161 * @privacy: this is a protected network, keys will be configured
1149 * after joining 1162 * after joining
1163 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1164 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1165 * required to assume that the port is unauthorized until authorized by
1166 * user space. Otherwise, port is marked authorized by default.
1150 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1167 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1151 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1168 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1152 */ 1169 */
@@ -1161,6 +1178,7 @@ struct cfg80211_ibss_params {
1161 u32 basic_rates; 1178 u32 basic_rates;
1162 bool channel_fixed; 1179 bool channel_fixed;
1163 bool privacy; 1180 bool privacy;
1181 bool control_port;
1164 int mcast_rate[IEEE80211_NUM_BANDS]; 1182 int mcast_rate[IEEE80211_NUM_BANDS];
1165}; 1183};
1166 1184
@@ -1185,6 +1203,8 @@ struct cfg80211_ibss_params {
1185 * @key_idx: index of WEP key for shared key authentication 1203 * @key_idx: index of WEP key for shared key authentication
1186 * @key: WEP key for shared key authentication 1204 * @key: WEP key for shared key authentication
1187 * @flags: See &enum cfg80211_assoc_req_flags 1205 * @flags: See &enum cfg80211_assoc_req_flags
1206 * @bg_scan_period: Background scan period in seconds
1207 * or -1 to indicate that default value is to be used.
1188 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1208 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1189 * will be used in ht_capa. Un-supported values will be ignored. 1209 * will be used in ht_capa. Un-supported values will be ignored.
1190 * @ht_capa_mask: The bits of ht_capa which are to be used. 1210 * @ht_capa_mask: The bits of ht_capa which are to be used.
@@ -1202,6 +1222,7 @@ struct cfg80211_connect_params {
1202 const u8 *key; 1222 const u8 *key;
1203 u8 key_len, key_idx; 1223 u8 key_len, key_idx;
1204 u32 flags; 1224 u32 flags;
1225 int bg_scan_period;
1205 struct ieee80211_ht_cap ht_capa; 1226 struct ieee80211_ht_cap ht_capa;
1206 struct ieee80211_ht_cap ht_capa_mask; 1227 struct ieee80211_ht_cap ht_capa_mask;
1207}; 1228};
@@ -1228,8 +1249,7 @@ enum wiphy_params_flags {
1228struct cfg80211_bitrate_mask { 1249struct cfg80211_bitrate_mask {
1229 struct { 1250 struct {
1230 u32 legacy; 1251 u32 legacy;
1231 /* TODO: add support for masking MCS rates; e.g.: */ 1252 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
1232 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
1233 } control[IEEE80211_NUM_BANDS]; 1253 } control[IEEE80211_NUM_BANDS];
1234}; 1254};
1235/** 1255/**
@@ -1342,12 +1362,10 @@ struct cfg80211_gtk_rekey_data {
1342 * 1362 *
1343 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1363 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1344 * 1364 *
1345 * @add_beacon: Add a beacon with given parameters, @head, @interval 1365 * @start_ap: Start acting in AP mode defined by the parameters.
1346 * and @dtim_period will be valid, @tail is optional. 1366 * @change_beacon: Change the beacon parameters for an access point mode
1347 * @set_beacon: Change the beacon parameters for an access point mode 1367 * interface. This should reject the call when AP mode wasn't started.
1348 * interface. This should reject the call when no beacon has been 1368 * @stop_ap: Stop being an AP, including stopping beaconing.
1349 * configured.
1350 * @del_beacon: Remove beacon configuration and stop sending the beacon.
1351 * 1369 *
1352 * @add_station: Add a new station. 1370 * @add_station: Add a new station.
1353 * @del_station: Remove a station; @mac may be NULL to remove all stations. 1371 * @del_station: Remove a station; @mac may be NULL to remove all stations.
@@ -1514,11 +1532,11 @@ struct cfg80211_ops {
1514 struct net_device *netdev, 1532 struct net_device *netdev,
1515 u8 key_index); 1533 u8 key_index);
1516 1534
1517 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1535 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
1518 struct beacon_parameters *info); 1536 struct cfg80211_ap_settings *settings);
1519 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1537 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
1520 struct beacon_parameters *info); 1538 struct cfg80211_beacon_data *info);
1521 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 1539 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
1522 1540
1523 1541
1524 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 1542 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
@@ -1573,11 +1591,9 @@ struct cfg80211_ops {
1573 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1591 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
1574 struct cfg80211_assoc_request *req); 1592 struct cfg80211_assoc_request *req);
1575 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1593 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
1576 struct cfg80211_deauth_request *req, 1594 struct cfg80211_deauth_request *req);
1577 void *cookie);
1578 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1595 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1579 struct cfg80211_disassoc_request *req, 1596 struct cfg80211_disassoc_request *req);
1580 void *cookie);
1581 1597
1582 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1598 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1583 struct cfg80211_connect_params *sme); 1599 struct cfg80211_connect_params *sme);
@@ -1978,6 +1994,11 @@ struct wiphy_wowlan_support {
1978 * configured as RX antennas. Antenna configuration commands will be 1994 * configured as RX antennas. Antenna configuration commands will be
1979 * rejected unless this or @available_antennas_tx is set. 1995 * rejected unless this or @available_antennas_tx is set.
1980 * 1996 *
1997 * @probe_resp_offload:
1998 * Bitmap of supported protocols for probe response offloading.
1999 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
2000 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
2001 *
1981 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 2002 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
1982 * may request, if implemented. 2003 * may request, if implemented.
1983 * 2004 *
@@ -2198,8 +2219,6 @@ struct cfg80211_conn;
2198struct cfg80211_internal_bss; 2219struct cfg80211_internal_bss;
2199struct cfg80211_cached_keys; 2220struct cfg80211_cached_keys;
2200 2221
2201#define MAX_AUTH_BSSES 4
2202
2203/** 2222/**
2204 * struct wireless_dev - wireless per-netdev state 2223 * struct wireless_dev - wireless per-netdev state
2205 * 2224 *
@@ -2263,8 +2282,6 @@ struct wireless_dev {
2263 struct list_head event_list; 2282 struct list_head event_list;
2264 spinlock_t event_lock; 2283 spinlock_t event_lock;
2265 2284
2266 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
2267 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
2268 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2285 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2269 struct ieee80211_channel *channel; 2286 struct ieee80211_channel *channel;
2270 2287
@@ -2680,7 +2697,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2680 * @wiphy: the wiphy reporting the BSS 2697 * @wiphy: the wiphy reporting the BSS
2681 * @channel: The channel the frame was received on 2698 * @channel: The channel the frame was received on
2682 * @bssid: the BSSID of the BSS 2699 * @bssid: the BSSID of the BSS
2683 * @timestamp: the TSF timestamp sent by the peer 2700 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
2684 * @capability: the capability field sent by the peer 2701 * @capability: the capability field sent by the peer
2685 * @beacon_interval: the beacon interval announced by the peer 2702 * @beacon_interval: the beacon interval announced by the peer
2686 * @ie: additional IEs sent by the peer 2703 * @ie: additional IEs sent by the peer
@@ -2696,9 +2713,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2696struct cfg80211_bss * __must_check 2713struct cfg80211_bss * __must_check
2697cfg80211_inform_bss(struct wiphy *wiphy, 2714cfg80211_inform_bss(struct wiphy *wiphy,
2698 struct ieee80211_channel *channel, 2715 struct ieee80211_channel *channel,
2699 const u8 *bssid, 2716 const u8 *bssid, u64 tsf, u16 capability,
2700 u64 timestamp, u16 capability, u16 beacon_interval, 2717 u16 beacon_interval, const u8 *ie, size_t ielen,
2701 const u8 *ie, size_t ielen,
2702 s32 signal, gfp_t gfp); 2718 s32 signal, gfp_t gfp);
2703 2719
2704struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 2720struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
@@ -2719,6 +2735,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
2719 struct ieee80211_channel *channel, 2735 struct ieee80211_channel *channel,
2720 const u8 *meshid, size_t meshidlen, 2736 const u8 *meshid, size_t meshidlen,
2721 const u8 *meshcfg); 2737 const u8 *meshcfg);
2738/**
2739 * cfg80211_ref_bss - reference BSS struct
2740 * @bss: the BSS struct to reference
2741 *
2742 * Increments the refcount of the given BSS struct.
2743 */
2744void cfg80211_ref_bss(struct cfg80211_bss *bss);
2745
2746/**
2747 * cfg80211_put_bss - unref BSS struct
2748 * @bss: the BSS struct
2749 *
2750 * Decrements the refcount of the given BSS struct.
2751 */
2722void cfg80211_put_bss(struct cfg80211_bss *bss); 2752void cfg80211_put_bss(struct cfg80211_bss *bss);
2723 2753
2724/** 2754/**
@@ -2756,20 +2786,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
2756void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 2786void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
2757 2787
2758/** 2788/**
2759 * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2760 * @dev: network device
2761 * @addr: The MAC address of the device with which the authentication timed out
2762 *
2763 * When a pending authentication had no action yet, the driver may decide
2764 * to not send a deauth frame, but in that case must calls this function
2765 * to tell cfg80211 about this decision. It is only valid to call this
2766 * function within the deauth() callback.
2767 */
2768void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2769
2770/**
2771 * cfg80211_send_rx_assoc - notification of processed association 2789 * cfg80211_send_rx_assoc - notification of processed association
2772 * @dev: network device 2790 * @dev: network device
2791 * @bss: the BSS struct association was requested for, the struct reference
2792 * is owned by cfg80211 after this call
2773 * @buf: (re)association response frame (header + body) 2793 * @buf: (re)association response frame (header + body)
2774 * @len: length of the frame data 2794 * @len: length of the frame data
2775 * 2795 *
@@ -2778,7 +2798,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2778 * function or cfg80211_send_assoc_timeout() to indicate the result of 2798 * function or cfg80211_send_assoc_timeout() to indicate the result of
2779 * cfg80211_ops::assoc() call. This function may sleep. 2799 * cfg80211_ops::assoc() call. This function may sleep.
2780 */ 2800 */
2781void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 2801void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
2802 const u8 *buf, size_t len);
2782 2803
2783/** 2804/**
2784 * cfg80211_send_assoc_timeout - notification of timed out association 2805 * cfg80211_send_assoc_timeout - notification of timed out association
@@ -3170,6 +3191,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3170 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3191 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3171 * @dev: network device 3192 * @dev: network device
3172 * @freq: Frequency on which the frame was received in MHz 3193 * @freq: Frequency on which the frame was received in MHz
3194 * @sig_dbm: signal strength in mBm, or 0 if unknown
3173 * @buf: Management frame (header + body) 3195 * @buf: Management frame (header + body)
3174 * @len: length of the frame data 3196 * @len: length of the frame data
3175 * @gfp: context flags 3197 * @gfp: context flags
@@ -3182,8 +3204,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3182 * This function is called whenever an Action frame is received for a station 3204 * This function is called whenever an Action frame is received for a station
3183 * mode interface, but is not processed in kernel. 3205 * mode interface, but is not processed in kernel.
3184 */ 3206 */
3185bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 3207bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3186 size_t len, gfp_t gfp); 3208 const u8 *buf, size_t len, gfp_t gfp);
3187 3209
3188/** 3210/**
3189 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3211 * cfg80211_mgmt_tx_status - notification of TX status for management frame
@@ -3296,6 +3318,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3296 * @frame: the frame 3318 * @frame: the frame
3297 * @len: length of the frame 3319 * @len: length of the frame
3298 * @freq: frequency the frame was received on 3320 * @freq: frequency the frame was received on
3321 * @sig_dbm: signal strength in mBm, or 0 if unknown
3299 * @gfp: allocation flags 3322 * @gfp: allocation flags
3300 * 3323 *
3301 * Use this function to report to userspace when a beacon was 3324 * Use this function to report to userspace when a beacon was
@@ -3304,7 +3327,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3304 */ 3327 */
3305void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3328void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3306 const u8 *frame, size_t len, 3329 const u8 *frame, size_t len,
3307 int freq, gfp_t gfp); 3330 int freq, int sig_dbm, gfp_t gfp);
3308 3331
3309/* 3332/*
3310 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3333 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
@@ -3316,6 +3339,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3316 struct ieee80211_channel *chan, 3339 struct ieee80211_channel *chan,
3317 enum nl80211_channel_type channel_type); 3340 enum nl80211_channel_type channel_type);
3318 3341
3342/*
3343 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3344 * @rate: given rate_info to calculate bitrate from
3345 *
3346 * return 0 if MCS index >= 32
3347 */
3348u16 cfg80211_calculate_bitrate(struct rate_info *rate);
3349
3319/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3350/* Logging, debugging and troubleshooting/diagnostic helpers. */
3320 3351
3321/* wiphy_printk helpers, similar to dev_printk */ 3352/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/compat.h b/include/net/compat.h
index 9ee75edcc29..a974ae92d18 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -41,7 +41,7 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int);
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
47 unsigned, unsigned); 47 unsigned, unsigned);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 2cd66d0be34..f55c980d8e2 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops {
72 void (*getpfccfg)(struct net_device *, int, u8 *); 72 void (*getpfccfg)(struct net_device *, int, u8 *);
73 u8 (*setall)(struct net_device *); 73 u8 (*setall)(struct net_device *);
74 u8 (*getcap)(struct net_device *, int, u8 *); 74 u8 (*getcap)(struct net_device *, int, u8 *);
75 u8 (*getnumtcs)(struct net_device *, int, u8 *); 75 int (*getnumtcs)(struct net_device *, int, u8 *);
76 u8 (*setnumtcs)(struct net_device *, int, u8); 76 int (*setnumtcs)(struct net_device *, int, u8);
77 u8 (*getpfcstate)(struct net_device *); 77 u8 (*getpfcstate)(struct net_device *);
78 void (*setpfcstate)(struct net_device *, u8); 78 void (*setpfcstate)(struct net_device *, u8);
79 void (*getbcncfg)(struct net_device *, int, u32 *); 79 void (*getbcncfg)(struct net_device *, int, u32 *);
diff --git a/include/net/dn.h b/include/net/dn.h
index 298521e0d8a..814af0b9387 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <net/flow.h>
6#include <asm/byteorder.h> 7#include <asm/byteorder.h>
7#include <asm/unaligned.h> 8#include <asm/unaligned.h>
8 9
diff --git a/include/net/flow.h b/include/net/flow.h
index 9b582437fbe..6c469dbdb91 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -93,6 +93,16 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
93 fl4->fl4_dport = dport; 93 fl4->fl4_dport = dport;
94 fl4->fl4_sport = sport; 94 fl4->fl4_sport = sport;
95} 95}
96
97/* Reset some input parameters after previous lookup */
98static inline void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos,
99 __be32 daddr, __be32 saddr)
100{
101 fl4->flowi4_oif = oif;
102 fl4->flowi4_tos = tos;
103 fl4->daddr = daddr;
104 fl4->saddr = saddr;
105}
96 106
97 107
98struct flowi6 { 108struct flowi6 {
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 7db32995ccd..ccb68880abf 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -131,35 +131,8 @@ extern void genl_unregister_mc_group(struct genl_family *family,
131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
132 u32 group, struct nlmsghdr *nlh, gfp_t flags); 132 u32 group, struct nlmsghdr *nlh, gfp_t flags);
133 133
134/** 134void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
135 * genlmsg_put - Add generic netlink header to netlink message 135 struct genl_family *family, int flags, u8 cmd);
136 * @skb: socket buffer holding the message
137 * @pid: netlink pid the message is addressed to
138 * @seq: sequence number (usually the one of the sender)
139 * @family: generic netlink family
140 * @flags netlink message flags
141 * @cmd: generic netlink command
142 *
143 * Returns pointer to user specific header
144 */
145static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
146 struct genl_family *family, int flags, u8 cmd)
147{
148 struct nlmsghdr *nlh;
149 struct genlmsghdr *hdr;
150
151 nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN +
152 family->hdrsize, flags);
153 if (nlh == NULL)
154 return NULL;
155
156 hdr = nlmsg_data(nlh);
157 hdr->cmd = cmd;
158 hdr->version = family->version;
159 hdr->reserved = 0;
160
161 return (char *) hdr + GENL_HDRLEN;
162}
163 136
164/** 137/**
165 * genlmsg_nlhdr - Obtain netlink header from user specified header 138 * genlmsg_nlhdr - Obtain netlink header from user specified header
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index e3e405106af..ae17e1352d7 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -132,6 +132,7 @@ struct rtable;
132 * @tos - TOS 132 * @tos - TOS
133 * @mc_ttl - Multicasting TTL 133 * @mc_ttl - Multicasting TTL
134 * @is_icsk - is this an inet_connection_sock? 134 * @is_icsk - is this an inet_connection_sock?
135 * @uc_index - Unicast outgoing device index
135 * @mc_index - Multicast device index 136 * @mc_index - Multicast device index
136 * @mc_list - Group array 137 * @mc_list - Group array
137 * @cork - info to build ip hdr on each ip frag while socket is corked 138 * @cork - info to build ip hdr on each ip frag while socket is corked
@@ -167,6 +168,8 @@ struct inet_sock {
167 transparent:1, 168 transparent:1,
168 mc_all:1, 169 mc_all:1,
169 nodefrag:1; 170 nodefrag:1;
171 __u8 rcv_tos;
172 int uc_index;
170 int mc_index; 173 int mc_index;
171 __be32 mc_addr; 174 __be32 mc_addr;
172 struct ip_mc_socklist __rcu *mc_list; 175 struct ip_mc_socklist __rcu *mc_list;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 06b795dd590..b94765e38e8 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -35,12 +35,12 @@ struct inet_peer {
35 35
36 u32 metrics[RTAX_MAX]; 36 u32 metrics[RTAX_MAX];
37 u32 rate_tokens; /* rate limiting for ICMP */ 37 u32 rate_tokens; /* rate limiting for ICMP */
38 int redirect_genid;
39 unsigned long rate_last; 38 unsigned long rate_last;
40 unsigned long pmtu_expires; 39 unsigned long pmtu_expires;
41 u32 pmtu_orig; 40 u32 pmtu_orig;
42 u32 pmtu_learned; 41 u32 pmtu_learned;
43 struct inetpeer_addr_base redirect_learned; 42 struct inetpeer_addr_base redirect_learned;
43 struct list_head gc_list;
44 /* 44 /*
45 * Once inet_peer is queued for deletion (refcnt == -1), following fields 45 * Once inet_peer is queued for deletion (refcnt == -1), following fields
46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
@@ -96,6 +96,8 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
96extern void inet_putpeer(struct inet_peer *p); 96extern void inet_putpeer(struct inet_peer *p);
97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
98 98
99extern void inetpeer_invalidate_tree(int family);
100
99/* 101/*
100 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 102 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
101 * tcp_ts_stamp if no refcount is taken on inet_peer 103 * tcp_ts_stamp if no refcount is taken on inet_peer
diff --git a/include/net/ip.h b/include/net/ip.h
index 775009f9eab..b53d65f24f7 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -388,7 +388,7 @@ static inline int sk_mc_loop(struct sock *sk)
388 return 1; 388 return 1;
389} 389}
390 390
391extern int ip_call_ra_chain(struct sk_buff *skb); 391extern bool ip_call_ra_chain(struct sk_buff *skb);
392 392
393/* 393/*
394 * Functions provided by ip_fragment.c 394 * Functions provided by ip_fragment.c
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 0954ec95915..cc7c1973238 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -62,6 +62,7 @@ struct sock_msg_q {
62#define AF_IUCV_FLAG_SYN 0x2 62#define AF_IUCV_FLAG_SYN 0x2
63#define AF_IUCV_FLAG_FIN 0x4 63#define AF_IUCV_FLAG_FIN 0x4
64#define AF_IUCV_FLAG_WIN 0x8 64#define AF_IUCV_FLAG_WIN 0x8
65#define AF_IUCV_FLAG_SHT 0x10
65 66
66struct af_iucv_trans_hdr { 67struct af_iucv_trans_hdr {
67 u16 magic; 68 u16 magic;
@@ -113,6 +114,7 @@ struct iucv_sock {
113 spinlock_t accept_q_lock; 114 spinlock_t accept_q_lock;
114 struct sock *parent; 115 struct sock *parent;
115 struct iucv_path *path; 116 struct iucv_path *path;
117 struct net_device *hs_dev;
116 struct sk_buff_head send_skb_q; 118 struct sk_buff_head send_skb_q;
117 struct sk_buff_head backlog_skb_q; 119 struct sk_buff_head backlog_skb_q;
118 struct sock_msg_q message_q; 120 struct sock_msg_q message_q;
@@ -131,6 +133,7 @@ struct iucv_sock {
131/* iucv socket options (SOL_IUCV) */ 133/* iucv socket options (SOL_IUCV) */
132#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ 134#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
133#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ 135#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
136#define SO_MSGSIZE 0x0800 /* get maximum msgsize */
134 137
135/* iucv related control messages (scm) */ 138/* iucv related control messages (scm) */
136#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ 139#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d49928ba5d0..9a012be615f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -229,7 +229,8 @@ enum ieee80211_rssi_event {
229 * valid in station mode only while @assoc is true and if also 229 * valid in station mode only while @assoc is true and if also
230 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 230 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
231 * @ps_dtim_period) 231 * @ps_dtim_period)
232 * @timestamp: beacon timestamp 232 * @last_tsf: last beacon's/probe response's TSF timestamp (could be old
233 * as it may have been received during scanning long ago)
233 * @beacon_int: beacon interval 234 * @beacon_int: beacon interval
234 * @assoc_capability: capabilities taken from assoc resp 235 * @assoc_capability: capabilities taken from assoc resp
235 * @basic_rates: bitmap of basic rates, each bit stands for an 236 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -276,7 +277,7 @@ struct ieee80211_bss_conf {
276 u8 dtim_period; 277 u8 dtim_period;
277 u16 beacon_int; 278 u16 beacon_int;
278 u16 assoc_capability; 279 u16 assoc_capability;
279 u64 timestamp; 280 u64 last_tsf;
280 u32 basic_rates; 281 u32 basic_rates;
281 int mcast_rate[IEEE80211_NUM_BANDS]; 282 int mcast_rate[IEEE80211_NUM_BANDS];
282 u16 ht_operation_mode; 283 u16 ht_operation_mode;
@@ -341,9 +342,9 @@ struct ieee80211_bss_conf {
341 * used to indicate that a frame was already retried due to PS 342 * used to indicate that a frame was already retried due to PS
342 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, 343 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
343 * used to indicate frame should not be encrypted 344 * used to indicate frame should not be encrypted
344 * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll 345 * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
345 * frame (PS-Poll or uAPSD) and should be sent although the station 346 * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
346 * is in powersave mode. 347 * be sent although the station is in powersave mode.
347 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the 348 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
348 * transmit function after the current frame, this can be used 349 * transmit function after the current frame, this can be used
349 * by drivers to kick the DMA queue only if unset or when the 350 * by drivers to kick the DMA queue only if unset or when the
@@ -399,7 +400,7 @@ enum mac80211_tx_control_flags {
399 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 400 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
400 IEEE80211_TX_INTFL_RETRIED = BIT(15), 401 IEEE80211_TX_INTFL_RETRIED = BIT(15),
401 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 402 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
402 IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), 403 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
403 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 404 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
404 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 405 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
405 /* hole at 20, use later */ 406 /* hole at 20, use later */
@@ -425,7 +426,7 @@ enum mac80211_tx_control_flags {
425 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ 426 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
426 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ 427 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
427 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ 428 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
428 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ 429 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
429 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ 430 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
430 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) 431 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
431 432
@@ -659,6 +660,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
659 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 660 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
660 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 661 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
661 * @RX_FLAG_SHORT_GI: Short guard interval was used 662 * @RX_FLAG_SHORT_GI: Short guard interval was used
663 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
664 * Valid only for data frames (mainly A-MPDU)
662 */ 665 */
663enum mac80211_rx_flags { 666enum mac80211_rx_flags {
664 RX_FLAG_MMIC_ERROR = 1<<0, 667 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -672,6 +675,7 @@ enum mac80211_rx_flags {
672 RX_FLAG_HT = 1<<9, 675 RX_FLAG_HT = 1<<9,
673 RX_FLAG_40MHZ = 1<<10, 676 RX_FLAG_40MHZ = 1<<10,
674 RX_FLAG_SHORT_GI = 1<<11, 677 RX_FLAG_SHORT_GI = 1<<11,
678 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
675}; 679};
676 680
677/** 681/**
@@ -852,6 +856,21 @@ struct ieee80211_channel_switch {
852}; 856};
853 857
854/** 858/**
859 * enum ieee80211_vif_flags - virtual interface flags
860 *
861 * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
862 * on this virtual interface to avoid unnecessary CPU wakeups
863 * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
864 * monitoring on this virtual interface -- i.e. it can monitor
865 * connection quality related parameters, such as the RSSI level and
866 * provide notifications if configured trigger levels are reached.
867 */
868enum ieee80211_vif_flags {
869 IEEE80211_VIF_BEACON_FILTER = BIT(0),
870 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
871};
872
873/**
855 * struct ieee80211_vif - per-interface data 874 * struct ieee80211_vif - per-interface data
856 * 875 *
857 * Data in this structure is continually present for driver 876 * Data in this structure is continually present for driver
@@ -863,6 +882,10 @@ struct ieee80211_channel_switch {
863 * @addr: address of this interface 882 * @addr: address of this interface
864 * @p2p: indicates whether this AP or STA interface is a p2p 883 * @p2p: indicates whether this AP or STA interface is a p2p
865 * interface, i.e. a GO or p2p-sta respectively 884 * interface, i.e. a GO or p2p-sta respectively
885 * @driver_flags: flags/capabilities the driver has for this interface,
886 * these need to be set (or cleared) when the interface is added
887 * or, if supported by the driver, the interface type is changed
888 * at runtime, mac80211 will never touch this field
866 * @drv_priv: data area for driver use, will always be aligned to 889 * @drv_priv: data area for driver use, will always be aligned to
867 * sizeof(void *). 890 * sizeof(void *).
868 */ 891 */
@@ -871,6 +894,7 @@ struct ieee80211_vif {
871 struct ieee80211_bss_conf bss_conf; 894 struct ieee80211_bss_conf bss_conf;
872 u8 addr[ETH_ALEN]; 895 u8 addr[ETH_ALEN];
873 bool p2p; 896 bool p2p;
897 u32 driver_flags;
874 /* must be last */ 898 /* must be last */
875 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 899 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
876}; 900};
@@ -962,6 +986,25 @@ enum set_key_cmd {
962}; 986};
963 987
964/** 988/**
989 * enum ieee80211_sta_state - station state
990 *
991 * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
992 * this is a special state for add/remove transitions
993 * @IEEE80211_STA_NONE: station exists without special state
994 * @IEEE80211_STA_AUTH: station is authenticated
995 * @IEEE80211_STA_ASSOC: station is associated
996 * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
997 */
998enum ieee80211_sta_state {
999 /* NOTE: These need to be ordered correctly! */
1000 IEEE80211_STA_NOTEXIST,
1001 IEEE80211_STA_NONE,
1002 IEEE80211_STA_AUTH,
1003 IEEE80211_STA_ASSOC,
1004 IEEE80211_STA_AUTHORIZED,
1005};
1006
1007/**
965 * struct ieee80211_sta - station table entry 1008 * struct ieee80211_sta - station table entry
966 * 1009 *
967 * A station table entry represents a station we are possibly 1010 * A station table entry represents a station we are possibly
@@ -1079,10 +1122,6 @@ enum sta_notify_cmd {
1079 * @IEEE80211_HW_MFP_CAPABLE: 1122 * @IEEE80211_HW_MFP_CAPABLE:
1080 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1123 * Hardware supports management frame protection (MFP, IEEE 802.11w).
1081 * 1124 *
1082 * @IEEE80211_HW_BEACON_FILTER:
1083 * Hardware supports dropping of irrelevant beacon frames to
1084 * avoid waking up cpu.
1085 *
1086 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: 1125 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
1087 * Hardware supports static spatial multiplexing powersave, 1126 * Hardware supports static spatial multiplexing powersave,
1088 * ie. can turn off all but one chain even on HT connections 1127 * ie. can turn off all but one chain even on HT connections
@@ -1108,11 +1147,6 @@ enum sta_notify_cmd {
1108 * When this flag is set, signaling beacon-loss will cause an immediate 1147 * When this flag is set, signaling beacon-loss will cause an immediate
1109 * change to disassociated state. 1148 * change to disassociated state.
1110 * 1149 *
1111 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1112 * Hardware can do connection quality monitoring - i.e. it can monitor
1113 * connection quality related parameters, such as the RSSI level and
1114 * provide notifications if configured trigger levels are reached.
1115 *
1116 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1150 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1117 * This device needs to know the DTIM period for the BSS before 1151 * This device needs to know the DTIM period for the BSS before
1118 * associating. 1152 * associating.
@@ -1134,6 +1168,10 @@ enum sta_notify_cmd {
1134 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session 1168 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
1135 * setup strictly in HW. mac80211 should not attempt to do this in 1169 * setup strictly in HW. mac80211 should not attempt to do this in
1136 * software. 1170 * software.
1171 *
1172 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1173 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1174 * the scan).
1137 */ 1175 */
1138enum ieee80211_hw_flags { 1176enum ieee80211_hw_flags {
1139 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1177 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1150,16 +1188,17 @@ enum ieee80211_hw_flags {
1150 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1188 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1151 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1189 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1152 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1190 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1153 IEEE80211_HW_BEACON_FILTER = 1<<14, 1191 /* reuse bit 14 */
1154 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1192 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1155 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1193 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1156 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1194 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1157 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1195 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1158 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1196 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1159 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1197 /* reuse bit 20 */
1160 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1198 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1161 IEEE80211_HW_AP_LINK_PS = 1<<22, 1199 IEEE80211_HW_AP_LINK_PS = 1<<22,
1162 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1200 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1201 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1163}; 1202};
1164 1203
1165/** 1204/**
@@ -1446,8 +1485,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1446 * way the host will only receive beacons where some relevant information 1485 * way the host will only receive beacons where some relevant information
1447 * (for example ERP protection or WMM settings) have changed. 1486 * (for example ERP protection or WMM settings) have changed.
1448 * 1487 *
1449 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER 1488 * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
1450 * hardware capability. The driver needs to enable beacon filter support 1489 * interface capability. The driver needs to enable beacon filter support
1451 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When 1490 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1452 * power save is enabled, the stack will not check for beacon loss and the 1491 * power save is enabled, the stack will not check for beacon loss and the
1453 * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). 1492 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
@@ -1599,7 +1638,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1599 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 1638 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
1600 * will inform the driver of this with the @allow_buffered_frames 1639 * will inform the driver of this with the @allow_buffered_frames
1601 * callback; this callback is optional. mac80211 will then transmit 1640 * callback; this callback is optional. mac80211 will then transmit
1602 * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE 1641 * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
1603 * on each frame. The last frame in the service period (or the only 1642 * on each frame. The last frame in the service period (or the only
1604 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to 1643 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
1605 * indicate that it ends the service period; as this frame must have 1644 * indicate that it ends the service period; as this frame must have
@@ -1607,6 +1646,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1607 * When TX status is reported for this frame, the service period is 1646 * When TX status is reported for this frame, the service period is
1608 * marked has having ended and a new one can be started by the peer. 1647 * marked has having ended and a new one can be started by the peer.
1609 * 1648 *
1649 * Additionally, non-bufferable MMPDUs can also be transmitted by
1650 * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
1651 *
1610 * Another race condition can happen on some devices like iwlwifi 1652 * Another race condition can happen on some devices like iwlwifi
1611 * when there are frames queued for the station and it wakes up 1653 * when there are frames queued for the station and it wakes up
1612 * or polls; the frames that are already queued could end up being 1654 * or polls; the frames that are already queued could end up being
@@ -1725,20 +1767,6 @@ enum ieee80211_ampdu_mlme_action {
1725}; 1767};
1726 1768
1727/** 1769/**
1728 * enum ieee80211_tx_sync_type - TX sync type
1729 * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication
1730 * (and possibly also before direct probe)
1731 * @IEEE80211_TX_SYNC_ASSOC: sync TX for association
1732 * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame
1733 * (not implemented yet)
1734 */
1735enum ieee80211_tx_sync_type {
1736 IEEE80211_TX_SYNC_AUTH,
1737 IEEE80211_TX_SYNC_ASSOC,
1738 IEEE80211_TX_SYNC_ACTION,
1739};
1740
1741/**
1742 * enum ieee80211_frame_release_type - frame release reason 1770 * enum ieee80211_frame_release_type - frame release reason
1743 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll 1771 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
1744 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to 1772 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
@@ -1848,26 +1876,6 @@ enum ieee80211_frame_release_type {
1848 * of the bss parameters has changed when a call is made. The callback 1876 * of the bss parameters has changed when a call is made. The callback
1849 * can sleep. 1877 * can sleep.
1850 * 1878 *
1851 * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the
1852 * driver should sync with the GO's powersaving so the device doesn't
1853 * transmit the frame while the GO is asleep. In the regular AP case
1854 * it may be used by drivers for devices implementing other restrictions
1855 * on talking to APs, e.g. due to regulatory enforcement or just HW
1856 * restrictions.
1857 * This function is called for every authentication, association and
1858 * action frame separately since applications might attempt to auth
1859 * with multiple APs before chosing one to associate to. If it returns
1860 * an error, the corresponding authentication, association or frame
1861 * transmission is aborted and reported as having failed. It is always
1862 * called after tuning to the correct channel.
1863 * The callback might be called multiple times before @finish_tx_sync
1864 * (but @finish_tx_sync will be called once for each) but in practice
1865 * this is unlikely to happen. It can also refuse in that case if the
1866 * driver cannot handle that situation.
1867 * This callback can sleep.
1868 * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned
1869 * an error. This callback can sleep.
1870 *
1871 * @prepare_multicast: Prepare for multicast filter configuration. 1879 * @prepare_multicast: Prepare for multicast filter configuration.
1872 * This callback is optional, and its return value is passed 1880 * This callback is optional, and its return value is passed
1873 * to configure_filter(). This callback must be atomic. 1881 * to configure_filter(). This callback must be atomic.
@@ -1963,6 +1971,13 @@ enum ieee80211_frame_release_type {
1963 * in AP mode, this callback will not be called when the flag 1971 * in AP mode, this callback will not be called when the flag
1964 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. 1972 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1965 * 1973 *
1974 * @sta_state: Notifies low level driver about state transition of a
1975 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
1976 * This callback is mutually exclusive with @sta_add/@sta_remove.
1977 * It must not fail for down transitions but may fail for transitions
1978 * up the list of states.
1979 * The callback can sleep.
1980 *
1966 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1981 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1967 * bursting) for a hardware TX queue. 1982 * bursting) for a hardware TX queue.
1968 * Returns a negative error code on failure. 1983 * Returns a negative error code on failure.
@@ -2098,7 +2113,7 @@ enum ieee80211_frame_release_type {
2098 * @allow_buffered_frames: Prepare device to allow the given number of frames 2113 * @allow_buffered_frames: Prepare device to allow the given number of frames
2099 * to go out to the given station. The frames will be sent by mac80211 2114 * to go out to the given station. The frames will be sent by mac80211
2100 * via the usual TX path after this call. The TX information for frames 2115 * via the usual TX path after this call. The TX information for frames
2101 * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set 2116 * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
2102 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case 2117 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
2103 * frames from multiple TIDs are released and the driver might reorder 2118 * frames from multiple TIDs are released and the driver might reorder
2104 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2119 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
@@ -2132,13 +2147,6 @@ struct ieee80211_ops {
2132 struct ieee80211_bss_conf *info, 2147 struct ieee80211_bss_conf *info,
2133 u32 changed); 2148 u32 changed);
2134 2149
2135 int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2136 const u8 *bssid, enum ieee80211_tx_sync_type type);
2137 void (*finish_tx_sync)(struct ieee80211_hw *hw,
2138 struct ieee80211_vif *vif,
2139 const u8 *bssid,
2140 enum ieee80211_tx_sync_type type);
2141
2142 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2150 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2143 struct netdev_hw_addr_list *mc_list); 2151 struct netdev_hw_addr_list *mc_list);
2144 void (*configure_filter)(struct ieee80211_hw *hw, 2152 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2182,6 +2190,10 @@ struct ieee80211_ops {
2182 struct ieee80211_sta *sta); 2190 struct ieee80211_sta *sta);
2183 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2191 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2184 enum sta_notify_cmd, struct ieee80211_sta *sta); 2192 enum sta_notify_cmd, struct ieee80211_sta *sta);
2193 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2194 struct ieee80211_sta *sta,
2195 enum ieee80211_sta_state old_state,
2196 enum ieee80211_sta_state new_state);
2185 int (*conf_tx)(struct ieee80211_hw *hw, 2197 int (*conf_tx)(struct ieee80211_hw *hw,
2186 struct ieee80211_vif *vif, u16 queue, 2198 struct ieee80211_vif *vif, u16 queue,
2187 const struct ieee80211_tx_queue_params *params); 2199 const struct ieee80211_tx_queue_params *params);
@@ -3316,7 +3328,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
3316 * 3328 *
3317 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3329 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3318 * 3330 *
3319 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and 3331 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
3320 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the 3332 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
3321 * hardware is not receiving beacons with this function. 3333 * hardware is not receiving beacons with this function.
3322 */ 3334 */
@@ -3327,7 +3339,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3327 * 3339 *
3328 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3340 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3329 * 3341 *
3330 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and 3342 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
3331 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 3343 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
3332 * needs to inform if the connection to the AP has been lost. 3344 * needs to inform if the connection to the AP has been lost.
3333 * 3345 *
@@ -3397,7 +3409,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3397 * @rssi_event: the RSSI trigger event type 3409 * @rssi_event: the RSSI trigger event type
3398 * @gfp: context flags 3410 * @gfp: context flags
3399 * 3411 *
3400 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality 3412 * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
3401 * monitoring is configured with an rssi threshold, the driver will inform 3413 * monitoring is configured with an rssi threshold, the driver will inform
3402 * whenever the rssi level reaches the threshold. 3414 * whenever the rssi level reaches the threshold.
3403 */ 3415 */
@@ -3516,6 +3528,8 @@ enum rate_control_changed {
3516 * @hw: The hardware the algorithm is invoked for. 3528 * @hw: The hardware the algorithm is invoked for.
3517 * @sband: The band this frame is being transmitted on. 3529 * @sband: The band this frame is being transmitted on.
3518 * @bss_conf: the current BSS configuration 3530 * @bss_conf: the current BSS configuration
3531 * @skb: the skb that will be transmitted, the control information in it needs
3532 * to be filled in
3519 * @reported_rate: The rate control algorithm can fill this in to indicate 3533 * @reported_rate: The rate control algorithm can fill this in to indicate
3520 * which rate should be reported to userspace as the current rate and 3534 * which rate should be reported to userspace as the current rate and
3521 * used for rate calculations in the mesh network. 3535 * used for rate calculations in the mesh network.
@@ -3523,12 +3537,11 @@ enum rate_control_changed {
3523 * RTS threshold 3537 * RTS threshold
3524 * @short_preamble: whether mac80211 will request short-preamble transmission 3538 * @short_preamble: whether mac80211 will request short-preamble transmission
3525 * if the selected rate supports it 3539 * if the selected rate supports it
3526 * @max_rate_idx: user-requested maximum rate (not MCS for now) 3540 * @max_rate_idx: user-requested maximum (legacy) rate
3527 * (deprecated; this will be removed once drivers get updated to use 3541 * (deprecated; this will be removed once drivers get updated to use
3528 * rate_idx_mask) 3542 * rate_idx_mask)
3529 * @rate_idx_mask: user-requested rate mask (not MCS for now) 3543 * @rate_idx_mask: user-requested (legacy) rate mask
3530 * @skb: the skb that will be transmitted, the control information in it needs 3544 * @rate_idx_mcs_mask: user-requested MCS rate mask
3531 * to be filled in
3532 * @bss: whether this frame is sent out in AP or IBSS mode 3545 * @bss: whether this frame is sent out in AP or IBSS mode
3533 */ 3546 */
3534struct ieee80211_tx_rate_control { 3547struct ieee80211_tx_rate_control {
@@ -3540,6 +3553,7 @@ struct ieee80211_tx_rate_control {
3540 bool rts, short_preamble; 3553 bool rts, short_preamble;
3541 u8 max_rate_idx; 3554 u8 max_rate_idx;
3542 u32 rate_idx_mask; 3555 u32 rate_idx_mask;
3556 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
3543 bool bss; 3557 bool bss;
3544}; 3558};
3545 3559
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index e3133c23980..6f9c25a76cd 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev,
133 const struct in6_addr *daddr); 133 const struct in6_addr *daddr);
134 134
135extern void ndisc_send_redirect(struct sk_buff *skb, 135extern void ndisc_send_redirect(struct sk_buff *skb,
136 struct neighbour *neigh,
137 const struct in6_addr *target); 136 const struct in6_addr *target);
138 137
139extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 138extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 8a2b0ae7dbd..ab86036bbf0 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
209__nf_conntrack_find(struct net *net, u16 zone, 209__nf_conntrack_find(struct net *net, u16 zone,
210 const struct nf_conntrack_tuple *tuple); 210 const struct nf_conntrack_tuple *tuple);
211 211
212extern void nf_conntrack_hash_insert(struct nf_conn *ct); 212extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
213extern void nf_ct_delete_from_lists(struct nf_conn *ct); 213extern void nf_ct_delete_from_lists(struct nf_conn *ct);
214extern void nf_ct_insert_dying_list(struct nf_conn *ct); 214extern void nf_ct_insert_dying_list(struct nf_conn *ct);
215 215
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 2dcf31703ac..96755c3798a 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -20,6 +20,9 @@ enum nf_ct_ext_id {
20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
21 NF_CT_EXT_TSTAMP, 21 NF_CT_EXT_TSTAMP,
22#endif 22#endif
23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
24 NF_CT_EXT_TIMEOUT,
25#endif
23 NF_CT_EXT_NUM, 26 NF_CT_EXT_NUM,
24}; 27};
25 28
@@ -29,6 +32,7 @@ enum nf_ct_ext_id {
29#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 32#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
30#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 33#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
31#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 34#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
35#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout
32 36
33/* Extensions: optional stuff which isn't permanently in struct. */ 37/* Extensions: optional stuff which isn't permanently in struct. */
34struct nf_ct_ext { 38struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f1c1311adc2..5767dc242de 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -69,4 +69,17 @@ extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
69 enum ip_conntrack_info ctinfo, 69 enum ip_conntrack_info ctinfo,
70 unsigned int timeout); 70 unsigned int timeout);
71 71
72struct nf_ct_helper_expectfn {
73 struct list_head head;
74 const char *name;
75 void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
76};
77
78void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n);
79void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n);
80struct nf_ct_helper_expectfn *
81nf_ct_helper_expectfn_find_by_name(const char *name);
82struct nf_ct_helper_expectfn *
83nf_ct_helper_expectfn_find_by_symbol(const void *symbol);
84
72#endif /*_NF_CONNTRACK_HELPER_H*/ 85#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index e3d3ee3c06a..90c67c7db7e 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -39,12 +39,13 @@ struct nf_conntrack_l4proto {
39 unsigned int dataoff, 39 unsigned int dataoff,
40 enum ip_conntrack_info ctinfo, 40 enum ip_conntrack_info ctinfo,
41 u_int8_t pf, 41 u_int8_t pf,
42 unsigned int hooknum); 42 unsigned int hooknum,
43 unsigned int *timeouts);
43 44
44 /* Called when a new connection for this protocol found; 45 /* Called when a new connection for this protocol found;
45 * returns TRUE if it's OK. If so, packet() called next. */ 46 * returns TRUE if it's OK. If so, packet() called next. */
46 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, 47 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb,
47 unsigned int dataoff); 48 unsigned int dataoff, unsigned int *timeouts);
48 49
49 /* Called when a conntrack entry is destroyed */ 50 /* Called when a conntrack entry is destroyed */
50 void (*destroy)(struct nf_conn *ct); 51 void (*destroy)(struct nf_conn *ct);
@@ -60,6 +61,9 @@ struct nf_conntrack_l4proto {
60 /* Print out the private part of the conntrack. */ 61 /* Print out the private part of the conntrack. */
61 int (*print_conntrack)(struct seq_file *s, struct nf_conn *); 62 int (*print_conntrack)(struct seq_file *s, struct nf_conn *);
62 63
64 /* Return the array of timeouts for this protocol. */
65 unsigned int *(*get_timeouts)(struct net *net);
66
63 /* convert protoinfo to nfnetink attributes */ 67 /* convert protoinfo to nfnetink attributes */
64 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 68 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
65 struct nf_conn *ct); 69 struct nf_conn *ct);
@@ -79,6 +83,17 @@ struct nf_conntrack_l4proto {
79 83
80 size_t nla_size; 84 size_t nla_size;
81 85
86#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
87 struct {
88 size_t obj_size;
89 int (*nlattr_to_obj)(struct nlattr *tb[], void *data);
90 int (*obj_to_nlattr)(struct sk_buff *skb, const void *data);
91
92 unsigned int nlattr_max;
93 const struct nla_policy *nla_policy;
94 } ctnl_timeout;
95#endif
96
82#ifdef CONFIG_SYSCTL 97#ifdef CONFIG_SYSCTL
83 struct ctl_table_header **ctl_table_header; 98 struct ctl_table_header **ctl_table_header;
84 struct ctl_table *ctl_table; 99 struct ctl_table *ctl_table;
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
new file mode 100644
index 00000000000..0e04db4a086
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -0,0 +1,78 @@
1#ifndef _NF_CONNTRACK_TIMEOUT_H
2#define _NF_CONNTRACK_TIMEOUT_H
3
4#include <net/net_namespace.h>
5#include <linux/netfilter/nf_conntrack_common.h>
6#include <linux/netfilter/nf_conntrack_tuple_common.h>
7#include <net/netfilter/nf_conntrack.h>
8#include <net/netfilter/nf_conntrack_extend.h>
9
10#define CTNL_TIMEOUT_NAME_MAX 32
11
12struct ctnl_timeout {
13 struct list_head head;
14 struct rcu_head rcu_head;
15 atomic_t refcnt;
16 char name[CTNL_TIMEOUT_NAME_MAX];
17 __u16 l3num;
18 __u8 l4num;
19 char data[0];
20};
21
22struct nf_conn_timeout {
23 struct ctnl_timeout *timeout;
24};
25
26#define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data)
27
28static inline
29struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
30{
31#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
32 return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT);
33#else
34 return NULL;
35#endif
36}
37
38static inline
39struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
40 struct ctnl_timeout *timeout,
41 gfp_t gfp)
42{
43#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
44 struct nf_conn_timeout *timeout_ext;
45
46 timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp);
47 if (timeout_ext == NULL)
48 return NULL;
49
50 timeout_ext->timeout = timeout;
51
52 return timeout_ext;
53#else
54 return NULL;
55#endif
56};
57
58#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
59extern int nf_conntrack_timeout_init(struct net *net);
60extern void nf_conntrack_timeout_fini(struct net *net);
61#else
62static inline int nf_conntrack_timeout_init(struct net *net)
63{
64 return 0;
65}
66
67static inline void nf_conntrack_timeout_fini(struct net *net)
68{
69 return;
70}
71#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
72
73#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
74extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name);
75extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
76#endif
77
78#endif /* _NF_CONNTRACK_TIMEOUT_H */
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h
index 0dfb34a5b53..7e1544e8f70 100644
--- a/include/net/netfilter/xt_log.h
+++ b/include/net/netfilter/xt_log.h
@@ -6,7 +6,7 @@ struct sbuff {
6}; 6};
7static struct sbuff emergency, *emergency_ptr = &emergency; 7static struct sbuff emergency, *emergency_ptr = &emergency;
8 8
9static int sb_add(struct sbuff *m, const char *f, ...) 9static __printf(2, 3) int sb_add(struct sbuff *m, const char *f, ...)
10{ 10{
11 va_list args; 11 va_list args;
12 int len; 12 int len;
diff --git a/include/net/netlink.h b/include/net/netlink.h
index cb1f3504687..f394fe5d764 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -441,41 +441,6 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ 441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
442 nlmsg_attrlen(nlh, hdrlen), rem) 442 nlmsg_attrlen(nlh, hdrlen), rem)
443 443
444#if 0
445/* FIXME: Enable once all users have been converted */
446
447/**
448 * __nlmsg_put - Add a new netlink message to an skb
449 * @skb: socket buffer to store message in
450 * @pid: netlink process id
451 * @seq: sequence number of message
452 * @type: message type
453 * @payload: length of message payload
454 * @flags: message flags
455 *
456 * The caller is responsible to ensure that the skb provides enough
457 * tailroom for both the netlink header and payload.
458 */
459static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid,
460 u32 seq, int type, int payload,
461 int flags)
462{
463 struct nlmsghdr *nlh;
464
465 nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload));
466 nlh->nlmsg_type = type;
467 nlh->nlmsg_len = nlmsg_msg_size(payload);
468 nlh->nlmsg_flags = flags;
469 nlh->nlmsg_pid = pid;
470 nlh->nlmsg_seq = seq;
471
472 memset((unsigned char *) nlmsg_data(nlh) + payload, 0,
473 nlmsg_padlen(payload));
474
475 return nlh;
476}
477#endif
478
479/** 444/**
480 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
481 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 3419bf5cd15..d55f4344333 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -41,6 +41,7 @@ static inline void *net_generic(const struct net *net, int id)
41 ptr = ng->ptr[id - 1]; 41 ptr = ng->ptr[id - 1];
42 rcu_read_unlock(); 42 rcu_read_unlock();
43 43
44 BUG_ON(!ptr);
44 return ptr; 45 return ptr;
45} 46}
46#endif 47#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index e503b87c4c1..d58fdec4759 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -13,7 +13,6 @@
13 13
14#ifndef _NETPRIO_CGROUP_H 14#ifndef _NETPRIO_CGROUP_H
15#define _NETPRIO_CGROUP_H 15#define _NETPRIO_CGROUP_H
16#include <linux/module.h>
17#include <linux/cgroup.h> 16#include <linux/cgroup.h>
18#include <linux/hardirq.h> 17#include <linux/hardirq.h>
19#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
@@ -38,19 +37,51 @@ extern int net_prio_subsys_id;
38 37
39extern void sock_update_netprioidx(struct sock *sk); 38extern void sock_update_netprioidx(struct sock *sk);
40 39
41static inline struct cgroup_netprio_state 40#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
42 *task_netprio_state(struct task_struct *p) 41
42static inline u32 task_netprioidx(struct task_struct *p)
43{ 43{
44#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) 44 struct cgroup_netprio_state *state;
45 return container_of(task_subsys_state(p, net_prio_subsys_id), 45 u32 idx;
46 struct cgroup_netprio_state, css); 46
47#else 47 rcu_read_lock();
48 return NULL; 48 state = container_of(task_subsys_state(p, net_prio_subsys_id),
49#endif 49 struct cgroup_netprio_state, css);
50 idx = state->prioidx;
51 rcu_read_unlock();
52 return idx;
53}
54
55#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
56
57static inline u32 task_netprioidx(struct task_struct *p)
58{
59 struct cgroup_netprio_state *state;
60 int subsys_id;
61 u32 idx = 0;
62
63 rcu_read_lock();
64 subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
65 rcu_read_lock_held());
66 if (subsys_id >= 0) {
67 state = container_of(task_subsys_state(p, subsys_id),
68 struct cgroup_netprio_state, css);
69 idx = state->prioidx;
70 }
71 rcu_read_unlock();
72 return idx;
50} 73}
51 74
52#else 75#else
53 76
77static inline u32 task_netprioidx(struct task_struct *p)
78{
79 return 0;
80}
81
82#endif /* CONFIG_NETPRIO_CGROUP */
83
84#else
54#define sock_update_netprioidx(sk) 85#define sock_update_netprioidx(sk)
55#endif 86#endif
56 87
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 2be95e2626c..276094b91d7 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -116,6 +116,11 @@
116#define NCI_DISC_MAP_MODE_POLL 0x01 116#define NCI_DISC_MAP_MODE_POLL 0x01
117#define NCI_DISC_MAP_MODE_LISTEN 0x02 117#define NCI_DISC_MAP_MODE_LISTEN 0x02
118 118
119/* NCI Discover Notification Type */
120#define NCI_DISCOVER_NTF_TYPE_LAST 0x00
121#define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01
122#define NCI_DISCOVER_NTF_TYPE_MORE 0x02
123
119/* NCI Deactivation Type */ 124/* NCI Deactivation Type */
120#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 125#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
121#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 126#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd {
207 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; 212 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
208} __packed; 213} __packed;
209 214
215#define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
216struct nci_rf_discover_select_cmd {
217 __u8 rf_discovery_id;
218 __u8 rf_protocol;
219 __u8 rf_interface;
220} __packed;
221
210#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 222#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
211struct nci_rf_deactivate_cmd { 223struct nci_rf_deactivate_cmd {
212 __u8 type; 224 __u8 type;
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 {
244 256
245#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 257#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
246 258
259#define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
260
247#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 261#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
248 262
249/* --------------------------- */ 263/* --------------------------- */
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf {
260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 274 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
261} __packed; 275} __packed;
262 276
277#define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
278
263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
264struct nci_core_intf_error_ntf { 280struct nci_core_intf_error_ntf {
265 __u8 status; 281 __u8 status;
266 __u8 conn_id; 282 __u8 conn_id;
267} __packed; 283} __packed;
268 284
269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 285#define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
270struct rf_tech_specific_params_nfca_poll { 286struct rf_tech_specific_params_nfca_poll {
271 __u16 sens_res; 287 __u16 sens_res;
272 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 288 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -275,11 +291,43 @@ struct rf_tech_specific_params_nfca_poll {
275 __u8 sel_res; 291 __u8 sel_res;
276} __packed; 292} __packed;
277 293
294struct rf_tech_specific_params_nfcb_poll {
295 __u8 sensb_res_len;
296 __u8 sensb_res[12]; /* 11 or 12 Bytes */
297} __packed;
298
299struct rf_tech_specific_params_nfcf_poll {
300 __u8 bit_rate;
301 __u8 sensf_res_len;
302 __u8 sensf_res[18]; /* 16 or 18 Bytes */
303} __packed;
304
305struct nci_rf_discover_ntf {
306 __u8 rf_discovery_id;
307 __u8 rf_protocol;
308 __u8 rf_tech_and_mode;
309 __u8 rf_tech_specific_params_len;
310
311 union {
312 struct rf_tech_specific_params_nfca_poll nfca_poll;
313 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
314 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
315 } rf_tech_specific_params;
316
317 __u8 ntf_type;
318} __packed;
319
320#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
278struct activation_params_nfca_poll_iso_dep { 321struct activation_params_nfca_poll_iso_dep {
279 __u8 rats_res_len; 322 __u8 rats_res_len;
280 __u8 rats_res[20]; 323 __u8 rats_res[20];
281}; 324};
282 325
326struct activation_params_nfcb_poll_iso_dep {
327 __u8 attrib_res_len;
328 __u8 attrib_res[50];
329};
330
283struct nci_rf_intf_activated_ntf { 331struct nci_rf_intf_activated_ntf {
284 __u8 rf_discovery_id; 332 __u8 rf_discovery_id;
285 __u8 rf_interface; 333 __u8 rf_interface;
@@ -291,6 +339,8 @@ struct nci_rf_intf_activated_ntf {
291 339
292 union { 340 union {
293 struct rf_tech_specific_params_nfca_poll nfca_poll; 341 struct rf_tech_specific_params_nfca_poll nfca_poll;
342 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
343 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
294 } rf_tech_specific_params; 344 } rf_tech_specific_params;
295 345
296 __u8 data_exch_rf_tech_and_mode; 346 __u8 data_exch_rf_tech_and_mode;
@@ -300,6 +350,7 @@ struct nci_rf_intf_activated_ntf {
300 350
301 union { 351 union {
302 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 352 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
353 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
303 } activation_params; 354 } activation_params;
304 355
305} __packed; 356} __packed;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index bccd89e9d4c..feba74027ff 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -34,21 +34,31 @@
34#include <net/nfc/nfc.h> 34#include <net/nfc/nfc.h>
35#include <net/nfc/nci.h> 35#include <net/nfc/nci.h>
36 36
37/* NCI device state */ 37/* NCI device flags */
38enum { 38enum nci_flag {
39 NCI_INIT, 39 NCI_INIT,
40 NCI_UP, 40 NCI_UP,
41 NCI_DATA_EXCHANGE,
42 NCI_DATA_EXCHANGE_TO,
43};
44
45/* NCI device states */
46enum nci_state {
47 NCI_IDLE,
41 NCI_DISCOVERY, 48 NCI_DISCOVERY,
49 NCI_W4_ALL_DISCOVERIES,
50 NCI_W4_HOST_SELECT,
42 NCI_POLL_ACTIVE, 51 NCI_POLL_ACTIVE,
43 NCI_DATA_EXCHANGE,
44}; 52};
45 53
46/* NCI timeouts */ 54/* NCI timeouts */
47#define NCI_RESET_TIMEOUT 5000 55#define NCI_RESET_TIMEOUT 5000
48#define NCI_INIT_TIMEOUT 5000 56#define NCI_INIT_TIMEOUT 5000
49#define NCI_RF_DISC_TIMEOUT 5000 57#define NCI_RF_DISC_TIMEOUT 5000
50#define NCI_RF_DEACTIVATE_TIMEOUT 5000 58#define NCI_RF_DISC_SELECT_TIMEOUT 5000
59#define NCI_RF_DEACTIVATE_TIMEOUT 30000
51#define NCI_CMD_TIMEOUT 5000 60#define NCI_CMD_TIMEOUT 5000
61#define NCI_DATA_TIMEOUT 700
52 62
53struct nci_dev; 63struct nci_dev;
54 64
@@ -59,6 +69,7 @@ struct nci_ops {
59}; 69};
60 70
61#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 71#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
72#define NCI_MAX_DISCOVERED_TARGETS 10
62 73
63/* NCI Core structures */ 74/* NCI Core structures */
64struct nci_dev { 75struct nci_dev {
@@ -68,12 +79,14 @@ struct nci_dev {
68 int tx_headroom; 79 int tx_headroom;
69 int tx_tailroom; 80 int tx_tailroom;
70 81
82 atomic_t state;
71 unsigned long flags; 83 unsigned long flags;
72 84
73 atomic_t cmd_cnt; 85 atomic_t cmd_cnt;
74 atomic_t credits_cnt; 86 atomic_t credits_cnt;
75 87
76 struct timer_list cmd_timer; 88 struct timer_list cmd_timer;
89 struct timer_list data_timer;
77 90
78 struct workqueue_struct *cmd_wq; 91 struct workqueue_struct *cmd_wq;
79 struct work_struct cmd_work; 92 struct work_struct cmd_work;
@@ -96,9 +109,11 @@ struct nci_dev {
96 void *driver_data; 109 void *driver_data;
97 110
98 __u32 poll_prots; 111 __u32 poll_prots;
99 __u32 target_available_prots;
100 __u32 target_active_prot; 112 __u32 target_active_prot;
101 113
114 struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS];
115 int n_targets;
116
102 /* received during NCI_OP_CORE_RESET_RSP */ 117 /* received during NCI_OP_CORE_RESET_RSP */
103 __u8 nci_ver; 118 __u8 nci_ver;
104 119
@@ -126,17 +141,17 @@ struct nci_dev {
126 141
127/* ----- NCI Devices ----- */ 142/* ----- NCI Devices ----- */
128struct nci_dev *nci_allocate_device(struct nci_ops *ops, 143struct nci_dev *nci_allocate_device(struct nci_ops *ops,
129 __u32 supported_protocols, 144 __u32 supported_protocols,
130 int tx_headroom, 145 int tx_headroom,
131 int tx_tailroom); 146 int tx_tailroom);
132void nci_free_device(struct nci_dev *ndev); 147void nci_free_device(struct nci_dev *ndev);
133int nci_register_device(struct nci_dev *ndev); 148int nci_register_device(struct nci_dev *ndev);
134void nci_unregister_device(struct nci_dev *ndev); 149void nci_unregister_device(struct nci_dev *ndev);
135int nci_recv_frame(struct sk_buff *skb); 150int nci_recv_frame(struct sk_buff *skb);
136 151
137static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, 152static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
138 unsigned int len, 153 unsigned int len,
139 gfp_t how) 154 gfp_t how)
140{ 155{
141 struct sk_buff *skb; 156 struct sk_buff *skb;
142 157
@@ -169,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
169int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); 184int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
170void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, 185void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
171 int err); 186 int err);
187void nci_clear_target_list(struct nci_dev *ndev);
172 188
173/* ----- NCI requests ----- */ 189/* ----- NCI requests ----- */
174#define NCI_REQ_DONE 0 190#define NCI_REQ_DONE 0
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 8696b773a69..bac070bf351 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -24,6 +24,7 @@
24#ifndef __NET_NFC_H 24#ifndef __NET_NFC_H
25#define __NET_NFC_H 25#define __NET_NFC_H
26 26
27#include <linux/nfc.h>
27#include <linux/device.h> 28#include <linux/device.h>
28#include <linux/skbuff.h> 29#include <linux/skbuff.h>
29 30
@@ -52,20 +53,19 @@ struct nfc_ops {
52 int (*dev_down)(struct nfc_dev *dev); 53 int (*dev_down)(struct nfc_dev *dev);
53 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 54 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
54 void (*stop_poll)(struct nfc_dev *dev); 55 void (*stop_poll)(struct nfc_dev *dev);
55 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, 56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode,
56 u8 comm_mode, u8 rf_mode); 57 u8 *gb, size_t gb_len);
57 int (*dep_link_down)(struct nfc_dev *dev); 58 int (*dep_link_down)(struct nfc_dev *dev);
58 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
59 u32 protocol); 60 u32 protocol);
60 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx);
61 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx,
62 struct sk_buff *skb, data_exchange_cb_t cb, 63 struct sk_buff *skb, data_exchange_cb_t cb,
63 void *cb_context); 64 void *cb_context);
64}; 65};
65 66
66#define NFC_TARGET_IDX_ANY -1 67#define NFC_TARGET_IDX_ANY -1
67#define NFC_MAX_GT_LEN 48 68#define NFC_MAX_GT_LEN 48
68#define NFC_MAX_NFCID1_LEN 10
69 69
70struct nfc_target { 70struct nfc_target {
71 u32 idx; 71 u32 idx;
@@ -73,7 +73,11 @@ struct nfc_target {
73 u16 sens_res; 73 u16 sens_res;
74 u8 sel_res; 74 u8 sel_res;
75 u8 nfcid1_len; 75 u8 nfcid1_len;
76 u8 nfcid1[NFC_MAX_NFCID1_LEN]; 76 u8 nfcid1[NFC_NFCID1_MAXSIZE];
77 u8 sensb_res_len;
78 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
79 u8 sensf_res_len;
80 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
77}; 81};
78 82
79struct nfc_genl_data { 83struct nfc_genl_data {
@@ -83,7 +87,6 @@ struct nfc_genl_data {
83 87
84struct nfc_dev { 88struct nfc_dev {
85 unsigned idx; 89 unsigned idx;
86 unsigned target_idx;
87 struct nfc_target *targets; 90 struct nfc_target *targets;
88 int n_targets; 91 int n_targets;
89 int targets_generation; 92 int targets_generation;
@@ -107,9 +110,9 @@ struct nfc_dev {
107extern struct class nfc_class; 110extern struct class nfc_class;
108 111
109struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 112struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
110 u32 supported_protocols, 113 u32 supported_protocols,
111 int tx_headroom, 114 int tx_headroom,
112 int tx_tailroom); 115 int tx_tailroom);
113 116
114/** 117/**
115 * nfc_free_device - free nfc device 118 * nfc_free_device - free nfc device
@@ -132,7 +135,7 @@ void nfc_unregister_device(struct nfc_dev *dev);
132 * @dev: The parent device 135 * @dev: The parent device
133 */ 136 */
134static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, 137static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev,
135 struct device *dev) 138 struct device *dev)
136{ 139{
137 nfc_dev->dev.parent = dev; 140 nfc_dev->dev.parent = dev;
138} 141}
@@ -169,17 +172,15 @@ static inline const char *nfc_device_name(struct nfc_dev *dev)
169} 172}
170 173
171struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, 174struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
172 unsigned int flags, unsigned int size, 175 unsigned int flags, unsigned int size,
173 unsigned int *err); 176 unsigned int *err);
174struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); 177struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
175 178
176int nfc_set_remote_general_bytes(struct nfc_dev *dev, 179int nfc_set_remote_general_bytes(struct nfc_dev *dev,
177 u8 *gt, u8 gt_len); 180 u8 *gt, u8 gt_len);
178 181
179u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len); 182int nfc_targets_found(struct nfc_dev *dev,
180 183 struct nfc_target *targets, int ntargets);
181int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
182 int ntargets);
183 184
184int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 185int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
185 u8 comm_mode, u8 rf_mode); 186 u8 comm_mode, u8 rf_mode);
diff --git a/include/net/route.h b/include/net/route.h
index 91855d185b5..b1c0d5b564c 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -270,6 +270,7 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
270 if (IS_ERR(rt)) 270 if (IS_ERR(rt))
271 return rt; 271 return rt;
272 ip_rt_put(rt); 272 ip_rt_put(rt);
273 flowi4_update_output(fl4, oif, tos, fl4->daddr, fl4->saddr);
273 } 274 }
274 security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); 275 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
275 return ip_route_output_flow(net, fl4, sk); 276 return ip_route_output_flow(net, fl4, sk);
@@ -284,6 +285,9 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable
284 fl4->fl4_dport = dport; 285 fl4->fl4_dport = dport;
285 fl4->fl4_sport = sport; 286 fl4->fl4_sport = sport;
286 ip_rt_put(rt); 287 ip_rt_put(rt);
288 flowi4_update_output(fl4, sk->sk_bound_dev_if,
289 RT_CONN_FLAGS(sk), fl4->daddr,
290 fl4->saddr);
287 security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); 291 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
288 return ip_route_output_flow(sock_net(sk), fl4, sk); 292 return ip_route_output_flow(sock_net(sk), fl4, sk);
289 } 293 }
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 678f1ffaf84..37029390197 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,7 +6,7 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11extern int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f6bb08b73ca..55ce96b53b0 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -220,9 +220,16 @@ struct tcf_proto {
220 220
221struct qdisc_skb_cb { 221struct qdisc_skb_cb {
222 unsigned int pkt_len; 222 unsigned int pkt_len;
223 long data[]; 223 unsigned char data[24];
224}; 224};
225 225
226static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
227{
228 struct qdisc_skb_cb *qcb;
229 BUILD_BUG_ON(sizeof(skb->cb) < sizeof(unsigned int) + sz);
230 BUILD_BUG_ON(sizeof(qcb->data) < sz);
231}
232
226static inline int qdisc_qlen(const struct Qdisc *q) 233static inline int qdisc_qlen(const struct Qdisc *q)
227{ 234{
228 return q->q.qlen; 235 return q->q.qlen;
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d3685615a8b..6ee44b24864 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -413,6 +413,7 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
413/* Look up the association by its id. */ 413/* Look up the association by its id. */
414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); 414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
415 415
416int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
416 417
417/* A macro to walk a list of skbs. */ 418/* A macro to walk a list of skbs. */
418#define sctp_skb_for_each(pos, head, tmp) \ 419#define sctp_skb_for_each(pos, head, tmp) \
diff --git a/include/net/sock.h b/include/net/sock.h
index bb972d254df..f84be9ed611 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -55,6 +55,7 @@
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/static_key.h>
58 59
59#include <linux/filter.h> 60#include <linux/filter.h>
60#include <linux/rculist_nulls.h> 61#include <linux/rculist_nulls.h>
@@ -68,7 +69,7 @@ struct cgroup;
68struct cgroup_subsys; 69struct cgroup_subsys;
69#ifdef CONFIG_NET 70#ifdef CONFIG_NET
70int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); 71int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss);
71void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss); 72void mem_cgroup_sockets_destroy(struct cgroup *cgrp);
72#else 73#else
73static inline 74static inline
74int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) 75int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
@@ -76,7 +77,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
76 return 0; 77 return 0;
77} 78}
78static inline 79static inline
79void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss) 80void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
80{ 81{
81} 82}
82#endif 83#endif
@@ -226,6 +227,7 @@ struct cg_proto;
226 * @sk_ack_backlog: current listen backlog 227 * @sk_ack_backlog: current listen backlog
227 * @sk_max_ack_backlog: listen backlog set in listen() 228 * @sk_max_ack_backlog: listen backlog set in listen()
228 * @sk_priority: %SO_PRIORITY setting 229 * @sk_priority: %SO_PRIORITY setting
230 * @sk_cgrp_prioidx: socket group's priority map index
229 * @sk_type: socket type (%SOCK_STREAM, etc) 231 * @sk_type: socket type (%SOCK_STREAM, etc)
230 * @sk_protocol: which protocol this socket belongs in this network family 232 * @sk_protocol: which protocol this socket belongs in this network family
231 * @sk_peer_pid: &struct pid for this socket's peer 233 * @sk_peer_pid: &struct pid for this socket's peer
@@ -355,6 +357,7 @@ struct sock {
355 struct page *sk_sndmsg_page; 357 struct page *sk_sndmsg_page;
356 struct sk_buff *sk_send_head; 358 struct sk_buff *sk_send_head;
357 __u32 sk_sndmsg_off; 359 __u32 sk_sndmsg_off;
360 __s32 sk_peek_off;
358 int sk_write_pending; 361 int sk_write_pending;
359#ifdef CONFIG_SECURITY 362#ifdef CONFIG_SECURITY
360 void *sk_security; 363 void *sk_security;
@@ -371,6 +374,30 @@ struct sock {
371 void (*sk_destruct)(struct sock *sk); 374 void (*sk_destruct)(struct sock *sk);
372}; 375};
373 376
377static inline int sk_peek_offset(struct sock *sk, int flags)
378{
379 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
380 return sk->sk_peek_off;
381 else
382 return 0;
383}
384
385static inline void sk_peek_offset_bwd(struct sock *sk, int val)
386{
387 if (sk->sk_peek_off >= 0) {
388 if (sk->sk_peek_off >= val)
389 sk->sk_peek_off -= val;
390 else
391 sk->sk_peek_off = 0;
392 }
393}
394
395static inline void sk_peek_offset_fwd(struct sock *sk, int val)
396{
397 if (sk->sk_peek_off >= 0)
398 sk->sk_peek_off += val;
399}
400
374/* 401/*
375 * Hashed lists helper routines 402 * Hashed lists helper routines
376 */ 403 */
@@ -588,6 +615,10 @@ enum sock_flags {
588 SOCK_RXQ_OVFL, 615 SOCK_RXQ_OVFL,
589 SOCK_ZEROCOPY, /* buffers from userspace */ 616 SOCK_ZEROCOPY, /* buffers from userspace */
590 SOCK_WIFI_STATUS, /* push wifi status to userspace */ 617 SOCK_WIFI_STATUS, /* push wifi status to userspace */
618 SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS.
619 * Will use last 4 bytes of packet sent from
620 * user-space instead.
621 */
591}; 622};
592 623
593static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 624static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -869,8 +900,7 @@ struct proto {
869 */ 900 */
870 int (*init_cgroup)(struct cgroup *cgrp, 901 int (*init_cgroup)(struct cgroup *cgrp,
871 struct cgroup_subsys *ss); 902 struct cgroup_subsys *ss);
872 void (*destroy_cgroup)(struct cgroup *cgrp, 903 void (*destroy_cgroup)(struct cgroup *cgrp);
873 struct cgroup_subsys *ss);
874 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 904 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
875#endif 905#endif
876}; 906};
@@ -921,14 +951,14 @@ inline void sk_refcnt_debug_release(const struct sock *sk)
921#define sk_refcnt_debug_release(sk) do { } while (0) 951#define sk_refcnt_debug_release(sk) do { } while (0)
922#endif /* SOCK_REFCNT_DEBUG */ 952#endif /* SOCK_REFCNT_DEBUG */
923 953
924#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 954#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET)
925extern struct jump_label_key memcg_socket_limit_enabled; 955extern struct static_key memcg_socket_limit_enabled;
926static inline struct cg_proto *parent_cg_proto(struct proto *proto, 956static inline struct cg_proto *parent_cg_proto(struct proto *proto,
927 struct cg_proto *cg_proto) 957 struct cg_proto *cg_proto)
928{ 958{
929 return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg)); 959 return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg));
930} 960}
931#define mem_cgroup_sockets_enabled static_branch(&memcg_socket_limit_enabled) 961#define mem_cgroup_sockets_enabled static_key_false(&memcg_socket_limit_enabled)
932#else 962#else
933#define mem_cgroup_sockets_enabled 0 963#define mem_cgroup_sockets_enabled 0
934static inline struct cg_proto *parent_cg_proto(struct proto *proto, 964static inline struct cg_proto *parent_cg_proto(struct proto *proto,
@@ -1007,9 +1037,8 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1007 struct res_counter *fail; 1037 struct res_counter *fail;
1008 int ret; 1038 int ret;
1009 1039
1010 ret = res_counter_charge(prot->memory_allocated, 1040 ret = res_counter_charge_nofail(prot->memory_allocated,
1011 amt << PAGE_SHIFT, &fail); 1041 amt << PAGE_SHIFT, &fail);
1012
1013 if (ret < 0) 1042 if (ret < 0)
1014 *parent_status = OVER_LIMIT; 1043 *parent_status = OVER_LIMIT;
1015} 1044}
@@ -1053,12 +1082,11 @@ sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status)
1053} 1082}
1054 1083
1055static inline void 1084static inline void
1056sk_memory_allocated_sub(struct sock *sk, int amt, int parent_status) 1085sk_memory_allocated_sub(struct sock *sk, int amt)
1057{ 1086{
1058 struct proto *prot = sk->sk_prot; 1087 struct proto *prot = sk->sk_prot;
1059 1088
1060 if (mem_cgroup_sockets_enabled && sk->sk_cgrp && 1089 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1061 parent_status != OVER_LIMIT) /* Otherwise was uncharged already */
1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt); 1090 memcg_memory_allocated_sub(sk->sk_cgrp, amt);
1063 1091
1064 atomic_long_sub(amt, prot->memory_allocated); 1092 atomic_long_sub(amt, prot->memory_allocated);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0118ea999f6..8607e6aad42 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -273,6 +273,14 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
273 return seq3 - seq2 >= seq1 - seq2; 273 return seq3 - seq2 >= seq1 - seq2;
274} 274}
275 275
276static inline bool tcp_out_of_memory(struct sock *sk)
277{
278 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
279 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
280 return true;
281 return false;
282}
283
276static inline bool tcp_too_many_orphans(struct sock *sk, int shift) 284static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
277{ 285{
278 struct percpu_counter *ocp = sk->sk_prot->orphan_count; 286 struct percpu_counter *ocp = sk->sk_prot->orphan_count;
@@ -283,13 +291,11 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
283 if (orphans << shift > sysctl_tcp_max_orphans) 291 if (orphans << shift > sysctl_tcp_max_orphans)
284 return true; 292 return true;
285 } 293 }
286
287 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
288 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
289 return true;
290 return false; 294 return false;
291} 295}
292 296
297extern bool tcp_check_oom(struct sock *sk, int shift);
298
293/* syncookies: remember time of last synqueue overflow */ 299/* syncookies: remember time of last synqueue overflow */
294static inline void tcp_synq_overflow(struct sock *sk) 300static inline void tcp_synq_overflow(struct sock *sk)
295{ 301{
@@ -311,6 +317,8 @@ extern struct proto tcp_prot;
311#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 317#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
312#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 318#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
313 319
320extern void tcp_init_mem(struct net *net);
321
314extern void tcp_v4_err(struct sk_buff *skb, u32); 322extern void tcp_v4_err(struct sk_buff *skb, u32);
315 323
316extern void tcp_shutdown (struct sock *sk, int how); 324extern void tcp_shutdown (struct sock *sk, int how);
@@ -1130,35 +1138,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1130/* MD5 Signature */ 1138/* MD5 Signature */
1131struct crypto_hash; 1139struct crypto_hash;
1132 1140
1141union tcp_md5_addr {
1142 struct in_addr a4;
1143#if IS_ENABLED(CONFIG_IPV6)
1144 struct in6_addr a6;
1145#endif
1146};
1147
1133/* - key database */ 1148/* - key database */
1134struct tcp_md5sig_key { 1149struct tcp_md5sig_key {
1135 u8 *key; 1150 struct hlist_node node;
1136 u8 keylen; 1151 u8 keylen;
1137}; 1152 u8 family; /* AF_INET or AF_INET6 */
1138 1153 union tcp_md5_addr addr;
1139struct tcp4_md5sig_key { 1154 u8 key[TCP_MD5SIG_MAXKEYLEN];
1140 struct tcp_md5sig_key base; 1155 struct rcu_head rcu;
1141 __be32 addr;
1142};
1143
1144struct tcp6_md5sig_key {
1145 struct tcp_md5sig_key base;
1146#if 0
1147 u32 scope_id; /* XXX */
1148#endif
1149 struct in6_addr addr;
1150}; 1156};
1151 1157
1152/* - sock block */ 1158/* - sock block */
1153struct tcp_md5sig_info { 1159struct tcp_md5sig_info {
1154 struct tcp4_md5sig_key *keys4; 1160 struct hlist_head head;
1155#if IS_ENABLED(CONFIG_IPV6) 1161 struct rcu_head rcu;
1156 struct tcp6_md5sig_key *keys6;
1157 u32 entries6;
1158 u32 alloced6;
1159#endif
1160 u32 entries4;
1161 u32 alloced4;
1162}; 1162};
1163 1163
1164/* - pseudo header */ 1164/* - pseudo header */
@@ -1195,19 +1195,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1195 const struct sock *sk, 1195 const struct sock *sk,
1196 const struct request_sock *req, 1196 const struct request_sock *req,
1197 const struct sk_buff *skb); 1197 const struct sk_buff *skb);
1198extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, 1198extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1199 struct sock *addr_sk); 1199 int family, const u8 *newkey,
1200extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, 1200 u8 newkeylen, gfp_t gfp);
1201 u8 newkeylen); 1201extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1202extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); 1202 int family);
1203extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1204 struct sock *addr_sk);
1203 1205
1204#ifdef CONFIG_TCP_MD5SIG 1206#ifdef CONFIG_TCP_MD5SIG
1205#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1207extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1206 &(struct tcp_md5sig_key) { \ 1208 const union tcp_md5_addr *addr, int family);
1207 .key = (twsk)->tw_md5_key, \ 1209#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1208 .keylen = (twsk)->tw_md5_keylen, \
1209 } : NULL)
1210#else 1210#else
1211static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1212 const union tcp_md5_addr *addr,
1213 int family)
1214{
1215 return NULL;
1216}
1211#define tcp_twsk_md5_key(twsk) NULL 1217#define tcp_twsk_md5_key(twsk) NULL
1212#endif 1218#endif
1213 1219
@@ -1356,8 +1362,9 @@ static inline void tcp_push_pending_frames(struct sock *sk)
1356 } 1362 }
1357} 1363}
1358 1364
1359/* Start sequence of the highest skb with SACKed bit, valid only if 1365/* Start sequence of the skb just after the highest skb with SACKed
1360 * sacked > 0 or when the caller has ensured validity by itself. 1366 * bit, valid only if sacked_out > 0 or when the caller has ensured
1367 * validity by itself.
1361 */ 1368 */
1362static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) 1369static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp)
1363{ 1370{
@@ -1462,10 +1469,6 @@ struct tcp_sock_af_ops {
1462 const struct sock *sk, 1469 const struct sock *sk,
1463 const struct request_sock *req, 1470 const struct request_sock *req,
1464 const struct sk_buff *skb); 1471 const struct sk_buff *skb);
1465 int (*md5_add) (struct sock *sk,
1466 struct sock *addr_sk,
1467 u8 *newkey,
1468 u8 len);
1469 int (*md5_parse) (struct sock *sk, 1472 int (*md5_parse) (struct sock *sk,
1470 char __user *optval, 1473 char __user *optval,
1471 int optlen); 1474 int optlen);
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 3512082fa90..48410ff25c9 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -13,7 +13,7 @@ struct tcp_memcontrol {
13 13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 16void tcp_destroy_cgroup(struct cgroup *cgrp);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); 17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); 18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 19#endif /* _TCP_MEMCG_H */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 5f097ca7d5c..71375459a88 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -40,7 +40,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
41 * with a zero checksum field are illegal. */ 41 * with a zero checksum field are illegal. */
42 if (uh->check == 0) { 42 if (uh->check == 0) {
43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n"); 43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n");
44 return 1; 44 return 1;
45 } 45 }
46 46
@@ -52,7 +52,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
52 /* 52 /*
53 * Coverage length violates RFC 3828: log and discard silently. 53 * Coverage length violates RFC 3828: log and discard silently.
54 */ 54 */
55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n", 55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n",
56 cscov, skb->len); 56 cscov, skb->len);
57 return 1; 57 return 1;
58 58
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 89174e29dca..96239e78e62 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1566,11 +1566,6 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1567 int probe); 1567 int probe);
1568 1568
1569struct hash_desc;
1570struct scatterlist;
1571typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1572 unsigned int);
1573
1574static inline int xfrm_addr_cmp(const xfrm_address_t *a, 1569static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1575 const xfrm_address_t *b, 1570 const xfrm_address_t *b,
1576 int family) 1571 int family)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 77273f2fdd8..b3a1c2daf6c 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -136,6 +136,7 @@ struct scsi_device {
136 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ 136 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
137 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ 137 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
138 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ 138 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
139 unsigned skip_vpd_pages:1; /* do not read VPD pages */
139 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ 140 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
140 unsigned no_start_on_add:1; /* do not issue start on add */ 141 unsigned no_start_on_add:1; /* do not issue start on add */
141 unsigned allow_restart:1; /* issue START_UNIT in error handler */ 142 unsigned allow_restart:1; /* issue START_UNIT in error handler */
@@ -246,8 +247,10 @@ struct scsi_target {
246 unsigned int single_lun:1; /* Indicates we should only 247 unsigned int single_lun:1; /* Indicates we should only
247 * allow I/O to one of the luns 248 * allow I/O to one of the luns
248 * for the device at a time. */ 249 * for the device at a time. */
249 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ 250 unsigned int pdt_1f_for_no_lun:1; /* PDT = 0x1f
250 /* means no lun present */ 251 * means no lun present. */
252 unsigned int no_report_luns:1; /* Don't use
253 * REPORT LUNS for scanning. */
251 /* commands actually active on LLD. protected by host lock. */ 254 /* commands actually active on LLD. protected by host lock. */
252 unsigned int target_busy; 255 unsigned int target_busy;
253 /* 256 /*
diff --git a/include/sound/core.h b/include/sound/core.h
index 5ab255f196c..cea1b5426df 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -417,6 +417,7 @@ static inline int __snd_bug_on(int cond)
417#define gameport_get_port_data(gp) (gp)->port_data 417#define gameport_get_port_data(gp) (gp)->port_data
418#endif 418#endif
419 419
420#ifdef CONFIG_PCI
420/* PCI quirk list helper */ 421/* PCI quirk list helper */
421struct snd_pci_quirk { 422struct snd_pci_quirk {
422 unsigned short subvendor; /* PCI subvendor ID */ 423 unsigned short subvendor; /* PCI subvendor ID */
@@ -456,5 +457,6 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
456const struct snd_pci_quirk * 457const struct snd_pci_quirk *
457snd_pci_quirk_lookup_id(u16 vendor, u16 device, 458snd_pci_quirk_lookup_id(u16 vendor, u16 device,
458 const struct snd_pci_quirk *list); 459 const struct snd_pci_quirk *list);
460#endif
459 461
460#endif /* __SOUND_CORE_H */ 462#endif /* __SOUND_CORE_H */
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 4866499bdee..e5e6ff98f0f 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -59,7 +59,7 @@ int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
59int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); 59int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
60 60
61/* core helpers also used by command snooping in pscsi */ 61/* core helpers also used by command snooping in pscsi */
62void *transport_kmap_first_data_page(struct se_cmd *); 62void *transport_kmap_data_sg(struct se_cmd *);
63void transport_kunmap_first_data_page(struct se_cmd *); 63void transport_kunmap_data_sg(struct se_cmd *);
64 64
65#endif /* TARGET_CORE_BACKEND_H */ 65#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index daf532bc721..dc4e345a016 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -582,6 +582,7 @@ struct se_cmd {
582 582
583 struct scatterlist *t_data_sg; 583 struct scatterlist *t_data_sg;
584 unsigned int t_data_nents; 584 unsigned int t_data_nents;
585 void *t_data_vmap;
585 struct scatterlist *t_bidi_data_sg; 586 struct scatterlist *t_bidi_data_sg;
586 unsigned int t_bidi_data_nents; 587 unsigned int t_bidi_data_nents;
587 588
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 523e8bc104d..d36fad317e7 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -114,7 +114,7 @@ void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
114 struct se_session *, u32, int, int, unsigned char *); 114 struct se_session *, u32, int, int, unsigned char *);
115int transport_lookup_cmd_lun(struct se_cmd *, u32); 115int transport_lookup_cmd_lun(struct se_cmd *, u32);
116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
117int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 117void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
118 unsigned char *, u32, u32, int, int, int); 118 unsigned char *, u32, u32, int, int, int);
119int transport_handle_cdb_direct(struct se_cmd *); 119int transport_handle_cdb_direct(struct se_cmd *);
120int transport_generic_handle_cdb_map(struct se_cmd *); 120int transport_generic_handle_cdb_map(struct se_cmd *);
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 1bcc2a8c00e..cae9a94f025 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -65,7 +65,6 @@ TRACE_EVENT(machine_suspend,
65 TP_printk("state=%lu", (unsigned long)__entry->state) 65 TP_printk("state=%lu", (unsigned long)__entry->state)
66); 66);
67 67
68/* This code will be removed after deprecation time exceeded (2.6.41) */
69#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED 68#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
70 69
71/* 70/*
@@ -151,6 +150,8 @@ enum {
151 events get removed */ 150 events get removed */
152static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; 151static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
153static inline void trace_power_end(u64 cpuid) {}; 152static inline void trace_power_end(u64 cpuid) {};
153static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
154static inline void trace_power_end_rcuidle(u64 cpuid) {};
154static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; 155static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
155#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ 156#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
156 157
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
new file mode 100644
index 00000000000..94ec79cc011
--- /dev/null
+++ b/include/trace/events/printk.h
@@ -0,0 +1,41 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM printk
3
4#if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_PRINTK_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT_CONDITION(console,
10 TP_PROTO(const char *log_buf, unsigned start, unsigned end,
11 unsigned log_buf_len),
12
13 TP_ARGS(log_buf, start, end, log_buf_len),
14
15 TP_CONDITION(start != end),
16
17 TP_STRUCT__entry(
18 __dynamic_array(char, msg, end - start + 1)
19 ),
20
21 TP_fast_assign(
22 if ((start & (log_buf_len - 1)) > (end & (log_buf_len - 1))) {
23 memcpy(__get_dynamic_array(msg),
24 log_buf + (start & (log_buf_len - 1)),
25 log_buf_len - (start & (log_buf_len - 1)));
26 memcpy((char *)__get_dynamic_array(msg) +
27 log_buf_len - (start & (log_buf_len - 1)),
28 log_buf, end & (log_buf_len - 1));
29 } else
30 memcpy(__get_dynamic_array(msg),
31 log_buf + (start & (log_buf_len - 1)),
32 end - start);
33 ((char *)__get_dynamic_array(msg))[end - start] = 0;
34 ),
35
36 TP_printk("%s", __get_str(msg))
37);
38#endif /* _TRACE_PRINTK_H */
39
40/* This part must be outside protection */
41#include <trace/define_trace.h>
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index d2d88bed891..337099783f3 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -313,19 +313,22 @@ TRACE_EVENT(rcu_prep_idle,
313/* 313/*
314 * Tracepoint for the registration of a single RCU callback function. 314 * Tracepoint for the registration of a single RCU callback function.
315 * The first argument is the type of RCU, the second argument is 315 * The first argument is the type of RCU, the second argument is
316 * a pointer to the RCU callback itself, and the third element is the 316 * a pointer to the RCU callback itself, the third element is the
317 * new RCU callback queue length for the current CPU. 317 * number of lazy callbacks queued, and the fourth element is the
318 * total number of callbacks queued.
318 */ 319 */
319TRACE_EVENT(rcu_callback, 320TRACE_EVENT(rcu_callback,
320 321
321 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen), 322 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy,
323 long qlen),
322 324
323 TP_ARGS(rcuname, rhp, qlen), 325 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
324 326
325 TP_STRUCT__entry( 327 TP_STRUCT__entry(
326 __field(char *, rcuname) 328 __field(char *, rcuname)
327 __field(void *, rhp) 329 __field(void *, rhp)
328 __field(void *, func) 330 __field(void *, func)
331 __field(long, qlen_lazy)
329 __field(long, qlen) 332 __field(long, qlen)
330 ), 333 ),
331 334
@@ -333,11 +336,13 @@ TRACE_EVENT(rcu_callback,
333 __entry->rcuname = rcuname; 336 __entry->rcuname = rcuname;
334 __entry->rhp = rhp; 337 __entry->rhp = rhp;
335 __entry->func = rhp->func; 338 __entry->func = rhp->func;
339 __entry->qlen_lazy = qlen_lazy;
336 __entry->qlen = qlen; 340 __entry->qlen = qlen;
337 ), 341 ),
338 342
339 TP_printk("%s rhp=%p func=%pf %ld", 343 TP_printk("%s rhp=%p func=%pf %ld/%ld",
340 __entry->rcuname, __entry->rhp, __entry->func, __entry->qlen) 344 __entry->rcuname, __entry->rhp, __entry->func,
345 __entry->qlen_lazy, __entry->qlen)
341); 346);
342 347
343/* 348/*
@@ -345,20 +350,21 @@ TRACE_EVENT(rcu_callback,
345 * kfree() form. The first argument is the RCU type, the second argument 350 * kfree() form. The first argument is the RCU type, the second argument
346 * is a pointer to the RCU callback, the third argument is the offset 351 * is a pointer to the RCU callback, the third argument is the offset
347 * of the callback within the enclosing RCU-protected data structure, 352 * of the callback within the enclosing RCU-protected data structure,
348 * and the fourth argument is the new RCU callback queue length for the 353 * the fourth argument is the number of lazy callbacks queued, and the
349 * current CPU. 354 * fifth argument is the total number of callbacks queued.
350 */ 355 */
351TRACE_EVENT(rcu_kfree_callback, 356TRACE_EVENT(rcu_kfree_callback,
352 357
353 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset, 358 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
354 long qlen), 359 long qlen_lazy, long qlen),
355 360
356 TP_ARGS(rcuname, rhp, offset, qlen), 361 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
357 362
358 TP_STRUCT__entry( 363 TP_STRUCT__entry(
359 __field(char *, rcuname) 364 __field(char *, rcuname)
360 __field(void *, rhp) 365 __field(void *, rhp)
361 __field(unsigned long, offset) 366 __field(unsigned long, offset)
367 __field(long, qlen_lazy)
362 __field(long, qlen) 368 __field(long, qlen)
363 ), 369 ),
364 370
@@ -366,41 +372,45 @@ TRACE_EVENT(rcu_kfree_callback,
366 __entry->rcuname = rcuname; 372 __entry->rcuname = rcuname;
367 __entry->rhp = rhp; 373 __entry->rhp = rhp;
368 __entry->offset = offset; 374 __entry->offset = offset;
375 __entry->qlen_lazy = qlen_lazy;
369 __entry->qlen = qlen; 376 __entry->qlen = qlen;
370 ), 377 ),
371 378
372 TP_printk("%s rhp=%p func=%ld %ld", 379 TP_printk("%s rhp=%p func=%ld %ld/%ld",
373 __entry->rcuname, __entry->rhp, __entry->offset, 380 __entry->rcuname, __entry->rhp, __entry->offset,
374 __entry->qlen) 381 __entry->qlen_lazy, __entry->qlen)
375); 382);
376 383
377/* 384/*
378 * Tracepoint for marking the beginning rcu_do_batch, performed to start 385 * Tracepoint for marking the beginning rcu_do_batch, performed to start
379 * RCU callback invocation. The first argument is the RCU flavor, 386 * RCU callback invocation. The first argument is the RCU flavor,
380 * the second is the total number of callbacks (including those that 387 * the second is the number of lazy callbacks queued, the third is
381 * are not yet ready to be invoked), and the third argument is the 388 * the total number of callbacks queued, and the fourth argument is
382 * current RCU-callback batch limit. 389 * the current RCU-callback batch limit.
383 */ 390 */
384TRACE_EVENT(rcu_batch_start, 391TRACE_EVENT(rcu_batch_start,
385 392
386 TP_PROTO(char *rcuname, long qlen, int blimit), 393 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit),
387 394
388 TP_ARGS(rcuname, qlen, blimit), 395 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
389 396
390 TP_STRUCT__entry( 397 TP_STRUCT__entry(
391 __field(char *, rcuname) 398 __field(char *, rcuname)
399 __field(long, qlen_lazy)
392 __field(long, qlen) 400 __field(long, qlen)
393 __field(int, blimit) 401 __field(int, blimit)
394 ), 402 ),
395 403
396 TP_fast_assign( 404 TP_fast_assign(
397 __entry->rcuname = rcuname; 405 __entry->rcuname = rcuname;
406 __entry->qlen_lazy = qlen_lazy;
398 __entry->qlen = qlen; 407 __entry->qlen = qlen;
399 __entry->blimit = blimit; 408 __entry->blimit = blimit;
400 ), 409 ),
401 410
402 TP_printk("%s CBs=%ld bl=%d", 411 TP_printk("%s CBs=%ld/%ld bl=%d",
403 __entry->rcuname, __entry->qlen, __entry->blimit) 412 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
413 __entry->blimit)
404); 414);
405 415
406/* 416/*
@@ -531,16 +541,21 @@ TRACE_EVENT(rcu_torture_read,
531#else /* #ifdef CONFIG_RCU_TRACE */ 541#else /* #ifdef CONFIG_RCU_TRACE */
532 542
533#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0) 543#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
534#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, qsmask) do { } while (0) 544#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
545 qsmask) do { } while (0)
535#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) 546#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
536#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 547#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
537#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks) do { } while (0) 548#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
549 grplo, grphi, gp_tasks) do { } \
550 while (0)
538#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0) 551#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
539#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0) 552#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
540#define trace_rcu_prep_idle(reason) do { } while (0) 553#define trace_rcu_prep_idle(reason) do { } while (0)
541#define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0) 554#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
542#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0) 555#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
543#define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0) 556 do { } while (0)
557#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
558 do { } while (0)
544#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) 559#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
545#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) 560#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
546#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ 561#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 6ba596b07a7..fbc7b1ad929 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include <linux/binfmts.h>
9 10
10/* 11/*
11 * Tracepoint for calling kthread_stop, performed to end a kthread: 12 * Tracepoint for calling kthread_stop, performed to end a kthread:
@@ -276,6 +277,32 @@ TRACE_EVENT(sched_process_fork,
276); 277);
277 278
278/* 279/*
280 * Tracepoint for exec:
281 */
282TRACE_EVENT(sched_process_exec,
283
284 TP_PROTO(struct task_struct *p, pid_t old_pid,
285 struct linux_binprm *bprm),
286
287 TP_ARGS(p, old_pid, bprm),
288
289 TP_STRUCT__entry(
290 __string( filename, bprm->filename )
291 __field( pid_t, pid )
292 __field( pid_t, old_pid )
293 ),
294
295 TP_fast_assign(
296 __assign_str(filename, bprm->filename);
297 __entry->pid = p->pid;
298 __entry->old_pid = p->pid;
299 ),
300
301 TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
302 __entry->pid, __entry->old_pid)
303);
304
305/*
279 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE 306 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
280 * adding sched_stat support to SCHED_FIFO/RR would be welcome. 307 * adding sched_stat support to SCHED_FIFO/RR would be welcome.
281 */ 308 */
@@ -370,56 +397,6 @@ TRACE_EVENT(sched_stat_runtime,
370 (unsigned long long)__entry->vruntime) 397 (unsigned long long)__entry->vruntime)
371); 398);
372 399
373#ifdef CREATE_TRACE_POINTS
374static inline u64 trace_get_sleeptime(struct task_struct *tsk)
375{
376#ifdef CONFIG_SCHEDSTATS
377 u64 block, sleep;
378
379 block = tsk->se.statistics.block_start;
380 sleep = tsk->se.statistics.sleep_start;
381 tsk->se.statistics.block_start = 0;
382 tsk->se.statistics.sleep_start = 0;
383
384 return block ? block : sleep ? sleep : 0;
385#else
386 return 0;
387#endif
388}
389#endif
390
391/*
392 * Tracepoint for accounting sleeptime (time the task is sleeping
393 * or waiting for I/O).
394 */
395TRACE_EVENT(sched_stat_sleeptime,
396
397 TP_PROTO(struct task_struct *tsk, u64 now),
398
399 TP_ARGS(tsk, now),
400
401 TP_STRUCT__entry(
402 __array( char, comm, TASK_COMM_LEN )
403 __field( pid_t, pid )
404 __field( u64, sleeptime )
405 ),
406
407 TP_fast_assign(
408 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
409 __entry->pid = tsk->pid;
410 __entry->sleeptime = trace_get_sleeptime(tsk);
411 __entry->sleeptime = __entry->sleeptime ?
412 now - __entry->sleeptime : 0;
413 )
414 TP_perf_assign(
415 __perf_count(__entry->sleeptime);
416 ),
417
418 TP_printk("comm=%s pid=%d sleeptime=%Lu [ns]",
419 __entry->comm, __entry->pid,
420 (unsigned long long)__entry->sleeptime)
421);
422
423/* 400/*
424 * Tracepoint for showing priority inheritance modifying a tasks 401 * Tracepoint for showing priority inheritance modifying a tasks
425 * priority. 402 * priority.
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
index 17df43464df..39a8a430d90 100644
--- a/include/trace/events/signal.h
+++ b/include/trace/events/signal.h
@@ -23,11 +23,23 @@
23 } \ 23 } \
24 } while (0) 24 } while (0)
25 25
26#ifndef TRACE_HEADER_MULTI_READ
27enum {
28 TRACE_SIGNAL_DELIVERED,
29 TRACE_SIGNAL_IGNORED,
30 TRACE_SIGNAL_ALREADY_PENDING,
31 TRACE_SIGNAL_OVERFLOW_FAIL,
32 TRACE_SIGNAL_LOSE_INFO,
33};
34#endif
35
26/** 36/**
27 * signal_generate - called when a signal is generated 37 * signal_generate - called when a signal is generated
28 * @sig: signal number 38 * @sig: signal number
29 * @info: pointer to struct siginfo 39 * @info: pointer to struct siginfo
30 * @task: pointer to struct task_struct 40 * @task: pointer to struct task_struct
41 * @group: shared or private
42 * @result: TRACE_SIGNAL_*
31 * 43 *
32 * Current process sends a 'sig' signal to 'task' process with 44 * Current process sends a 'sig' signal to 'task' process with
33 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, 45 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
@@ -37,9 +49,10 @@
37 */ 49 */
38TRACE_EVENT(signal_generate, 50TRACE_EVENT(signal_generate,
39 51
40 TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), 52 TP_PROTO(int sig, struct siginfo *info, struct task_struct *task,
53 int group, int result),
41 54
42 TP_ARGS(sig, info, task), 55 TP_ARGS(sig, info, task, group, result),
43 56
44 TP_STRUCT__entry( 57 TP_STRUCT__entry(
45 __field( int, sig ) 58 __field( int, sig )
@@ -47,6 +60,8 @@ TRACE_EVENT(signal_generate,
47 __field( int, code ) 60 __field( int, code )
48 __array( char, comm, TASK_COMM_LEN ) 61 __array( char, comm, TASK_COMM_LEN )
49 __field( pid_t, pid ) 62 __field( pid_t, pid )
63 __field( int, group )
64 __field( int, result )
50 ), 65 ),
51 66
52 TP_fast_assign( 67 TP_fast_assign(
@@ -54,11 +69,14 @@ TRACE_EVENT(signal_generate,
54 TP_STORE_SIGINFO(__entry, info); 69 TP_STORE_SIGINFO(__entry, info);
55 memcpy(__entry->comm, task->comm, TASK_COMM_LEN); 70 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
56 __entry->pid = task->pid; 71 __entry->pid = task->pid;
72 __entry->group = group;
73 __entry->result = result;
57 ), 74 ),
58 75
59 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", 76 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d",
60 __entry->sig, __entry->errno, __entry->code, 77 __entry->sig, __entry->errno, __entry->code,
61 __entry->comm, __entry->pid) 78 __entry->comm, __entry->pid, __entry->group,
79 __entry->result)
62); 80);
63 81
64/** 82/**
@@ -101,65 +119,6 @@ TRACE_EVENT(signal_deliver,
101 __entry->sa_handler, __entry->sa_flags) 119 __entry->sa_handler, __entry->sa_flags)
102); 120);
103 121
104DECLARE_EVENT_CLASS(signal_queue_overflow,
105
106 TP_PROTO(int sig, int group, struct siginfo *info),
107
108 TP_ARGS(sig, group, info),
109
110 TP_STRUCT__entry(
111 __field( int, sig )
112 __field( int, group )
113 __field( int, errno )
114 __field( int, code )
115 ),
116
117 TP_fast_assign(
118 __entry->sig = sig;
119 __entry->group = group;
120 TP_STORE_SIGINFO(__entry, info);
121 ),
122
123 TP_printk("sig=%d group=%d errno=%d code=%d",
124 __entry->sig, __entry->group, __entry->errno, __entry->code)
125);
126
127/**
128 * signal_overflow_fail - called when signal queue is overflow
129 * @sig: signal number
130 * @group: signal to process group or not (bool)
131 * @info: pointer to struct siginfo
132 *
133 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
134 * siginfo queue is overflow, and the signal is dropped.
135 * 'group' is not 0 if the signal will be sent to a process group.
136 * 'sig' is always one of RT signals.
137 */
138DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail,
139
140 TP_PROTO(int sig, int group, struct siginfo *info),
141
142 TP_ARGS(sig, group, info)
143);
144
145/**
146 * signal_lose_info - called when siginfo is lost
147 * @sig: signal number
148 * @group: signal to process group or not (bool)
149 * @info: pointer to struct siginfo
150 *
151 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
152 * queue is overflow.
153 * 'group' is not 0 if the signal will be sent to a process group.
154 * 'sig' is always one of non-RT signals.
155 */
156DEFINE_EVENT(signal_queue_overflow, signal_lose_info,
157
158 TP_PROTO(int sig, int group, struct siginfo *info),
159
160 TP_ARGS(sig, group, info)
161);
162
163#endif /* _TRACE_SIGNAL_H */ 122#endif /* _TRACE_SIGNAL_H */
164 123
165/* This part must be outside protection */ 124/* This part must be outside protection */
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 8588a891802..5973410e8f8 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -47,7 +47,10 @@ DECLARE_EVENT_CLASS(writeback_work_class,
47 __field(int, reason) 47 __field(int, reason)
48 ), 48 ),
49 TP_fast_assign( 49 TP_fast_assign(
50 strncpy(__entry->name, dev_name(bdi->dev), 32); 50 struct device *dev = bdi->dev;
51 if (!dev)
52 dev = default_backing_dev_info.dev;
53 strncpy(__entry->name, dev_name(dev), 32);
51 __entry->nr_pages = work->nr_pages; 54 __entry->nr_pages = work->nr_pages;
52 __entry->sb_dev = work->sb ? work->sb->s_dev : 0; 55 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
53 __entry->sync_mode = work->sync_mode; 56 __entry->sync_mode = work->sync_mode;
@@ -426,7 +429,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template,
426 429
427 TP_fast_assign( 430 TP_fast_assign(
428 strncpy(__entry->name, 431 strncpy(__entry->name,
429 dev_name(inode->i_mapping->backing_dev_info->dev), 32); 432 dev_name(inode_to_bdi(inode)->dev), 32);
430 __entry->ino = inode->i_ino; 433 __entry->ino = inode->i_ino;
431 __entry->state = inode->i_state; 434 __entry->state = inode->i_state;
432 __entry->dirtied_when = inode->dirtied_when; 435 __entry->dirtied_when = inode->dirtied_when;
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b24ff1..483f67caa7a 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -590,6 +590,11 @@ struct omap_dss_device {
590 int (*get_backlight)(struct omap_dss_device *dssdev); 590 int (*get_backlight)(struct omap_dss_device *dssdev);
591}; 591};
592 592
593struct omap_dss_hdmi_data
594{
595 int hpd_gpio;
596};
597
593struct omap_dss_driver { 598struct omap_dss_driver {
594 struct device_driver driver; 599 struct device_driver driver;
595 600