aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-01-08 21:12:55 -0500
committerPaul Mundt <lethal@linux-sh.org>2012-01-08 21:12:55 -0500
commitca371d2854d48c0c22e7aa031df182f96dc85820 (patch)
tree1c62be8b4da0bfc82fa7ffa1ad5b0e958266cbd1 /include/linux
parent0d376945d0bc0a8f8e00861d506b10e42e8af372 (diff)
parenta0e86bd4252519321b0d102dc4ed90557aa7bee9 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into sh-latest
Conflicts: arch/arm/mach-shmobile/clock-sh73a0.c Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/amba/bus.h7
-rw-r--r--include/linux/amba/pl022.h4
-rw-r--r--include/linux/atmdev.h10
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/bcma/bcma.h55
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h1
-rw-r--r--include/linux/bitops.h10
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/can/platform/cc770.h33
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--include/linux/cgroup_subsys.h8
-rw-r--r--include/linux/clocksource.h11
-rw-r--r--include/linux/compat.h13
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/cordic.h4
-rw-r--r--include/linux/cpu.h19
-rw-r--r--include/linux/cpuidle.h2
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/debugfs.h72
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/device.h114
-rw-r--r--include/linux/dma-buf.h176
-rw-r--r--include/linux/dma_remapping.h2
-rw-r--r--include/linux/dynamic_queue_limits.h97
-rw-r--r--include/linux/edac.h8
-rw-r--r--include/linux/eeprom_93cx6.h8
-rw-r--r--include/linux/errqueue.h7
-rw-r--r--include/linux/ethtool.h116
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/freezer.h159
-rw-r--r--include/linux/fs.h110
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/genetlink.h24
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/hardirq.h21
-rw-r--r--include/linux/i2c.h13
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h32
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_team.h242
-rw-r--r--include/linux/if_vlan.h80
-rw-r--r--include/linux/inet_diag.h43
-rw-r--r--include/linux/init_task.h4
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irqdomain.h3
-rw-r--r--include/linux/iscsi_boot_sysfs.h8
-rw-r--r--include/linux/jump_label.h27
-rw-r--r--include/linux/kernel_stat.h36
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kref.h77
-rw-r--r--include/linux/kthread.h1
-rw-r--r--include/linux/kvm.h1
-rw-r--r--include/linux/latencytop.h3
-rw-r--r--include/linux/lglock.h36
-rw-r--r--include/linux/lockd/lockd.h6
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/log2.h1
-rw-r--r--include/linux/mdio-bitbang.h2
-rw-r--r--include/linux/mdio-gpio.h2
-rw-r--r--include/linux/memblock.h170
-rw-r--r--include/linux/memcontrol.h23
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/mfd/da9052/da9052.h131
-rw-r--r--include/linux/mfd/da9052/pdata.h40
-rw-r--r--include/linux/mfd/da9052/reg.h749
-rw-r--r--include/linux/mii.h200
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/cmd.h51
-rw-r--r--include/linux/mlx4/device.h80
-rw-r--r--include/linux/mlx4/qp.h28
-rw-r--r--include/linux/mm.h35
-rw-r--r--include/linux/mmc/card.h6
-rw-r--r--include/linux/mmzone.h8
-rw-r--r--include/linux/mnt_namespace.h31
-rw-r--r--include/linux/mod_devicetable.h18
-rw-r--r--include/linux/mount.h39
-rw-r--r--include/linux/neighbour.h1
-rw-r--r--include/linux/netdev_features.h146
-rw-r--r--include/linux/netdevice.h345
-rw-r--r--include/linux/netfilter.h26
-rw-r--r--include/linux/netfilter/Kbuild4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h27
-rw-r--r--include/linux/netfilter/nf_nat.h25
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h36
-rw-r--r--include/linux/netfilter/xt_CT.h3
-rw-r--r--include/linux/netfilter/xt_ecn.h35
-rw-r--r--include/linux/netfilter/xt_nfacct.h13
-rw-r--r--include/linux/netfilter/xt_rpfilter.h23
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h38
-rw-r--r--include/linux/netfilter_ipv4/nf_nat.h58
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/nfc.h31
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nl80211.h171
-rw-r--r--include/linux/node.h6
-rw-r--r--include/linux/of.h44
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_gpio.h10
-rw-r--r--include/linux/openvswitch.h452
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/perf_event.h9
-rw-r--r--include/linux/phonet.h2
-rw-r--r--include/linux/pkt_sched.h38
-rw-r--r--include/linux/platform_device.h44
-rw-r--r--include/linux/pm.h244
-rw-r--r--include/linux/pm_domain.h103
-rw-r--r--include/linux/pm_qos.h8
-rw-r--r--include/linux/pm_runtime.h5
-rw-r--r--include/linux/poison.h6
-rw-r--r--include/linux/proc_fs.h24
-rw-r--r--include/linux/pstore.h12
-rw-r--r--include/linux/raid/md_p.h7
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcupdate.h115
-rw-r--r--include/linux/regmap.h59
-rw-r--r--include/linux/reiserfs_fs.h9
-rw-r--r--include/linux/reiserfs_fs_sb.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/sched.h35
-rw-r--r--include/linux/security.h68
-rw-r--r--include/linux/seq_file.h10
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/shrinker.h2
-rw-r--r--include/linux/sigma.h13
-rw-r--r--include/linux/skbuff.h86
-rw-r--r--include/linux/smscphy.h25
-rw-r--r--include/linux/sock_diag.h48
-rw-r--r--include/linux/spi/spi.h11
-rw-r--r--include/linux/srcu.h87
-rw-r--r--include/linux/ssb/ssb.h9
-rw-r--r--include/linux/ssb/ssb_regs.h17
-rw-r--r--include/linux/sunrpc/cache.h2
-rw-r--r--include/linux/sunrpc/clnt.h8
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/suspend.h35
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/tick.h11
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/unix_diag.h54
-rw-r--r--include/linux/usb.h14
-rw-r--r--include/linux/virtio_config.h14
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/wait.h4
-rw-r--r--include/linux/wanrouter.h2
-rw-r--r--include/linux/wl12xx.h5
158 files changed, 4917 insertions, 1277 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 619b5657af77..c94e71781b79 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h
185header-y += if_pppox.h 185header-y += if_pppox.h
186header-y += if_slip.h 186header-y += if_slip.h
187header-y += if_strip.h 187header-y += if_strip.h
188header-y += if_team.h
188header-y += if_tr.h 189header-y += if_tr.h
189header-y += if_tun.h 190header-y += if_tun.h
190header-y += if_tunnel.h 191header-y += if_tunnel.h
@@ -194,7 +195,9 @@ header-y += igmp.h
194header-y += in.h 195header-y += in.h
195header-y += in6.h 196header-y += in6.h
196header-y += in_route.h 197header-y += in_route.h
198header-y += sock_diag.h
197header-y += inet_diag.h 199header-y += inet_diag.h
200header-y += unix_diag.h
198header-y += inotify.h 201header-y += inotify.h
199header-y += input.h 202header-y += input.h
200header-y += ioctl.h 203header-y += ioctl.h
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fcbbe71a3cc1..724c69c40bb8 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/mod_devicetable.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/resource.h> 21#include <linux/resource.h>
21#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
@@ -35,12 +36,6 @@ struct amba_device {
35 unsigned int irq[AMBA_NR_IRQS]; 36 unsigned int irq[AMBA_NR_IRQS];
36}; 37};
37 38
38struct amba_id {
39 unsigned int id;
40 unsigned int mask;
41 void *data;
42};
43
44struct amba_driver { 39struct amba_driver {
45 struct device_driver drv; 40 struct device_driver drv;
46 int (*probe)(struct amba_device *, const struct amba_id *); 41 int (*probe)(struct amba_device *, const struct amba_id *);
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 4ce98f54186b..572f637299c9 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -238,6 +238,9 @@ struct dma_chan;
238 * @enable_dma: if true enables DMA driven transfers. 238 * @enable_dma: if true enables DMA driven transfers.
239 * @dma_rx_param: parameter to locate an RX DMA channel. 239 * @dma_rx_param: parameter to locate an RX DMA channel.
240 * @dma_tx_param: parameter to locate a TX DMA channel. 240 * @dma_tx_param: parameter to locate a TX DMA channel.
241 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately.
241 */ 244 */
242struct pl022_ssp_controller { 245struct pl022_ssp_controller {
243 u16 bus_id; 246 u16 bus_id;
@@ -246,6 +249,7 @@ struct pl022_ssp_controller {
246 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 249 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
247 void *dma_rx_param; 250 void *dma_rx_param;
248 void *dma_tx_param; 251 void *dma_tx_param;
252 int autosuspend_delay;
249}; 253};
250 254
251/** 255/**
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 49a83ca900ba..f4ff882cb2da 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -445,16 +445,6 @@ void vcc_insert_socket(struct sock *sk);
445 445
446void atm_dev_release_vccs(struct atm_dev *dev); 446void atm_dev_release_vccs(struct atm_dev *dev);
447 447
448/*
449 * This is approximately the algorithm used by alloc_skb.
450 *
451 */
452
453static inline int atm_guess_pdu2truesize(int size)
454{
455 return SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
456}
457
458 448
459static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) 449static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
460{ 450{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2f81c6f3b630..426ab9f4dd85 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -468,13 +468,13 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
468#define audit_get_sessionid(t) ((t)->sessionid) 468#define audit_get_sessionid(t) ((t)->sessionid)
469extern void audit_log_task_context(struct audit_buffer *ab); 469extern void audit_log_task_context(struct audit_buffer *ab);
470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
472extern int audit_bprm(struct linux_binprm *bprm); 472extern int audit_bprm(struct linux_binprm *bprm);
473extern void audit_socketcall(int nargs, unsigned long *args); 473extern void audit_socketcall(int nargs, unsigned long *args);
474extern int audit_sockaddr(int len, void *addr); 474extern int audit_sockaddr(int len, void *addr);
475extern void __audit_fd_pair(int fd1, int fd2); 475extern void __audit_fd_pair(int fd1, int fd2);
476extern int audit_set_macxattr(const char *name); 476extern int audit_set_macxattr(const char *name);
477extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr); 477extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); 478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); 479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
@@ -494,12 +494,12 @@ static inline void audit_fd_pair(int fd1, int fd2)
494 if (unlikely(!audit_dummy_context())) 494 if (unlikely(!audit_dummy_context()))
495 __audit_fd_pair(fd1, fd2); 495 __audit_fd_pair(fd1, fd2);
496} 496}
497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
498{ 498{
499 if (unlikely(!audit_dummy_context())) 499 if (unlikely(!audit_dummy_context()))
500 __audit_ipc_set_perm(qbytes, uid, gid, mode); 500 __audit_ipc_set_perm(qbytes, uid, gid, mode);
501} 501}
502static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) 502static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
503{ 503{
504 if (unlikely(!audit_dummy_context())) 504 if (unlikely(!audit_dummy_context()))
505 __audit_mq_open(oflag, mode, attr); 505 __audit_mq_open(oflag, mode, attr);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 4d4b59de9467..f4b8346b1a33 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -205,61 +205,82 @@ struct bcma_bus {
205 struct ssb_sprom sprom; 205 struct ssb_sprom sprom;
206}; 206};
207 207
208extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) 208static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
209{ 209{
210 return core->bus->ops->read8(core, offset); 210 return core->bus->ops->read8(core, offset);
211} 211}
212extern inline u32 bcma_read16(struct bcma_device *core, u16 offset) 212static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
213{ 213{
214 return core->bus->ops->read16(core, offset); 214 return core->bus->ops->read16(core, offset);
215} 215}
216extern inline u32 bcma_read32(struct bcma_device *core, u16 offset) 216static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
217{ 217{
218 return core->bus->ops->read32(core, offset); 218 return core->bus->ops->read32(core, offset);
219} 219}
220extern inline 220static inline
221void bcma_write8(struct bcma_device *core, u16 offset, u32 value) 221void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
222{ 222{
223 core->bus->ops->write8(core, offset, value); 223 core->bus->ops->write8(core, offset, value);
224} 224}
225extern inline 225static inline
226void bcma_write16(struct bcma_device *core, u16 offset, u32 value) 226void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
227{ 227{
228 core->bus->ops->write16(core, offset, value); 228 core->bus->ops->write16(core, offset, value);
229} 229}
230extern inline 230static inline
231void bcma_write32(struct bcma_device *core, u16 offset, u32 value) 231void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
232{ 232{
233 core->bus->ops->write32(core, offset, value); 233 core->bus->ops->write32(core, offset, value);
234} 234}
235#ifdef CONFIG_BCMA_BLOCKIO 235#ifdef CONFIG_BCMA_BLOCKIO
236extern inline void bcma_block_read(struct bcma_device *core, void *buffer, 236static inline void bcma_block_read(struct bcma_device *core, void *buffer,
237 size_t count, u16 offset, u8 reg_width) 237 size_t count, u16 offset, u8 reg_width)
238{ 238{
239 core->bus->ops->block_read(core, buffer, count, offset, reg_width); 239 core->bus->ops->block_read(core, buffer, count, offset, reg_width);
240} 240}
241extern inline void bcma_block_write(struct bcma_device *core, const void *buffer, 241static inline void bcma_block_write(struct bcma_device *core,
242 size_t count, u16 offset, u8 reg_width) 242 const void *buffer, size_t count,
243 u16 offset, u8 reg_width)
243{ 244{
244 core->bus->ops->block_write(core, buffer, count, offset, reg_width); 245 core->bus->ops->block_write(core, buffer, count, offset, reg_width);
245} 246}
246#endif 247#endif
247extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) 248static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
248{ 249{
249 return core->bus->ops->aread32(core, offset); 250 return core->bus->ops->aread32(core, offset);
250} 251}
251extern inline 252static inline
252void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) 253void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
253{ 254{
254 core->bus->ops->awrite32(core, offset, value); 255 core->bus->ops->awrite32(core, offset, value);
255} 256}
256 257
257#define bcma_mask32(cc, offset, mask) \ 258static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
258 bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) 259{
259#define bcma_set32(cc, offset, set) \ 260 bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
260 bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) 261}
261#define bcma_maskset32(cc, offset, mask, set) \ 262static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
262 bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) 263{
264 bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
265}
266static inline void bcma_maskset32(struct bcma_device *cc,
267 u16 offset, u32 mask, u32 set)
268{
269 bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
270}
271static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
272{
273 bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
274}
275static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
276{
277 bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
278}
279static inline void bcma_maskset16(struct bcma_device *cc,
280 u16 offset, u16 mask, u16 set)
281{
282 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
283}
263 284
264extern bool bcma_core_is_enabled(struct bcma_device *core); 285extern bool bcma_core_is_enabled(struct bcma_device *core);
265extern void bcma_core_disable(struct bcma_device *core, u32 flags); 286extern void bcma_core_disable(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 1526d965ed06..a33086a7530b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -203,6 +203,7 @@
203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ 203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ 204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
206#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
206#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ 207#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
207#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ 208#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
208#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ 209#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3ef66a2a083..3c1063acb2ab 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -22,8 +22,14 @@ extern unsigned long __sw_hweight64(__u64 w);
22#include <asm/bitops.h> 22#include <asm/bitops.h>
23 23
24#define for_each_set_bit(bit, addr, size) \ 24#define for_each_set_bit(bit, addr, size) \
25 for ((bit) = find_first_bit((addr), (size)); \ 25 for ((bit) = find_first_bit((addr), (size)); \
26 (bit) < (size); \ 26 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1))
28
29/* same as for_each_set_bit() but use bit as value to start with */
30#define for_each_set_bit_cont(bit, addr, size) \
31 for ((bit) = find_next_bit((addr), (size), (bit)); \
32 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1)) 33 (bit) = find_next_bit((addr), (size), (bit) + 1))
28 34
29static __inline__ int get_bitmask_order(unsigned int count) 35static __inline__ int get_bitmask_order(unsigned int count)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c7a6d3b5bc7b..94acd8172b5b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *);
805 */ 805 */
806extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 806extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
807 spinlock_t *lock, int node_id); 807 spinlock_t *lock, int node_id);
808extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
809 request_fn_proc *,
810 spinlock_t *, int node_id);
811extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 808extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
812extern struct request_queue *blk_init_allocated_queue(struct request_queue *, 809extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
813 request_fn_proc *, spinlock_t *); 810 request_fn_proc *, spinlock_t *);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index ab344a521105..66d3e954eb6c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,7 +44,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47unsigned long free_all_memory_core_early(int nodeid); 47extern unsigned long free_low_memory_core_early(int nodeid);
48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
49extern unsigned long free_all_bootmem(void); 49extern unsigned long free_all_bootmem(void);
50 50
diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h
new file mode 100644
index 000000000000..7702641f87ee
--- /dev/null
+++ b/include/linux/can/platform/cc770.h
@@ -0,0 +1,33 @@
1#ifndef _CAN_PLATFORM_CC770_H_
2#define _CAN_PLATFORM_CC770_H_
3
4/* CPU Interface Register (0x02) */
5#define CPUIF_CEN 0x01 /* Clock Out Enable */
6#define CPUIF_MUX 0x04 /* Multiplex */
7#define CPUIF_SLP 0x08 /* Sleep */
8#define CPUIF_PWD 0x10 /* Power Down Mode */
9#define CPUIF_DMC 0x20 /* Divide Memory Clock */
10#define CPUIF_DSC 0x40 /* Divide System Clock */
11#define CPUIF_RST 0x80 /* Hardware Reset Status */
12
13/* Clock Out Register (0x1f) */
14#define CLKOUT_CD_MASK 0x0f /* Clock Divider mask */
15#define CLKOUT_SL_MASK 0x30 /* Slew Rate mask */
16#define CLKOUT_SL_SHIFT 4
17
18/* Bus Configuration Register (0x2f) */
19#define BUSCFG_DR0 0x01 /* Disconnect RX0 Input / Select RX input */
20#define BUSCFG_DR1 0x02 /* Disconnect RX1 Input / Silent mode */
21#define BUSCFG_DT1 0x08 /* Disconnect TX1 Output */
22#define BUSCFG_POL 0x20 /* Polarity dominant or recessive */
23#define BUSCFG_CBY 0x40 /* Input Comparator Bypass */
24
25struct cc770_platform_data {
26 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
27
28 u8 cir; /* CPU Interface Register */
29 u8 cor; /* Clock Out Register */
30 u8 bcr; /* Bus Configuration Register */
31};
32
33#endif /* !_CAN_PLATFORM_CC770_H_ */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1b7f9d525013..a17becc36ca1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -319,7 +319,7 @@ struct cftype {
319 * If not 0, file mode is set to this value, otherwise it will 319 * If not 0, file mode is set to this value, otherwise it will
320 * be figured out automatically 320 * be figured out automatically
321 */ 321 */
322 mode_t mode; 322 umode_t mode;
323 323
324 /* 324 /*
325 * If non-zero, defines the maximum length of string that can 325 * If non-zero, defines the maximum length of string that can
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ac663c18776c..0bd390ce98b2 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -59,8 +59,16 @@ SUBSYS(net_cls)
59SUBSYS(blkio) 59SUBSYS(blkio)
60#endif 60#endif
61 61
62/* */
63
62#ifdef CONFIG_CGROUP_PERF 64#ifdef CONFIG_CGROUP_PERF
63SUBSYS(perf) 65SUBSYS(perf)
64#endif 66#endif
65 67
66/* */ 68/* */
69
70#ifdef CONFIG_NETPRIO_CGROUP
71SUBSYS(net_prio)
72#endif
73
74/* */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c86c940d1de3..081147da0564 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -71,7 +71,7 @@ struct timecounter {
71 71
72/** 72/**
73 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds 73 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
74 * @tc: Pointer to cycle counter. 74 * @cc: Pointer to cycle counter.
75 * @cycles: Cycles 75 * @cycles: Cycles
76 * 76 *
77 * XXX - This could use some mult_lxl_ll() asm optimization. Same code 77 * XXX - This could use some mult_lxl_ll() asm optimization. Same code
@@ -114,7 +114,7 @@ extern u64 timecounter_read(struct timecounter *tc);
114 * time base as values returned by 114 * time base as values returned by
115 * timecounter_read() 115 * timecounter_read()
116 * @tc: Pointer to time counter. 116 * @tc: Pointer to time counter.
117 * @cycle: a value returned by tc->cc->read() 117 * @cycle_tstamp: a value returned by tc->cc->read()
118 * 118 *
119 * Cycle counts that are converted correctly as long as they 119 * Cycle counts that are converted correctly as long as they
120 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count], 120 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
@@ -156,11 +156,12 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
156 * @mult: cycle to nanosecond multiplier 156 * @mult: cycle to nanosecond multiplier
157 * @shift: cycle to nanosecond divisor (power of two) 157 * @shift: cycle to nanosecond divisor (power of two)
158 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 158 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
159 * @maxadj maximum adjustment value to mult (~11%) 159 * @maxadj: maximum adjustment value to mult (~11%)
160 * @flags: flags describing special properties 160 * @flags: flags describing special properties
161 * @archdata: arch-specific data 161 * @archdata: arch-specific data
162 * @suspend: suspend function for the clocksource, if necessary 162 * @suspend: suspend function for the clocksource, if necessary
163 * @resume: resume function for the clocksource, if necessary 163 * @resume: resume function for the clocksource, if necessary
164 * @cycle_last: most recent cycle counter value seen by ::read()
164 */ 165 */
165struct clocksource { 166struct clocksource {
166 /* 167 /*
@@ -187,6 +188,7 @@ struct clocksource {
187 void (*suspend)(struct clocksource *cs); 188 void (*suspend)(struct clocksource *cs);
188 void (*resume)(struct clocksource *cs); 189 void (*resume)(struct clocksource *cs);
189 190
191 /* private: */
190#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 192#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
191 /* Watchdog related data, used by the framework */ 193 /* Watchdog related data, used by the framework */
192 struct list_head wd_list; 194 struct list_head wd_list;
@@ -261,6 +263,9 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
261 263
262/** 264/**
263 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds 265 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
266 * @cycles: cycles
267 * @mult: cycle to nanosecond multiplier
268 * @shift: cycle to nanosecond divisor (power of two)
264 * 269 *
265 * Converts cycles to nanoseconds, using the given mult and shift. 270 * Converts cycles to nanoseconds, using the given mult and shift.
266 * 271 *
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 154bf5683015..41c9f6515f46 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -422,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
423 unsigned int nr_segs, unsigned int flags); 423 unsigned int nr_segs, unsigned int flags);
424asmlinkage long compat_sys_open(const char __user *filename, int flags, 424asmlinkage long compat_sys_open(const char __user *filename, int flags,
425 int mode); 425 umode_t mode);
426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
427 int flags, int mode); 427 int flags, umode_t mode);
428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
429 struct file_handle __user *handle, 429 struct file_handle __user *handle,
430 int flags); 430 int flags);
@@ -552,5 +552,14 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
552 552
553extern void __user *compat_alloc_user_space(unsigned long len); 553extern void __user *compat_alloc_user_space(unsigned long len);
554 554
555asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
556 const struct compat_iovec __user *lvec,
557 unsigned long liovcnt, const struct compat_iovec __user *rvec,
558 unsigned long riovcnt, unsigned long flags);
559asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
560 const struct compat_iovec __user *lvec,
561 unsigned long liovcnt, const struct compat_iovec __user *rvec,
562 unsigned long riovcnt, unsigned long flags);
563
555#endif /* CONFIG_COMPAT */ 564#endif /* CONFIG_COMPAT */
556#endif /* _LINUX_COMPAT_H */ 565#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3081c58d696e..34025df61829 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -124,7 +124,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
124struct configfs_attribute { 124struct configfs_attribute {
125 const char *ca_name; 125 const char *ca_name;
126 struct module *ca_owner; 126 struct module *ca_owner;
127 mode_t ca_mode; 127 umode_t ca_mode;
128}; 128};
129 129
130/* 130/*
diff --git a/include/linux/cordic.h b/include/linux/cordic.h
index f932093e20c2..cf68ca4a508c 100644
--- a/include/linux/cordic.h
+++ b/include/linux/cordic.h
@@ -35,8 +35,8 @@ struct cordic_iq {
35 * @theta: angle in degrees for which i/q coordinate is to be calculated. 35 * @theta: angle in degrees for which i/q coordinate is to be calculated.
36 * @coord: function output parameter holding the i/q coordinate. 36 * @coord: function output parameter holding the i/q coordinate.
37 * 37 *
38 * The function calculates the i/q coordinate for a given angle using 38 * The function calculates the i/q coordinate for a given angle using the
39 * cordic algorithm. The coordinate consists of a real (i) and an 39 * CORDIC algorithm. The coordinate consists of a real (i) and an
40 * imaginary (q) part. The real part is essentially the cosine of the 40 * imaginary (q) part. The real part is essentially the cosine of the
41 * angle and the imaginary part is the sine of the angle. The returned 41 * angle and the imaginary part is the sine of the angle. The returned
42 * values are scaled by 2^16 for precision. The range for theta is 42 * values are scaled by 2^16 for precision. The range for theta is
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 6cb60fd2ea84..1f6587590a1a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,7 +14,7 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/node.h> 18#include <linux/node.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/cpumask.h> 20#include <linux/cpumask.h>
@@ -22,19 +22,20 @@
22struct cpu { 22struct cpu {
23 int node_id; /* The node which contains the CPU */ 23 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 24 int hotpluggable; /* creates sysfs control file if hotpluggable */
25 struct sys_device sysdev; 25 struct device dev;
26}; 26};
27 27
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct sys_device *get_cpu_sysdev(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu);
30 31
31extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); 32extern int cpu_add_dev_attr(struct device_attribute *attr);
32extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); 33extern void cpu_remove_dev_attr(struct device_attribute *attr);
33 34
34extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 35extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
35extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 36extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
36 37
37extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 38extern int sched_create_sysfs_power_savings_entries(struct device *dev);
38 39
39#ifdef CONFIG_HOTPLUG_CPU 40#ifdef CONFIG_HOTPLUG_CPU
40extern void unregister_cpu(struct cpu *cpu); 41extern void unregister_cpu(struct cpu *cpu);
@@ -160,7 +161,7 @@ static inline void cpu_maps_update_done(void)
160} 161}
161 162
162#endif /* CONFIG_SMP */ 163#endif /* CONFIG_SMP */
163extern struct sysdev_class cpu_sysdev_class; 164extern struct bus_type cpu_subsys;
164 165
165#ifdef CONFIG_HOTPLUG_CPU 166#ifdef CONFIG_HOTPLUG_CPU
166/* Stop CPUs going up and down. */ 167/* Stop CPUs going up and down. */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 7408af843b8a..23f81de51829 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -130,7 +130,6 @@ struct cpuidle_driver {
130#ifdef CONFIG_CPU_IDLE 130#ifdef CONFIG_CPU_IDLE
131extern void disable_cpuidle(void); 131extern void disable_cpuidle(void);
132extern int cpuidle_idle_call(void); 132extern int cpuidle_idle_call(void);
133
134extern int cpuidle_register_driver(struct cpuidle_driver *drv); 133extern int cpuidle_register_driver(struct cpuidle_driver *drv);
135struct cpuidle_driver *cpuidle_get_driver(void); 134struct cpuidle_driver *cpuidle_get_driver(void);
136extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 135extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
@@ -145,7 +144,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
145#else 144#else
146static inline void disable_cpuidle(void) { } 145static inline void disable_cpuidle(void) { }
147static inline int cpuidle_idle_call(void) { return -ENODEV; } 146static inline int cpuidle_idle_call(void) { return -ENODEV; }
148
149static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 147static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
150{return -ENODEV; } 148{return -ENODEV; }
151static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } 149static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 4df926199369..ed9f74f6c519 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -339,7 +339,8 @@ extern int d_validate(struct dentry *, struct dentry *);
339 */ 339 */
340extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 340extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
341 341
342extern char *__d_path(const struct path *path, struct path *root, char *, int); 342extern char *__d_path(const struct path *, const struct path *, char *, int);
343extern char *d_absolute_path(const struct path *, char *, int);
343extern char *d_path(const struct path *, char *, int); 344extern char *d_path(const struct path *, char *, int);
344extern char *d_path_with_unreachable(const struct path *, char *, int); 345extern char *d_path_with_unreachable(const struct path *, char *, int);
345extern char *dentry_path_raw(struct dentry *, char *, int); 346extern char *dentry_path_raw(struct dentry *, char *, int);
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d9b20ddc5b..6169c26fd8c8 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -16,6 +16,7 @@
16#define _DEBUGFS_H_ 16#define _DEBUGFS_H_
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/seq_file.h>
19 20
20#include <linux/types.h> 21#include <linux/types.h>
21 22
@@ -26,6 +27,17 @@ struct debugfs_blob_wrapper {
26 unsigned long size; 27 unsigned long size;
27}; 28};
28 29
30struct debugfs_reg32 {
31 char *name;
32 unsigned long offset;
33};
34
35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs;
37 int nregs;
38 void __iomem *base;
39};
40
29extern struct dentry *arch_debugfs_dir; 41extern struct dentry *arch_debugfs_dir;
30 42
31#if defined(CONFIG_DEBUG_FS) 43#if defined(CONFIG_DEBUG_FS)
@@ -34,7 +46,7 @@ extern struct dentry *arch_debugfs_dir;
34extern const struct file_operations debugfs_file_operations; 46extern const struct file_operations debugfs_file_operations;
35extern const struct inode_operations debugfs_link_operations; 47extern const struct inode_operations debugfs_link_operations;
36 48
37struct dentry *debugfs_create_file(const char *name, mode_t mode, 49struct dentry *debugfs_create_file(const char *name, umode_t mode,
38 struct dentry *parent, void *data, 50 struct dentry *parent, void *data,
39 const struct file_operations *fops); 51 const struct file_operations *fops);
40 52
@@ -49,31 +61,38 @@ void debugfs_remove_recursive(struct dentry *dentry);
49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 61struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
50 struct dentry *new_dir, const char *new_name); 62 struct dentry *new_dir, const char *new_name);
51 63
52struct dentry *debugfs_create_u8(const char *name, mode_t mode, 64struct dentry *debugfs_create_u8(const char *name, umode_t mode,
53 struct dentry *parent, u8 *value); 65 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_u16(const char *name, mode_t mode, 66struct dentry *debugfs_create_u16(const char *name, umode_t mode,
55 struct dentry *parent, u16 *value); 67 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_u32(const char *name, mode_t mode, 68struct dentry *debugfs_create_u32(const char *name, umode_t mode,
57 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
58struct dentry *debugfs_create_u64(const char *name, mode_t mode, 70struct dentry *debugfs_create_u64(const char *name, umode_t mode,
59 struct dentry *parent, u64 *value); 71 struct dentry *parent, u64 *value);
60struct dentry *debugfs_create_x8(const char *name, mode_t mode, 72struct dentry *debugfs_create_x8(const char *name, umode_t mode,
61 struct dentry *parent, u8 *value); 73 struct dentry *parent, u8 *value);
62struct dentry *debugfs_create_x16(const char *name, mode_t mode, 74struct dentry *debugfs_create_x16(const char *name, umode_t mode,
63 struct dentry *parent, u16 *value); 75 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 76struct dentry *debugfs_create_x32(const char *name, umode_t mode,
65 struct dentry *parent, u32 *value); 77 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode, 78struct dentry *debugfs_create_x64(const char *name, umode_t mode,
67 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
68struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
69 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
70struct dentry *debugfs_create_bool(const char *name, mode_t mode, 82struct dentry *debugfs_create_bool(const char *name, umode_t mode,
71 struct dentry *parent, u32 *value); 83 struct dentry *parent, u32 *value);
72 84
73struct dentry *debugfs_create_blob(const char *name, mode_t mode, 85struct dentry *debugfs_create_blob(const char *name, umode_t mode,
74 struct dentry *parent, 86 struct dentry *parent,
75 struct debugfs_blob_wrapper *blob); 87 struct debugfs_blob_wrapper *blob);
76 88
89struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
90 struct dentry *parent,
91 struct debugfs_regset32 *regset);
92
93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
94 int nregs, void __iomem *base, char *prefix);
95
77bool debugfs_initialized(void); 96bool debugfs_initialized(void);
78 97
79#else 98#else
@@ -86,7 +105,7 @@ bool debugfs_initialized(void);
86 * want to duplicate the design decision mistakes of procfs and devfs again. 105 * want to duplicate the design decision mistakes of procfs and devfs again.
87 */ 106 */
88 107
89static inline struct dentry *debugfs_create_file(const char *name, mode_t mode, 108static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
90 struct dentry *parent, void *data, 109 struct dentry *parent, void *data,
91 const struct file_operations *fops) 110 const struct file_operations *fops)
92{ 111{
@@ -118,76 +137,83 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr
118 return ERR_PTR(-ENODEV); 137 return ERR_PTR(-ENODEV);
119} 138}
120 139
121static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, 140static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
122 struct dentry *parent, 141 struct dentry *parent,
123 u8 *value) 142 u8 *value)
124{ 143{
125 return ERR_PTR(-ENODEV); 144 return ERR_PTR(-ENODEV);
126} 145}
127 146
128static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode, 147static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
129 struct dentry *parent, 148 struct dentry *parent,
130 u16 *value) 149 u16 *value)
131{ 150{
132 return ERR_PTR(-ENODEV); 151 return ERR_PTR(-ENODEV);
133} 152}
134 153
135static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, 154static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
136 struct dentry *parent, 155 struct dentry *parent,
137 u32 *value) 156 u32 *value)
138{ 157{
139 return ERR_PTR(-ENODEV); 158 return ERR_PTR(-ENODEV);
140} 159}
141 160
142static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, 161static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
143 struct dentry *parent, 162 struct dentry *parent,
144 u64 *value) 163 u64 *value)
145{ 164{
146 return ERR_PTR(-ENODEV); 165 return ERR_PTR(-ENODEV);
147} 166}
148 167
149static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode, 168static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
150 struct dentry *parent, 169 struct dentry *parent,
151 u8 *value) 170 u8 *value)
152{ 171{
153 return ERR_PTR(-ENODEV); 172 return ERR_PTR(-ENODEV);
154} 173}
155 174
156static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode, 175static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
157 struct dentry *parent, 176 struct dentry *parent,
158 u16 *value) 177 u16 *value)
159{ 178{
160 return ERR_PTR(-ENODEV); 179 return ERR_PTR(-ENODEV);
161} 180}
162 181
163static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, 182static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
164 struct dentry *parent, 183 struct dentry *parent,
165 u32 *value) 184 u32 *value)
166{ 185{
167 return ERR_PTR(-ENODEV); 186 return ERR_PTR(-ENODEV);
168} 187}
169 188
170static inline struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 189static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
171 struct dentry *parent, 190 struct dentry *parent,
172 size_t *value) 191 size_t *value)
173{ 192{
174 return ERR_PTR(-ENODEV); 193 return ERR_PTR(-ENODEV);
175} 194}
176 195
177static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 196static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
178 struct dentry *parent, 197 struct dentry *parent,
179 u32 *value) 198 u32 *value)
180{ 199{
181 return ERR_PTR(-ENODEV); 200 return ERR_PTR(-ENODEV);
182} 201}
183 202
184static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, 203static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
185 struct dentry *parent, 204 struct dentry *parent,
186 struct debugfs_blob_wrapper *blob) 205 struct debugfs_blob_wrapper *blob)
187{ 206{
188 return ERR_PTR(-ENODEV); 207 return ERR_PTR(-ENODEV);
189} 208}
190 209
210static inline struct dentry *debugfs_create_regset32(const char *name,
211 mode_t mode, struct dentry *parent,
212 struct debugfs_regset32 *regset)
213{
214 return ERR_PTR(-ENODEV);
215}
216
191static inline bool debugfs_initialized(void) 217static inline bool debugfs_initialized(void)
192{ 218{
193 return false; 219 return false;
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 65970b811e22..0e5f5785d9f2 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -46,6 +46,8 @@ struct debug_obj {
46 * fails 46 * fails
47 * @fixup_free: fixup function, which is called when the free check 47 * @fixup_free: fixup function, which is called when the free check
48 * fails 48 * fails
49 * @fixup_assert_init: fixup function, which is called when the assert_init
50 * check fails
49 */ 51 */
50struct debug_obj_descr { 52struct debug_obj_descr {
51 const char *name; 53 const char *name;
@@ -54,6 +56,7 @@ struct debug_obj_descr {
54 int (*fixup_activate) (void *addr, enum debug_obj_state state); 56 int (*fixup_activate) (void *addr, enum debug_obj_state state);
55 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 57 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
56 int (*fixup_free) (void *addr, enum debug_obj_state state); 58 int (*fixup_free) (void *addr, enum debug_obj_state state);
59 int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
57}; 60};
58 61
59#ifdef CONFIG_DEBUG_OBJECTS 62#ifdef CONFIG_DEBUG_OBJECTS
@@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
64extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
65extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
66extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
70extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
67 71
68/* 72/*
69 * Active state: 73 * Active state:
@@ -89,6 +93,8 @@ static inline void
89debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } 93debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
90static inline void 94static inline void
91debug_object_free (void *addr, struct debug_obj_descr *descr) { } 95debug_object_free (void *addr, struct debug_obj_descr *descr) { }
96static inline void
97debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { }
92 98
93static inline void debug_objects_early_init(void) { } 99static inline void debug_objects_early_init(void) { }
94static inline void debug_objects_mem_init(void) { } 100static inline void debug_objects_mem_init(void) { }
diff --git a/include/linux/device.h b/include/linux/device.h
index 3136ede5a1e1..5b3adb8f9588 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
53 * struct bus_type - The bus type of the device 53 * struct bus_type - The bus type of the device
54 * 54 *
55 * @name: The name of the bus. 55 * @name: The name of the bus.
56 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
57 * @dev_root: Default device to use as the parent.
56 * @bus_attrs: Default attributes of the bus. 58 * @bus_attrs: Default attributes of the bus.
57 * @dev_attrs: Default attributes of the devices on the bus. 59 * @dev_attrs: Default attributes of the devices on the bus.
58 * @drv_attrs: Default attributes of the device drivers on the bus. 60 * @drv_attrs: Default attributes of the device drivers on the bus.
@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
86 */ 88 */
87struct bus_type { 89struct bus_type {
88 const char *name; 90 const char *name;
91 const char *dev_name;
92 struct device *dev_root;
89 struct bus_attribute *bus_attrs; 93 struct bus_attribute *bus_attrs;
90 struct device_attribute *dev_attrs; 94 struct device_attribute *dev_attrs;
91 struct driver_attribute *drv_attrs; 95 struct driver_attribute *drv_attrs;
@@ -106,12 +110,30 @@ struct bus_type {
106 struct subsys_private *p; 110 struct subsys_private *p;
107}; 111};
108 112
109extern int __must_check bus_register(struct bus_type *bus); 113/* This is a #define to keep the compiler from merging different
114 * instances of the __key variable */
115#define bus_register(subsys) \
116({ \
117 static struct lock_class_key __key; \
118 __bus_register(subsys, &__key); \
119})
120extern int __must_check __bus_register(struct bus_type *bus,
121 struct lock_class_key *key);
110extern void bus_unregister(struct bus_type *bus); 122extern void bus_unregister(struct bus_type *bus);
111 123
112extern int __must_check bus_rescan_devices(struct bus_type *bus); 124extern int __must_check bus_rescan_devices(struct bus_type *bus);
113 125
114/* iterator helpers for buses */ 126/* iterator helpers for buses */
127struct subsys_dev_iter {
128 struct klist_iter ki;
129 const struct device_type *type;
130};
131void subsys_dev_iter_init(struct subsys_dev_iter *iter,
132 struct bus_type *subsys,
133 struct device *start,
134 const struct device_type *type);
135struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
136void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
115 137
116int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 138int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
117 int (*fn)(struct device *dev, void *data)); 139 int (*fn)(struct device *dev, void *data));
@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
121struct device *bus_find_device_by_name(struct bus_type *bus, 143struct device *bus_find_device_by_name(struct bus_type *bus,
122 struct device *start, 144 struct device *start,
123 const char *name); 145 const char *name);
124 146struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
147 struct device *hint);
125int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 148int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
126 void *data, int (*fn)(struct device_driver *, void *)); 149 void *data, int (*fn)(struct device_driver *, void *));
127
128void bus_sort_breadthfirst(struct bus_type *bus, 150void bus_sort_breadthfirst(struct bus_type *bus,
129 int (*compare)(const struct device *a, 151 int (*compare)(const struct device *a,
130 const struct device *b)); 152 const struct device *b));
@@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv,
256 int (*match)(struct device *dev, void *data)); 278 int (*match)(struct device *dev, void *data));
257 279
258/** 280/**
281 * struct subsys_interface - interfaces to device functions
282 * @name name of the device function
283 * @subsystem subsytem of the devices to attach to
284 * @node the list of functions registered at the subsystem
285 * @add device hookup to device function handler
286 * @remove device hookup to device function handler
287 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not
290 * exclusively claim or control devices. Interfaces usually represent
291 * a specific functionality of a subsystem/class of devices.
292 */
293struct subsys_interface {
294 const char *name;
295 struct bus_type *subsys;
296 struct list_head node;
297 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
298 int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
299};
300
301int subsys_interface_register(struct subsys_interface *sif);
302void subsys_interface_unregister(struct subsys_interface *sif);
303
304int subsys_system_register(struct bus_type *subsys,
305 const struct attribute_group **groups);
306
307/**
259 * struct class - device classes 308 * struct class - device classes
260 * @name: Name of the class. 309 * @name: Name of the class.
261 * @owner: The module owner. 310 * @owner: The module owner.
@@ -294,7 +343,7 @@ struct class {
294 struct kobject *dev_kobj; 343 struct kobject *dev_kobj;
295 344
296 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 345 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
297 char *(*devnode)(struct device *dev, mode_t *mode); 346 char *(*devnode)(struct device *dev, umode_t *mode);
298 347
299 void (*class_release)(struct class *class); 348 void (*class_release)(struct class *class);
300 void (*dev_release)(struct device *dev); 349 void (*dev_release)(struct device *dev);
@@ -423,7 +472,7 @@ struct device_type {
423 const char *name; 472 const char *name;
424 const struct attribute_group **groups; 473 const struct attribute_group **groups;
425 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 474 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
426 char *(*devnode)(struct device *dev, mode_t *mode); 475 char *(*devnode)(struct device *dev, umode_t *mode);
427 void (*release)(struct device *dev); 476 void (*release)(struct device *dev);
428 477
429 const struct dev_pm_ops *pm; 478 const struct dev_pm_ops *pm;
@@ -438,11 +487,31 @@ struct device_attribute {
438 const char *buf, size_t count); 487 const char *buf, size_t count);
439}; 488};
440 489
441#define DEVICE_ATTR(_name, _mode, _show, _store) \ 490struct dev_ext_attribute {
442struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 491 struct device_attribute attr;
492 void *var;
493};
494
495ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
496 char *buf);
497ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count);
499ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
500 char *buf);
501ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 const char *buf, size_t count);
443 503
444extern int __must_check device_create_file(struct device *device, 504#define DEVICE_ATTR(_name, _mode, _show, _store) \
445 const struct device_attribute *entry); 505 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
506#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
507 struct dev_ext_attribute dev_attr_##_name = \
508 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
509#define DEVICE_INT_ATTR(_name, _mode, _var) \
510 struct dev_ext_attribute dev_attr_##_name = \
511 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
512
513extern int device_create_file(struct device *device,
514 const struct device_attribute *entry);
446extern void device_remove_file(struct device *dev, 515extern void device_remove_file(struct device *dev,
447 const struct device_attribute *attr); 516 const struct device_attribute *attr);
448extern int __must_check device_create_bin_file(struct device *dev, 517extern int __must_check device_create_bin_file(struct device *dev,
@@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id);
490extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 559extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
491extern void devm_kfree(struct device *dev, void *p); 560extern void devm_kfree(struct device *dev, void *p);
492 561
562void __iomem *devm_request_and_ioremap(struct device *dev,
563 struct resource *res);
564
493struct device_dma_parameters { 565struct device_dma_parameters {
494 /* 566 /*
495 * a low level driver may set these to teach IOMMU code about 567 * a low level driver may set these to teach IOMMU code about
@@ -600,6 +672,7 @@ struct device {
600 struct device_node *of_node; /* associated device tree node */ 672 struct device_node *of_node; /* associated device tree node */
601 673
602 dev_t devt; /* dev_t, creates the sysfs "dev" */ 674 dev_t devt; /* dev_t, creates the sysfs "dev" */
675 u32 id; /* device instance */
603 676
604 spinlock_t devres_lock; 677 spinlock_t devres_lock;
605 struct list_head devres_head; 678 struct list_head devres_head;
@@ -720,7 +793,7 @@ extern int device_rename(struct device *dev, const char *new_name);
720extern int device_move(struct device *dev, struct device *new_parent, 793extern int device_move(struct device *dev, struct device *new_parent,
721 enum dpm_order dpm_order); 794 enum dpm_order dpm_order);
722extern const char *device_get_devnode(struct device *dev, 795extern const char *device_get_devnode(struct device *dev,
723 mode_t *mode, const char **tmp); 796 umode_t *mode, const char **tmp);
724extern void *dev_get_drvdata(const struct device *dev); 797extern void *dev_get_drvdata(const struct device *dev);
725extern int dev_set_drvdata(struct device *dev, void *data); 798extern int dev_set_drvdata(struct device *dev, void *data);
726 799
@@ -924,4 +997,25 @@ extern long sysfs_deprecated;
924#define sysfs_deprecated 0 997#define sysfs_deprecated 0
925#endif 998#endif
926 999
1000/**
1001 * module_driver() - Helper macro for drivers that don't do anything
1002 * special in module init/exit. This eliminates a lot of boilerplate.
1003 * Each module may only use this macro once, and calling it replaces
1004 * module_init() and module_exit().
1005 *
1006 * Use this macro to construct bus specific macros for registering
1007 * drivers, and do not use it on its own.
1008 */
1009#define module_driver(__driver, __register, __unregister) \
1010static int __init __driver##_init(void) \
1011{ \
1012 return __register(&(__driver)); \
1013} \
1014module_init(__driver##_init); \
1015static void __exit __driver##_exit(void) \
1016{ \
1017 __unregister(&(__driver)); \
1018} \
1019module_exit(__driver##_exit);
1020
927#endif /* _DEVICE_H_ */ 1021#endif /* _DEVICE_H_ */
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 000000000000..f8ac076afa52
--- /dev/null
+++ b/include/linux/dma-buf.h
@@ -0,0 +1,176 @@
1/*
2 * Header file for dma buffer sharing framework.
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Author: Sumit Semwal <sumit.semwal@ti.com>
6 *
7 * Many thanks to linaro-mm-sig list, and specially
8 * Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
9 * Daniel Vetter <daniel@ffwll.ch> for their support in creation and
10 * refining of this idea.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
23 */
24#ifndef __DMA_BUF_H__
25#define __DMA_BUF_H__
26
27#include <linux/file.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h>
31#include <linux/list.h>
32#include <linux/dma-mapping.h>
33
34struct dma_buf;
35struct dma_buf_attachment;
36
37/**
38 * struct dma_buf_ops - operations possible on struct dma_buf
39 * @attach: [optional] allows different devices to 'attach' themselves to the
40 * given buffer. It might return -EBUSY to signal that backing storage
41 * is already allocated and incompatible with the requirements
42 * of requesting device.
43 * @detach: [optional] detach a given device from this buffer.
44 * @map_dma_buf: returns list of scatter pages allocated, increases usecount
45 * of the buffer. Requires atleast one attach to be called
46 * before. Returned sg list should already be mapped into
47 * _device_ address space. This call may sleep. May also return
48 * -EINTR. Should return -EINVAL if attach hasn't been called yet.
49 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
50 * pages.
51 * @release: release this buffer; to be called after the last dma_buf_put.
52 */
53struct dma_buf_ops {
54 int (*attach)(struct dma_buf *, struct device *,
55 struct dma_buf_attachment *);
56
57 void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
58
59 /* For {map,unmap}_dma_buf below, any specific buffer attributes
60 * required should get added to device_dma_parameters accessible
61 * via dev->dma_params.
62 */
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block.
69 */
70
71 /* after final dma_buf_put() */
72 void (*release)(struct dma_buf *);
73
74};
75
76/**
77 * struct dma_buf - shared buffer object
78 * @size: size of the buffer
79 * @file: file pointer used for sharing buffers across, and for refcounting.
80 * @attachments: list of dma_buf_attachment that denotes all devices attached.
81 * @ops: dma_buf_ops associated with this buffer object.
82 * @priv: exporter specific private data for this buffer object.
83 */
84struct dma_buf {
85 size_t size;
86 struct file *file;
87 struct list_head attachments;
88 const struct dma_buf_ops *ops;
89 /* mutex to serialize list manipulation and other ops */
90 struct mutex lock;
91 void *priv;
92};
93
94/**
95 * struct dma_buf_attachment - holds device-buffer attachment data
96 * @dmabuf: buffer for this attachment.
97 * @dev: device attached to the buffer.
98 * @node: list of dma_buf_attachment.
99 * @priv: exporter specific attachment data.
100 *
101 * This structure holds the attachment information between the dma_buf buffer
102 * and its user device(s). The list contains one attachment struct per device
103 * attached to the buffer.
104 */
105struct dma_buf_attachment {
106 struct dma_buf *dmabuf;
107 struct device *dev;
108 struct list_head node;
109 void *priv;
110};
111
112#ifdef CONFIG_DMA_SHARED_BUFFER
113struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
114 struct device *dev);
115void dma_buf_detach(struct dma_buf *dmabuf,
116 struct dma_buf_attachment *dmabuf_attach);
117struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
118 size_t size, int flags);
119int dma_buf_fd(struct dma_buf *dmabuf);
120struct dma_buf *dma_buf_get(int fd);
121void dma_buf_put(struct dma_buf *dmabuf);
122
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
126#else
127
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
129 struct device *dev)
130{
131 return ERR_PTR(-ENODEV);
132}
133
134static inline void dma_buf_detach(struct dma_buf *dmabuf,
135 struct dma_buf_attachment *dmabuf_attach)
136{
137 return;
138}
139
140static inline struct dma_buf *dma_buf_export(void *priv,
141 struct dma_buf_ops *ops,
142 size_t size, int flags)
143{
144 return ERR_PTR(-ENODEV);
145}
146
147static inline int dma_buf_fd(struct dma_buf *dmabuf)
148{
149 return -ENODEV;
150}
151
152static inline struct dma_buf *dma_buf_get(int fd)
153{
154 return ERR_PTR(-ENODEV);
155}
156
157static inline void dma_buf_put(struct dma_buf *dmabuf)
158{
159 return;
160}
161
162static inline struct sg_table *dma_buf_map_attachment(
163 struct dma_buf_attachment *attach, enum dma_data_direction write)
164{
165 return ERR_PTR(-ENODEV);
166}
167
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg)
170{
171 return;
172}
173
174#endif /* CONFIG_DMA_SHARED_BUFFER */
175
176#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index ef90cbd8e173..57c9a8ae4f2d 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -31,6 +31,7 @@ extern void free_dmar_iommu(struct intel_iommu *iommu);
31extern int iommu_calculate_agaw(struct intel_iommu *iommu); 31extern int iommu_calculate_agaw(struct intel_iommu *iommu);
32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); 32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
33extern int dmar_disabled; 33extern int dmar_disabled;
34extern int intel_iommu_enabled;
34#else 35#else
35static inline int iommu_calculate_agaw(struct intel_iommu *iommu) 36static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
36{ 37{
@@ -44,6 +45,7 @@ static inline void free_dmar_iommu(struct intel_iommu *iommu)
44{ 45{
45} 46}
46#define dmar_disabled (1) 47#define dmar_disabled (1)
48#define intel_iommu_enabled (0)
47#endif 49#endif
48 50
49 51
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
new file mode 100644
index 000000000000..5621547d631b
--- /dev/null
+++ b/include/linux/dynamic_queue_limits.h
@@ -0,0 +1,97 @@
1/*
2 * Dynamic queue limits (dql) - Definitions
3 *
4 * Copyright (c) 2011, Tom Herbert <therbert@google.com>
5 *
6 * This header file contains the definitions for dynamic queue limits (dql).
7 * dql would be used in conjunction with a producer/consumer type queue
8 * (possibly a HW queue). Such a queue would have these general properties:
9 *
10 * 1) Objects are queued up to some limit specified as number of objects.
11 * 2) Periodically a completion process executes which retires consumed
12 * objects.
13 * 3) Starvation occurs when limit has been reached, all queued data has
14 * actually been consumed, but completion processing has not yet run
15 * so queuing new data is blocked.
16 * 4) Minimizing the amount of queued data is desirable.
17 *
18 * The goal of dql is to calculate the limit as the minimum number of objects
19 * needed to prevent starvation.
20 *
21 * The primary functions of dql are:
22 * dql_queued - called when objects are enqueued to record number of objects
23 * dql_avail - returns how many objects are available to be queued based
24 * on the object limit and how many objects are already enqueued
25 * dql_completed - called at completion time to indicate how many objects
26 * were retired from the queue
27 *
28 * The dql implementation does not implement any locking for the dql data
29 * structures, the higher layer should provide this. dql_queued should
30 * be serialized to prevent concurrent execution of the function; this
31 * is also true for dql_completed. However, dql_queued and dlq_completed can
32 * be executed concurrently (i.e. they can be protected by different locks).
33 */
34
35#ifndef _LINUX_DQL_H
36#define _LINUX_DQL_H
37
38#ifdef __KERNEL__
39
40struct dql {
41 /* Fields accessed in enqueue path (dql_queued) */
42 unsigned int num_queued; /* Total ever queued */
43 unsigned int adj_limit; /* limit + num_completed */
44 unsigned int last_obj_cnt; /* Count at last queuing */
45
46 /* Fields accessed only by completion path (dql_completed) */
47
48 unsigned int limit ____cacheline_aligned_in_smp; /* Current limit */
49 unsigned int num_completed; /* Total ever completed */
50
51 unsigned int prev_ovlimit; /* Previous over limit */
52 unsigned int prev_num_queued; /* Previous queue total */
53 unsigned int prev_last_obj_cnt; /* Previous queuing cnt */
54
55 unsigned int lowest_slack; /* Lowest slack found */
56 unsigned long slack_start_time; /* Time slacks seen */
57
58 /* Configuration */
59 unsigned int max_limit; /* Max limit */
60 unsigned int min_limit; /* Minimum limit */
61 unsigned int slack_hold_time; /* Time to measure slack */
62};
63
64/* Set some static maximums */
65#define DQL_MAX_OBJECT (UINT_MAX / 16)
66#define DQL_MAX_LIMIT ((UINT_MAX / 2) - DQL_MAX_OBJECT)
67
68/*
69 * Record number of objects queued. Assumes that caller has already checked
70 * availability in the queue with dql_avail.
71 */
72static inline void dql_queued(struct dql *dql, unsigned int count)
73{
74 BUG_ON(count > DQL_MAX_OBJECT);
75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count;
78}
79
80/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql)
82{
83 return dql->adj_limit - dql->num_queued;
84}
85
86/* Record number of completed objects and recalculate the limit. */
87void dql_completed(struct dql *dql, unsigned int count);
88
89/* Reset dql state */
90void dql_reset(struct dql *dql);
91
92/* Initialize dql state */
93int dql_init(struct dql *dql, unsigned hold_time);
94
95#endif /* _KERNEL_ */
96
97#endif /* _LINUX_DQL_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 055b248bdd53..1cd3947987e5 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 19#define EDAC_OPSTATE_POLL 0
@@ -23,12 +23,12 @@
23extern int edac_op_state; 23extern int edac_op_state;
24extern int edac_err_assert; 24extern int edac_err_assert;
25extern atomic_t edac_handlers; 25extern atomic_t edac_handlers;
26extern struct sysdev_class edac_class; 26extern struct bus_type edac_subsys;
27 27
28extern int edac_handler_set(void); 28extern int edac_handler_set(void);
29extern void edac_atomic_assert_error(void); 29extern void edac_atomic_assert_error(void);
30extern struct sysdev_class *edac_get_sysfs_class(void); 30extern struct bus_type *edac_get_sysfs_subsys(void);
31extern void edac_put_sysfs_class(void); 31extern void edac_put_sysfs_subsys(void);
32 32
33static inline void opstate_init(void) 33static inline void opstate_init(void)
34{ 34{
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index c4627cbdb8e0..e50f98b0297a 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -33,6 +33,7 @@
33#define PCI_EEPROM_WIDTH_93C86 8 33#define PCI_EEPROM_WIDTH_93C86 8
34#define PCI_EEPROM_WIDTH_OPCODE 3 34#define PCI_EEPROM_WIDTH_OPCODE 3
35#define PCI_EEPROM_WRITE_OPCODE 0x05 35#define PCI_EEPROM_WRITE_OPCODE 0x05
36#define PCI_EEPROM_ERASE_OPCODE 0x07
36#define PCI_EEPROM_READ_OPCODE 0x06 37#define PCI_EEPROM_READ_OPCODE 0x06
37#define PCI_EEPROM_EWDS_OPCODE 0x10 38#define PCI_EEPROM_EWDS_OPCODE 0x10
38#define PCI_EEPROM_EWEN_OPCODE 0x13 39#define PCI_EEPROM_EWEN_OPCODE 0x13
@@ -46,6 +47,7 @@
46 * @register_write(struct eeprom_93cx6 *eeprom): handler to 47 * @register_write(struct eeprom_93cx6 *eeprom): handler to
47 * write to the eeprom register by using all reg_* fields. 48 * write to the eeprom register by using all reg_* fields.
48 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines 49 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
50 * @drive_data: Set if we're driving the data line.
49 * @reg_data_in: register field to indicate data input 51 * @reg_data_in: register field to indicate data input
50 * @reg_data_out: register field to indicate data output 52 * @reg_data_out: register field to indicate data output
51 * @reg_data_clock: register field to set the data clock 53 * @reg_data_clock: register field to set the data clock
@@ -62,6 +64,7 @@ struct eeprom_93cx6 {
62 64
63 int width; 65 int width;
64 66
67 char drive_data;
65 char reg_data_in; 68 char reg_data_in;
66 char reg_data_out; 69 char reg_data_out;
67 char reg_data_clock; 70 char reg_data_clock;
@@ -72,3 +75,8 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
72 const u8 word, u16 *data); 75 const u8 word, u16 *data);
73extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 76extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
74 const u8 word, __le16 *data, const u16 words); 77 const u8 word, __le16 *data, const u16 words);
78
79extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
80
81extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
82 u8 addr, u16 data);
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 034072cea853..fd0628be45ce 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -17,14 +17,15 @@ struct sock_extended_err {
17#define SO_EE_ORIGIN_LOCAL 1 17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2 18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3 19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TIMESTAMPING 4 20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
24#ifdef __KERNEL__ 25#ifdef __KERNEL__
25 26
26#include <net/ip.h> 27#include <net/ip.h>
27#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 28#if IS_ENABLED(CONFIG_IPV6)
28#include <linux/ipv6.h> 29#include <linux/ipv6.h>
29#endif 30#endif
30 31
@@ -33,7 +34,7 @@ struct sock_extended_err {
33struct sock_exterr_skb { 34struct sock_exterr_skb {
34 union { 35 union {
35 struct inet_skb_parm h4; 36 struct inet_skb_parm h4;
36#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 37#if IS_ENABLED(CONFIG_IPV6)
37 struct inet6_skb_parm h6; 38 struct inet6_skb_parm h6;
38#endif 39#endif
39 } header; 40 } header;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index de33de1e2052..da5b2de99ae4 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
489 * on return. 489 * on return.
490 * 490 *
491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
492 * rules on return. 492 * rules on return. If @data is non-zero on return then it is the
493 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
494 * driver supports any special location values. If that flag is not
495 * set in @data then special location values should not be used.
493 * 496 *
494 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 497 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
495 * existing rule on entry and @fs contains the rule on return. 498 * existing rule on entry and @fs contains the rule on return.
@@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
501 * must use the second parameter to get_rxnfc() instead of @rule_locs. 504 * must use the second parameter to get_rxnfc() instead of @rule_locs.
502 * 505 *
503 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 506 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
504 * @fs.@location specifies the location to use and must not be ignored. 507 * @fs.@location either specifies the location to use or is a special
508 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
509 * @fs.@location is the actual rule location.
505 * 510 *
506 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 511 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
507 * existing rule on entry. 512 * existing rule on entry.
513 *
514 * A driver supporting the special location values for
515 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
516 * location, and may remove a rule at a later location (lower
517 * priority) that matches exactly the same set of flows. The special
518 * values are: %RX_CLS_LOC_ANY, selecting any location;
519 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
520 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
521 * location (minimum priority). Additional special values may be
522 * defined in future and drivers must return -%EINVAL for any
523 * unrecognised value.
508 */ 524 */
509struct ethtool_rxnfc { 525struct ethtool_rxnfc {
510 __u32 cmd; 526 __u32 cmd;
@@ -543,9 +559,15 @@ struct compat_ethtool_rxnfc {
543/** 559/**
544 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 560 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
545 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 561 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
546 * @size: On entry, the array size of the user buffer. On return from 562 * @size: On entry, the array size of the user buffer, which may be zero.
547 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. 563 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
564 * indirection table.
548 * @ring_index: RX ring/queue index for each hash value 565 * @ring_index: RX ring/queue index for each hash value
566 *
567 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
568 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
569 * the table should be reset to default values. This last feature
570 * is not supported by the original implementations.
549 */ 571 */
550struct ethtool_rxfh_indir { 572struct ethtool_rxfh_indir {
551 __u32 cmd; 573 __u32 cmd;
@@ -724,9 +746,6 @@ enum ethtool_sfeatures_retval_bits {
724 746
725#include <linux/rculist.h> 747#include <linux/rculist.h>
726 748
727/* needed by dev_disable_lro() */
728extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
729
730extern int __ethtool_get_settings(struct net_device *dev, 749extern int __ethtool_get_settings(struct net_device *dev,
731 struct ethtool_cmd *cmd); 750 struct ethtool_cmd *cmd);
732 751
@@ -750,19 +769,18 @@ struct net_device;
750 769
751/* Some generic methods drivers may use in their ethtool_ops */ 770/* Some generic methods drivers may use in their ethtool_ops */
752u32 ethtool_op_get_link(struct net_device *dev); 771u32 ethtool_op_get_link(struct net_device *dev);
753u32 ethtool_op_get_tx_csum(struct net_device *dev); 772
754int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 773/**
755int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 774 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
756int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); 775 * @index: Index in RX flow hash indirection table
757u32 ethtool_op_get_sg(struct net_device *dev); 776 * @n_rx_rings: Number of RX rings to use
758int ethtool_op_set_sg(struct net_device *dev, u32 data); 777 *
759u32 ethtool_op_get_tso(struct net_device *dev); 778 * This function provides the default policy for RX flow hash indirection.
760int ethtool_op_set_tso(struct net_device *dev, u32 data); 779 */
761u32 ethtool_op_get_ufo(struct net_device *dev); 780static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
762int ethtool_op_set_ufo(struct net_device *dev, u32 data); 781{
763u32 ethtool_op_get_flags(struct net_device *dev); 782 return index % n_rx_rings;
764int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 783}
765bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
766 784
767/** 785/**
768 * struct ethtool_ops - optional netdev operations 786 * struct ethtool_ops - optional netdev operations
@@ -807,22 +825,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
807 * @get_pauseparam: Report pause parameters 825 * @get_pauseparam: Report pause parameters
808 * @set_pauseparam: Set pause parameters. Returns a negative error code 826 * @set_pauseparam: Set pause parameters. Returns a negative error code
809 * or zero. 827 * or zero.
810 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
811 * Report whether receive checksums are turned on or off.
812 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
813 * receive checksum on or off. Returns a negative error code or zero.
814 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
815 * are turned on or off.
816 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
817 * transmit checksums on or off. Returns a negative error code or zero.
818 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
819 * enabled.
820 * @set_sg: Deprecated in favour of generic netdev features. Turn
821 * scatter-gather on or off. Returns a negative error code or zero.
822 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
823 * offload is enabled.
824 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
825 * segmentation offload on or off. Returns a negative error code or zero.
826 * @self_test: Run specified self-tests 828 * @self_test: Run specified self-tests
827 * @get_strings: Return a set of strings that describe the requested objects 829 * @get_strings: Return a set of strings that describe the requested objects
828 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED 830 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
@@ -844,15 +846,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
844 * negative error code or zero. 846 * negative error code or zero.
845 * @complete: Function to be called after any other operation except 847 * @complete: Function to be called after any other operation except
846 * @begin. Will be called even if the other operation failed. 848 * @begin. Will be called even if the other operation failed.
847 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
848 * offload is enabled.
849 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
850 * fragmentation offload on or off. Returns a negative error code or zero.
851 * @get_flags: Deprecated as redundant. Report features included in
852 * &enum ethtool_flags that are enabled.
853 * @set_flags: Deprecated in favour of generic netdev features. Turn
854 * features included in &enum ethtool_flags on or off. Returns a
855 * negative error code or zero.
856 * @get_priv_flags: Report driver-specific feature flags. 849 * @get_priv_flags: Report driver-specific feature flags.
857 * @set_priv_flags: Set driver-specific feature flags. Returns a negative 850 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
858 * error code or zero. 851 * error code or zero.
@@ -866,11 +859,13 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
866 * @reset: Reset (part of) the device, as specified by a bitmask of 859 * @reset: Reset (part of) the device, as specified by a bitmask of
867 * flags from &enum ethtool_reset_flags. Returns a negative 860 * flags from &enum ethtool_reset_flags. Returns a negative
868 * error code or zero. 861 * error code or zero.
869 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code 862 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
870 * or zero. 863 * Returns zero if not supported for this specific device.
871 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 864 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
865 * Will not be called if @get_rxfh_indir_size returns zero.
872 * Returns a negative error code or zero. 866 * Returns a negative error code or zero.
873 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 867 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
868 * Will not be called if @get_rxfh_indir_size returns zero.
874 * Returns a negative error code or zero. 869 * Returns a negative error code or zero.
875 * @get_channels: Get number of channels. 870 * @get_channels: Get number of channels.
876 * @set_channels: Set number of channels. Returns a negative error code or 871 * @set_channels: Set number of channels. Returns a negative error code or
@@ -917,14 +912,6 @@ struct ethtool_ops {
917 struct ethtool_pauseparam*); 912 struct ethtool_pauseparam*);
918 int (*set_pauseparam)(struct net_device *, 913 int (*set_pauseparam)(struct net_device *,
919 struct ethtool_pauseparam*); 914 struct ethtool_pauseparam*);
920 u32 (*get_rx_csum)(struct net_device *);
921 int (*set_rx_csum)(struct net_device *, u32);
922 u32 (*get_tx_csum)(struct net_device *);
923 int (*set_tx_csum)(struct net_device *, u32);
924 u32 (*get_sg)(struct net_device *);
925 int (*set_sg)(struct net_device *, u32);
926 u32 (*get_tso)(struct net_device *);
927 int (*set_tso)(struct net_device *, u32);
928 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 915 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
929 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 916 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
930 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); 917 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
@@ -932,10 +919,6 @@ struct ethtool_ops {
932 struct ethtool_stats *, u64 *); 919 struct ethtool_stats *, u64 *);
933 int (*begin)(struct net_device *); 920 int (*begin)(struct net_device *);
934 void (*complete)(struct net_device *); 921 void (*complete)(struct net_device *);
935 u32 (*get_ufo)(struct net_device *);
936 int (*set_ufo)(struct net_device *, u32);
937 u32 (*get_flags)(struct net_device *);
938 int (*set_flags)(struct net_device *, u32);
939 u32 (*get_priv_flags)(struct net_device *); 922 u32 (*get_priv_flags)(struct net_device *);
940 int (*set_priv_flags)(struct net_device *, u32); 923 int (*set_priv_flags)(struct net_device *, u32);
941 int (*get_sset_count)(struct net_device *, int); 924 int (*get_sset_count)(struct net_device *, int);
@@ -944,12 +927,9 @@ struct ethtool_ops {
944 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 927 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
945 int (*flash_device)(struct net_device *, struct ethtool_flash *); 928 int (*flash_device)(struct net_device *, struct ethtool_flash *);
946 int (*reset)(struct net_device *, u32 *); 929 int (*reset)(struct net_device *, u32 *);
947 int (*set_rx_ntuple)(struct net_device *, 930 u32 (*get_rxfh_indir_size)(struct net_device *);
948 struct ethtool_rx_ntuple *); 931 int (*get_rxfh_indir)(struct net_device *, u32 *);
949 int (*get_rxfh_indir)(struct net_device *, 932 int (*set_rxfh_indir)(struct net_device *, const u32 *);
950 struct ethtool_rxfh_indir *);
951 int (*set_rxfh_indir)(struct net_device *,
952 const struct ethtool_rxfh_indir *);
953 void (*get_channels)(struct net_device *, struct ethtool_channels *); 933 void (*get_channels)(struct net_device *, struct ethtool_channels *);
954 int (*set_channels)(struct net_device *, struct ethtool_channels *); 934 int (*set_channels)(struct net_device *, struct ethtool_channels *);
955 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 935 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
@@ -1173,6 +1153,12 @@ struct ethtool_ops {
1173 1153
1174#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 1154#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1175 1155
1156/* Special RX classification rule insert location values */
1157#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1158#define RX_CLS_LOC_ANY 0xffffffff
1159#define RX_CLS_LOC_FIRST 0xfffffffe
1160#define RX_CLS_LOC_LAST 0xfffffffd
1161
1176/* Reset flags */ 1162/* Reset flags */
1177/* The reset() operation must clear the flags for the components which 1163/* The reset() operation must clear the flags for the components which
1178 * were actually reset. On successful return, the flags indicate the 1164 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dec99116a0e4..f957085d40ed 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -884,7 +884,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
884 884
885/* ialloc.c */ 885/* ialloc.c */
886extern struct inode * ext3_new_inode (handle_t *, struct inode *, 886extern struct inode * ext3_new_inode (handle_t *, struct inode *,
887 const struct qstr *, int); 887 const struct qstr *, umode_t);
888extern void ext3_free_inode (handle_t *, struct inode *); 888extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *); 890extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index a5386e3ee756..0ab54e16a91f 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -5,71 +5,58 @@
5 5
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/wait.h> 7#include <linux/wait.h>
8#include <linux/atomic.h>
8 9
9#ifdef CONFIG_FREEZER 10#ifdef CONFIG_FREEZER
11extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */
12extern bool pm_freezing; /* PM freezing in effect */
13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
14
10/* 15/*
11 * Check if a process has been frozen 16 * Check if a process has been frozen
12 */ 17 */
13static inline int frozen(struct task_struct *p) 18static inline bool frozen(struct task_struct *p)
14{ 19{
15 return p->flags & PF_FROZEN; 20 return p->flags & PF_FROZEN;
16} 21}
17 22
18/* 23extern bool freezing_slow_path(struct task_struct *p);
19 * Check if there is a request to freeze a process
20 */
21static inline int freezing(struct task_struct *p)
22{
23 return test_tsk_thread_flag(p, TIF_FREEZE);
24}
25
26/*
27 * Request that a process be frozen
28 */
29static inline void set_freeze_flag(struct task_struct *p)
30{
31 set_tsk_thread_flag(p, TIF_FREEZE);
32}
33 24
34/* 25/*
35 * Sometimes we may need to cancel the previous 'freeze' request 26 * Check if there is a request to freeze a process
36 */ 27 */
37static inline void clear_freeze_flag(struct task_struct *p) 28static inline bool freezing(struct task_struct *p)
38{
39 clear_tsk_thread_flag(p, TIF_FREEZE);
40}
41
42static inline bool should_send_signal(struct task_struct *p)
43{ 29{
44 return !(p->flags & PF_FREEZER_NOSIG); 30 if (likely(!atomic_read(&system_freezing_cnt)))
31 return false;
32 return freezing_slow_path(p);
45} 33}
46 34
47/* Takes and releases task alloc lock using task_lock() */ 35/* Takes and releases task alloc lock using task_lock() */
48extern int thaw_process(struct task_struct *p); 36extern void __thaw_task(struct task_struct *t);
49 37
50extern void refrigerator(void); 38extern bool __refrigerator(bool check_kthr_stop);
51extern int freeze_processes(void); 39extern int freeze_processes(void);
52extern int freeze_kernel_threads(void); 40extern int freeze_kernel_threads(void);
53extern void thaw_processes(void); 41extern void thaw_processes(void);
54 42
55static inline int try_to_freeze(void) 43static inline bool try_to_freeze(void)
56{ 44{
57 if (freezing(current)) { 45 might_sleep();
58 refrigerator(); 46 if (likely(!freezing(current)))
59 return 1; 47 return false;
60 } else 48 return __refrigerator(false);
61 return 0;
62} 49}
63 50
64extern bool freeze_task(struct task_struct *p, bool sig_only); 51extern bool freeze_task(struct task_struct *p);
65extern void cancel_freezing(struct task_struct *p); 52extern bool set_freezable(void);
66 53
67#ifdef CONFIG_CGROUP_FREEZER 54#ifdef CONFIG_CGROUP_FREEZER
68extern int cgroup_freezing_or_frozen(struct task_struct *task); 55extern bool cgroup_freezing(struct task_struct *task);
69#else /* !CONFIG_CGROUP_FREEZER */ 56#else /* !CONFIG_CGROUP_FREEZER */
70static inline int cgroup_freezing_or_frozen(struct task_struct *task) 57static inline bool cgroup_freezing(struct task_struct *task)
71{ 58{
72 return 0; 59 return false;
73} 60}
74#endif /* !CONFIG_CGROUP_FREEZER */ 61#endif /* !CONFIG_CGROUP_FREEZER */
75 62
@@ -80,33 +67,27 @@ static inline int cgroup_freezing_or_frozen(struct task_struct *task)
80 * appropriately in case the child has exited before the freezing of tasks is 67 * appropriately in case the child has exited before the freezing of tasks is
81 * complete. However, we don't want kernel threads to be frozen in unexpected 68 * complete. However, we don't want kernel threads to be frozen in unexpected
82 * places, so we allow them to block freeze_processes() instead or to set 69 * places, so we allow them to block freeze_processes() instead or to set
83 * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork 70 * PF_NOFREEZE if needed. Fortunately, in the ____call_usermodehelper() case the
84 * parents. Fortunately, in the ____call_usermodehelper() case the parent won't 71 * parent won't really block freeze_processes(), since ____call_usermodehelper()
85 * really block freeze_processes(), since ____call_usermodehelper() (the child) 72 * (the child) does a little before exec/exit and it can't be frozen before
86 * does a little before exec/exit and it can't be frozen before waking up the 73 * waking up the parent.
87 * parent.
88 */ 74 */
89 75
90/* 76
91 * If the current task is a user space one, tell the freezer not to count it as 77/* Tell the freezer not to count the current task as freezable. */
92 * freezable.
93 */
94static inline void freezer_do_not_count(void) 78static inline void freezer_do_not_count(void)
95{ 79{
96 if (current->mm) 80 current->flags |= PF_FREEZER_SKIP;
97 current->flags |= PF_FREEZER_SKIP;
98} 81}
99 82
100/* 83/*
101 * If the current task is a user space one, tell the freezer to count it as 84 * Tell the freezer to count the current task as freezable again and try to
102 * freezable again and try to freeze it. 85 * freeze it.
103 */ 86 */
104static inline void freezer_count(void) 87static inline void freezer_count(void)
105{ 88{
106 if (current->mm) { 89 current->flags &= ~PF_FREEZER_SKIP;
107 current->flags &= ~PF_FREEZER_SKIP; 90 try_to_freeze();
108 try_to_freeze();
109 }
110} 91}
111 92
112/* 93/*
@@ -118,21 +99,29 @@ static inline int freezer_should_skip(struct task_struct *p)
118} 99}
119 100
120/* 101/*
121 * Tell the freezer that the current task should be frozen by it 102 * These macros are intended to be used whenever you want allow a task that's
103 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
104 * that neither return any clear indication of whether a freeze event happened
105 * while in this function.
122 */ 106 */
123static inline void set_freezable(void)
124{
125 current->flags &= ~PF_NOFREEZE;
126}
127 107
128/* 108/* Like schedule(), but should not block the freezer. */
129 * Tell the freezer that the current task should be frozen by it and that it 109#define freezable_schedule() \
130 * should send a fake signal to the task to freeze it. 110({ \
131 */ 111 freezer_do_not_count(); \
132static inline void set_freezable_with_signal(void) 112 schedule(); \
133{ 113 freezer_count(); \
134 current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); 114})
135} 115
116/* Like schedule_timeout_killable(), but should not block the freezer. */
117#define freezable_schedule_timeout_killable(timeout) \
118({ \
119 long __retval; \
120 freezer_do_not_count(); \
121 __retval = schedule_timeout_killable(timeout); \
122 freezer_count(); \
123 __retval; \
124})
136 125
137/* 126/*
138 * Freezer-friendly wrappers around wait_event_interruptible(), 127 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -152,47 +141,51 @@ static inline void set_freezable_with_signal(void)
152#define wait_event_freezable(wq, condition) \ 141#define wait_event_freezable(wq, condition) \
153({ \ 142({ \
154 int __retval; \ 143 int __retval; \
155 do { \ 144 for (;;) { \
156 __retval = wait_event_interruptible(wq, \ 145 __retval = wait_event_interruptible(wq, \
157 (condition) || freezing(current)); \ 146 (condition) || freezing(current)); \
158 if (__retval && !freezing(current)) \ 147 if (__retval || (condition)) \
159 break; \ 148 break; \
160 else if (!(condition)) \ 149 try_to_freeze(); \
161 __retval = -ERESTARTSYS; \ 150 } \
162 } while (try_to_freeze()); \
163 __retval; \ 151 __retval; \
164}) 152})
165 153
166
167#define wait_event_freezable_timeout(wq, condition, timeout) \ 154#define wait_event_freezable_timeout(wq, condition, timeout) \
168({ \ 155({ \
169 long __retval = timeout; \ 156 long __retval = timeout; \
170 do { \ 157 for (;;) { \
171 __retval = wait_event_interruptible_timeout(wq, \ 158 __retval = wait_event_interruptible_timeout(wq, \
172 (condition) || freezing(current), \ 159 (condition) || freezing(current), \
173 __retval); \ 160 __retval); \
174 } while (try_to_freeze()); \ 161 if (__retval <= 0 || (condition)) \
162 break; \
163 try_to_freeze(); \
164 } \
175 __retval; \ 165 __retval; \
176}) 166})
167
177#else /* !CONFIG_FREEZER */ 168#else /* !CONFIG_FREEZER */
178static inline int frozen(struct task_struct *p) { return 0; } 169static inline bool frozen(struct task_struct *p) { return false; }
179static inline int freezing(struct task_struct *p) { return 0; } 170static inline bool freezing(struct task_struct *p) { return false; }
180static inline void set_freeze_flag(struct task_struct *p) {} 171static inline void __thaw_task(struct task_struct *t) {}
181static inline void clear_freeze_flag(struct task_struct *p) {}
182static inline int thaw_process(struct task_struct *p) { return 1; }
183 172
184static inline void refrigerator(void) {} 173static inline bool __refrigerator(bool check_kthr_stop) { return false; }
185static inline int freeze_processes(void) { return -ENOSYS; } 174static inline int freeze_processes(void) { return -ENOSYS; }
186static inline int freeze_kernel_threads(void) { return -ENOSYS; } 175static inline int freeze_kernel_threads(void) { return -ENOSYS; }
187static inline void thaw_processes(void) {} 176static inline void thaw_processes(void) {}
188 177
189static inline int try_to_freeze(void) { return 0; } 178static inline bool try_to_freeze(void) { return false; }
190 179
191static inline void freezer_do_not_count(void) {} 180static inline void freezer_do_not_count(void) {}
192static inline void freezer_count(void) {} 181static inline void freezer_count(void) {}
193static inline int freezer_should_skip(struct task_struct *p) { return 0; } 182static inline int freezer_should_skip(struct task_struct *p) { return 0; }
194static inline void set_freezable(void) {} 183static inline void set_freezable(void) {}
195static inline void set_freezable_with_signal(void) {} 184
185#define freezable_schedule() schedule()
186
187#define freezable_schedule_timeout_killable(timeout) \
188 schedule_timeout_killable(timeout)
196 189
197#define wait_event_freezable(wq, condition) \ 190#define wait_event_freezable(wq, condition) \
198 wait_event_interruptible(wq, condition) 191 wait_event_interruptible(wq, condition)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e3130220ce3e..7aacf31418fe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -393,8 +393,8 @@ struct inodes_stat_t {
393#include <linux/semaphore.h> 393#include <linux/semaphore.h>
394#include <linux/fiemap.h> 394#include <linux/fiemap.h>
395#include <linux/rculist_bl.h> 395#include <linux/rculist_bl.h>
396#include <linux/shrinker.h>
397#include <linux/atomic.h> 396#include <linux/atomic.h>
397#include <linux/shrinker.h>
398 398
399#include <asm/byteorder.h> 399#include <asm/byteorder.h>
400 400
@@ -1428,6 +1428,7 @@ struct super_block {
1428#else 1428#else
1429 struct list_head s_files; 1429 struct list_head s_files;
1430#endif 1430#endif
1431 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1431 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ 1432 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1432 struct list_head s_dentry_lru; /* unused dentry lru */ 1433 struct list_head s_dentry_lru; /* unused dentry lru */
1433 int s_nr_dentry_unused; /* # of dentry on lru */ 1434 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1440,7 +1441,7 @@ struct super_block {
1440 struct block_device *s_bdev; 1441 struct block_device *s_bdev;
1441 struct backing_dev_info *s_bdi; 1442 struct backing_dev_info *s_bdi;
1442 struct mtd_info *s_mtd; 1443 struct mtd_info *s_mtd;
1443 struct list_head s_instances; 1444 struct hlist_node s_instances;
1444 struct quota_info s_dquot; /* Diskquota specific options */ 1445 struct quota_info s_dquot; /* Diskquota specific options */
1445 1446
1446 int s_frozen; 1447 int s_frozen;
@@ -1481,6 +1482,12 @@ struct super_block {
1481 int cleancache_poolid; 1482 int cleancache_poolid;
1482 1483
1483 struct shrinker s_shrink; /* per-sb shrinker handle */ 1484 struct shrinker s_shrink; /* per-sb shrinker handle */
1485
1486 /* Number of inodes with nlink == 0 but still referenced */
1487 atomic_long_t s_remove_count;
1488
1489 /* Being remounted read-only */
1490 int s_readonly_remount;
1484}; 1491};
1485 1492
1486/* superblock cache pruning functions */ 1493/* superblock cache pruning functions */
@@ -1516,9 +1523,9 @@ extern void unlock_super(struct super_block *);
1516/* 1523/*
1517 * VFS helper functions.. 1524 * VFS helper functions..
1518 */ 1525 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1526extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1527extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1528extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1529extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1530extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1531extern int vfs_rmdir(struct inode *, struct dentry *);
@@ -1534,7 +1541,7 @@ extern void dentry_unhash(struct dentry *dentry);
1534 * VFS file helper functions. 1541 * VFS file helper functions.
1535 */ 1542 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1543extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1537 mode_t mode); 1544 umode_t mode);
1538/* 1545/*
1539 * VFS FS_IOC_FIEMAP helper definitions. 1546 * VFS FS_IOC_FIEMAP helper definitions.
1540 */ 1547 */
@@ -1619,13 +1626,13 @@ struct inode_operations {
1619 int (*readlink) (struct dentry *, char __user *,int); 1626 int (*readlink) (struct dentry *, char __user *,int);
1620 void (*put_link) (struct dentry *, struct nameidata *, void *); 1627 void (*put_link) (struct dentry *, struct nameidata *, void *);
1621 1628
1622 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 1629 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1623 int (*link) (struct dentry *,struct inode *,struct dentry *); 1630 int (*link) (struct dentry *,struct inode *,struct dentry *);
1624 int (*unlink) (struct inode *,struct dentry *); 1631 int (*unlink) (struct inode *,struct dentry *);
1625 int (*symlink) (struct inode *,struct dentry *,const char *); 1632 int (*symlink) (struct inode *,struct dentry *,const char *);
1626 int (*mkdir) (struct inode *,struct dentry *,int); 1633 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1627 int (*rmdir) (struct inode *,struct dentry *); 1634 int (*rmdir) (struct inode *,struct dentry *);
1628 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1635 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1629 int (*rename) (struct inode *, struct dentry *, 1636 int (*rename) (struct inode *, struct dentry *,
1630 struct inode *, struct dentry *); 1637 struct inode *, struct dentry *);
1631 void (*truncate) (struct inode *); 1638 void (*truncate) (struct inode *);
@@ -1672,10 +1679,10 @@ struct super_operations {
1672 int (*remount_fs) (struct super_block *, int *, char *); 1679 int (*remount_fs) (struct super_block *, int *, char *);
1673 void (*umount_begin) (struct super_block *); 1680 void (*umount_begin) (struct super_block *);
1674 1681
1675 int (*show_options)(struct seq_file *, struct vfsmount *); 1682 int (*show_options)(struct seq_file *, struct dentry *);
1676 int (*show_devname)(struct seq_file *, struct vfsmount *); 1683 int (*show_devname)(struct seq_file *, struct dentry *);
1677 int (*show_path)(struct seq_file *, struct vfsmount *); 1684 int (*show_path)(struct seq_file *, struct dentry *);
1678 int (*show_stats)(struct seq_file *, struct vfsmount *); 1685 int (*show_stats)(struct seq_file *, struct dentry *);
1679#ifdef CONFIG_QUOTA 1686#ifdef CONFIG_QUOTA
1680 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1687 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1681 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1688 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1764,31 +1771,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1764 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1771 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1765} 1772}
1766 1773
1767/** 1774extern void inc_nlink(struct inode *inode);
1768 * set_nlink - directly set an inode's link count 1775extern void drop_nlink(struct inode *inode);
1769 * @inode: inode 1776extern void clear_nlink(struct inode *inode);
1770 * @nlink: new nlink (should be non-zero) 1777extern void set_nlink(struct inode *inode, unsigned int nlink);
1771 *
1772 * This is a low-level filesystem helper to replace any
1773 * direct filesystem manipulation of i_nlink.
1774 */
1775static inline void set_nlink(struct inode *inode, unsigned int nlink)
1776{
1777 inode->__i_nlink = nlink;
1778}
1779
1780/**
1781 * inc_nlink - directly increment an inode's link count
1782 * @inode: inode
1783 *
1784 * This is a low-level filesystem helper to replace any
1785 * direct filesystem manipulation of i_nlink. Currently,
1786 * it is only here for parity with dec_nlink().
1787 */
1788static inline void inc_nlink(struct inode *inode)
1789{
1790 inode->__i_nlink++;
1791}
1792 1778
1793static inline void inode_inc_link_count(struct inode *inode) 1779static inline void inode_inc_link_count(struct inode *inode)
1794{ 1780{
@@ -1796,35 +1782,6 @@ static inline void inode_inc_link_count(struct inode *inode)
1796 mark_inode_dirty(inode); 1782 mark_inode_dirty(inode);
1797} 1783}
1798 1784
1799/**
1800 * drop_nlink - directly drop an inode's link count
1801 * @inode: inode
1802 *
1803 * This is a low-level filesystem helper to replace any
1804 * direct filesystem manipulation of i_nlink. In cases
1805 * where we are attempting to track writes to the
1806 * filesystem, a decrement to zero means an imminent
1807 * write when the file is truncated and actually unlinked
1808 * on the filesystem.
1809 */
1810static inline void drop_nlink(struct inode *inode)
1811{
1812 inode->__i_nlink--;
1813}
1814
1815/**
1816 * clear_nlink - directly zero an inode's link count
1817 * @inode: inode
1818 *
1819 * This is a low-level filesystem helper to replace any
1820 * direct filesystem manipulation of i_nlink. See
1821 * drop_nlink() for why we care about i_nlink hitting zero.
1822 */
1823static inline void clear_nlink(struct inode *inode)
1824{
1825 inode->__i_nlink = 0;
1826}
1827
1828static inline void inode_dec_link_count(struct inode *inode) 1785static inline void inode_dec_link_count(struct inode *inode)
1829{ 1786{
1830 drop_nlink(inode); 1787 drop_nlink(inode);
@@ -1864,7 +1821,7 @@ struct file_system_type {
1864 void (*kill_sb) (struct super_block *); 1821 void (*kill_sb) (struct super_block *);
1865 struct module *owner; 1822 struct module *owner;
1866 struct file_system_type * next; 1823 struct file_system_type * next;
1867 struct list_head fs_supers; 1824 struct hlist_head fs_supers;
1868 1825
1869 struct lock_class_key s_lock_key; 1826 struct lock_class_key s_lock_key;
1870 struct lock_class_key s_umount_key; 1827 struct lock_class_key s_umount_key;
@@ -1939,9 +1896,10 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1939extern int vfs_statfs(struct path *, struct kstatfs *); 1896extern int vfs_statfs(struct path *, struct kstatfs *);
1940extern int user_statfs(const char __user *, struct kstatfs *); 1897extern int user_statfs(const char __user *, struct kstatfs *);
1941extern int fd_statfs(int, struct kstatfs *); 1898extern int fd_statfs(int, struct kstatfs *);
1942extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1899extern int vfs_ustat(dev_t, struct kstatfs *);
1943extern int freeze_super(struct super_block *super); 1900extern int freeze_super(struct super_block *super);
1944extern int thaw_super(struct super_block *super); 1901extern int thaw_super(struct super_block *super);
1902extern bool our_mnt(struct vfsmount *mnt);
1945 1903
1946extern int current_umask(void); 1904extern int current_umask(void);
1947 1905
@@ -2053,8 +2011,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2053extern int do_fallocate(struct file *file, int mode, loff_t offset, 2011extern int do_fallocate(struct file *file, int mode, loff_t offset,
2054 loff_t len); 2012 loff_t len);
2055extern long do_sys_open(int dfd, const char __user *filename, int flags, 2013extern long do_sys_open(int dfd, const char __user *filename, int flags,
2056 int mode); 2014 umode_t mode);
2057extern struct file *filp_open(const char *, int, int); 2015extern struct file *filp_open(const char *, int, umode_t);
2058extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2016extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2059 const char *, int); 2017 const char *, int);
2060extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2018extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2091,6 +2049,7 @@ extern void bd_forget(struct inode *inode);
2091extern void bdput(struct block_device *); 2049extern void bdput(struct block_device *);
2092extern void invalidate_bdev(struct block_device *); 2050extern void invalidate_bdev(struct block_device *);
2093extern int sync_blockdev(struct block_device *bdev); 2051extern int sync_blockdev(struct block_device *bdev);
2052extern void kill_bdev(struct block_device *);
2094extern struct super_block *freeze_bdev(struct block_device *); 2053extern struct super_block *freeze_bdev(struct block_device *);
2095extern void emergency_thaw_all(void); 2054extern void emergency_thaw_all(void);
2096extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2055extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
@@ -2098,6 +2057,7 @@ extern int fsync_bdev(struct block_device *);
2098#else 2057#else
2099static inline void bd_forget(struct inode *inode) {} 2058static inline void bd_forget(struct inode *inode) {}
2100static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2059static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2060static inline void kill_bdev(struct block_device *bdev) {}
2101static inline void invalidate_bdev(struct block_device *bdev) {} 2061static inline void invalidate_bdev(struct block_device *bdev) {}
2102 2062
2103static inline struct super_block *freeze_bdev(struct block_device *sb) 2063static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2190,8 +2150,6 @@ extern const struct file_operations read_pipefifo_fops;
2190extern const struct file_operations write_pipefifo_fops; 2150extern const struct file_operations write_pipefifo_fops;
2191extern const struct file_operations rdwr_pipefifo_fops; 2151extern const struct file_operations rdwr_pipefifo_fops;
2192 2152
2193extern int fs_may_remount_ro(struct super_block *);
2194
2195#ifdef CONFIG_BLOCK 2153#ifdef CONFIG_BLOCK
2196/* 2154/*
2197 * return READ, READA, or WRITE 2155 * return READ, READA, or WRITE
@@ -2414,6 +2372,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2414 unsigned long nr_segs, loff_t pos); 2372 unsigned long nr_segs, loff_t pos);
2415extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2373extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2416 int datasync); 2374 int datasync);
2375extern void block_sync_page(struct page *page);
2417 2376
2418/* fs/splice.c */ 2377/* fs/splice.c */
2419extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2378extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2530,7 +2489,6 @@ extern void put_filesystem(struct file_system_type *fs);
2530extern struct file_system_type *get_fs_type(const char *name); 2489extern struct file_system_type *get_fs_type(const char *name);
2531extern struct super_block *get_super(struct block_device *); 2490extern struct super_block *get_super(struct block_device *);
2532extern struct super_block *get_active_super(struct block_device *bdev); 2491extern struct super_block *get_active_super(struct block_device *bdev);
2533extern struct super_block *user_get_super(dev_t);
2534extern void drop_super(struct super_block *sb); 2492extern void drop_super(struct super_block *sb);
2535extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2493extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2536extern void iterate_supers_type(struct file_system_type *, 2494extern void iterate_supers_type(struct file_system_type *,
@@ -2589,7 +2547,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2589 2547
2590extern void file_update_time(struct file *file); 2548extern void file_update_time(struct file *file);
2591 2549
2592extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2550extern int generic_show_options(struct seq_file *m, struct dentry *root);
2593extern void save_mount_options(struct super_block *sb, char *options); 2551extern void save_mount_options(struct super_block *sb, char *options);
2594extern void replace_mount_options(struct super_block *sb, char *options); 2552extern void replace_mount_options(struct super_block *sb, char *options);
2595 2553
@@ -2690,7 +2648,7 @@ int __init get_filesystem_list(char *buf);
2690#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2648#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2691 (flag & __FMODE_NONOTIFY))) 2649 (flag & __FMODE_NONOTIFY)))
2692 2650
2693static inline int is_sxid(mode_t mode) 2651static inline int is_sxid(umode_t mode)
2694{ 2652{
2695 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2653 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2696} 2654}
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 96efa6794ea5..c3da42dd22ba 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -172,6 +172,7 @@ enum {
172 TRACE_EVENT_FL_FILTERED_BIT, 172 TRACE_EVENT_FL_FILTERED_BIT,
173 TRACE_EVENT_FL_RECORDED_CMD_BIT, 173 TRACE_EVENT_FL_RECORDED_CMD_BIT,
174 TRACE_EVENT_FL_CAP_ANY_BIT, 174 TRACE_EVENT_FL_CAP_ANY_BIT,
175 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
175}; 176};
176 177
177enum { 178enum {
@@ -179,6 +180,7 @@ enum {
179 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 180 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
180 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 181 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
181 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 182 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
183 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
182}; 184};
183 185
184struct ftrace_event_call { 186struct ftrace_event_call {
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 61549b26ad6f..73c28dea10ae 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -85,6 +85,30 @@ enum {
85/* All generic netlink requests are serialized by a global lock. */ 85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void); 86extern void genl_lock(void);
87extern void genl_unlock(void); 87extern void genl_unlock(void);
88#ifdef CONFIG_PROVE_LOCKING
89extern int lockdep_genl_is_held(void);
90#endif
91
92/**
93 * rcu_dereference_genl - rcu_dereference with debug checking
94 * @p: The pointer to read, prior to dereferencing
95 *
96 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
97 * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
98 */
99#define rcu_dereference_genl(p) \
100 rcu_dereference_check(p, lockdep_genl_is_held())
101
102/**
103 * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
104 * @p: The pointer to read, prior to dereferencing
105 *
106 * Return the value of the specified RCU-protected pointer, but omit
107 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
108 * caller holds genl mutex.
109 */
110#define genl_dereference(p) \
111 rcu_dereference_protected(p, lockdep_genl_is_held())
88 112
89#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
90 114
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6d18f3531f18..fe23ee768589 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -163,7 +163,7 @@ struct gendisk {
163 * disks that can't be partitioned. */ 163 * disks that can't be partitioned. */
164 164
165 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 165 char disk_name[DISK_NAME_LEN]; /* name of major driver */
166 char *(*devnode)(struct gendisk *gd, mode_t *mode); 166 char *(*devnode)(struct gendisk *gd, umode_t *mode);
167 167
168 unsigned int events; /* supported events */ 168 unsigned int events; /* supported events */
169 unsigned int async_events; /* async events, subset of all */ 169 unsigned int async_events; /* async events, subset of all */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index f743883f769e..bb7f30971858 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -139,20 +139,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
139extern void account_system_vtime(struct task_struct *tsk); 139extern void account_system_vtime(struct task_struct *tsk);
140#endif 140#endif
141 141
142#if defined(CONFIG_NO_HZ)
143#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
144extern void rcu_enter_nohz(void);
145extern void rcu_exit_nohz(void);
146
147static inline void rcu_irq_enter(void)
148{
149 rcu_exit_nohz();
150}
151
152static inline void rcu_irq_exit(void)
153{
154 rcu_enter_nohz();
155}
156 143
157static inline void rcu_nmi_enter(void) 144static inline void rcu_nmi_enter(void)
158{ 145{
@@ -163,17 +150,9 @@ static inline void rcu_nmi_exit(void)
163} 150}
164 151
165#else 152#else
166extern void rcu_irq_enter(void);
167extern void rcu_irq_exit(void);
168extern void rcu_nmi_enter(void); 153extern void rcu_nmi_enter(void);
169extern void rcu_nmi_exit(void); 154extern void rcu_nmi_exit(void);
170#endif 155#endif
171#else
172# define rcu_irq_enter() do { } while (0)
173# define rcu_irq_exit() do { } while (0)
174# define rcu_nmi_enter() do { } while (0)
175# define rcu_nmi_exit() do { } while (0)
176#endif /* #if defined(CONFIG_NO_HZ) */
177 156
178/* 157/*
179 * It is safe to do non-atomic ops on ->hardirq_context, 158 * It is safe to do non-atomic ops on ->hardirq_context,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 07d103a06d64..8e25a9167f13 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
482{ 482{
483 return adap->nr; 483 return adap->nr;
484} 484}
485
486/**
487 * module_i2c_driver() - Helper macro for registering a I2C driver
488 * @__i2c_driver: i2c_driver struct
489 *
490 * Helper macro for I2C drivers which do not do anything special in module
491 * init/exit. This eliminates a lot of boilerplate. Each module may only
492 * use this macro once, and calling it replaces module_init() and module_exit()
493 */
494#define module_i2c_driver(__i2c_driver) \
495 module_driver(__i2c_driver, i2c_add_driver, \
496 i2c_del_driver)
497
485#endif /* I2C */ 498#endif /* I2C */
486#endif /* __KERNEL__ */ 499#endif /* __KERNEL__ */
487 500
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 42557851b12e..501370b61ee5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
920 920
921typedef struct { 921typedef struct {
922 const char *name; 922 const char *name;
923 mode_t mode; 923 umode_t mode;
924 const struct file_operations *proc_fops; 924 const struct file_operations *proc_fops;
925} ide_proc_entry_t; 925} ide_proc_entry_t;
926 926
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3c40f8..210e2c325534 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -128,6 +128,7 @@
128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040 129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060 130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
131#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
131/* A-MSDU 802.11n */ 132/* A-MSDU 802.11n */
132#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 133#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
133/* Mesh Control 802.11s */ 134/* Mesh Control 802.11s */
@@ -543,6 +544,15 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
543 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); 544 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
544} 545}
545 546
547/**
548 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
549 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
550 */
551static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
552{
553 return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
554}
555
546struct ieee80211s_hdr { 556struct ieee80211s_hdr {
547 u8 flags; 557 u8 flags;
548 u8 ttl; 558 u8 ttl;
@@ -770,6 +780,9 @@ struct ieee80211_mgmt {
770 } u; 780 } u;
771} __attribute__ ((packed)); 781} __attribute__ ((packed));
772 782
783/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
784#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
785
773/* mgmt header + 1 byte category code */ 786/* mgmt header + 1 byte category code */
774#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 787#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
775 788
@@ -1552,6 +1565,8 @@ enum ieee80211_sa_query_action {
1552#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1565#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1553#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1566#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1554 1567
1568#define WLAN_CIPHER_SUITE_SMS4 0x00147201
1569
1555/* AKM suite selectors */ 1570/* AKM suite selectors */
1556#define WLAN_AKM_SUITE_8021X 0x000FAC01 1571#define WLAN_AKM_SUITE_8021X 0x000FAC01
1557#define WLAN_AKM_SUITE_PSK 0x000FAC02 1572#define WLAN_AKM_SUITE_PSK 0x000FAC02
@@ -1689,6 +1704,23 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1689} 1704}
1690 1705
1691/** 1706/**
1707 * ieee80211_is_public_action - check if frame is a public action frame
1708 * @hdr: the frame
1709 * @len: length of the frame
1710 */
1711static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
1712 size_t len)
1713{
1714 struct ieee80211_mgmt *mgmt = (void *)hdr;
1715
1716 if (len < IEEE80211_MIN_ACTION_SIZE)
1717 return false;
1718 if (!ieee80211_is_action(hdr->frame_control))
1719 return false;
1720 return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
1721}
1722
1723/**
1692 * ieee80211_fhss_chan_to_freq - get channel frequency 1724 * ieee80211_fhss_chan_to_freq - get channel frequency
1693 * @channel: the FHSS channel 1725 * @channel: the FHSS channel
1694 * 1726 *
diff --git a/include/linux/if.h b/include/linux/if.h
index db20bd4fd16b..06b6ef60c821 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -79,6 +79,7 @@
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing 79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
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 83
83#define IF_GET_IFACE 0x0001 /* for querying only */ 84#define IF_GET_IFACE 0x0001 /* for querying only */
84#define IF_GET_PROTO 0x0002 85#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e473003e4bda..56d907a2c804 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -79,6 +79,7 @@
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ 81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
82#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
82#define ETH_P_TIPC 0x88CA /* TIPC */ 83#define ETH_P_TIPC 0x88CA /* TIPC */
83#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 84#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
84#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 85#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
new file mode 100644
index 000000000000..828181fbad5d
--- /dev/null
+++ b/include/linux/if_team.h
@@ -0,0 +1,242 @@
1/*
2 * include/linux/if_team.h - Network team device driver header
3 * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef _LINUX_IF_TEAM_H_
12#define _LINUX_IF_TEAM_H_
13
14#ifdef __KERNEL__
15
16struct team_pcpu_stats {
17 u64 rx_packets;
18 u64 rx_bytes;
19 u64 rx_multicast;
20 u64 tx_packets;
21 u64 tx_bytes;
22 struct u64_stats_sync syncp;
23 u32 rx_dropped;
24 u32 tx_dropped;
25};
26
27struct team;
28
29struct team_port {
30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */
32 struct list_head list; /* node in ordinary list */
33 struct team *team;
34 int index;
35
36 /*
37 * A place for storing original values of the device before it
38 * become a port.
39 */
40 struct {
41 unsigned char dev_addr[MAX_ADDR_LEN];
42 unsigned int mtu;
43 } orig;
44
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 struct rcu_head rcu;
50};
51
52struct team_mode_ops {
53 int (*init)(struct team *team);
54 void (*exit)(struct team *team);
55 rx_handler_result_t (*receive)(struct team *team,
56 struct team_port *port,
57 struct sk_buff *skb);
58 bool (*transmit)(struct team *team, struct sk_buff *skb);
59 int (*port_enter)(struct team *team, struct team_port *port);
60 void (*port_leave)(struct team *team, struct team_port *port);
61 void (*port_change_mac)(struct team *team, struct team_port *port);
62};
63
64enum team_option_type {
65 TEAM_OPTION_TYPE_U32,
66 TEAM_OPTION_TYPE_STRING,
67};
68
69struct team_option {
70 struct list_head list;
71 const char *name;
72 enum team_option_type type;
73 int (*getter)(struct team *team, void *arg);
74 int (*setter)(struct team *team, void *arg);
75};
76
77struct team_mode {
78 struct list_head list;
79 const char *kind;
80 struct module *owner;
81 size_t priv_size;
82 const struct team_mode_ops *ops;
83};
84
85#define TEAM_PORT_HASHBITS 4
86#define TEAM_PORT_HASHENTRIES (1 << TEAM_PORT_HASHBITS)
87
88#define TEAM_MODE_PRIV_LONGS 4
89#define TEAM_MODE_PRIV_SIZE (sizeof(long) * TEAM_MODE_PRIV_LONGS)
90
91struct team {
92 struct net_device *dev; /* associated netdevice */
93 struct team_pcpu_stats __percpu *pcpu_stats;
94
95 struct mutex lock; /* used for overall locking, e.g. port lists write */
96
97 /*
98 * port lists with port count
99 */
100 int port_count;
101 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES];
102 struct list_head port_list;
103
104 struct list_head option_list;
105
106 const struct team_mode *mode;
107 struct team_mode_ops ops;
108 long mode_priv[TEAM_MODE_PRIV_LONGS];
109};
110
111static inline struct hlist_head *team_port_index_hash(struct team *team,
112 int port_index)
113{
114 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
115}
116
117static inline struct team_port *team_get_port_by_index(struct team *team,
118 int port_index)
119{
120 struct hlist_node *p;
121 struct team_port *port;
122 struct hlist_head *head = team_port_index_hash(team, port_index);
123
124 hlist_for_each_entry(port, p, head, hlist)
125 if (port->index == port_index)
126 return port;
127 return NULL;
128}
129static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
130 int port_index)
131{
132 struct hlist_node *p;
133 struct team_port *port;
134 struct hlist_head *head = team_port_index_hash(team, port_index);
135
136 hlist_for_each_entry_rcu(port, p, head, hlist)
137 if (port->index == port_index)
138 return port;
139 return NULL;
140}
141
142extern int team_port_set_team_mac(struct team_port *port);
143extern int team_options_register(struct team *team,
144 const struct team_option *option,
145 size_t option_count);
146extern void team_options_unregister(struct team *team,
147 const struct team_option *option,
148 size_t option_count);
149extern int team_mode_register(struct team_mode *mode);
150extern int team_mode_unregister(struct team_mode *mode);
151
152#endif /* __KERNEL__ */
153
154#define TEAM_STRING_MAX_LEN 32
155
156/**********************************
157 * NETLINK_GENERIC netlink family.
158 **********************************/
159
160enum {
161 TEAM_CMD_NOOP,
162 TEAM_CMD_OPTIONS_SET,
163 TEAM_CMD_OPTIONS_GET,
164 TEAM_CMD_PORT_LIST_GET,
165
166 __TEAM_CMD_MAX,
167 TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
168};
169
170enum {
171 TEAM_ATTR_UNSPEC,
172 TEAM_ATTR_TEAM_IFINDEX, /* u32 */
173 TEAM_ATTR_LIST_OPTION, /* nest */
174 TEAM_ATTR_LIST_PORT, /* nest */
175
176 __TEAM_ATTR_MAX,
177 TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
178};
179
180/* Nested layout of get/set msg:
181 *
182 * [TEAM_ATTR_LIST_OPTION]
183 * [TEAM_ATTR_ITEM_OPTION]
184 * [TEAM_ATTR_OPTION_*], ...
185 * [TEAM_ATTR_ITEM_OPTION]
186 * [TEAM_ATTR_OPTION_*], ...
187 * ...
188 * [TEAM_ATTR_LIST_PORT]
189 * [TEAM_ATTR_ITEM_PORT]
190 * [TEAM_ATTR_PORT_*], ...
191 * [TEAM_ATTR_ITEM_PORT]
192 * [TEAM_ATTR_PORT_*], ...
193 * ...
194 */
195
196enum {
197 TEAM_ATTR_ITEM_OPTION_UNSPEC,
198 TEAM_ATTR_ITEM_OPTION, /* nest */
199
200 __TEAM_ATTR_ITEM_OPTION_MAX,
201 TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
202};
203
204enum {
205 TEAM_ATTR_OPTION_UNSPEC,
206 TEAM_ATTR_OPTION_NAME, /* string */
207 TEAM_ATTR_OPTION_CHANGED, /* flag */
208 TEAM_ATTR_OPTION_TYPE, /* u8 */
209 TEAM_ATTR_OPTION_DATA, /* dynamic */
210
211 __TEAM_ATTR_OPTION_MAX,
212 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
213};
214
215enum {
216 TEAM_ATTR_ITEM_PORT_UNSPEC,
217 TEAM_ATTR_ITEM_PORT, /* nest */
218
219 __TEAM_ATTR_ITEM_PORT_MAX,
220 TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
221};
222
223enum {
224 TEAM_ATTR_PORT_UNSPEC,
225 TEAM_ATTR_PORT_IFINDEX, /* u32 */
226 TEAM_ATTR_PORT_CHANGED, /* flag */
227 TEAM_ATTR_PORT_LINKUP, /* flag */
228 TEAM_ATTR_PORT_SPEED, /* u32 */
229 TEAM_ATTR_PORT_DUPLEX, /* u8 */
230
231 __TEAM_ATTR_PORT_MAX,
232 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
233};
234
235/*
236 * NETLINK_GENERIC related info
237 */
238#define TEAM_GENL_NAME "team"
239#define TEAM_GENL_VERSION 0x1
240#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
241
242#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 12d5543b14f2..13aff1e2183b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -74,22 +74,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
74/* found in socket.c */ 74/* found in socket.c */
75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 76
77/* if this changes, algorithm will have to be reworked because this 77struct vlan_info;
78 * depends on completely exhausting the VLAN identifier space. Thus
79 * it gives constant time look-up, but in many cases it wastes memory.
80 */
81#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
82#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
83
84struct vlan_group {
85 struct net_device *real_dev; /* The ethernet(like) device
86 * the vlan is attached to.
87 */
88 unsigned int nr_vlans;
89 struct hlist_node hlist; /* linked list */
90 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
91 struct rcu_head rcu;
92};
93 78
94static inline int is_vlan_dev(struct net_device *dev) 79static inline int is_vlan_dev(struct net_device *dev)
95{ 80{
@@ -109,6 +94,13 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
109extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler); 94extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
110extern struct sk_buff *vlan_untag(struct sk_buff *skb); 95extern struct sk_buff *vlan_untag(struct sk_buff *skb);
111 96
97extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
98extern void vlan_vid_del(struct net_device *dev, unsigned short vid);
99
100extern int vlan_vids_add_by_dev(struct net_device *dev,
101 const struct net_device *by_dev);
102extern void vlan_vids_del_by_dev(struct net_device *dev,
103 const struct net_device *by_dev);
112#else 104#else
113static inline struct net_device * 105static inline struct net_device *
114__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
@@ -139,6 +131,26 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
139{ 131{
140 return skb; 132 return skb;
141} 133}
134
135static inline int vlan_vid_add(struct net_device *dev, unsigned short vid)
136{
137 return 0;
138}
139
140static inline void vlan_vid_del(struct net_device *dev, unsigned short vid)
141{
142}
143
144static inline int vlan_vids_add_by_dev(struct net_device *dev,
145 const struct net_device *by_dev)
146{
147 return 0;
148}
149
150static inline void vlan_vids_del_by_dev(struct net_device *dev,
151 const struct net_device *by_dev)
152{
153}
142#endif 154#endif
143 155
144/** 156/**
@@ -310,6 +322,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
310 322
311 return protocol; 323 return protocol;
312} 324}
325
326static inline void vlan_set_encap_proto(struct sk_buff *skb,
327 struct vlan_hdr *vhdr)
328{
329 __be16 proto;
330 unsigned char *rawp;
331
332 /*
333 * Was a VLAN packet, grab the encapsulated protocol, which the layer
334 * three protocols care about.
335 */
336
337 proto = vhdr->h_vlan_encapsulated_proto;
338 if (ntohs(proto) >= 1536) {
339 skb->protocol = proto;
340 return;
341 }
342
343 rawp = skb->data;
344 if (*(unsigned short *) rawp == 0xFFFF)
345 /*
346 * This is a magic hack to spot IPX packets. Older Novell
347 * breaks the protocol design and runs IPX over 802.3 without
348 * an 802.2 LLC layer. We look for FFFF which isn't a used
349 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
350 * but does for the rest.
351 */
352 skb->protocol = htons(ETH_P_802_3);
353 else
354 /*
355 * Real 802.2 LLC
356 */
357 skb->protocol = htons(ETH_P_802_2);
358}
313#endif /* __KERNEL__ */ 359#endif /* __KERNEL__ */
314 360
315/* VLAN IOCTLs are found in sockios.h */ 361/* VLAN IOCTLs are found in sockios.h */
@@ -352,7 +398,7 @@ struct vlan_ioctl_args {
352 unsigned int skb_priority; 398 unsigned int skb_priority;
353 unsigned int name_type; 399 unsigned int name_type;
354 unsigned int bind_type; 400 unsigned int bind_type;
355 unsigned int flag; /* Matches vlan_dev_info flags */ 401 unsigned int flag; /* Matches vlan_dev_priv flags */
356 } u; 402 } u;
357 403
358 short vlan_qos; 404 short vlan_qos;
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index abf5028db981..34e8d52c1925 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -22,7 +22,7 @@ struct inet_diag_sockid {
22 22
23/* Request structure */ 23/* Request structure */
24 24
25struct inet_diag_req { 25struct inet_diag_req_compat {
26 __u8 idiag_family; /* Family of addresses. */ 26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len; 27 __u8 idiag_src_len;
28 __u8 idiag_dst_len; 28 __u8 idiag_dst_len;
@@ -34,6 +34,15 @@ struct inet_diag_req {
34 __u32 idiag_dbs; /* Tables to dump (NI) */ 34 __u32 idiag_dbs; /* Tables to dump (NI) */
35}; 35};
36 36
37struct inet_diag_req {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
37enum { 46enum {
38 INET_DIAG_REQ_NONE, 47 INET_DIAG_REQ_NONE,
39 INET_DIAG_REQ_BYTECODE, 48 INET_DIAG_REQ_BYTECODE,
@@ -99,9 +108,10 @@ enum {
99 INET_DIAG_CONG, 108 INET_DIAG_CONG,
100 INET_DIAG_TOS, 109 INET_DIAG_TOS,
101 INET_DIAG_TCLASS, 110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO,
102}; 112};
103 113
104#define INET_DIAG_MAX INET_DIAG_TCLASS 114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
105 115
106 116
107/* INET_DIAG_MEM */ 117/* INET_DIAG_MEM */
@@ -125,16 +135,41 @@ struct tcpvegas_info {
125#ifdef __KERNEL__ 135#ifdef __KERNEL__
126struct sock; 136struct sock;
127struct inet_hashinfo; 137struct inet_hashinfo;
138struct nlattr;
139struct nlmsghdr;
140struct sk_buff;
141struct netlink_callback;
128 142
129struct inet_diag_handler { 143struct inet_diag_handler {
130 struct inet_hashinfo *idiag_hashinfo; 144 void (*dump)(struct sk_buff *skb,
145 struct netlink_callback *cb,
146 struct inet_diag_req *r,
147 struct nlattr *bc);
148
149 int (*dump_one)(struct sk_buff *in_skb,
150 const struct nlmsghdr *nlh,
151 struct inet_diag_req *req);
152
131 void (*idiag_get_info)(struct sock *sk, 153 void (*idiag_get_info)(struct sock *sk,
132 struct inet_diag_msg *r, 154 struct inet_diag_msg *r,
133 void *info); 155 void *info);
134 __u16 idiag_info_size;
135 __u16 idiag_type; 156 __u16 idiag_type;
136}; 157};
137 158
159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req *req,
162 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
165 struct netlink_callback *cb, struct inet_diag_req *r,
166 struct nlattr *bc);
167int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
168 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
169 struct inet_diag_req *req);
170
171int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
172
138extern int inet_diag_register(const struct inet_diag_handler *handler); 173extern int inet_diag_register(const struct inet_diag_handler *handler);
139extern void inet_diag_unregister(const struct inet_diag_handler *handler); 174extern void inet_diag_unregister(const struct inet_diag_handler *handler);
140#endif /* __KERNEL__ */ 175#endif /* __KERNEL__ */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 94b1e356c02a..32574eef9394 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -126,6 +126,8 @@ extern struct cred init_cred;
126# define INIT_PERF_EVENTS(tsk) 126# define INIT_PERF_EVENTS(tsk)
127#endif 127#endif
128 128
129#define INIT_TASK_COMM "swapper"
130
129/* 131/*
130 * INIT_TASK is used to set up the first task table, touch at 132 * INIT_TASK is used to set up the first task table, touch at
131 * your own risk!. Base=0, limit=0x1fffff (=2MB) 133 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -162,7 +164,7 @@ extern struct cred init_cred;
162 .group_leader = &tsk, \ 164 .group_leader = &tsk, \
163 RCU_INIT_POINTER(.real_cred, &init_cred), \ 165 RCU_INIT_POINTER(.real_cred, &init_cred), \
164 RCU_INIT_POINTER(.cred, &init_cred), \ 166 RCU_INIT_POINTER(.cred, &init_cred), \
165 .comm = "swapper", \ 167 .comm = INIT_TASK_COMM, \
166 .thread = INIT_THREAD, \ 168 .thread = INIT_THREAD, \
167 .fs = &init_fs, \ 169 .fs = &init_fs, \
168 .files = &init_files, \ 170 .files = &init_files, \
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 3b1594d662b0..30e816148df4 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -93,7 +93,7 @@ struct kern_ipc_perm
93 gid_t gid; 93 gid_t gid;
94 uid_t cuid; 94 uid_t cuid;
95 gid_t cgid; 95 gid_t cgid;
96 mode_t mode; 96 umode_t mode;
97 unsigned long seq; 97 unsigned long seq;
98 void *security; 98 void *security;
99}; 99};
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 0c997767429a..6318268dcaf5 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -404,7 +404,7 @@ struct tcp6_sock {
404 404
405extern int inet6_sk_rebuild_header(struct sock *sk); 405extern int inet6_sk_rebuild_header(struct sock *sk);
406 406
407#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 407#if IS_ENABLED(CONFIG_IPV6)
408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
409{ 409{
410 return inet_sk(__sk)->pinet6; 410 return inet_sk(__sk)->pinet6;
@@ -515,7 +515,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
515#define inet6_rcv_saddr(__sk) NULL 515#define inet6_rcv_saddr(__sk) NULL
516#define tcp_twsk_ipv6only(__sk) 0 516#define tcp_twsk_ipv6only(__sk) 0
517#define inet_v6_ipv6only(__sk) 0 517#define inet_v6_ipv6only(__sk) 0
518#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 518#endif /* IS_ENABLED(CONFIG_IPV6) */
519 519
520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 99834e581b9e..bd4272b61a14 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -91,10 +91,11 @@ static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
91 91
92extern void irq_domain_add(struct irq_domain *domain); 92extern void irq_domain_add(struct irq_domain *domain);
93extern void irq_domain_del(struct irq_domain *domain); 93extern void irq_domain_del(struct irq_domain *domain);
94
95extern struct irq_domain_ops irq_domain_simple_ops;
94#endif /* CONFIG_IRQ_DOMAIN */ 96#endif /* CONFIG_IRQ_DOMAIN */
95 97
96#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 98#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
97extern struct irq_domain_ops irq_domain_simple_ops;
98extern void irq_domain_add_simple(struct device_node *controller, int irq_base); 99extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
99extern void irq_domain_generate_simple(const struct of_device_id *match, 100extern void irq_domain_generate_simple(const struct of_device_id *match,
100 u64 phys_base, unsigned int irq_start); 101 u64 phys_base, unsigned int irq_start);
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index f0a2f8b0aa13..2a8b1659bf35 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -91,7 +91,7 @@ struct iscsi_boot_kobj {
91 * The enum of the type. This can be any value of the above 91 * The enum of the type. This can be any value of the above
92 * properties. 92 * properties.
93 */ 93 */
94 mode_t (*is_visible) (void *data, int type); 94 umode_t (*is_visible) (void *data, int type);
95 95
96 /* 96 /*
97 * Driver specific release function. 97 * Driver specific release function.
@@ -110,20 +110,20 @@ struct iscsi_boot_kobj *
110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
111 void *data, 111 void *data,
112 ssize_t (*show) (void *data, int type, char *buf), 112 ssize_t (*show) (void *data, int type, char *buf),
113 mode_t (*is_visible) (void *data, int type), 113 umode_t (*is_visible) (void *data, int type),
114 void (*release) (void *data)); 114 void (*release) (void *data));
115 115
116struct iscsi_boot_kobj * 116struct iscsi_boot_kobj *
117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
118 void *data, 118 void *data,
119 ssize_t (*show) (void *data, int type, char *buf), 119 ssize_t (*show) (void *data, int type, char *buf),
120 mode_t (*is_visible) (void *data, int type), 120 umode_t (*is_visible) (void *data, int type),
121 void (*release) (void *data)); 121 void (*release) (void *data));
122struct iscsi_boot_kobj * 122struct iscsi_boot_kobj *
123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
124 void *data, 124 void *data,
125 ssize_t (*show) (void *data, int type, char *buf), 125 ssize_t (*show) (void *data, int type, char *buf),
126 mode_t (*is_visible) (void *data, int type), 126 umode_t (*is_visible) (void *data, int type),
127 void (*release) (void *data)); 127 void (*release) (void *data));
128 128
129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name); 129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 388b0d425b50..5ce8b140428f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <linux/workqueue.h>
6 7
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 8#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8 9
@@ -14,6 +15,12 @@ struct jump_label_key {
14#endif 15#endif
15}; 16};
16 17
18struct jump_label_key_deferred {
19 struct jump_label_key key;
20 unsigned long timeout;
21 struct delayed_work work;
22};
23
17# include <asm/jump_label.h> 24# include <asm/jump_label.h>
18# define HAVE_JUMP_LABEL 25# define HAVE_JUMP_LABEL
19#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 26#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -51,8 +58,11 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
51extern int jump_label_text_reserved(void *start, void *end); 58extern int jump_label_text_reserved(void *start, void *end);
52extern void jump_label_inc(struct jump_label_key *key); 59extern void jump_label_inc(struct jump_label_key *key);
53extern void jump_label_dec(struct jump_label_key *key); 60extern void jump_label_dec(struct jump_label_key *key);
61extern void jump_label_dec_deferred(struct jump_label_key_deferred *key);
54extern bool jump_label_enabled(struct jump_label_key *key); 62extern bool jump_label_enabled(struct jump_label_key *key);
55extern void jump_label_apply_nops(struct module *mod); 63extern void jump_label_apply_nops(struct module *mod);
64extern void jump_label_rate_limit(struct jump_label_key_deferred *key,
65 unsigned long rl);
56 66
57#else /* !HAVE_JUMP_LABEL */ 67#else /* !HAVE_JUMP_LABEL */
58 68
@@ -68,6 +78,10 @@ static __always_inline void jump_label_init(void)
68{ 78{
69} 79}
70 80
81struct jump_label_key_deferred {
82 struct jump_label_key key;
83};
84
71static __always_inline bool static_branch(struct jump_label_key *key) 85static __always_inline bool static_branch(struct jump_label_key *key)
72{ 86{
73 if (unlikely(atomic_read(&key->enabled))) 87 if (unlikely(atomic_read(&key->enabled)))
@@ -85,6 +99,11 @@ static inline void jump_label_dec(struct jump_label_key *key)
85 atomic_dec(&key->enabled); 99 atomic_dec(&key->enabled);
86} 100}
87 101
102static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key)
103{
104 jump_label_dec(&key->key);
105}
106
88static inline int jump_label_text_reserved(void *start, void *end) 107static inline int jump_label_text_reserved(void *start, void *end)
89{ 108{
90 return 0; 109 return 0;
@@ -102,6 +121,14 @@ static inline int jump_label_apply_nops(struct module *mod)
102{ 121{
103 return 0; 122 return 0;
104} 123}
124
125static inline void jump_label_rate_limit(struct jump_label_key_deferred *key,
126 unsigned long rl)
127{
128}
105#endif /* HAVE_JUMP_LABEL */ 129#endif /* HAVE_JUMP_LABEL */
106 130
131#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), })
132#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), })
133
107#endif /* _LINUX_JUMP_LABEL_H */ 134#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 0cce2db580c3..2fbd9053c2df 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -6,6 +6,7 @@
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/sched.h>
9#include <asm/irq.h> 10#include <asm/irq.h>
10#include <asm/cputime.h> 11#include <asm/cputime.h>
11 12
@@ -15,21 +16,25 @@
15 * used by rstatd/perfmeter 16 * used by rstatd/perfmeter
16 */ 17 */
17 18
18struct cpu_usage_stat { 19enum cpu_usage_stat {
19 cputime64_t user; 20 CPUTIME_USER,
20 cputime64_t nice; 21 CPUTIME_NICE,
21 cputime64_t system; 22 CPUTIME_SYSTEM,
22 cputime64_t softirq; 23 CPUTIME_SOFTIRQ,
23 cputime64_t irq; 24 CPUTIME_IRQ,
24 cputime64_t idle; 25 CPUTIME_IDLE,
25 cputime64_t iowait; 26 CPUTIME_IOWAIT,
26 cputime64_t steal; 27 CPUTIME_STEAL,
27 cputime64_t guest; 28 CPUTIME_GUEST,
28 cputime64_t guest_nice; 29 CPUTIME_GUEST_NICE,
30 NR_STATS,
31};
32
33struct kernel_cpustat {
34 u64 cpustat[NR_STATS];
29}; 35};
30 36
31struct kernel_stat { 37struct kernel_stat {
32 struct cpu_usage_stat cpustat;
33#ifndef CONFIG_GENERIC_HARDIRQS 38#ifndef CONFIG_GENERIC_HARDIRQS
34 unsigned int irqs[NR_IRQS]; 39 unsigned int irqs[NR_IRQS];
35#endif 40#endif
@@ -38,10 +43,13 @@ struct kernel_stat {
38}; 43};
39 44
40DECLARE_PER_CPU(struct kernel_stat, kstat); 45DECLARE_PER_CPU(struct kernel_stat, kstat);
46DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
41 47
42#define kstat_cpu(cpu) per_cpu(kstat, cpu)
43/* Must have preemption disabled for this to be meaningful. */ 48/* Must have preemption disabled for this to be meaningful. */
44#define kstat_this_cpu __get_cpu_var(kstat) 49#define kstat_this_cpu (&__get_cpu_var(kstat))
50#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat))
51#define kstat_cpu(cpu) per_cpu(kstat, cpu)
52#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
45 53
46extern unsigned long long nr_context_switches(void); 54extern unsigned long long nr_context_switches(void);
47 55
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index b16f65390734..722f477c4ef7 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -117,5 +117,7 @@ extern void usermodehelper_init(void);
117extern int usermodehelper_disable(void); 117extern int usermodehelper_disable(void);
118extern void usermodehelper_enable(void); 118extern void usermodehelper_enable(void);
119extern bool usermodehelper_is_disabled(void); 119extern bool usermodehelper_is_disabled(void);
120extern void read_lock_usermodehelper(void);
121extern void read_unlock_usermodehelper(void);
120 122
121#endif /* __LINUX_KMOD_H__ */ 123#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index ad81e1c51487..fc615a97e2d3 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
191} 191}
192 192
193extern struct kobject *kset_find_obj(struct kset *, const char *); 193extern struct kobject *kset_find_obj(struct kset *, const char *);
194extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
195 struct kobject *);
196 194
197/* The global /sys/kernel/ kobject for people to chain off of */ 195/* The global /sys/kernel/ kobject for people to chain off of */
198extern struct kobject *kernel_kobj; 196extern struct kobject *kernel_kobj;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index d4a62ab2ee5e..abc0120b09b7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,16 +15,81 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/bug.h>
19#include <linux/atomic.h>
19 20
20struct kref { 21struct kref {
21 atomic_t refcount; 22 atomic_t refcount;
22}; 23};
23 24
24void kref_init(struct kref *kref); 25/**
25void kref_get(struct kref *kref); 26 * kref_init - initialize object.
26int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 27 * @kref: object in question.
27int kref_sub(struct kref *kref, unsigned int count, 28 */
28 void (*release) (struct kref *kref)); 29static inline void kref_init(struct kref *kref)
30{
31 atomic_set(&kref->refcount, 1);
32}
33
34/**
35 * kref_get - increment refcount for object.
36 * @kref: object.
37 */
38static inline void kref_get(struct kref *kref)
39{
40 WARN_ON(!atomic_read(&kref->refcount));
41 atomic_inc(&kref->refcount);
42}
29 43
44/**
45 * kref_sub - subtract a number of refcounts for object.
46 * @kref: object.
47 * @count: Number of recounts to subtract.
48 * @release: pointer to the function that will clean up the object when the
49 * last reference to the object is released.
50 * This pointer is required, and it is not acceptable to pass kfree
51 * in as this function. If the caller does pass kfree to this
52 * function, you will be publicly mocked mercilessly by the kref
53 * maintainer, and anyone else who happens to notice it. You have
54 * been warned.
55 *
56 * Subtract @count from the refcount, and if 0, call release().
57 * Return 1 if the object was removed, otherwise return 0. Beware, if this
58 * function returns 0, you still can not count on the kref from remaining in
59 * memory. Only use the return value if you want to see if the kref is now
60 * gone, not present.
61 */
62static inline int kref_sub(struct kref *kref, unsigned int count,
63 void (*release)(struct kref *kref))
64{
65 WARN_ON(release == NULL);
66
67 if (atomic_sub_and_test((int) count, &kref->refcount)) {
68 release(kref);
69 return 1;
70 }
71 return 0;
72}
73
74/**
75 * kref_put - decrement refcount for object.
76 * @kref: object.
77 * @release: pointer to the function that will clean up the object when the
78 * last reference to the object is released.
79 * This pointer is required, and it is not acceptable to pass kfree
80 * in as this function. If the caller does pass kfree to this
81 * function, you will be publicly mocked mercilessly by the kref
82 * maintainer, and anyone else who happens to notice it. You have
83 * been warned.
84 *
85 * Decrement the refcount, and if 0, call release().
86 * Return 1 if the object was removed, otherwise return 0. Beware, if this
87 * function returns 0, you still can not count on the kref from remaining in
88 * memory. Only use the return value if you want to see if the kref is now
89 * gone, not present.
90 */
91static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
92{
93 return kref_sub(kref, 1, release);
94}
30#endif /* _KREF_H_ */ 95#endif /* _KREF_H_ */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 5cac19b3a266..0714b24c0e45 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -35,6 +35,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
35void kthread_bind(struct task_struct *k, unsigned int cpu); 35void kthread_bind(struct task_struct *k, unsigned int cpu);
36int kthread_stop(struct task_struct *k); 36int kthread_stop(struct task_struct *k);
37int kthread_should_stop(void); 37int kthread_should_stop(void);
38bool kthread_freezable_should_stop(bool *was_frozen);
38void *kthread_data(struct task_struct *k); 39void *kthread_data(struct task_struct *k);
39 40
40int kthreadd(void *unused); 41int kthreadd(void *unused);
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c3892fc1d538..68e67e50d028 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -557,6 +557,7 @@ struct kvm_ppc_pvinfo {
557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ 557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
558#define KVM_CAP_PPC_PAPR 68 558#define KVM_CAP_PPC_PAPR 68
559#define KVM_CAP_S390_GMAP 71 559#define KVM_CAP_S390_GMAP 71
560#define KVM_CAP_TSC_DEADLINE_TIMER 72
560 561
561#ifdef KVM_CAP_IRQ_ROUTING 562#ifdef KVM_CAP_IRQ_ROUTING
562 563
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
index b0e99898527c..e23121f9d82a 100644
--- a/include/linux/latencytop.h
+++ b/include/linux/latencytop.h
@@ -10,6 +10,8 @@
10#define _INCLUDE_GUARD_LATENCYTOP_H_ 10#define _INCLUDE_GUARD_LATENCYTOP_H_
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13struct task_struct;
14
13#ifdef CONFIG_LATENCYTOP 15#ifdef CONFIG_LATENCYTOP
14 16
15#define LT_SAVECOUNT 32 17#define LT_SAVECOUNT 32
@@ -23,7 +25,6 @@ struct latency_record {
23}; 25};
24 26
25 27
26struct task_struct;
27 28
28extern int latencytop_enabled; 29extern int latencytop_enabled;
29void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); 30void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index f549056fb20b..87f402ccec55 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/lockdep.h> 23#include <linux/lockdep.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/cpu.h>
25 26
26/* can make br locks by using local lock for read side, global lock for write */ 27/* can make br locks by using local lock for read side, global lock for write */
27#define br_lock_init(name) name##_lock_init() 28#define br_lock_init(name) name##_lock_init()
@@ -72,9 +73,31 @@
72 73
73#define DEFINE_LGLOCK(name) \ 74#define DEFINE_LGLOCK(name) \
74 \ 75 \
76 DEFINE_SPINLOCK(name##_cpu_lock); \
77 cpumask_t name##_cpus __read_mostly; \
75 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ 78 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
76 DEFINE_LGLOCK_LOCKDEP(name); \ 79 DEFINE_LGLOCK_LOCKDEP(name); \
77 \ 80 \
81 static int \
82 name##_lg_cpu_callback(struct notifier_block *nb, \
83 unsigned long action, void *hcpu) \
84 { \
85 switch (action & ~CPU_TASKS_FROZEN) { \
86 case CPU_UP_PREPARE: \
87 spin_lock(&name##_cpu_lock); \
88 cpu_set((unsigned long)hcpu, name##_cpus); \
89 spin_unlock(&name##_cpu_lock); \
90 break; \
91 case CPU_UP_CANCELED: case CPU_DEAD: \
92 spin_lock(&name##_cpu_lock); \
93 cpu_clear((unsigned long)hcpu, name##_cpus); \
94 spin_unlock(&name##_cpu_lock); \
95 } \
96 return NOTIFY_OK; \
97 } \
98 static struct notifier_block name##_lg_cpu_notifier = { \
99 .notifier_call = name##_lg_cpu_callback, \
100 }; \
78 void name##_lock_init(void) { \ 101 void name##_lock_init(void) { \
79 int i; \ 102 int i; \
80 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ 103 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
@@ -83,6 +106,11 @@
83 lock = &per_cpu(name##_lock, i); \ 106 lock = &per_cpu(name##_lock, i); \
84 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ 107 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
85 } \ 108 } \
109 register_hotcpu_notifier(&name##_lg_cpu_notifier); \
110 get_online_cpus(); \
111 for_each_online_cpu(i) \
112 cpu_set(i, name##_cpus); \
113 put_online_cpus(); \
86 } \ 114 } \
87 EXPORT_SYMBOL(name##_lock_init); \ 115 EXPORT_SYMBOL(name##_lock_init); \
88 \ 116 \
@@ -124,9 +152,9 @@
124 \ 152 \
125 void name##_global_lock_online(void) { \ 153 void name##_global_lock_online(void) { \
126 int i; \ 154 int i; \
127 preempt_disable(); \ 155 spin_lock(&name##_cpu_lock); \
128 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ 156 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
129 for_each_online_cpu(i) { \ 157 for_each_cpu(i, &name##_cpus) { \
130 arch_spinlock_t *lock; \ 158 arch_spinlock_t *lock; \
131 lock = &per_cpu(name##_lock, i); \ 159 lock = &per_cpu(name##_lock, i); \
132 arch_spin_lock(lock); \ 160 arch_spin_lock(lock); \
@@ -137,12 +165,12 @@
137 void name##_global_unlock_online(void) { \ 165 void name##_global_unlock_online(void) { \
138 int i; \ 166 int i; \
139 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ 167 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
140 for_each_online_cpu(i) { \ 168 for_each_cpu(i, &name##_cpus) { \
141 arch_spinlock_t *lock; \ 169 arch_spinlock_t *lock; \
142 lock = &per_cpu(name##_lock, i); \ 170 lock = &per_cpu(name##_lock, i); \
143 arch_spin_unlock(lock); \ 171 arch_spin_unlock(lock); \
144 } \ 172 } \
145 preempt_enable(); \ 173 spin_unlock(&name##_cpu_lock); \
146 } \ 174 } \
147 EXPORT_SYMBOL(name##_global_unlock_online); \ 175 EXPORT_SYMBOL(name##_global_unlock_online); \
148 \ 176 \
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ff9abff55aa0..90b0656a869e 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
301 return ipv4_is_loopback(sin->sin_addr.s_addr); 301 return ipv4_is_loopback(sin->sin_addr.s_addr);
302} 302}
303 303
304#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 304#if IS_ENABLED(CONFIG_IPV6)
305static inline int __nlm_privileged_request6(const struct sockaddr *sap) 305static inline int __nlm_privileged_request6(const struct sockaddr *sap)
306{ 306{
307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; 307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
@@ -314,12 +314,12 @@ static inline int __nlm_privileged_request6(const struct sockaddr *sap)
314 314
315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK; 315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
316} 316}
317#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 317#else /* IS_ENABLED(CONFIG_IPV6) */
318static inline int __nlm_privileged_request6(const struct sockaddr *sap) 318static inline int __nlm_privileged_request6(const struct sockaddr *sap)
319{ 319{
320 return 0; 320 return 0;
321} 321}
322#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 322#endif /* IS_ENABLED(CONFIG_IPV6) */
323 323
324/* 324/*
325 * Ensure incoming requests are from local privileged callers. 325 * Ensure incoming requests are from local privileged callers.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b6a56e37284c..d36619ead3ba 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
343 343
344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) 344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
345 345
346#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
347
346#else /* !LOCKDEP */ 348#else /* !LOCKDEP */
347 349
348static inline void lockdep_off(void) 350static inline void lockdep_off(void)
@@ -392,6 +394,8 @@ struct lock_class_key { };
392 394
393#define lockdep_assert_held(l) do { } while (0) 395#define lockdep_assert_held(l) do { } while (0)
394 396
397#define lockdep_recursing(tsk) (0)
398
395#endif /* !LOCKDEP */ 399#endif /* !LOCKDEP */
396 400
397#ifdef CONFIG_LOCK_STAT 401#ifdef CONFIG_LOCK_STAT
diff --git a/include/linux/log2.h b/include/linux/log2.h
index 25b808631cd9..fd7ff3d91e6a 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
185#define rounddown_pow_of_two(n) \ 185#define rounddown_pow_of_two(n) \
186( \ 186( \
187 __builtin_constant_p(n) ? ( \ 187 __builtin_constant_p(n) ? ( \
188 (n == 1) ? 0 : \
189 (1UL << ilog2(n))) : \ 188 (1UL << ilog2(n))) : \
190 __rounddown_pow_of_two(n) \ 189 __rounddown_pow_of_two(n) \
191 ) 190 )
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
index 0fe00cd4c93c..76f52bbbb2f4 100644
--- a/include/linux/mdio-bitbang.h
+++ b/include/linux/mdio-bitbang.h
@@ -32,6 +32,8 @@ struct mdiobb_ops {
32 32
33struct mdiobb_ctrl { 33struct mdiobb_ctrl {
34 const struct mdiobb_ops *ops; 34 const struct mdiobb_ops *ops;
35 /* reset callback */
36 int (*reset)(struct mii_bus *bus);
35}; 37};
36 38
37/* The returned bus is not yet registered with the phy layer. */ 39/* The returned bus is not yet registered with the phy layer. */
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
index e9d3fdfe41d7..7c9fe3c2be73 100644
--- a/include/linux/mdio-gpio.h
+++ b/include/linux/mdio-gpio.h
@@ -20,6 +20,8 @@ struct mdio_gpio_platform_data {
20 20
21 unsigned int phy_mask; 21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR]; 22 int irqs[PHY_MAX_ADDR];
23 /* reset callback */
24 int (*reset)(struct mii_bus *bus);
23}; 25};
24 26
25#endif /* __LINUX_MDIO_GPIO_H */ 27#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e6b843e16e81..a6bb10235148 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -2,8 +2,6 @@
2#define _LINUX_MEMBLOCK_H 2#define _LINUX_MEMBLOCK_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#define MEMBLOCK_ERROR 0
6
7#ifdef CONFIG_HAVE_MEMBLOCK 5#ifdef CONFIG_HAVE_MEMBLOCK
8/* 6/*
9 * Logical memory blocks. 7 * Logical memory blocks.
@@ -19,81 +17,161 @@
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/mm.h> 18#include <linux/mm.h>
21 19
22#include <asm/memblock.h>
23
24#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
25 21
26struct memblock_region { 22struct memblock_region {
27 phys_addr_t base; 23 phys_addr_t base;
28 phys_addr_t size; 24 phys_addr_t size;
25#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
26 int nid;
27#endif
29}; 28};
30 29
31struct memblock_type { 30struct memblock_type {
32 unsigned long cnt; /* number of regions */ 31 unsigned long cnt; /* number of regions */
33 unsigned long max; /* size of the allocated array */ 32 unsigned long max; /* size of the allocated array */
33 phys_addr_t total_size; /* size of all regions */
34 struct memblock_region *regions; 34 struct memblock_region *regions;
35}; 35};
36 36
37struct memblock { 37struct memblock {
38 phys_addr_t current_limit; 38 phys_addr_t current_limit;
39 phys_addr_t memory_size; /* Updated by memblock_analyze() */
40 struct memblock_type memory; 39 struct memblock_type memory;
41 struct memblock_type reserved; 40 struct memblock_type reserved;
42}; 41};
43 42
44extern struct memblock memblock; 43extern struct memblock memblock;
45extern int memblock_debug; 44extern int memblock_debug;
46extern int memblock_can_resize;
47 45
48#define memblock_dbg(fmt, ...) \ 46#define memblock_dbg(fmt, ...) \
49 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 47 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
50 48
51u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align); 49phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
50 phys_addr_t size, phys_addr_t align, int nid);
51phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
52 phys_addr_t size, phys_addr_t align);
52int memblock_free_reserved_regions(void); 53int memblock_free_reserved_regions(void);
53int memblock_reserve_reserved_regions(void); 54int memblock_reserve_reserved_regions(void);
54 55
55extern void memblock_init(void); 56void memblock_allow_resize(void);
56extern void memblock_analyze(void); 57int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
57extern long memblock_add(phys_addr_t base, phys_addr_t size); 58int memblock_add(phys_addr_t base, phys_addr_t size);
58extern long memblock_remove(phys_addr_t base, phys_addr_t size); 59int memblock_remove(phys_addr_t base, phys_addr_t size);
59extern long memblock_free(phys_addr_t base, phys_addr_t size); 60int memblock_free(phys_addr_t base, phys_addr_t size);
60extern long memblock_reserve(phys_addr_t base, phys_addr_t size); 61int memblock_reserve(phys_addr_t base, phys_addr_t size);
62
63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
65 unsigned long *out_end_pfn, int *out_nid);
66
67/**
68 * for_each_mem_pfn_range - early memory pfn range iterator
69 * @i: an integer used as loop variable
70 * @nid: node selector, %MAX_NUMNODES for all nodes
71 * @p_start: ptr to ulong for start pfn of the range, can be %NULL
72 * @p_end: ptr to ulong for end pfn of the range, can be %NULL
73 * @p_nid: ptr to int for nid of the range, can be %NULL
74 *
75 * Walks over configured memory ranges. Available after early_node_map is
76 * populated.
77 */
78#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
79 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
80 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
81#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
82
83void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
84 phys_addr_t *out_end, int *out_nid);
85
86/**
87 * for_each_free_mem_range - iterate through free memblock areas
88 * @i: u64 used as loop variable
89 * @nid: node selector, %MAX_NUMNODES for all nodes
90 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
91 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
92 * @p_nid: ptr to int for nid of the range, can be %NULL
93 *
94 * Walks over free (memory && !reserved) areas of memblock. Available as
95 * soon as memblock is initialized.
96 */
97#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
98 for (i = 0, \
99 __next_free_mem_range(&i, nid, p_start, p_end, p_nid); \
100 i != (u64)ULLONG_MAX; \
101 __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
102
103void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
104 phys_addr_t *out_end, int *out_nid);
61 105
62/* The numa aware allocator is only available if 106/**
63 * CONFIG_ARCH_POPULATES_NODE_MAP is set 107 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
108 * @i: u64 used as loop variable
109 * @nid: node selector, %MAX_NUMNODES for all nodes
110 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
111 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
112 * @p_nid: ptr to int for nid of the range, can be %NULL
113 *
114 * Walks over free (memory && !reserved) areas of memblock in reverse
115 * order. Available as soon as memblock is initialized.
64 */ 116 */
65extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, 117#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
66 int nid); 118 for (i = (u64)ULLONG_MAX, \
67extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, 119 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \
68 int nid); 120 i != (u64)ULLONG_MAX; \
121 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
69 122
70extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); 123#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
124int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
125
126static inline void memblock_set_region_node(struct memblock_region *r, int nid)
127{
128 r->nid = nid;
129}
130
131static inline int memblock_get_region_node(const struct memblock_region *r)
132{
133 return r->nid;
134}
135#else
136static inline void memblock_set_region_node(struct memblock_region *r, int nid)
137{
138}
139
140static inline int memblock_get_region_node(const struct memblock_region *r)
141{
142 return 0;
143}
144#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
145
146phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
147phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
148
149phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
71 150
72/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 151/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
73#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 152#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
74#define MEMBLOCK_ALLOC_ACCESSIBLE 0 153#define MEMBLOCK_ALLOC_ACCESSIBLE 0
75 154
76extern phys_addr_t memblock_alloc_base(phys_addr_t size, 155phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
77 phys_addr_t align, 156 phys_addr_t max_addr);
78 phys_addr_t max_addr); 157phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
79extern phys_addr_t __memblock_alloc_base(phys_addr_t size, 158 phys_addr_t max_addr);
80 phys_addr_t align, 159phys_addr_t memblock_phys_mem_size(void);
81 phys_addr_t max_addr); 160phys_addr_t memblock_start_of_DRAM(void);
82extern phys_addr_t memblock_phys_mem_size(void); 161phys_addr_t memblock_end_of_DRAM(void);
83extern phys_addr_t memblock_start_of_DRAM(void); 162void memblock_enforce_memory_limit(phys_addr_t memory_limit);
84extern phys_addr_t memblock_end_of_DRAM(void); 163int memblock_is_memory(phys_addr_t addr);
85extern void memblock_enforce_memory_limit(phys_addr_t memory_limit); 164int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
86extern int memblock_is_memory(phys_addr_t addr); 165int memblock_is_reserved(phys_addr_t addr);
87extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); 166int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
88extern int memblock_is_reserved(phys_addr_t addr); 167
89extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); 168extern void __memblock_dump_all(void);
90 169
91extern void memblock_dump_all(void); 170static inline void memblock_dump_all(void)
92 171{
93/* Provided by the architecture */ 172 if (memblock_debug)
94extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid); 173 __memblock_dump_all();
95extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1, 174}
96 phys_addr_t addr2, phys_addr_t size2);
97 175
98/** 176/**
99 * memblock_set_current_limit - Set the current allocation limit to allow 177 * memblock_set_current_limit - Set the current allocation limit to allow
@@ -101,7 +179,7 @@ extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
101 * accessible during boot 179 * accessible during boot
102 * @limit: New limit value (physical address) 180 * @limit: New limit value (physical address)
103 */ 181 */
104extern void memblock_set_current_limit(phys_addr_t limit); 182void memblock_set_current_limit(phys_addr_t limit);
105 183
106 184
107/* 185/*
@@ -154,9 +232,9 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
154 region++) 232 region++)
155 233
156 234
157#ifdef ARCH_DISCARD_MEMBLOCK 235#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
158#define __init_memblock __init 236#define __init_memblock __meminit
159#define __initdata_memblock __initdata 237#define __initdata_memblock __meminitdata
160#else 238#else
161#define __init_memblock 239#define __init_memblock
162#define __initdata_memblock 240#define __initdata_memblock
@@ -165,7 +243,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
165#else 243#else
166static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align) 244static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
167{ 245{
168 return MEMBLOCK_ERROR; 246 return 0;
169} 247}
170 248
171#endif /* CONFIG_HAVE_MEMBLOCK */ 249#endif /* CONFIG_HAVE_MEMBLOCK */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b87068a1a09e..9b296ea41bb8 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -85,6 +85,9 @@ extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
87 87
88extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
89extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
90
88static inline 91static inline
89int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 92int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
90{ 93{
@@ -381,5 +384,25 @@ mem_cgroup_print_bad_page(struct page *page)
381} 384}
382#endif 385#endif
383 386
387enum {
388 UNDER_LIMIT,
389 SOFT_LIMIT,
390 OVER_LIMIT,
391};
392
393#ifdef CONFIG_INET
394struct sock;
395#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
396void sock_update_memcg(struct sock *sk);
397void sock_release_memcg(struct sock *sk);
398#else
399static inline void sock_update_memcg(struct sock *sk)
400{
401}
402static inline void sock_release_memcg(struct sock *sk)
403{
404}
405#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
406#endif /* CONFIG_INET */
384#endif /* _LINUX_MEMCONTROL_H */ 407#endif /* _LINUX_MEMCONTROL_H */
385 408
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 935699b30b7c..1ac7f6e405f9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -15,7 +15,6 @@
15#ifndef _LINUX_MEMORY_H_ 15#ifndef _LINUX_MEMORY_H_
16#define _LINUX_MEMORY_H_ 16#define _LINUX_MEMORY_H_
17 17
18#include <linux/sysdev.h>
19#include <linux/node.h> 18#include <linux/node.h>
20#include <linux/compiler.h> 19#include <linux/compiler.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -38,7 +37,7 @@ struct memory_block {
38 int phys_device; /* to which fru does this belong? */ 37 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 38 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 39 int (*phys_callback)(struct memory_block *);
41 struct sys_device sysdev; 40 struct device dev;
42}; 41};
43 42
44int arch_get_memory_phys_device(unsigned long start_pfn); 43int arch_get_memory_phys_device(unsigned long start_pfn);
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
new file mode 100644
index 000000000000..5702d1be13b4
--- /dev/null
+++ b/include/linux/mfd/da9052/da9052.h
@@ -0,0 +1,131 @@
1/*
2 * da9052 declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_DA9052_H
25#define __MFD_DA9052_DA9052_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29#include <linux/slab.h>
30#include <linux/completion.h>
31#include <linux/list.h>
32#include <linux/mfd/core.h>
33
34#include <linux/mfd/da9052/reg.h>
35
36#define DA9052_IRQ_DCIN 0
37#define DA9052_IRQ_VBUS 1
38#define DA9052_IRQ_DCINREM 2
39#define DA9052_IRQ_VBUSREM 3
40#define DA9052_IRQ_VDDLOW 4
41#define DA9052_IRQ_ALARM 5
42#define DA9052_IRQ_SEQRDY 6
43#define DA9052_IRQ_COMP1V2 7
44#define DA9052_IRQ_NONKEY 8
45#define DA9052_IRQ_IDFLOAT 9
46#define DA9052_IRQ_IDGND 10
47#define DA9052_IRQ_CHGEND 11
48#define DA9052_IRQ_TBAT 12
49#define DA9052_IRQ_ADC_EOM 13
50#define DA9052_IRQ_PENDOWN 14
51#define DA9052_IRQ_TSIREADY 15
52#define DA9052_IRQ_GPI0 16
53#define DA9052_IRQ_GPI1 17
54#define DA9052_IRQ_GPI2 18
55#define DA9052_IRQ_GPI3 19
56#define DA9052_IRQ_GPI4 20
57#define DA9052_IRQ_GPI5 21
58#define DA9052_IRQ_GPI6 22
59#define DA9052_IRQ_GPI7 23
60#define DA9052_IRQ_GPI8 24
61#define DA9052_IRQ_GPI9 25
62#define DA9052_IRQ_GPI10 26
63#define DA9052_IRQ_GPI11 27
64#define DA9052_IRQ_GPI12 28
65#define DA9052_IRQ_GPI13 29
66#define DA9052_IRQ_GPI14 30
67#define DA9052_IRQ_GPI15 31
68
69enum da9052_chip_id {
70 DA9052,
71 DA9053_AA,
72 DA9053_BA,
73 DA9053_BB,
74};
75
76struct da9052_pdata;
77
78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev;
82 struct regmap *regmap;
83
84 int irq_base;
85 u8 chip_id;
86
87 int chip_irq;
88};
89
90/* Device I/O API */
91static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
92{
93 int val, ret;
94
95 ret = regmap_read(da9052->regmap, reg, &val);
96 if (ret < 0)
97 return ret;
98 return val;
99}
100
101static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
102 unsigned char val)
103{
104 return regmap_write(da9052->regmap, reg, val);
105}
106
107static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
108 unsigned reg_cnt, unsigned char *val)
109{
110 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
111}
112
113static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
114 unsigned reg_cnt, unsigned char *val)
115{
116 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
117}
118
119static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
120 unsigned char bit_mask,
121 unsigned char reg_val)
122{
123 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
124}
125
126int da9052_device_init(struct da9052 *da9052, u8 chip_id);
127void da9052_device_exit(struct da9052 *da9052);
128
129extern struct regmap_config da9052_regmap_config;
130
131#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9052/pdata.h b/include/linux/mfd/da9052/pdata.h
new file mode 100644
index 000000000000..62c5c3c2992e
--- /dev/null
+++ b/include/linux/mfd/da9052/pdata.h
@@ -0,0 +1,40 @@
1/*
2 * Platform data declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_PDATA_H__
25#define __MFD_DA9052_PDATA_H__
26
27#define DA9052_MAX_REGULATORS 14
28
29struct da9052;
30
31struct da9052_pdata {
32 struct led_platform_data *pled;
33 int (*init) (struct da9052 *da9052);
34 int irq_base;
35 int gpio_base;
36 int use_for_apm;
37 struct regulator_init_data *regulators[DA9052_MAX_REGULATORS];
38};
39
40#endif
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
new file mode 100644
index 000000000000..b97f7309d7f6
--- /dev/null
+++ b/include/linux/mfd/da9052/reg.h
@@ -0,0 +1,749 @@
1/*
2 * Register declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __LINUX_MFD_DA9052_REG_H
25#define __LINUX_MFD_DA9052_REG_H
26
27/* PAGE REGISTERS */
28#define DA9052_PAGE0_CON_REG 0
29#define DA9052_PAGE1_CON_REG 128
30
31/* STATUS REGISTERS */
32#define DA9052_STATUS_A_REG 1
33#define DA9052_STATUS_B_REG 2
34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4
36
37/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6
40#define DA9052_EVENT_C_REG 7
41#define DA9052_EVENT_D_REG 8
42#define DA9052_FAULTLOG_REG 9
43
44/* IRQ REGISTERS */
45#define DA9052_IRQ_MASK_A_REG 10
46#define DA9052_IRQ_MASK_B_REG 11
47#define DA9052_IRQ_MASK_C_REG 12
48#define DA9052_IRQ_MASK_D_REG 13
49
50/* CONTROL REGISTERS */
51#define DA9052_CONTROL_A_REG 14
52#define DA9052_CONTROL_B_REG 15
53#define DA9052_CONTROL_C_REG 16
54#define DA9052_CONTROL_D_REG 17
55
56#define DA9052_PDDIS_REG 18
57#define DA9052_INTERFACE_REG 19
58#define DA9052_RESET_REG 20
59
60/* GPIO REGISTERS */
61#define DA9052_GPIO_0_1_REG 21
62#define DA9052_GPIO_2_3_REG 22
63#define DA9052_GPIO_4_5_REG 23
64#define DA9052_GPIO_6_7_REG 24
65#define DA9052_GPIO_14_15_REG 28
66
67/* POWER SEQUENCER CONTROL REGISTERS */
68#define DA9052_ID_0_1_REG 29
69#define DA9052_ID_2_3_REG 30
70#define DA9052_ID_4_5_REG 31
71#define DA9052_ID_6_7_REG 32
72#define DA9052_ID_8_9_REG 33
73#define DA9052_ID_10_11_REG 34
74#define DA9052_ID_12_13_REG 35
75#define DA9052_ID_14_15_REG 36
76#define DA9052_ID_16_17_REG 37
77#define DA9052_ID_18_19_REG 38
78#define DA9052_ID_20_21_REG 39
79#define DA9052_SEQ_STATUS_REG 40
80#define DA9052_SEQ_A_REG 41
81#define DA9052_SEQ_B_REG 42
82#define DA9052_SEQ_TIMER_REG 43
83
84/* LDO AND BUCK REGISTERS */
85#define DA9052_BUCKA_REG 44
86#define DA9052_BUCKB_REG 45
87#define DA9052_BUCKCORE_REG 46
88#define DA9052_BUCKPRO_REG 47
89#define DA9052_BUCKMEM_REG 48
90#define DA9052_BUCKPERI_REG 49
91#define DA9052_LDO1_REG 50
92#define DA9052_LDO2_REG 51
93#define DA9052_LDO3_REG 52
94#define DA9052_LDO4_REG 53
95#define DA9052_LDO5_REG 54
96#define DA9052_LDO6_REG 55
97#define DA9052_LDO7_REG 56
98#define DA9052_LDO8_REG 57
99#define DA9052_LDO9_REG 58
100#define DA9052_LDO10_REG 59
101#define DA9052_SUPPLY_REG 60
102#define DA9052_PULLDOWN_REG 61
103#define DA9052_CHGBUCK_REG 62
104#define DA9052_WAITCONT_REG 63
105#define DA9052_ISET_REG 64
106#define DA9052_BATCHG_REG 65
107
108/* BATTERY CONTROL REGISTRS */
109#define DA9052_CHG_CONT_REG 66
110#define DA9052_INPUT_CONT_REG 67
111#define DA9052_CHG_TIME_REG 68
112#define DA9052_BBAT_CONT_REG 69
113
114/* LED CONTROL REGISTERS */
115#define DA9052_BOOST_REG 70
116#define DA9052_LED_CONT_REG 71
117#define DA9052_LEDMIN123_REG 72
118#define DA9052_LED1_CONF_REG 73
119#define DA9052_LED2_CONF_REG 74
120#define DA9052_LED3_CONF_REG 75
121#define DA9052_LED1CONT_REG 76
122#define DA9052_LED2CONT_REG 77
123#define DA9052_LED3CONT_REG 78
124#define DA9052_LED_CONT_4_REG 79
125#define DA9052_LED_CONT_5_REG 80
126
127/* ADC CONTROL REGISTERS */
128#define DA9052_ADC_MAN_REG 81
129#define DA9052_ADC_CONT_REG 82
130#define DA9052_ADC_RES_L_REG 83
131#define DA9052_ADC_RES_H_REG 84
132#define DA9052_VDD_RES_REG 85
133#define DA9052_VDD_MON_REG 86
134
135#define DA9052_ICHG_AV_REG 87
136#define DA9052_ICHG_THD_REG 88
137#define DA9052_ICHG_END_REG 89
138#define DA9052_TBAT_RES_REG 90
139#define DA9052_TBAT_HIGHP_REG 91
140#define DA9052_TBAT_HIGHN_REG 92
141#define DA9052_TBAT_LOW_REG 93
142#define DA9052_T_OFFSET_REG 94
143
144#define DA9052_ADCIN4_RES_REG 95
145#define DA9052_AUTO4_HIGH_REG 96
146#define DA9052_AUTO4_LOW_REG 97
147#define DA9052_ADCIN5_RES_REG 98
148#define DA9052_AUTO5_HIGH_REG 99
149#define DA9052_AUTO5_LOW_REG 100
150#define DA9052_ADCIN6_RES_REG 101
151#define DA9052_AUTO6_HIGH_REG 102
152#define DA9052_AUTO6_LOW_REG 103
153
154#define DA9052_TJUNC_RES_REG 104
155
156/* TSI CONTROL REGISTERS */
157#define DA9052_TSI_CONT_A_REG 105
158#define DA9052_TSI_CONT_B_REG 106
159#define DA9052_TSI_X_MSB_REG 107
160#define DA9052_TSI_Y_MSB_REG 108
161#define DA9052_TSI_LSB_REG 109
162#define DA9052_TSI_Z_MSB_REG 110
163
164/* RTC COUNT REGISTERS */
165#define DA9052_COUNT_S_REG 111
166#define DA9052_COUNT_MI_REG 112
167#define DA9052_COUNT_H_REG 113
168#define DA9052_COUNT_D_REG 114
169#define DA9052_COUNT_MO_REG 115
170#define DA9052_COUNT_Y_REG 116
171
172/* RTC CONTROL REGISTERS */
173#define DA9052_ALARM_MI_REG 117
174#define DA9052_ALARM_H_REG 118
175#define DA9052_ALARM_D_REG 119
176#define DA9052_ALARM_MO_REG 120
177#define DA9052_ALARM_Y_REG 121
178#define DA9052_SECOND_A_REG 122
179#define DA9052_SECOND_B_REG 123
180#define DA9052_SECOND_C_REG 124
181#define DA9052_SECOND_D_REG 125
182
183/* PAGE CONFIGURATION BIT */
184#define DA9052_PAGE_CONF 0X80
185
186/* STATUS REGISTER A BITS */
187#define DA9052_STATUSA_VDATDET 0X80
188#define DA9052_STATUSA_VBUSSEL 0X40
189#define DA9052_STATUSA_DCINSEL 0X20
190#define DA9052_STATUSA_VBUSDET 0X10
191#define DA9052_STATUSA_DCINDET 0X08
192#define DA9052_STATUSA_IDGND 0X04
193#define DA9052_STATUSA_IDFLOAT 0X02
194#define DA9052_STATUSA_NONKEY 0X01
195
196/* STATUS REGISTER B BITS */
197#define DA9052_STATUSB_COMPDET 0X80
198#define DA9052_STATUSB_SEQUENCING 0X40
199#define DA9052_STATUSB_GPFB2 0X20
200#define DA9052_STATUSB_CHGTO 0X10
201#define DA9052_STATUSB_CHGEND 0X08
202#define DA9052_STATUSB_CHGLIM 0X04
203#define DA9052_STATUSB_CHGPRE 0X02
204#define DA9052_STATUSB_CHGATT 0X01
205
206/* STATUS REGISTER C BITS */
207#define DA9052_STATUSC_GPI7 0X80
208#define DA9052_STATUSC_GPI6 0X40
209#define DA9052_STATUSC_GPI5 0X20
210#define DA9052_STATUSC_GPI4 0X10
211#define DA9052_STATUSC_GPI3 0X08
212#define DA9052_STATUSC_GPI2 0X04
213#define DA9052_STATUSC_GPI1 0X02
214#define DA9052_STATUSC_GPI0 0X01
215
216/* STATUS REGISTER D BITS */
217#define DA9052_STATUSD_GPI15 0X80
218#define DA9052_STATUSD_GPI14 0X40
219#define DA9052_STATUSD_GPI13 0X20
220#define DA9052_STATUSD_GPI12 0X10
221#define DA9052_STATUSD_GPI11 0X08
222#define DA9052_STATUSD_GPI10 0X04
223#define DA9052_STATUSD_GPI9 0X02
224#define DA9052_STATUSD_GPI8 0X01
225
226/* EVENT REGISTER A BITS */
227#define DA9052_EVENTA_ECOMP1V2 0X80
228#define DA9052_EVENTA_ESEQRDY 0X40
229#define DA9052_EVENTA_EALRAM 0X20
230#define DA9052_EVENTA_EVDDLOW 0X10
231#define DA9052_EVENTA_EVBUSREM 0X08
232#define DA9052_EVENTA_EDCINREM 0X04
233#define DA9052_EVENTA_EVBUSDET 0X02
234#define DA9052_EVENTA_EDCINDET 0X01
235
236/* EVENT REGISTER B BITS */
237#define DA9052_EVENTB_ETSIREADY 0X80
238#define DA9052_EVENTB_EPENDOWN 0X40
239#define DA9052_EVENTB_EADCEOM 0X20
240#define DA9052_EVENTB_ETBAT 0X10
241#define DA9052_EVENTB_ECHGEND 0X08
242#define DA9052_EVENTB_EIDGND 0X04
243#define DA9052_EVENTB_EIDFLOAT 0X02
244#define DA9052_EVENTB_ENONKEY 0X01
245
246/* EVENT REGISTER C BITS */
247#define DA9052_EVENTC_EGPI7 0X80
248#define DA9052_EVENTC_EGPI6 0X40
249#define DA9052_EVENTC_EGPI5 0X20
250#define DA9052_EVENTC_EGPI4 0X10
251#define DA9052_EVENTC_EGPI3 0X08
252#define DA9052_EVENTC_EGPI2 0X04
253#define DA9052_EVENTC_EGPI1 0X02
254#define DA9052_EVENTC_EGPI0 0X01
255
256/* EVENT REGISTER D BITS */
257#define DA9052_EVENTD_EGPI15 0X80
258#define DA9052_EVENTD_EGPI14 0X40
259#define DA9052_EVENTD_EGPI13 0X20
260#define DA9052_EVENTD_EGPI12 0X10
261#define DA9052_EVENTD_EGPI11 0X08
262#define DA9052_EVENTD_EGPI10 0X04
263#define DA9052_EVENTD_EGPI9 0X02
264#define DA9052_EVENTD_EGPI8 0X01
265
266/* IRQ MASK REGISTERS BITS */
267#define DA9052_M_NONKEY 0X0100
268
269/* TSI EVENT REGISTERS BITS */
270#define DA9052_E_PEN_DOWN 0X4000
271#define DA9052_E_TSI_READY 0X8000
272
273/* FAULT LOG REGISTER BITS */
274#define DA9052_FAULTLOG_WAITSET 0X80
275#define DA9052_FAULTLOG_NSDSET 0X40
276#define DA9052_FAULTLOG_KEYSHUT 0X20
277#define DA9052_FAULTLOG_TEMPOVER 0X08
278#define DA9052_FAULTLOG_VDDSTART 0X04
279#define DA9052_FAULTLOG_VDDFAULT 0X02
280#define DA9052_FAULTLOG_TWDERROR 0X01
281
282/* CONTROL REGISTER A BITS */
283#define DA9052_CONTROLA_GPIV 0X80
284#define DA9052_CONTROLA_PMOTYPE 0X20
285#define DA9052_CONTROLA_PMOV 0X10
286#define DA9052_CONTROLA_PMIV 0X08
287#define DA9052_CONTROLA_PMIFV 0X08
288#define DA9052_CONTROLA_PWR1EN 0X04
289#define DA9052_CONTROLA_PWREN 0X02
290#define DA9052_CONTROLA_SYSEN 0X01
291
292/* CONTROL REGISTER B BITS */
293#define DA9052_CONTROLB_SHUTDOWN 0X80
294#define DA9052_CONTROLB_DEEPSLEEP 0X40
295#define DA9052_CONTROL_B_WRITEMODE 0X20
296#define DA9052_CONTROLB_BBATEN 0X10
297#define DA9052_CONTROLB_OTPREADEN 0X08
298#define DA9052_CONTROLB_AUTOBOOT 0X04
299#define DA9052_CONTROLB_ACTDIODE 0X02
300#define DA9052_CONTROLB_BUCKMERGE 0X01
301
302/* CONTROL REGISTER C BITS */
303#define DA9052_CONTROLC_BLINKDUR 0X80
304#define DA9052_CONTROLC_BLINKFRQ 0X60
305#define DA9052_CONTROLC_DEBOUNCING 0X1C
306#define DA9052_CONTROLC_PMFB2PIN 0X02
307#define DA9052_CONTROLC_PMFB1PIN 0X01
308
309/* CONTROL REGISTER D BITS */
310#define DA9052_CONTROLD_WATCHDOG 0X80
311#define DA9052_CONTROLD_ACCDETEN 0X40
312#define DA9052_CONTROLD_GPI1415SD 0X20
313#define DA9052_CONTROLD_NONKEYSD 0X10
314#define DA9052_CONTROLD_KEEPACTEN 0X08
315#define DA9052_CONTROLD_TWDSCALE 0X07
316
317/* POWER DOWN DISABLE REGISTER BITS */
318#define DA9052_PDDIS_PMCONTPD 0X80
319#define DA9052_PDDIS_OUT32KPD 0X40
320#define DA9052_PDDIS_CHGBBATPD 0X20
321#define DA9052_PDDIS_CHGPD 0X10
322#define DA9052_PDDIS_HS2WIREPD 0X08
323#define DA9052_PDDIS_PMIFPD 0X04
324#define DA9052_PDDIS_GPADCPD 0X02
325#define DA9052_PDDIS_GPIOPD 0X01
326
327/* CONTROL REGISTER D BITS */
328#define DA9052_INTERFACE_IFBASEADDR 0XE0
329#define DA9052_INTERFACE_NCSPOL 0X10
330#define DA9052_INTERFACE_RWPOL 0X08
331#define DA9052_INTERFACE_CPHA 0X04
332#define DA9052_INTERFACE_CPOL 0X02
333#define DA9052_INTERFACE_IFTYPE 0X01
334
335/* CONTROL REGISTER D BITS */
336#define DA9052_RESET_RESETEVENT 0XC0
337#define DA9052_RESET_RESETTIMER 0X3F
338
339/* GPIO REGISTERS */
340/* GPIO CONTROL REGISTER BITS */
341#define DA9052_GPIO_EVEN_PORT_PIN 0X03
342#define DA9052_GPIO_EVEN_PORT_TYPE 0X04
343#define DA9052_GPIO_EVEN_PORT_MODE 0X08
344
345#define DA9052_GPIO_ODD_PORT_PIN 0X30
346#define DA9052_GPIO_ODD_PORT_TYPE 0X40
347#define DA9052_GPIO_ODD_PORT_MODE 0X80
348
349/*POWER SEQUENCER REGISTER BITS */
350/* SEQ CONTROL REGISTER BITS FOR ID 0 AND 1 */
351#define DA9052_ID01_LDO1STEP 0XF0
352#define DA9052_ID01_SYSPRE 0X04
353#define DA9052_ID01_DEFSUPPLY 0X02
354#define DA9052_ID01_NRESMODE 0X01
355
356/* SEQ CONTROL REGISTER BITS FOR ID 2 AND 3 */
357#define DA9052_ID23_LDO3STEP 0XF0
358#define DA9052_ID23_LDO2STEP 0X0F
359
360/* SEQ CONTROL REGISTER BITS FOR ID 4 AND 5 */
361#define DA9052_ID45_LDO5STEP 0XF0
362#define DA9052_ID45_LDO4STEP 0X0F
363
364/* SEQ CONTROL REGISTER BITS FOR ID 6 AND 7 */
365#define DA9052_ID67_LDO7STEP 0XF0
366#define DA9052_ID67_LDO6STEP 0X0F
367
368/* SEQ CONTROL REGISTER BITS FOR ID 8 AND 9 */
369#define DA9052_ID89_LDO9STEP 0XF0
370#define DA9052_ID89_LDO8STEP 0X0F
371
372/* SEQ CONTROL REGISTER BITS FOR ID 10 AND 11 */
373#define DA9052_ID1011_PDDISSTEP 0XF0
374#define DA9052_ID1011_LDO10STEP 0X0F
375
376/* SEQ CONTROL REGISTER BITS FOR ID 12 AND 13 */
377#define DA9052_ID1213_VMEMSWSTEP 0XF0
378#define DA9052_ID1213_VPERISWSTEP 0X0F
379
380/* SEQ CONTROL REGISTER BITS FOR ID 14 AND 15 */
381#define DA9052_ID1415_BUCKPROSTEP 0XF0
382#define DA9052_ID1415_BUCKCORESTEP 0X0F
383
384/* SEQ CONTROL REGISTER BITS FOR ID 16 AND 17 */
385#define DA9052_ID1617_BUCKPERISTEP 0XF0
386#define DA9052_ID1617_BUCKMEMSTEP 0X0F
387
388/* SEQ CONTROL REGISTER BITS FOR ID 18 AND 19 */
389#define DA9052_ID1819_GPRISE2STEP 0XF0
390#define DA9052_ID1819_GPRISE1STEP 0X0F
391
392/* SEQ CONTROL REGISTER BITS FOR ID 20 AND 21 */
393#define DA9052_ID2021_GPFALL2STEP 0XF0
394#define DA9052_ID2021_GPFALL1STEP 0X0F
395
396/* POWER SEQ STATUS REGISTER BITS */
397#define DA9052_SEQSTATUS_SEQPOINTER 0XF0
398#define DA9052_SEQSTATUS_WAITSTEP 0X0F
399
400/* POWER SEQ A REGISTER BITS */
401#define DA9052_SEQA_POWEREND 0XF0
402#define DA9052_SEQA_SYSTEMEND 0X0F
403
404/* POWER SEQ B REGISTER BITS */
405#define DA9052_SEQB_PARTDOWN 0XF0
406#define DA9052_SEQB_MAXCOUNT 0X0F
407
408/* POWER SEQ TIMER REGISTER BITS */
409#define DA9052_SEQTIMER_SEQDUMMY 0XF0
410#define DA9052_SEQTIMER_SEQTIME 0X0F
411
412/*POWER SUPPLY CONTROL REGISTER BITS */
413/* BUCK REGISTER A BITS */
414#define DA9052_BUCKA_BPROILIM 0XC0
415#define DA9052_BUCKA_BPROMODE 0X30
416#define DA9052_BUCKA_BCOREILIM 0X0C
417#define DA9052_BUCKA_BCOREMODE 0X03
418
419/* BUCK REGISTER B BITS */
420#define DA9052_BUCKB_BERIILIM 0XC0
421#define DA9052_BUCKB_BPERIMODE 0X30
422#define DA9052_BUCKB_BMEMILIM 0X0C
423#define DA9052_BUCKB_BMEMMODE 0X03
424
425/* BUCKCORE REGISTER BITS */
426#define DA9052_BUCKCORE_BCORECONF 0X80
427#define DA9052_BUCKCORE_BCOREEN 0X40
428#define DA9052_BUCKCORE_VBCORE 0X3F
429
430/* BUCKPRO REGISTER BITS */
431#define DA9052_BUCKPRO_BPROCONF 0X80
432#define DA9052_BUCKPRO_BPROEN 0X40
433#define DA9052_BUCKPRO_VBPRO 0X3F
434
435/* BUCKMEM REGISTER BITS */
436#define DA9052_BUCKMEM_BMEMCONF 0X80
437#define DA9052_BUCKMEM_BMEMEN 0X40
438#define DA9052_BUCKMEM_VBMEM 0X3F
439
440/* BUCKPERI REGISTER BITS */
441#define DA9052_BUCKPERI_BPERICONF 0X80
442#define DA9052_BUCKPERI_BPERIEN 0X40
443#define DA9052_BUCKPERI_BPERIHS 0X20
444#define DA9052_BUCKPERI_VBPERI 0X1F
445
446/* LDO1 REGISTER BITS */
447#define DA9052_LDO1_LDO1CONF 0X80
448#define DA9052_LDO1_LDO1EN 0X40
449#define DA9052_LDO1_VLDO1 0X1F
450
451/* LDO2 REGISTER BITS */
452#define DA9052_LDO2_LDO2CONF 0X80
453#define DA9052_LDO2_LDO2EN 0X40
454#define DA9052_LDO2_VLDO2 0X3F
455
456/* LDO3 REGISTER BITS */
457#define DA9052_LDO3_LDO3CONF 0X80
458#define DA9052_LDO3_LDO3EN 0X40
459#define DA9052_LDO3_VLDO3 0X3F
460
461/* LDO4 REGISTER BITS */
462#define DA9052_LDO4_LDO4CONF 0X80
463#define DA9052_LDO4_LDO4EN 0X40
464#define DA9052_LDO4_VLDO4 0X3F
465
466/* LDO5 REGISTER BITS */
467#define DA9052_LDO5_LDO5CONF 0X80
468#define DA9052_LDO5_LDO5EN 0X40
469#define DA9052_LDO5_VLDO5 0X3F
470
471/* LDO6 REGISTER BITS */
472#define DA9052_LDO6_LDO6CONF 0X80
473#define DA9052_LDO6_LDO6EN 0X40
474#define DA9052_LDO6_VLDO6 0X3F
475
476/* LDO7 REGISTER BITS */
477#define DA9052_LDO7_LDO7CONF 0X80
478#define DA9052_LDO7_LDO7EN 0X40
479#define DA9052_LDO7_VLDO7 0X3F
480
481/* LDO8 REGISTER BITS */
482#define DA9052_LDO8_LDO8CONF 0X80
483#define DA9052_LDO8_LDO8EN 0X40
484#define DA9052_LDO8_VLDO8 0X3F
485
486/* LDO9 REGISTER BITS */
487#define DA9052_LDO9_LDO9CONF 0X80
488#define DA9052_LDO9_LDO9EN 0X40
489#define DA9052_LDO9_VLDO9 0X3F
490
491/* LDO10 REGISTER BITS */
492#define DA9052_LDO10_LDO10CONF 0X80
493#define DA9052_LDO10_LDO10EN 0X40
494#define DA9052_LDO10_VLDO10 0X3F
495
496/* SUPPLY REGISTER BITS */
497#define DA9052_SUPPLY_VLOCK 0X80
498#define DA9052_SUPPLY_VMEMSWEN 0X40
499#define DA9052_SUPPLY_VPERISWEN 0X20
500#define DA9052_SUPPLY_VLDO3GO 0X10
501#define DA9052_SUPPLY_VLDO2GO 0X08
502#define DA9052_SUPPLY_VBMEMGO 0X04
503#define DA9052_SUPPLY_VBPROGO 0X02
504#define DA9052_SUPPLY_VBCOREGO 0X01
505
506/* PULLDOWN REGISTER BITS */
507#define DA9052_PULLDOWN_LDO5PDDIS 0X20
508#define DA9052_PULLDOWN_LDO2PDDIS 0X10
509#define DA9052_PULLDOWN_LDO1PDDIS 0X08
510#define DA9052_PULLDOWN_MEMPDDIS 0X04
511#define DA9052_PULLDOWN_PROPDDIS 0X02
512#define DA9052_PULLDOWN_COREPDDIS 0X01
513
514/* BAT CHARGER REGISTER BITS */
515/* CHARGER BUCK REGISTER BITS */
516#define DA9052_CHGBUCK_CHGTEMP 0X80
517#define DA9052_CHGBUCK_CHGUSBILIM 0X40
518#define DA9052_CHGBUCK_CHGBUCKLP 0X20
519#define DA9052_CHGBUCK_CHGBUCKEN 0X10
520#define DA9052_CHGBUCK_ISETBUCK 0X0F
521
522/* WAIT COUNTER REGISTER BITS */
523#define DA9052_WAITCONT_WAITDIR 0X80
524#define DA9052_WAITCONT_RTCCLOCK 0X40
525#define DA9052_WAITCONT_WAITMODE 0X20
526#define DA9052_WAITCONT_EN32KOUT 0X10
527#define DA9052_WAITCONT_DELAYTIME 0X0F
528
529/* ISET CONTROL REGISTER BITS */
530#define DA9052_ISET_ISETDCIN 0XF0
531#define DA9052_ISET_ISETVBUS 0X0F
532
533/* BATTERY CHARGER CONTROL REGISTER BITS */
534#define DA9052_BATCHG_ICHGPRE 0XC0
535#define DA9052_BATCHG_ICHGBAT 0X3F
536
537/* CHARGER COUNTER REGISTER BITS */
538#define DA9052_CHG_CONT_VCHG_BAT 0XF8
539#define DA9052_CHG_CONT_TCTR 0X07
540
541/* INPUT CONTROL REGISTER BITS */
542#define DA9052_INPUT_CONT_TCTR_MODE 0X80
543#define DA9052_INPUT_CONT_VBUS_SUSP 0X10
544#define DA9052_INPUT_CONT_DCIN_SUSP 0X08
545
546/* CHARGING TIME REGISTER BITS */
547#define DA9052_CHGTIME_CHGTIME 0XFF
548
549/* BACKUP BATTERY CONTROL REGISTER BITS */
550#define DA9052_BBATCONT_BCHARGERISET 0XF0
551#define DA9052_BBATCONT_BCHARGERVSET 0X0F
552
553/* LED REGISTERS BITS */
554/* LED BOOST REGISTER BITS */
555#define DA9052_BOOST_EBFAULT 0X80
556#define DA9052_BOOST_MBFAULT 0X40
557#define DA9052_BOOST_BOOSTFRQ 0X20
558#define DA9052_BOOST_BOOSTILIM 0X10
559#define DA9052_BOOST_LED3INEN 0X08
560#define DA9052_BOOST_LED2INEN 0X04
561#define DA9052_BOOST_LED1INEN 0X02
562#define DA9052_BOOST_BOOSTEN 0X01
563
564/* LED CONTROL REGISTER BITS */
565#define DA9052_LEDCONT_SELLEDMODE 0X80
566#define DA9052_LEDCONT_LED3ICONT 0X40
567#define DA9052_LEDCONT_LED3RAMP 0X20
568#define DA9052_LEDCONT_LED3EN 0X10
569#define DA9052_LEDCONT_LED2RAMP 0X08
570#define DA9052_LEDCONT_LED2EN 0X04
571#define DA9052_LEDCONT_LED1RAMP 0X02
572#define DA9052_LEDCONT_LED1EN 0X01
573
574/* LEDMIN123 REGISTER BIT */
575#define DA9052_LEDMIN123_LEDMINCURRENT 0XFF
576
577/* LED1CONF REGISTER BIT */
578#define DA9052_LED1CONF_LED1CURRENT 0XFF
579
580/* LED2CONF REGISTER BIT */
581#define DA9052_LED2CONF_LED2CURRENT 0XFF
582
583/* LED3CONF REGISTER BIT */
584#define DA9052_LED3CONF_LED3CURRENT 0XFF
585
586/* LED COUNT REGISTER BIT */
587#define DA9052_LED_CONT_DIM 0X80
588
589/* ADC MAN REGISTERS BITS */
590#define DA9052_ADC_MAN_MAN_CONV 0X10
591#define DA9052_ADC_MAN_MUXSEL_VDDOUT 0X00
592#define DA9052_ADC_MAN_MUXSEL_ICH 0X01
593#define DA9052_ADC_MAN_MUXSEL_TBAT 0X02
594#define DA9052_ADC_MAN_MUXSEL_VBAT 0X03
595#define DA9052_ADC_MAN_MUXSEL_AD4 0X04
596#define DA9052_ADC_MAN_MUXSEL_AD5 0X05
597#define DA9052_ADC_MAN_MUXSEL_AD6 0X06
598#define DA9052_ADC_MAN_MUXSEL_VBBAT 0X09
599
600/* ADC CONTROL REGSISTERS BITS */
601#define DA9052_ADCCONT_COMP1V2EN 0X80
602#define DA9052_ADCCONT_ADCMODE 0X40
603#define DA9052_ADCCONT_TBATISRCEN 0X20
604#define DA9052_ADCCONT_AD4ISRCEN 0X10
605#define DA9052_ADCCONT_AUTOAD6EN 0X08
606#define DA9052_ADCCONT_AUTOAD5EN 0X04
607#define DA9052_ADCCONT_AUTOAD4EN 0X02
608#define DA9052_ADCCONT_AUTOVDDEN 0X01
609
610/* ADC 10 BIT MANUAL CONVERSION RESULT LOW REGISTER */
611#define DA9052_ADC_RES_LSB 0X03
612
613/* ADC 10 BIT MANUAL CONVERSION RESULT HIGH REGISTER */
614#define DA9052_ADCRESH_ADCRESMSB 0XFF
615
616/* VDD RES REGSISTER BIT*/
617#define DA9052_VDDRES_VDDOUTRES 0XFF
618
619/* VDD MON REGSISTER BIT */
620#define DA9052_VDDMON_VDDOUTMON 0XFF
621
622/* ICHG_AV REGSISTER BIT */
623#define DA9052_ICHGAV_ICHGAV 0XFF
624
625/* ICHG_THD REGSISTER BIT */
626#define DA9052_ICHGTHD_ICHGTHD 0XFF
627
628/* ICHG_END REGSISTER BIT */
629#define DA9052_ICHGEND_ICHGEND 0XFF
630
631/* TBAT_RES REGSISTER BIT */
632#define DA9052_TBATRES_TBATRES 0XFF
633
634/* TBAT_HIGHP REGSISTER BIT */
635#define DA9052_TBATHIGHP_TBATHIGHP 0XFF
636
637/* TBAT_HIGHN REGSISTER BIT */
638#define DA9052_TBATHIGHN_TBATHIGHN 0XFF
639
640/* TBAT_LOW REGSISTER BIT */
641#define DA9052_TBATLOW_TBATLOW 0XFF
642
643/* T_OFFSET REGSISTER BIT */
644#define DA9052_TOFFSET_TOFFSET 0XFF
645
646/* ADCIN4_RES REGSISTER BIT */
647#define DA9052_ADCIN4RES_ADCIN4RES 0XFF
648
649/* ADCIN4_HIGH REGSISTER BIT */
650#define DA9052_AUTO4HIGH_AUTO4HIGH 0XFF
651
652/* ADCIN4_LOW REGSISTER BIT */
653#define DA9052_AUTO4LOW_AUTO4LOW 0XFF
654
655/* ADCIN5_RES REGSISTER BIT */
656#define DA9052_ADCIN5RES_ADCIN5RES 0XFF
657
658/* ADCIN5_HIGH REGSISTER BIT */
659#define DA9052_AUTO5HIGH_AUTOHIGH 0XFF
660
661/* ADCIN5_LOW REGSISTER BIT */
662#define DA9052_AUTO5LOW_AUTO5LOW 0XFF
663
664/* ADCIN6_RES REGSISTER BIT */
665#define DA9052_ADCIN6RES_ADCIN6RES 0XFF
666
667/* ADCIN6_HIGH REGSISTER BIT */
668#define DA9052_AUTO6HIGH_AUTO6HIGH 0XFF
669
670/* ADCIN6_LOW REGSISTER BIT */
671#define DA9052_AUTO6LOW_AUTO6LOW 0XFF
672
673/* TJUNC_RES REGSISTER BIT*/
674#define DA9052_TJUNCRES_TJUNCRES 0XFF
675
676/* TSI REGISTER */
677/* TSI CONTROL REGISTER A BITS */
678#define DA9052_TSICONTA_TSIDELAY 0XC0
679#define DA9052_TSICONTA_TSISKIP 0X38
680#define DA9052_TSICONTA_TSIMODE 0X04
681#define DA9052_TSICONTA_PENDETEN 0X02
682#define DA9052_TSICONTA_AUTOTSIEN 0X01
683
684/* TSI CONTROL REGISTER B BITS */
685#define DA9052_TSICONTB_ADCREF 0X80
686#define DA9052_TSICONTB_TSIMAN 0X40
687#define DA9052_TSICONTB_TSIMUX 0X30
688#define DA9052_TSICONTB_TSISEL3 0X08
689#define DA9052_TSICONTB_TSISEL2 0X04
690#define DA9052_TSICONTB_TSISEL1 0X02
691#define DA9052_TSICONTB_TSISEL0 0X01
692
693/* TSI X CO-ORDINATE MSB RESULT REGISTER BITS */
694#define DA9052_TSIXMSB_TSIXM 0XFF
695
696/* TSI Y CO-ORDINATE MSB RESULT REGISTER BITS */
697#define DA9052_TSIYMSB_TSIYM 0XFF
698
699/* TSI CO-ORDINATE LSB RESULT REGISTER BITS */
700#define DA9052_TSILSB_PENDOWN 0X40
701#define DA9052_TSILSB_TSIZL 0X30
702#define DA9052_TSILSB_TSIYL 0X0C
703#define DA9052_TSILSB_TSIXL 0X03
704
705/* TSI Z MEASUREMENT MSB RESULT REGISTER BIT */
706#define DA9052_TSIZMSB_TSIZM 0XFF
707
708/* RTC REGISTER */
709/* RTC TIMER SECONDS REGISTER BITS */
710#define DA9052_COUNTS_MONITOR 0X40
711#define DA9052_RTC_SEC 0X3F
712
713/* RTC TIMER MINUTES REGISTER BIT */
714#define DA9052_RTC_MIN 0X3F
715
716/* RTC TIMER HOUR REGISTER BIT */
717#define DA9052_RTC_HOUR 0X1F
718
719/* RTC TIMER DAYS REGISTER BIT */
720#define DA9052_RTC_DAY 0X1F
721
722/* RTC TIMER MONTHS REGISTER BIT */
723#define DA9052_RTC_MONTH 0X0F
724
725/* RTC TIMER YEARS REGISTER BIT */
726#define DA9052_RTC_YEAR 0X3F
727
728/* RTC ALARM MINUTES REGISTER BITS */
729#define DA9052_ALARMM_I_TICK_TYPE 0X80
730#define DA9052_ALARMMI_ALARMTYPE 0X40
731
732/* RTC ALARM YEARS REGISTER BITS */
733#define DA9052_ALARM_Y_TICK_ON 0X80
734#define DA9052_ALARM_Y_ALARM_ON 0X40
735
736/* RTC SECONDS REGISTER A BITS */
737#define DA9052_SECONDA_SECONDSA 0XFF
738
739/* RTC SECONDS REGISTER B BITS */
740#define DA9052_SECONDB_SECONDSB 0XFF
741
742/* RTC SECONDS REGISTER C BITS */
743#define DA9052_SECONDC_SECONDSC 0XFF
744
745/* RTC SECONDS REGISTER D BITS */
746#define DA9052_SECONDD_SECONDSD 0XFF
747
748#endif
749/* __LINUX_MFD_DA9052_REG_H */
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 27748230aa69..2783eca629a0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -9,6 +9,7 @@
9#define __LINUX_MII_H__ 9#define __LINUX_MII_H__
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ethtool.h>
12 13
13/* Generic MII registers. */ 14/* Generic MII registers. */
14#define MII_BMCR 0x00 /* Basic mode control register */ 15#define MII_BMCR 0x00 /* Basic mode control register */
@@ -240,6 +241,205 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 241}
241 242
242/** 243/**
244 * ethtool_adv_to_mii_adv_t
245 * @ethadv: the ethtool advertisement settings
246 *
247 * A small helper function that translates ethtool advertisement
248 * settings to phy autonegotiation advertisements for the
249 * MII_ADVERTISE register.
250 */
251static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
252{
253 u32 result = 0;
254
255 if (ethadv & ADVERTISED_10baseT_Half)
256 result |= ADVERTISE_10HALF;
257 if (ethadv & ADVERTISED_10baseT_Full)
258 result |= ADVERTISE_10FULL;
259 if (ethadv & ADVERTISED_100baseT_Half)
260 result |= ADVERTISE_100HALF;
261 if (ethadv & ADVERTISED_100baseT_Full)
262 result |= ADVERTISE_100FULL;
263 if (ethadv & ADVERTISED_Pause)
264 result |= ADVERTISE_PAUSE_CAP;
265 if (ethadv & ADVERTISED_Asym_Pause)
266 result |= ADVERTISE_PAUSE_ASYM;
267
268 return result;
269}
270
271/**
272 * mii_adv_to_ethtool_adv_t
273 * @adv: value of the MII_ADVERTISE register
274 *
275 * A small helper function that translates MII_ADVERTISE bits
276 * to ethtool advertisement settings.
277 */
278static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
279{
280 u32 result = 0;
281
282 if (adv & ADVERTISE_10HALF)
283 result |= ADVERTISED_10baseT_Half;
284 if (adv & ADVERTISE_10FULL)
285 result |= ADVERTISED_10baseT_Full;
286 if (adv & ADVERTISE_100HALF)
287 result |= ADVERTISED_100baseT_Half;
288 if (adv & ADVERTISE_100FULL)
289 result |= ADVERTISED_100baseT_Full;
290 if (adv & ADVERTISE_PAUSE_CAP)
291 result |= ADVERTISED_Pause;
292 if (adv & ADVERTISE_PAUSE_ASYM)
293 result |= ADVERTISED_Asym_Pause;
294
295 return result;
296}
297
298/**
299 * ethtool_adv_to_mii_ctrl1000_t
300 * @ethadv: the ethtool advertisement settings
301 *
302 * A small helper function that translates ethtool advertisement
303 * settings to phy autonegotiation advertisements for the
304 * MII_CTRL1000 register when in 1000T mode.
305 */
306static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
307{
308 u32 result = 0;
309
310 if (ethadv & ADVERTISED_1000baseT_Half)
311 result |= ADVERTISE_1000HALF;
312 if (ethadv & ADVERTISED_1000baseT_Full)
313 result |= ADVERTISE_1000FULL;
314
315 return result;
316}
317
318/**
319 * mii_ctrl1000_to_ethtool_adv_t
320 * @adv: value of the MII_CTRL1000 register
321 *
322 * A small helper function that translates MII_CTRL1000
323 * bits, when in 1000Base-T mode, to ethtool
324 * advertisement settings.
325 */
326static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
327{
328 u32 result = 0;
329
330 if (adv & ADVERTISE_1000HALF)
331 result |= ADVERTISED_1000baseT_Half;
332 if (adv & ADVERTISE_1000FULL)
333 result |= ADVERTISED_1000baseT_Full;
334
335 return result;
336}
337
338/**
339 * mii_lpa_to_ethtool_lpa_t
340 * @adv: value of the MII_LPA register
341 *
342 * A small helper function that translates MII_LPA
343 * bits, when in 1000Base-T mode, to ethtool
344 * LP advertisement settings.
345 */
346static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
347{
348 u32 result = 0;
349
350 if (lpa & LPA_LPACK)
351 result |= ADVERTISED_Autoneg;
352
353 return result | mii_adv_to_ethtool_adv_t(lpa);
354}
355
356/**
357 * mii_stat1000_to_ethtool_lpa_t
358 * @adv: value of the MII_STAT1000 register
359 *
360 * A small helper function that translates MII_STAT1000
361 * bits, when in 1000Base-T mode, to ethtool
362 * advertisement settings.
363 */
364static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
365{
366 u32 result = 0;
367
368 if (lpa & LPA_1000HALF)
369 result |= ADVERTISED_1000baseT_Half;
370 if (lpa & LPA_1000FULL)
371 result |= ADVERTISED_1000baseT_Full;
372
373 return result;
374}
375
376/**
377 * ethtool_adv_to_mii_adv_x
378 * @ethadv: the ethtool advertisement settings
379 *
380 * A small helper function that translates ethtool advertisement
381 * settings to phy autonegotiation advertisements for the
382 * MII_CTRL1000 register when in 1000Base-X mode.
383 */
384static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
385{
386 u32 result = 0;
387
388 if (ethadv & ADVERTISED_1000baseT_Half)
389 result |= ADVERTISE_1000XHALF;
390 if (ethadv & ADVERTISED_1000baseT_Full)
391 result |= ADVERTISE_1000XFULL;
392 if (ethadv & ADVERTISED_Pause)
393 result |= ADVERTISE_1000XPAUSE;
394 if (ethadv & ADVERTISED_Asym_Pause)
395 result |= ADVERTISE_1000XPSE_ASYM;
396
397 return result;
398}
399
400/**
401 * mii_adv_to_ethtool_adv_x
402 * @adv: value of the MII_CTRL1000 register
403 *
404 * A small helper function that translates MII_CTRL1000
405 * bits, when in 1000Base-X mode, to ethtool
406 * advertisement settings.
407 */
408static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
409{
410 u32 result = 0;
411
412 if (adv & ADVERTISE_1000XHALF)
413 result |= ADVERTISED_1000baseT_Half;
414 if (adv & ADVERTISE_1000XFULL)
415 result |= ADVERTISED_1000baseT_Full;
416 if (adv & ADVERTISE_1000XPAUSE)
417 result |= ADVERTISED_Pause;
418 if (adv & ADVERTISE_1000XPSE_ASYM)
419 result |= ADVERTISED_Asym_Pause;
420
421 return result;
422}
423
424/**
425 * mii_lpa_to_ethtool_lpa_x
426 * @adv: value of the MII_LPA register
427 *
428 * A small helper function that translates MII_LPA
429 * bits, when in 1000Base-X mode, to ethtool
430 * LP advertisement settings.
431 */
432static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
433{
434 u32 result = 0;
435
436 if (lpa & LPA_LPACK)
437 result |= ADVERTISED_Autoneg;
438
439 return result | mii_adv_to_ethtool_adv_x(lpa);
440}
441
442/**
243 * mii_advertise_flowctrl - get flow control advertisement flags 443 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) 444 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */ 445 */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c41d7270c6c6..32085249e9cb 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -54,7 +54,7 @@ struct miscdevice {
54 struct device *parent; 54 struct device *parent;
55 struct device *this_device; 55 struct device *this_device;
56 const char *nodename; 56 const char *nodename;
57 mode_t mode; 57 umode_t mode;
58}; 58};
59 59
60extern int misc_register(struct miscdevice * misc); 60extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index b56e4587208d..9958ff2cad3c 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -59,12 +59,15 @@ enum {
59 MLX4_CMD_HW_HEALTH_CHECK = 0x50, 59 MLX4_CMD_HW_HEALTH_CHECK = 0x50,
60 MLX4_CMD_SET_PORT = 0xc, 60 MLX4_CMD_SET_PORT = 0xc,
61 MLX4_CMD_SET_NODE = 0x5a, 61 MLX4_CMD_SET_NODE = 0x5a,
62 MLX4_CMD_QUERY_FUNC = 0x56,
62 MLX4_CMD_ACCESS_DDR = 0x2e, 63 MLX4_CMD_ACCESS_DDR = 0x2e,
63 MLX4_CMD_MAP_ICM = 0xffa, 64 MLX4_CMD_MAP_ICM = 0xffa,
64 MLX4_CMD_UNMAP_ICM = 0xff9, 65 MLX4_CMD_UNMAP_ICM = 0xff9,
65 MLX4_CMD_MAP_ICM_AUX = 0xffc, 66 MLX4_CMD_MAP_ICM_AUX = 0xffc,
66 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 67 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
67 MLX4_CMD_SET_ICM_SIZE = 0xffd, 68 MLX4_CMD_SET_ICM_SIZE = 0xffd,
69 /*master notify fw on finish for slave's flr*/
70 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
68 71
69 /* TPT commands */ 72 /* TPT commands */
70 MLX4_CMD_SW2HW_MPT = 0xd, 73 MLX4_CMD_SW2HW_MPT = 0xd,
@@ -119,6 +122,26 @@ enum {
119 /* miscellaneous commands */ 122 /* miscellaneous commands */
120 MLX4_CMD_DIAG_RPRT = 0x30, 123 MLX4_CMD_DIAG_RPRT = 0x30,
121 MLX4_CMD_NOP = 0x31, 124 MLX4_CMD_NOP = 0x31,
125 MLX4_CMD_ACCESS_MEM = 0x2e,
126 MLX4_CMD_SET_VEP = 0x52,
127
128 /* Ethernet specific commands */
129 MLX4_CMD_SET_VLAN_FLTR = 0x47,
130 MLX4_CMD_SET_MCAST_FLTR = 0x48,
131 MLX4_CMD_DUMP_ETH_STATS = 0x49,
132
133 /* Communication channel commands */
134 MLX4_CMD_ARM_COMM_CHANNEL = 0x57,
135 MLX4_CMD_GEN_EQE = 0x58,
136
137 /* virtual commands */
138 MLX4_CMD_ALLOC_RES = 0xf00,
139 MLX4_CMD_FREE_RES = 0xf01,
140 MLX4_CMD_MCAST_ATTACH = 0xf05,
141 MLX4_CMD_UCAST_ATTACH = 0xf06,
142 MLX4_CMD_PROMISC = 0xf08,
143 MLX4_CMD_QUERY_FUNC_CAP = 0xf0a,
144 MLX4_CMD_QP_ATTACH = 0xf0b,
122 145
123 /* debug commands */ 146 /* debug commands */
124 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, 147 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
@@ -126,6 +149,7 @@ enum {
126 149
127 /* statistics commands */ 150 /* statistics commands */
128 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55,
129}; 153};
130 154
131enum { 155enum {
@@ -135,7 +159,8 @@ enum {
135}; 159};
136 160
137enum { 161enum {
138 MLX4_MAILBOX_SIZE = 4096 162 MLX4_MAILBOX_SIZE = 4096,
163 MLX4_ACCESS_MEM_ALIGN = 256,
139}; 164};
140 165
141enum { 166enum {
@@ -148,6 +173,11 @@ enum {
148 MLX4_SET_PORT_GID_TABLE = 0x5, 173 MLX4_SET_PORT_GID_TABLE = 0x5,
149}; 174};
150 175
176enum {
177 MLX4_CMD_WRAPPED,
178 MLX4_CMD_NATIVE
179};
180
151struct mlx4_dev; 181struct mlx4_dev;
152 182
153struct mlx4_cmd_mailbox { 183struct mlx4_cmd_mailbox {
@@ -157,23 +187,24 @@ struct mlx4_cmd_mailbox {
157 187
158int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 188int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
159 int out_is_imm, u32 in_modifier, u8 op_modifier, 189 int out_is_imm, u32 in_modifier, u8 op_modifier,
160 u16 op, unsigned long timeout); 190 u16 op, unsigned long timeout, int native);
161 191
162/* Invoke a command with no output parameter */ 192/* Invoke a command with no output parameter */
163static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier, 193static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier,
164 u8 op_modifier, u16 op, unsigned long timeout) 194 u8 op_modifier, u16 op, unsigned long timeout,
195 int native)
165{ 196{
166 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier, 197 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier,
167 op_modifier, op, timeout); 198 op_modifier, op, timeout, native);
168} 199}
169 200
170/* Invoke a command with an output mailbox */ 201/* Invoke a command with an output mailbox */
171static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param, 202static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param,
172 u32 in_modifier, u8 op_modifier, u16 op, 203 u32 in_modifier, u8 op_modifier, u16 op,
173 unsigned long timeout) 204 unsigned long timeout, int native)
174{ 205{
175 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier, 206 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier,
176 op_modifier, op, timeout); 207 op_modifier, op, timeout, native);
177} 208}
178 209
179/* 210/*
@@ -183,13 +214,17 @@ static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param
183 */ 214 */
184static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 215static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
185 u32 in_modifier, u8 op_modifier, u16 op, 216 u32 in_modifier, u8 op_modifier, u16 op,
186 unsigned long timeout) 217 unsigned long timeout, int native)
187{ 218{
188 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier, 219 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier,
189 op_modifier, op, timeout); 220 op_modifier, op, timeout, native);
190} 221}
191 222
192struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); 223struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
193void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); 224void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
194 225
226u32 mlx4_comm_get_version(void);
227
228#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
229
195#endif /* MLX4_CMD_H */ 230#endif /* MLX4_CMD_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 84b0b1848f17..5c4fe8e5bfe5 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -47,6 +47,9 @@
47enum { 47enum {
48 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
50 MLX4_FLAG_MASTER = 1 << 2,
51 MLX4_FLAG_SLAVE = 1 << 3,
52 MLX4_FLAG_SRIOV = 1 << 4,
50}; 53};
51 54
52enum { 55enum {
@@ -58,6 +61,15 @@ enum {
58}; 61};
59 62
60enum { 63enum {
64 MLX4_MAX_NUM_PF = 16,
65 MLX4_MAX_NUM_VF = 64,
66 MLX4_MFUNC_MAX = 80,
67 MLX4_MFUNC_EQ_NUM = 4,
68 MLX4_MFUNC_MAX_EQES = 8,
69 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
70};
71
72enum {
61 MLX4_DEV_CAP_FLAG_RC = 1LL << 0, 73 MLX4_DEV_CAP_FLAG_RC = 1LL << 0,
62 MLX4_DEV_CAP_FLAG_UC = 1LL << 1, 74 MLX4_DEV_CAP_FLAG_UC = 1LL << 1,
63 MLX4_DEV_CAP_FLAG_UD = 1LL << 2, 75 MLX4_DEV_CAP_FLAG_UD = 1LL << 2,
@@ -77,11 +89,13 @@ enum {
77 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, 89 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
78 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, 90 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
79 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, 91 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34,
80 MLX4_DEV_CAP_FLAG_WOL = 1LL << 38, 92 MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37,
93 MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38,
81 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, 94 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
82 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 95 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
83 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 96 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
84 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48 97 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
85}; 99};
86 100
87#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
@@ -116,7 +130,11 @@ enum mlx4_event {
116 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, 130 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09,
117 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, 131 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f,
118 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, 132 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e,
119 MLX4_EVENT_TYPE_CMD = 0x0a 133 MLX4_EVENT_TYPE_CMD = 0x0a,
134 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
135 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
136 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
137 MLX4_EVENT_TYPE_NONE = 0xff,
120}; 138};
121 139
122enum { 140enum {
@@ -183,6 +201,7 @@ enum mlx4_qp_region {
183}; 201};
184 202
185enum mlx4_port_type { 203enum mlx4_port_type {
204 MLX4_PORT_TYPE_NONE = 0,
186 MLX4_PORT_TYPE_IB = 1, 205 MLX4_PORT_TYPE_IB = 1,
187 MLX4_PORT_TYPE_ETH = 2, 206 MLX4_PORT_TYPE_ETH = 2,
188 MLX4_PORT_TYPE_AUTO = 3 207 MLX4_PORT_TYPE_AUTO = 3
@@ -215,6 +234,7 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
215 234
216struct mlx4_caps { 235struct mlx4_caps {
217 u64 fw_ver; 236 u64 fw_ver;
237 u32 function;
218 int num_ports; 238 int num_ports;
219 int vl_cap[MLX4_MAX_PORTS + 1]; 239 int vl_cap[MLX4_MAX_PORTS + 1];
220 int ib_mtu_cap[MLX4_MAX_PORTS + 1]; 240 int ib_mtu_cap[MLX4_MAX_PORTS + 1];
@@ -229,6 +249,7 @@ struct mlx4_caps {
229 u64 trans_code[MLX4_MAX_PORTS + 1]; 249 u64 trans_code[MLX4_MAX_PORTS + 1];
230 int local_ca_ack_delay; 250 int local_ca_ack_delay;
231 int num_uars; 251 int num_uars;
252 u32 uar_page_size;
232 int bf_reg_size; 253 int bf_reg_size;
233 int bf_regs_per_page; 254 int bf_regs_per_page;
234 int max_sq_sg; 255 int max_sq_sg;
@@ -252,8 +273,7 @@ struct mlx4_caps {
252 int num_comp_vectors; 273 int num_comp_vectors;
253 int comp_pool; 274 int comp_pool;
254 int num_mpts; 275 int num_mpts;
255 int num_mtt_segs; 276 int num_mtts;
256 int mtts_per_seg;
257 int fmr_reserved_mtts; 277 int fmr_reserved_mtts;
258 int reserved_mtts; 278 int reserved_mtts;
259 int reserved_mrws; 279 int reserved_mrws;
@@ -283,7 +303,9 @@ struct mlx4_caps {
283 int log_num_prios; 303 int log_num_prios;
284 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 304 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
285 u8 supported_type[MLX4_MAX_PORTS + 1]; 305 u8 supported_type[MLX4_MAX_PORTS + 1];
286 u32 port_mask; 306 u8 suggested_type[MLX4_MAX_PORTS + 1];
307 u8 default_sense[MLX4_MAX_PORTS + 1];
308 u32 port_mask[MLX4_MAX_PORTS + 1];
287 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 309 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
288 u32 max_counters; 310 u32 max_counters;
289 u8 ext_port_cap[MLX4_MAX_PORTS + 1]; 311 u8 ext_port_cap[MLX4_MAX_PORTS + 1];
@@ -303,7 +325,7 @@ struct mlx4_buf {
303}; 325};
304 326
305struct mlx4_mtt { 327struct mlx4_mtt {
306 u32 first_seg; 328 u32 offset;
307 int order; 329 int order;
308 int page_shift; 330 int page_shift;
309}; 331};
@@ -465,10 +487,12 @@ struct mlx4_counter {
465struct mlx4_dev { 487struct mlx4_dev {
466 struct pci_dev *pdev; 488 struct pci_dev *pdev;
467 unsigned long flags; 489 unsigned long flags;
490 unsigned long num_slaves;
468 struct mlx4_caps caps; 491 struct mlx4_caps caps;
469 struct radix_tree_root qp_table_tree; 492 struct radix_tree_root qp_table_tree;
470 u8 rev_id; 493 u8 rev_id;
471 char board_id[MLX4_BOARD_ID_LEN]; 494 char board_id[MLX4_BOARD_ID_LEN];
495 int num_vfs;
472}; 496};
473 497
474struct mlx4_init_port_param { 498struct mlx4_init_port_param {
@@ -487,14 +511,32 @@ struct mlx4_init_port_param {
487 511
488#define mlx4_foreach_port(port, dev, type) \ 512#define mlx4_foreach_port(port, dev, type) \
489 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 513 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
490 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ 514 if ((type) == (dev)->caps.port_mask[(port)])
491 ~(dev)->caps.port_mask) & 1 << ((port) - 1))
492 515
493#define mlx4_foreach_ib_transport_port(port, dev) \ 516#define mlx4_foreach_ib_transport_port(port, dev) \
494 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 517 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
495 if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \ 518 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
496 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) 519 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
497 520
521static inline int mlx4_is_master(struct mlx4_dev *dev)
522{
523 return dev->flags & MLX4_FLAG_MASTER;
524}
525
526static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
527{
528 return (qpn < dev->caps.sqp_start + 8);
529}
530
531static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
532{
533 return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER);
534}
535
536static inline int mlx4_is_slave(struct mlx4_dev *dev)
537{
538 return dev->flags & MLX4_FLAG_SLAVE;
539}
498 540
499int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 541int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
500 struct mlx4_buf *buf); 542 struct mlx4_buf *buf);
@@ -560,6 +602,10 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
560int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 602int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
561int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 603int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
562 604
605int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
606 int block_mcast_loopback, enum mlx4_protocol prot);
607int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
608 enum mlx4_protocol prot);
563int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 609int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
564 int block_mcast_loopback, enum mlx4_protocol protocol); 610 int block_mcast_loopback, enum mlx4_protocol protocol);
565int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 611int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
@@ -570,9 +616,11 @@ int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
570int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); 616int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
571int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); 617int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
572 618
573int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap); 619int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
574void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn); 620void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
575int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap); 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);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
576 624
577int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 625int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
578int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 626int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 48cc4cb97858..bee8fa231276 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -97,6 +97,33 @@ enum {
97 MLX4_QP_BIT_RIC = 1 << 4, 97 MLX4_QP_BIT_RIC = 1 << 4,
98}; 98};
99 99
100enum {
101 MLX4_RSS_HASH_XOR = 0,
102 MLX4_RSS_HASH_TOP = 1,
103
104 MLX4_RSS_UDP_IPV6 = 1 << 0,
105 MLX4_RSS_UDP_IPV4 = 1 << 1,
106 MLX4_RSS_TCP_IPV6 = 1 << 2,
107 MLX4_RSS_IPV6 = 1 << 3,
108 MLX4_RSS_TCP_IPV4 = 1 << 4,
109 MLX4_RSS_IPV4 = 1 << 5,
110
111 /* offset of mlx4_rss_context within mlx4_qp_context.pri_path */
112 MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24,
113 /* offset of being RSS indirection QP within mlx4_qp_context.flags */
114 MLX4_RSS_QPC_FLAG_OFFSET = 13,
115};
116
117struct mlx4_rss_context {
118 __be32 base_qpn;
119 __be32 default_qpn;
120 u16 reserved;
121 u8 hash_fn;
122 u8 flags;
123 __be32 rss_key[10];
124 __be32 base_qpn_udp;
125};
126
100struct mlx4_qp_path { 127struct mlx4_qp_path {
101 u8 fl; 128 u8 fl;
102 u8 reserved1[2]; 129 u8 reserved1[2];
@@ -183,6 +210,7 @@ struct mlx4_wqe_ctrl_seg {
183 * [4] IP checksum 210 * [4] IP checksum
184 * [3:2] C (generate completion queue entry) 211 * [3:2] C (generate completion queue entry)
185 * [1] SE (solicited event) 212 * [1] SE (solicited event)
213 * [0] FL (force loopback)
186 */ 214 */
187 __be32 srcrb_flags; 215 __be32 srcrb_flags;
188 /* 216 /*
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3dc3a8c2c485..5d9b4c9813bd 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -10,6 +10,7 @@
10#include <linux/mmzone.h> 10#include <linux/mmzone.h>
11#include <linux/rbtree.h> 11#include <linux/rbtree.h>
12#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
13#include <linux/atomic.h>
13#include <linux/debug_locks.h> 14#include <linux/debug_locks.h>
14#include <linux/mm_types.h> 15#include <linux/mm_types.h>
15#include <linux/range.h> 16#include <linux/range.h>
@@ -1252,41 +1253,34 @@ static inline void pgtable_page_dtor(struct page *page)
1252extern void free_area_init(unsigned long * zones_size); 1253extern void free_area_init(unsigned long * zones_size);
1253extern void free_area_init_node(int nid, unsigned long * zones_size, 1254extern void free_area_init_node(int nid, unsigned long * zones_size,
1254 unsigned long zone_start_pfn, unsigned long *zholes_size); 1255 unsigned long zone_start_pfn, unsigned long *zholes_size);
1255#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 1256#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1256/* 1257/*
1257 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its 1258 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
1258 * zones, allocate the backing mem_map and account for memory holes in a more 1259 * zones, allocate the backing mem_map and account for memory holes in a more
1259 * architecture independent manner. This is a substitute for creating the 1260 * architecture independent manner. This is a substitute for creating the
1260 * zone_sizes[] and zholes_size[] arrays and passing them to 1261 * zone_sizes[] and zholes_size[] arrays and passing them to
1261 * free_area_init_node() 1262 * free_area_init_node()
1262 * 1263 *
1263 * An architecture is expected to register range of page frames backed by 1264 * An architecture is expected to register range of page frames backed by
1264 * physical memory with add_active_range() before calling 1265 * physical memory with memblock_add[_node]() before calling
1265 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic 1266 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
1266 * usage, an architecture is expected to do something like 1267 * usage, an architecture is expected to do something like
1267 * 1268 *
1268 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, 1269 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
1269 * max_highmem_pfn}; 1270 * max_highmem_pfn};
1270 * for_each_valid_physical_page_range() 1271 * for_each_valid_physical_page_range()
1271 * add_active_range(node_id, start_pfn, end_pfn) 1272 * memblock_add_node(base, size, nid)
1272 * free_area_init_nodes(max_zone_pfns); 1273 * free_area_init_nodes(max_zone_pfns);
1273 * 1274 *
1274 * If the architecture guarantees that there are no holes in the ranges 1275 * free_bootmem_with_active_regions() calls free_bootmem_node() for each
1275 * registered with add_active_range(), free_bootmem_active_regions() 1276 * registered physical page range. Similarly
1276 * will call free_bootmem_node() for each registered physical page range. 1277 * sparse_memory_present_with_active_regions() calls memory_present() for
1277 * Similarly sparse_memory_present_with_active_regions() calls 1278 * each range when SPARSEMEM is enabled.
1278 * memory_present() for each range when SPARSEMEM is enabled.
1279 * 1279 *
1280 * See mm/page_alloc.c for more information on each function exposed by 1280 * See mm/page_alloc.c for more information on each function exposed by
1281 * CONFIG_ARCH_POPULATES_NODE_MAP 1281 * CONFIG_HAVE_MEMBLOCK_NODE_MAP.
1282 */ 1282 */
1283extern void free_area_init_nodes(unsigned long *max_zone_pfn); 1283extern void free_area_init_nodes(unsigned long *max_zone_pfn);
1284extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1285 unsigned long end_pfn);
1286extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1287 unsigned long end_pfn);
1288extern void remove_all_active_ranges(void);
1289void sort_node_map(void);
1290unsigned long node_map_pfn_alignment(void); 1284unsigned long node_map_pfn_alignment(void);
1291unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, 1285unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1292 unsigned long end_pfn); 1286 unsigned long end_pfn);
@@ -1299,14 +1293,11 @@ extern void free_bootmem_with_active_regions(int nid,
1299 unsigned long max_low_pfn); 1293 unsigned long max_low_pfn);
1300int add_from_early_node_map(struct range *range, int az, 1294int add_from_early_node_map(struct range *range, int az,
1301 int nr_range, int nid); 1295 int nr_range, int nid);
1302u64 __init find_memory_core_early(int nid, u64 size, u64 align,
1303 u64 goal, u64 limit);
1304typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1305extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1306extern void sparse_memory_present_with_active_regions(int nid); 1296extern void sparse_memory_present_with_active_regions(int nid);
1307#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
1308 1297
1309#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ 1298#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
1299
1300#if !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) && \
1310 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) 1301 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
1311static inline int __early_pfn_to_nid(unsigned long pfn) 1302static inline int __early_pfn_to_nid(unsigned long pfn)
1312{ 1303{
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 415f2db414e1..c8ef9bc54d50 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -218,6 +218,7 @@ struct mmc_card {
218#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ 218#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
219#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ 219#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
220#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ 220#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
221#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
221 /* byte mode */ 222 /* byte mode */
222 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ 223 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
223#define MMC_NO_POWER_NOTIFICATION 0 224#define MMC_NO_POWER_NOTIFICATION 0
@@ -433,6 +434,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
433 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; 434 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
434} 435}
435 436
437static inline int mmc_card_long_read_time(const struct mmc_card *c)
438{
439 return c->quirks & MMC_QUIRK_LONG_READ_TIME;
440}
441
436#define mmc_card_name(c) ((c)->cid.prod_name) 442#define mmc_card_name(c) ((c)->cid.prod_name)
437#define mmc_card_id(c) (dev_name(&(c)->dev)) 443#define mmc_card_id(c) (dev_name(&(c)->dev))
438 444
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 188cb2ffe8db..3ac040f19369 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -598,13 +598,13 @@ struct zonelist {
598#endif 598#endif
599}; 599};
600 600
601#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 601#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
602struct node_active_region { 602struct node_active_region {
603 unsigned long start_pfn; 603 unsigned long start_pfn;
604 unsigned long end_pfn; 604 unsigned long end_pfn;
605 int nid; 605 int nid;
606}; 606};
607#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 607#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
608 608
609#ifndef CONFIG_DISCONTIGMEM 609#ifndef CONFIG_DISCONTIGMEM
610/* The array of struct pages - for discontigmem use pgdat->lmem_map */ 610/* The array of struct pages - for discontigmem use pgdat->lmem_map */
@@ -720,7 +720,7 @@ extern int movable_zone;
720 720
721static inline int zone_movable_is_highmem(void) 721static inline int zone_movable_is_highmem(void)
722{ 722{
723#if defined(CONFIG_HIGHMEM) && defined(CONFIG_ARCH_POPULATES_NODE_MAP) 723#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE)
724 return movable_zone == ZONE_HIGHMEM; 724 return movable_zone == ZONE_HIGHMEM;
725#else 725#else
726 return 0; 726 return 0;
@@ -938,7 +938,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
938#endif 938#endif
939 939
940#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 940#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
941 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 941 !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
942static inline unsigned long early_pfn_to_nid(unsigned long pfn) 942static inline unsigned long early_pfn_to_nid(unsigned long pfn)
943{ 943{
944 return 0; 944 return 0;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 29304855652d..5a8e3903d770 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -2,39 +2,16 @@
2#define _NAMESPACE_H_ 2#define _NAMESPACE_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/path.h> 5struct mnt_namespace;
6#include <linux/seq_file.h>
7#include <linux/wait.h>
8
9struct mnt_namespace {
10 atomic_t count;
11 struct vfsmount * root;
12 struct list_head list;
13 wait_queue_head_t poll;
14 int event;
15};
16
17struct proc_mounts {
18 struct seq_file m; /* must be the first element */
19 struct mnt_namespace *ns;
20 struct path root;
21};
22
23struct fs_struct; 6struct fs_struct;
24 7
25extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
26extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
27 struct fs_struct *); 9 struct fs_struct *);
28extern void put_mnt_ns(struct mnt_namespace *ns); 10extern void put_mnt_ns(struct mnt_namespace *ns);
29static inline void get_mnt_ns(struct mnt_namespace *ns)
30{
31 atomic_inc(&ns->count);
32}
33 11
34extern const struct seq_operations mounts_op; 12extern const struct file_operations proc_mounts_operations;
35extern const struct seq_operations mountinfo_op; 13extern const struct file_operations proc_mountinfo_operations;
36extern const struct seq_operations mountstats_op; 14extern const struct file_operations proc_mountstats_operations;
37extern int mnt_had_events(struct proc_mounts *);
38 15
39#endif 16#endif
40#endif 17#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 468819cdde87..83ac0713ed0a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -542,4 +542,22 @@ struct isapnp_device_id {
542 kernel_ulong_t driver_data; /* data private to the driver */ 542 kernel_ulong_t driver_data; /* data private to the driver */
543}; 543};
544 544
545/**
546 * struct amba_id - identifies a device on an AMBA bus
547 * @id: The significant bits if the hardware device ID
548 * @mask: Bitmask specifying which bits of the id field are significant when
549 * matching. A driver binds to a device when ((hardware device ID) & mask)
550 * == id.
551 * @data: Private data used by the driver.
552 */
553struct amba_id {
554 unsigned int id;
555 unsigned int mask;
556#ifndef __KERNEL__
557 kernel_ulong_t data;
558#else
559 void *data;
560#endif
561};
562
545#endif /* LINUX_MOD_DEVICETABLE_H */ 563#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 33fe53d78110..d7029f4a191a 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,45 +47,10 @@ struct mnt_namespace;
47 47
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50struct mnt_pcp {
51 int mnt_count;
52 int mnt_writers;
53};
54
55struct vfsmount { 50struct vfsmount {
56 struct list_head mnt_hash;
57 struct vfsmount *mnt_parent; /* fs we are mounted on */
58 struct dentry *mnt_mountpoint; /* dentry of mountpoint */
59 struct dentry *mnt_root; /* root of the mounted tree */ 51 struct dentry *mnt_root; /* root of the mounted tree */
60 struct super_block *mnt_sb; /* pointer to superblock */ 52 struct super_block *mnt_sb; /* pointer to superblock */
61#ifdef CONFIG_SMP
62 struct mnt_pcp __percpu *mnt_pcp;
63 atomic_t mnt_longterm; /* how many of the refs are longterm */
64#else
65 int mnt_count;
66 int mnt_writers;
67#endif
68 struct list_head mnt_mounts; /* list of children, anchored here */
69 struct list_head mnt_child; /* and going through their mnt_child */
70 int mnt_flags; 53 int mnt_flags;
71 /* 4 bytes hole on 64bits arches without fsnotify */
72#ifdef CONFIG_FSNOTIFY
73 __u32 mnt_fsnotify_mask;
74 struct hlist_head mnt_fsnotify_marks;
75#endif
76 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
77 struct list_head mnt_list;
78 struct list_head mnt_expire; /* link in fs-specific expiry list */
79 struct list_head mnt_share; /* circular list of shared mounts */
80 struct list_head mnt_slave_list;/* list of slave mounts */
81 struct list_head mnt_slave; /* slave list entry */
82 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
83 struct mnt_namespace *mnt_ns; /* containing namespace */
84 int mnt_id; /* mount identifier */
85 int mnt_group_id; /* peer group identifier */
86 int mnt_expiry_mark; /* true if marked for expiry */
87 int mnt_pinned;
88 int mnt_ghosts;
89}; 54};
90 55
91struct file; /* forward dec */ 56struct file; /* forward dec */
@@ -94,15 +59,13 @@ extern int mnt_want_write(struct vfsmount *mnt);
94extern int mnt_want_write_file(struct file *file); 59extern int mnt_want_write_file(struct file *file);
95extern int mnt_clone_write(struct vfsmount *mnt); 60extern int mnt_clone_write(struct vfsmount *mnt);
96extern void mnt_drop_write(struct vfsmount *mnt); 61extern void mnt_drop_write(struct vfsmount *mnt);
62extern void mnt_drop_write_file(struct file *file);
97extern void mntput(struct vfsmount *mnt); 63extern void mntput(struct vfsmount *mnt);
98extern struct vfsmount *mntget(struct vfsmount *mnt); 64extern struct vfsmount *mntget(struct vfsmount *mnt);
99extern void mnt_pin(struct vfsmount *mnt); 65extern void mnt_pin(struct vfsmount *mnt);
100extern void mnt_unpin(struct vfsmount *mnt); 66extern void mnt_unpin(struct vfsmount *mnt);
101extern int __mnt_is_readonly(struct vfsmount *mnt); 67extern int __mnt_is_readonly(struct vfsmount *mnt);
102 68
103extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
104 const char *name, void *data);
105
106struct file_system_type; 69struct file_system_type;
107extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 70extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
108 int flags, const char *name, 71 int flags, const char *name,
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index a7003b7a695d..b188f68a08c9 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -116,6 +116,7 @@ enum {
116 NDTPA_PROXY_DELAY, /* u64, msecs */ 116 NDTPA_PROXY_DELAY, /* u64, msecs */
117 NDTPA_PROXY_QLEN, /* u32 */ 117 NDTPA_PROXY_QLEN, /* u32 */
118 NDTPA_LOCKTIME, /* u64, msecs */ 118 NDTPA_LOCKTIME, /* u64, msecs */
119 NDTPA_QUEUE_LENBYTES, /* u32 */
119 __NDTPA_MAX 120 __NDTPA_MAX
120}; 121};
121#define NDTPA_MAX (__NDTPA_MAX - 1) 122#define NDTPA_MAX (__NDTPA_MAX - 1)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
new file mode 100644
index 000000000000..77f5202977ce
--- /dev/null
+++ b/include/linux/netdev_features.h
@@ -0,0 +1,146 @@
1/*
2 * Network device features.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#ifndef _LINUX_NETDEV_FEATURES_H
11#define _LINUX_NETDEV_FEATURES_H
12
13#include <linux/types.h>
14
15typedef u64 netdev_features_t;
16
17enum {
18 NETIF_F_SG_BIT, /* Scatter/gather IO. */
19 NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
20 __UNUSED_NETIF_F_1,
21 NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
25 NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */
26 NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */
27 NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */
28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
29 NETIF_F_GSO_BIT, /* Enable software GSO. */
30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
31 /* do not use LLTX in new drivers */
32 NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */
33 NETIF_F_GRO_BIT, /* Generic receive offload */
34 NETIF_F_LRO_BIT, /* large receive offload */
35
36 /**/NETIF_F_GSO_SHIFT, /* keep the order of SKB_GSO_* bits */
37 NETIF_F_TSO_BIT /* ... TCPv4 segmentation */
38 = NETIF_F_GSO_SHIFT,
39 NETIF_F_UFO_BIT, /* ... UDPv4 fragmentation */
40 NETIF_F_GSO_ROBUST_BIT, /* ... ->SKB_GSO_DODGY */
41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
47 = NETIF_F_GSO_LAST,
48
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
51 NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
52 NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
53 NETIF_F_RXHASH_BIT, /* Receive hashing offload */
54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57
58 /*
59 * Add your fresh new feature above and remember to update
60 * netdev_features_strings[] in net/core/ethtool.c and maybe
61 * some feature mask #defines below. Please also describe it
62 * in Documentation/networking/netdev-features.txt.
63 */
64
65 /**/NETDEV_FEATURE_COUNT
66};
67
68/* copy'n'paste compression ;) */
69#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit))
70#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
71
72#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC)
73#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU)
74#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST)
75#define NETIF_F_FSO __NETIF_F(FSO)
76#define NETIF_F_GRO __NETIF_F(GRO)
77#define NETIF_F_GSO __NETIF_F(GSO)
78#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
79#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
80#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
81#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER)
82#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX)
83#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX)
84#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
85#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
86#define NETIF_F_LLTX __NETIF_F(LLTX)
87#define NETIF_F_LOOPBACK __NETIF_F(LOOPBACK)
88#define NETIF_F_LRO __NETIF_F(LRO)
89#define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL)
90#define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY)
91#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
92#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
93#define NETIF_F_RXHASH __NETIF_F(RXHASH)
94#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM)
95#define NETIF_F_SG __NETIF_F(SG)
96#define NETIF_F_TSO6 __NETIF_F(TSO6)
97#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
98#define NETIF_F_TSO __NETIF_F(TSO)
99#define NETIF_F_UFO __NETIF_F(UFO)
100#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
101
102/* Features valid for ethtool to change */
103/* = all defined minus driver/device-class-related */
104#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
105 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
106
107/* remember that ((t)1 << t_BITS) is undefined in C99 */
108#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
109 (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \
110 ~NETIF_F_NEVER_CHANGE)
111
112/* Segmentation offload feature mask */
113#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
114 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
115
116/* List of features with software fallbacks. */
117#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
118 NETIF_F_TSO6 | NETIF_F_UFO)
119
120#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
121#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
122#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
123#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
124
125#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
126
127#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
128 NETIF_F_FSO)
129
130/*
131 * If one device supports one of these features, then enable them
132 * for all in netdev_increment_features.
133 */
134#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
135 NETIF_F_SG | NETIF_F_HIGHDMA | \
136 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
137/*
138 * If one device doesn't support one of these features, then disable it
139 * for all in netdev_increment_features.
140 */
141#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
142
143/* changeable features with no special hardware requirements */
144#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
145
146#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cbeb5867cff7..a1d109590da4 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,7 @@
43#include <linux/rculist.h> 43#include <linux/rculist.h>
44#include <linux/dmaengine.h> 44#include <linux/dmaengine.h>
45#include <linux/workqueue.h> 45#include <linux/workqueue.h>
46#include <linux/dynamic_queue_limits.h>
46 47
47#include <linux/ethtool.h> 48#include <linux/ethtool.h>
48#include <net/net_namespace.h> 49#include <net/net_namespace.h>
@@ -50,8 +51,10 @@
50#ifdef CONFIG_DCB 51#ifdef CONFIG_DCB
51#include <net/dcbnl.h> 52#include <net/dcbnl.h>
52#endif 53#endif
54#include <net/netprio_cgroup.h>
55
56#include <linux/netdev_features.h>
53 57
54struct vlan_group;
55struct netpoll_info; 58struct netpoll_info;
56struct phy_device; 59struct phy_device;
57/* 802.11 specific */ 60/* 802.11 specific */
@@ -141,22 +144,20 @@ static inline bool dev_xmit_complete(int rc)
141 * used. 144 * used.
142 */ 145 */
143 146
144#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 147#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
145# if defined(CONFIG_MAC80211_MESH) 148# if defined(CONFIG_MAC80211_MESH)
146# define LL_MAX_HEADER 128 149# define LL_MAX_HEADER 128
147# else 150# else
148# define LL_MAX_HEADER 96 151# define LL_MAX_HEADER 96
149# endif 152# endif
150#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE) 153#elif IS_ENABLED(CONFIG_TR)
151# define LL_MAX_HEADER 48 154# define LL_MAX_HEADER 48
152#else 155#else
153# define LL_MAX_HEADER 32 156# define LL_MAX_HEADER 32
154#endif 157#endif
155 158
156#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ 159#if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \
157 !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \ 160 !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL)
158 !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
159 !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
160#define MAX_HEADER LL_MAX_HEADER 161#define MAX_HEADER LL_MAX_HEADER
161#else 162#else
162#define MAX_HEADER (LL_MAX_HEADER + 48) 163#define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -212,6 +213,11 @@ enum {
212#include <linux/cache.h> 213#include <linux/cache.h>
213#include <linux/skbuff.h> 214#include <linux/skbuff.h>
214 215
216#ifdef CONFIG_RPS
217#include <linux/jump_label.h>
218extern struct jump_label_key rps_needed;
219#endif
220
215struct neighbour; 221struct neighbour;
216struct neigh_parms; 222struct neigh_parms;
217struct sk_buff; 223struct sk_buff;
@@ -272,16 +278,11 @@ struct hh_cache {
272 * 278 *
273 * We could use other alignment values, but we must maintain the 279 * We could use other alignment values, but we must maintain the
274 * relationship HH alignment <= LL alignment. 280 * relationship HH alignment <= LL alignment.
275 *
276 * LL_ALLOCATED_SPACE also takes into account the tailroom the device
277 * may need.
278 */ 281 */
279#define LL_RESERVED_SPACE(dev) \ 282#define LL_RESERVED_SPACE(dev) \
280 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 283 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
281#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 284#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
282 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 285 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
283#define LL_ALLOCATED_SPACE(dev) \
284 ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
285 286
286struct header_ops { 287struct header_ops {
287 int (*create) (struct sk_buff *skb, struct net_device *dev, 288 int (*create) (struct sk_buff *skb, struct net_device *dev,
@@ -516,11 +517,23 @@ static inline void napi_synchronize(const struct napi_struct *n)
516#endif 517#endif
517 518
518enum netdev_queue_state_t { 519enum netdev_queue_state_t {
519 __QUEUE_STATE_XOFF, 520 __QUEUE_STATE_DRV_XOFF,
521 __QUEUE_STATE_STACK_XOFF,
520 __QUEUE_STATE_FROZEN, 522 __QUEUE_STATE_FROZEN,
521#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \ 523#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
522 (1 << __QUEUE_STATE_FROZEN)) 524 (1 << __QUEUE_STATE_STACK_XOFF))
525#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
526 (1 << __QUEUE_STATE_FROZEN))
523}; 527};
528/*
529 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
530 * netif_tx_* functions below are used to manipulate this flag. The
531 * __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit
532 * queue independently. The netif_xmit_*stopped functions below are called
533 * to check if the queue has been stopped by the driver or stack (either
534 * of the XOFF bits are set in the state). Drivers should not need to call
535 * netif_xmit*stopped functions, they should only be using netif_tx_*.
536 */
524 537
525struct netdev_queue { 538struct netdev_queue {
526/* 539/*
@@ -528,9 +541,8 @@ struct netdev_queue {
528 */ 541 */
529 struct net_device *dev; 542 struct net_device *dev;
530 struct Qdisc *qdisc; 543 struct Qdisc *qdisc;
531 unsigned long state;
532 struct Qdisc *qdisc_sleeping; 544 struct Qdisc *qdisc_sleeping;
533#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 545#ifdef CONFIG_SYSFS
534 struct kobject kobj; 546 struct kobject kobj;
535#endif 547#endif
536#if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 548#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
@@ -545,6 +557,18 @@ struct netdev_queue {
545 * please use this field instead of dev->trans_start 557 * please use this field instead of dev->trans_start
546 */ 558 */
547 unsigned long trans_start; 559 unsigned long trans_start;
560
561 /*
562 * Number of TX timeouts for this queue
563 * (/sys/class/net/DEV/Q/trans_timeout)
564 */
565 unsigned long trans_timeout;
566
567 unsigned long state;
568
569#ifdef CONFIG_BQL
570 struct dql dql;
571#endif
548} ____cacheline_aligned_in_smp; 572} ____cacheline_aligned_in_smp;
549 573
550static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 574static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -573,7 +597,7 @@ struct rps_map {
573 struct rcu_head rcu; 597 struct rcu_head rcu;
574 u16 cpus[0]; 598 u16 cpus[0];
575}; 599};
576#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 600#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
577 601
578/* 602/*
579 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the 603 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
@@ -597,7 +621,7 @@ struct rps_dev_flow_table {
597 struct rps_dev_flow flows[0]; 621 struct rps_dev_flow flows[0];
598}; 622};
599#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ 623#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
600 (_num * sizeof(struct rps_dev_flow))) 624 ((_num) * sizeof(struct rps_dev_flow)))
601 625
602/* 626/*
603 * The rps_sock_flow_table contains mappings of flows to the last CPU 627 * The rps_sock_flow_table contains mappings of flows to the last CPU
@@ -608,7 +632,7 @@ struct rps_sock_flow_table {
608 u16 ents[0]; 632 u16 ents[0];
609}; 633};
610#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ 634#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
611 (_num * sizeof(u16))) 635 ((_num) * sizeof(u16)))
612 636
613#define RPS_NO_CPU 0xffff 637#define RPS_NO_CPU 0xffff
614 638
@@ -660,7 +684,7 @@ struct xps_map {
660 struct rcu_head rcu; 684 struct rcu_head rcu;
661 u16 queues[0]; 685 u16 queues[0];
662}; 686};
663#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16))) 687#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
664#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ 688#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
665 / sizeof(u16)) 689 / sizeof(u16))
666 690
@@ -683,6 +707,23 @@ struct netdev_tc_txq {
683 u16 offset; 707 u16 offset;
684}; 708};
685 709
710#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
711/*
712 * This structure is to hold information about the device
713 * configured to run FCoE protocol stack.
714 */
715struct netdev_fcoe_hbainfo {
716 char manufacturer[64];
717 char serial_number[64];
718 char hardware_version[64];
719 char driver_version[64];
720 char optionrom_version[64];
721 char firmware_version[64];
722 char model[256];
723 char model_description[256];
724};
725#endif
726
686/* 727/*
687 * This structure defines the management hooks for network devices. 728 * This structure defines the management hooks for network devices.
688 * The following hooks can be defined; unless noted otherwise, they are 729 * The following hooks can be defined; unless noted otherwise, they are
@@ -767,11 +808,11 @@ struct netdev_tc_txq {
767 * 3. Update dev->stats asynchronously and atomically, and define 808 * 3. Update dev->stats asynchronously and atomically, and define
768 * neither operation. 809 * neither operation.
769 * 810 *
770 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 811 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
771 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 812 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
772 * this function is called when a VLAN id is registered. 813 * this function is called when a VLAN id is registered.
773 * 814 *
774 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 815 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
775 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 816 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
776 * this function is called when a VLAN id is unregistered. 817 * this function is called when a VLAN id is unregistered.
777 * 818 *
@@ -823,6 +864,13 @@ struct netdev_tc_txq {
823 * perform necessary setup and returns 1 to indicate the device is set up 864 * perform necessary setup and returns 1 to indicate the device is set up
824 * successfully to perform DDP on this I/O, otherwise this returns 0. 865 * successfully to perform DDP on this I/O, otherwise this returns 0.
825 * 866 *
867 * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
868 * struct netdev_fcoe_hbainfo *hbainfo);
869 * Called when the FCoE Protocol stack wants information on the underlying
870 * device. This information is utilized by the FCoE protocol stack to
871 * register attributes with Fiber Channel management service as per the
872 * FC-GS Fabric Device Management Information(FDMI) specification.
873 *
826 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); 874 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
827 * Called when the underlying device wants to override default World Wide 875 * Called when the underlying device wants to override default World Wide
828 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own 876 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
@@ -845,12 +893,13 @@ struct netdev_tc_txq {
845 * Called to release previously enslaved netdev. 893 * Called to release previously enslaved netdev.
846 * 894 *
847 * Feature/offload setting functions. 895 * Feature/offload setting functions.
848 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); 896 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
897 * netdev_features_t features);
849 * Adjusts the requested feature flags according to device-specific 898 * Adjusts the requested feature flags according to device-specific
850 * constraints, and returns the resulting flags. Must not modify 899 * constraints, and returns the resulting flags. Must not modify
851 * the device state. 900 * the device state.
852 * 901 *
853 * int (*ndo_set_features)(struct net_device *dev, u32 features); 902 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
854 * Called to update device configuration to new features. Passed 903 * Called to update device configuration to new features. Passed
855 * feature set might be less than what was returned by ndo_fix_features()). 904 * feature set might be less than what was returned by ndo_fix_features()).
856 * Must return >0 or -errno if it changed dev->features itself. 905 * Must return >0 or -errno if it changed dev->features itself.
@@ -885,9 +934,9 @@ struct net_device_ops {
885 struct rtnl_link_stats64 *storage); 934 struct rtnl_link_stats64 *storage);
886 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 935 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
887 936
888 void (*ndo_vlan_rx_add_vid)(struct net_device *dev, 937 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
889 unsigned short vid); 938 unsigned short vid);
890 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 939 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
891 unsigned short vid); 940 unsigned short vid);
892#ifdef CONFIG_NET_POLL_CONTROLLER 941#ifdef CONFIG_NET_POLL_CONTROLLER
893 void (*ndo_poll_controller)(struct net_device *dev); 942 void (*ndo_poll_controller)(struct net_device *dev);
@@ -912,7 +961,7 @@ struct net_device_ops {
912 int (*ndo_get_vf_port)(struct net_device *dev, 961 int (*ndo_get_vf_port)(struct net_device *dev,
913 int vf, struct sk_buff *skb); 962 int vf, struct sk_buff *skb);
914 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 963 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
915#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 964#if IS_ENABLED(CONFIG_FCOE)
916 int (*ndo_fcoe_enable)(struct net_device *dev); 965 int (*ndo_fcoe_enable)(struct net_device *dev);
917 int (*ndo_fcoe_disable)(struct net_device *dev); 966 int (*ndo_fcoe_disable)(struct net_device *dev);
918 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 967 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
@@ -925,9 +974,11 @@ struct net_device_ops {
925 u16 xid, 974 u16 xid,
926 struct scatterlist *sgl, 975 struct scatterlist *sgl,
927 unsigned int sgc); 976 unsigned int sgc);
977 int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
978 struct netdev_fcoe_hbainfo *hbainfo);
928#endif 979#endif
929 980
930#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE) 981#if IS_ENABLED(CONFIG_LIBFCOE)
931#define NETDEV_FCOE_WWNN 0 982#define NETDEV_FCOE_WWNN 0
932#define NETDEV_FCOE_WWPN 1 983#define NETDEV_FCOE_WWPN 1
933 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 984 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
@@ -944,10 +995,12 @@ struct net_device_ops {
944 struct net_device *slave_dev); 995 struct net_device *slave_dev);
945 int (*ndo_del_slave)(struct net_device *dev, 996 int (*ndo_del_slave)(struct net_device *dev,
946 struct net_device *slave_dev); 997 struct net_device *slave_dev);
947 u32 (*ndo_fix_features)(struct net_device *dev, 998 netdev_features_t (*ndo_fix_features)(struct net_device *dev,
948 u32 features); 999 netdev_features_t features);
949 int (*ndo_set_features)(struct net_device *dev, 1000 int (*ndo_set_features)(struct net_device *dev,
950 u32 features); 1001 netdev_features_t features);
1002 int (*ndo_neigh_construct)(struct neighbour *n);
1003 void (*ndo_neigh_destroy)(struct neighbour *n);
951}; 1004};
952 1005
953/* 1006/*
@@ -997,91 +1050,13 @@ struct net_device {
997 struct list_head unreg_list; 1050 struct list_head unreg_list;
998 1051
999 /* currently active device features */ 1052 /* currently active device features */
1000 u32 features; 1053 netdev_features_t features;
1001 /* user-changeable features */ 1054 /* user-changeable features */
1002 u32 hw_features; 1055 netdev_features_t hw_features;
1003 /* user-requested features */ 1056 /* user-requested features */
1004 u32 wanted_features; 1057 netdev_features_t wanted_features;
1005 /* mask of features inheritable by VLAN devices */ 1058 /* mask of features inheritable by VLAN devices */
1006 u32 vlan_features; 1059 netdev_features_t vlan_features;
1007
1008 /* Net device feature bits; if you change something,
1009 * also update netdev_features_strings[] in ethtool.c */
1010
1011#define NETIF_F_SG 1 /* Scatter/gather IO. */
1012#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
1013#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
1014#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
1015#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */
1016#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
1017#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
1018#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
1019#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
1020#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
1021#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
1022#define NETIF_F_GSO 2048 /* Enable software GSO. */
1023#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
1024 /* do not use LLTX in new drivers */
1025#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
1026#define NETIF_F_GRO 16384 /* Generic receive offload */
1027#define NETIF_F_LRO 32768 /* large receive offload */
1028
1029/* the GSO_MASK reserves bits 16 through 23 */
1030#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
1031#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
1032#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
1033#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
1034#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1035#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
1036#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
1037#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */
1038
1039 /* Segmentation offload features */
1040#define NETIF_F_GSO_SHIFT 16
1041#define NETIF_F_GSO_MASK 0x00ff0000
1042#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
1043#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
1044#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
1045#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
1046#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
1047#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
1048
1049 /* Features valid for ethtool to change */
1050 /* = all defined minus driver/device-class-related */
1051#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
1052 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1053#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
1054
1055 /* List of features with software fallbacks. */
1056#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
1057 NETIF_F_TSO6 | NETIF_F_UFO)
1058
1059
1060#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
1061#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
1062#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
1063#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
1064
1065#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1066
1067#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
1068 NETIF_F_FSO)
1069
1070 /*
1071 * If one device supports one of these features, then enable them
1072 * for all in netdev_increment_features.
1073 */
1074#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
1075 NETIF_F_SG | NETIF_F_HIGHDMA | \
1076 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
1077 /*
1078 * If one device doesn't support one of these features, then disable it
1079 * for all in netdev_increment_features.
1080 */
1081#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
1082
1083 /* changeable features with no special hardware requirements */
1084#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
1085 1060
1086 /* Interface index. Unique device identifier */ 1061 /* Interface index. Unique device identifier */
1087 int ifindex; 1062 int ifindex;
@@ -1132,6 +1107,7 @@ struct net_device {
1132 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1107 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
1133 unsigned char addr_assign_type; /* hw address assignment type */ 1108 unsigned char addr_assign_type; /* hw address assignment type */
1134 unsigned char addr_len; /* hardware address length */ 1109 unsigned char addr_len; /* hardware address length */
1110 unsigned char neigh_priv_len;
1135 unsigned short dev_id; /* for shared network cards */ 1111 unsigned short dev_id; /* for shared network cards */
1136 1112
1137 spinlock_t addr_list_lock; 1113 spinlock_t addr_list_lock;
@@ -1144,11 +1120,11 @@ struct net_device {
1144 1120
1145 /* Protocol specific pointers */ 1121 /* Protocol specific pointers */
1146 1122
1147#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1123#if IS_ENABLED(CONFIG_VLAN_8021Q)
1148 struct vlan_group __rcu *vlgrp; /* VLAN group */ 1124 struct vlan_info __rcu *vlan_info; /* VLAN info */
1149#endif 1125#endif
1150#ifdef CONFIG_NET_DSA 1126#if IS_ENABLED(CONFIG_NET_DSA)
1151 void *dsa_ptr; /* dsa specific data */ 1127 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */
1152#endif 1128#endif
1153 void *atalk_ptr; /* AppleTalk link */ 1129 void *atalk_ptr; /* AppleTalk link */
1154 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1130 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
@@ -1184,9 +1160,11 @@ struct net_device {
1184 1160
1185 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1161 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1186 1162
1187#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 1163#ifdef CONFIG_SYSFS
1188 struct kset *queues_kset; 1164 struct kset *queues_kset;
1165#endif
1189 1166
1167#ifdef CONFIG_RPS
1190 struct netdev_rx_queue *_rx; 1168 struct netdev_rx_queue *_rx;
1191 1169
1192 /* Number of RX queues allocated at register_netdev() time */ 1170 /* Number of RX queues allocated at register_netdev() time */
@@ -1308,10 +1286,13 @@ struct net_device {
1308 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; 1286 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1309 u8 prio_tc_map[TC_BITMASK + 1]; 1287 u8 prio_tc_map[TC_BITMASK + 1];
1310 1288
1311#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1289#if IS_ENABLED(CONFIG_FCOE)
1312 /* max exchange id for FCoE LRO by ddp */ 1290 /* max exchange id for FCoE LRO by ddp */
1313 unsigned int fcoe_ddp_xid; 1291 unsigned int fcoe_ddp_xid;
1314#endif 1292#endif
1293#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
1294 struct netprio_map __rcu *priomap;
1295#endif
1315 /* phy device may attach itself for hardware timestamping */ 1296 /* phy device may attach itself for hardware timestamping */
1316 struct phy_device *phydev; 1297 struct phy_device *phydev;
1317 1298
@@ -1515,7 +1496,7 @@ struct packet_type {
1515 struct packet_type *, 1496 struct packet_type *,
1516 struct net_device *); 1497 struct net_device *);
1517 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1498 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1518 u32 features); 1499 netdev_features_t features);
1519 int (*gso_send_check)(struct sk_buff *skb); 1500 int (*gso_send_check)(struct sk_buff *skb);
1520 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1501 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1521 struct sk_buff *skb); 1502 struct sk_buff *skb);
@@ -1783,7 +1764,7 @@ extern void __netif_schedule(struct Qdisc *q);
1783 1764
1784static inline void netif_schedule_queue(struct netdev_queue *txq) 1765static inline void netif_schedule_queue(struct netdev_queue *txq)
1785{ 1766{
1786 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) 1767 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
1787 __netif_schedule(txq->qdisc); 1768 __netif_schedule(txq->qdisc);
1788} 1769}
1789 1770
@@ -1797,7 +1778,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
1797 1778
1798static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) 1779static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
1799{ 1780{
1800 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1781 clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1801} 1782}
1802 1783
1803/** 1784/**
@@ -1829,7 +1810,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1829 return; 1810 return;
1830 } 1811 }
1831#endif 1812#endif
1832 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state)) 1813 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
1833 __netif_schedule(dev_queue->qdisc); 1814 __netif_schedule(dev_queue->qdisc);
1834} 1815}
1835 1816
@@ -1861,7 +1842,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1861 pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); 1842 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1862 return; 1843 return;
1863 } 1844 }
1864 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1845 set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1865} 1846}
1866 1847
1867/** 1848/**
@@ -1888,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
1888 1869
1889static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 1870static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1890{ 1871{
1891 return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1872 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1892} 1873}
1893 1874
1894/** 1875/**
@@ -1902,9 +1883,68 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1902 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1883 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1903} 1884}
1904 1885
1905static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue) 1886static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue)
1887{
1888 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
1889}
1890
1891static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
1892{
1893 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
1894}
1895
1896static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1897 unsigned int bytes)
1898{
1899#ifdef CONFIG_BQL
1900 dql_queued(&dev_queue->dql, bytes);
1901 if (unlikely(dql_avail(&dev_queue->dql) < 0)) {
1902 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1903 if (unlikely(dql_avail(&dev_queue->dql) >= 0))
1904 clear_bit(__QUEUE_STATE_STACK_XOFF,
1905 &dev_queue->state);
1906 }
1907#endif
1908}
1909
1910static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1906{ 1911{
1907 return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN; 1912 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
1913}
1914
1915static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1916 unsigned pkts, unsigned bytes)
1917{
1918#ifdef CONFIG_BQL
1919 if (likely(bytes)) {
1920 dql_completed(&dev_queue->dql, bytes);
1921 if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF,
1922 &dev_queue->state) &&
1923 dql_avail(&dev_queue->dql) >= 0)) {
1924 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF,
1925 &dev_queue->state))
1926 netif_schedule_queue(dev_queue);
1927 }
1928 }
1929#endif
1930}
1931
1932static inline void netdev_completed_queue(struct net_device *dev,
1933 unsigned pkts, unsigned bytes)
1934{
1935 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1936}
1937
1938static inline void netdev_tx_reset_queue(struct netdev_queue *q)
1939{
1940#ifdef CONFIG_BQL
1941 dql_reset(&q->dql);
1942#endif
1943}
1944
1945static inline void netdev_reset_queue(struct net_device *dev_queue)
1946{
1947 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
1908} 1948}
1909 1949
1910/** 1950/**
@@ -1991,7 +2031,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1991 if (netpoll_trap()) 2031 if (netpoll_trap())
1992 return; 2032 return;
1993#endif 2033#endif
1994 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state)) 2034 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
1995 __netif_schedule(txq->qdisc); 2035 __netif_schedule(txq->qdisc);
1996} 2036}
1997 2037
@@ -2520,7 +2560,8 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master)
2520extern int netdev_set_bond_master(struct net_device *dev, 2560extern int netdev_set_bond_master(struct net_device *dev,
2521 struct net_device *master); 2561 struct net_device *master);
2522extern int skb_checksum_help(struct sk_buff *skb); 2562extern int skb_checksum_help(struct sk_buff *skb);
2523extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); 2563extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
2564 netdev_features_t features);
2524#ifdef CONFIG_BUG 2565#ifdef CONFIG_BUG
2525extern void netdev_rx_csum_fault(struct net_device *dev); 2566extern void netdev_rx_csum_fault(struct net_device *dev);
2526#else 2567#else
@@ -2536,6 +2577,8 @@ extern void net_disable_timestamp(void);
2536extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); 2577extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
2537extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); 2578extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
2538extern void dev_seq_stop(struct seq_file *seq, void *v); 2579extern void dev_seq_stop(struct seq_file *seq, void *v);
2580extern int dev_seq_open_ops(struct inode *inode, struct file *file,
2581 const struct seq_operations *ops);
2539#endif 2582#endif
2540 2583
2541extern int netdev_class_create_file(struct class_attribute *class_attr); 2584extern int netdev_class_create_file(struct class_attribute *class_attr);
@@ -2547,11 +2590,13 @@ extern const char *netdev_drivername(const struct net_device *dev);
2547 2590
2548extern void linkwatch_run_queue(void); 2591extern void linkwatch_run_queue(void);
2549 2592
2550static inline u32 netdev_get_wanted_features(struct net_device *dev) 2593static inline netdev_features_t netdev_get_wanted_features(
2594 struct net_device *dev)
2551{ 2595{
2552 return (dev->features & ~dev->hw_features) | dev->wanted_features; 2596 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2553} 2597}
2554u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2598netdev_features_t netdev_increment_features(netdev_features_t all,
2599 netdev_features_t one, netdev_features_t mask);
2555int __netdev_update_features(struct net_device *dev); 2600int __netdev_update_features(struct net_device *dev);
2556void netdev_update_features(struct net_device *dev); 2601void netdev_update_features(struct net_device *dev);
2557void netdev_change_features(struct net_device *dev); 2602void netdev_change_features(struct net_device *dev);
@@ -2559,21 +2604,31 @@ void netdev_change_features(struct net_device *dev);
2559void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2604void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2560 struct net_device *dev); 2605 struct net_device *dev);
2561 2606
2562u32 netif_skb_features(struct sk_buff *skb); 2607netdev_features_t netif_skb_features(struct sk_buff *skb);
2563 2608
2564static inline int net_gso_ok(u32 features, int gso_type) 2609static inline int net_gso_ok(netdev_features_t features, int gso_type)
2565{ 2610{
2566 int feature = gso_type << NETIF_F_GSO_SHIFT; 2611 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2612
2613 /* check flags correspondence */
2614 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
2615 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
2616 BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
2617 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
2618 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
2619 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
2620
2567 return (features & feature) == feature; 2621 return (features & feature) == feature;
2568} 2622}
2569 2623
2570static inline int skb_gso_ok(struct sk_buff *skb, u32 features) 2624static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2571{ 2625{
2572 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2626 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2573 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2627 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2574} 2628}
2575 2629
2576static inline int netif_needs_gso(struct sk_buff *skb, int features) 2630static inline int netif_needs_gso(struct sk_buff *skb,
2631 netdev_features_t features)
2577{ 2632{
2578 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2633 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2579 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2634 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
@@ -2592,22 +2647,6 @@ static inline int netif_is_bond_slave(struct net_device *dev)
2592 2647
2593extern struct pernet_operations __net_initdata loopback_net_ops; 2648extern struct pernet_operations __net_initdata loopback_net_ops;
2594 2649
2595static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2596{
2597 if (dev->features & NETIF_F_RXCSUM)
2598 return 1;
2599 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2600 return 0;
2601 return dev->ethtool_ops->get_rx_csum(dev);
2602}
2603
2604static inline u32 dev_ethtool_get_flags(struct net_device *dev)
2605{
2606 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
2607 return 0;
2608 return dev->ethtool_ops->get_flags(dev);
2609}
2610
2611/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2650/* Logging, debugging and troubleshooting/diagnostic helpers. */
2612 2651
2613/* netdev_printk helpers, similar to dev_printk */ 2652/* netdev_printk helpers, similar to dev_printk */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 857f5026ced6..b809265607d0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -162,6 +162,24 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
162 162
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)
166#include <linux/jump_label.h>
167extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
169{
170 if (__builtin_constant_p(pf) &&
171 __builtin_constant_p(hook))
172 return static_branch(&nf_hooks_needed[pf][hook]);
173
174 return !list_empty(&nf_hooks[pf][hook]);
175}
176#else
177static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
178{
179 return !list_empty(&nf_hooks[pf][hook]);
180}
181#endif
182
165int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 183int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
166 struct net_device *indev, struct net_device *outdev, 184 struct net_device *indev, struct net_device *outdev,
167 int (*okfn)(struct sk_buff *), int thresh); 185 int (*okfn)(struct sk_buff *), int thresh);
@@ -179,11 +197,9 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
179 struct net_device *outdev, 197 struct net_device *outdev,
180 int (*okfn)(struct sk_buff *), int thresh) 198 int (*okfn)(struct sk_buff *), int thresh)
181{ 199{
182#ifndef CONFIG_NETFILTER_DEBUG 200 if (nf_hooks_active(pf, hook))
183 if (list_empty(&nf_hooks[pf][hook])) 201 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
184 return 1; 202 return 1;
185#endif
186 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
187} 203}
188 204
189static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 205static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index a1b410c76fc3..e144f54185c0 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -5,7 +5,9 @@ header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h 6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h 7header-y += nf_conntrack_tuple_common.h
8header-y += nf_nat.h
8header-y += nfnetlink.h 9header-y += nfnetlink.h
10header-y += nfnetlink_acct.h
9header-y += nfnetlink_compat.h 11header-y += nfnetlink_compat.h
10header-y += nfnetlink_conntrack.h 12header-y += nfnetlink_conntrack.h
11header-y += nfnetlink_log.h 13header-y += nfnetlink_log.h
@@ -21,6 +23,7 @@ header-y += xt_DSCP.h
21header-y += xt_IDLETIMER.h 23header-y += xt_IDLETIMER.h
22header-y += xt_LED.h 24header-y += xt_LED.h
23header-y += xt_MARK.h 25header-y += xt_MARK.h
26header-y += xt_nfacct.h
24header-y += xt_NFLOG.h 27header-y += xt_NFLOG.h
25header-y += xt_NFQUEUE.h 28header-y += xt_NFQUEUE.h
26header-y += xt_RATEEST.h 29header-y += xt_RATEEST.h
@@ -40,6 +43,7 @@ header-y += xt_cpu.h
40header-y += xt_dccp.h 43header-y += xt_dccp.h
41header-y += xt_devgroup.h 44header-y += xt_devgroup.h
42header-y += xt_dscp.h 45header-y += xt_dscp.h
46header-y += xt_ecn.h
43header-y += xt_esp.h 47header-y += xt_esp.h
44header-y += xt_hashlimit.h 48header-y += xt_hashlimit.h
45header-y += xt_helper.h 49header-y += xt_helper.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 0d3dd66322ec..9e3a2838291b 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack has a userspace helper. */
88 IPS_USERSPACE_HELPER_BIT = 13,
89 IPS_USERSPACE_HELPER = (1 << IPS_USERSPACE_HELPER_BIT),
86}; 90};
87 91
88/* Connection tracking event types */ 92/* Connection tracking event types */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 2ea22b018a87..2f6bbc5b8125 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -7,6 +7,33 @@ enum ip_conntrack_dir {
7 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
8}; 8};
9 9
10/* The protocol-specific manipulable parts of the tuple: always in
11 * network order
12 */
13union nf_conntrack_man_proto {
14 /* Add other protocols here. */
15 __be16 all;
16
17 struct {
18 __be16 port;
19 } tcp;
20 struct {
21 __be16 port;
22 } udp;
23 struct {
24 __be16 id;
25 } icmp;
26 struct {
27 __be16 port;
28 } dccp;
29 struct {
30 __be16 port;
31 } sctp;
32 struct {
33 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
34 } gre;
35};
36
10#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) 37#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
11 38
12#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ 39#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
diff --git a/include/linux/netfilter/nf_nat.h b/include/linux/netfilter/nf_nat.h
new file mode 100644
index 000000000000..8df2d13730b2
--- /dev/null
+++ b/include/linux/netfilter/nf_nat.h
@@ -0,0 +1,25 @@
1#ifndef _NETFILTER_NF_NAT_H
2#define _NETFILTER_NF_NAT_H
3
4#include <linux/netfilter.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7#define NF_NAT_RANGE_MAP_IPS 1
8#define NF_NAT_RANGE_PROTO_SPECIFIED 2
9#define NF_NAT_RANGE_PROTO_RANDOM 4
10#define NF_NAT_RANGE_PERSISTENT 8
11
12struct nf_nat_ipv4_range {
13 unsigned int flags;
14 __be32 min_ip;
15 __be32 max_ip;
16 union nf_conntrack_man_proto min;
17 union nf_conntrack_man_proto max;
18};
19
20struct nf_nat_ipv4_multi_range_compat {
21 unsigned int rangesize;
22 struct nf_nat_ipv4_range range[1];
23};
24
25#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 74d33861473c..b64454c2f79f 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -48,7 +48,8 @@ struct nfgenmsg {
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7 51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_COUNT 8
52 53
53#ifdef __KERNEL__ 54#ifdef __KERNEL__
54 55
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
new file mode 100644
index 000000000000..7c4279b4ae7a
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -0,0 +1,36 @@
1#ifndef _NFNL_ACCT_H_
2#define _NFNL_ACCT_H_
3
4#ifndef NFACCT_NAME_MAX
5#define NFACCT_NAME_MAX 32
6#endif
7
8enum nfnl_acct_msg_types {
9 NFNL_MSG_ACCT_NEW,
10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_MAX
14};
15
16enum nfnl_acct_type {
17 NFACCT_UNSPEC,
18 NFACCT_NAME,
19 NFACCT_PKTS,
20 NFACCT_BYTES,
21 NFACCT_USE,
22 __NFACCT_MAX
23};
24#define NFACCT_MAX (__NFACCT_MAX - 1)
25
26#ifdef __KERNEL__
27
28struct nf_acct;
29
30extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
31extern void nfnl_acct_put(struct nf_acct *acct);
32extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
33
34#endif /* __KERNEL__ */
35
36#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index b56e76811c04..6390f0992f36 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -3,7 +3,8 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
7#define XT_CT_USERSPACE_HELPER 0x2
7 8
8struct xt_ct_target_info { 9struct xt_ct_target_info {
9 __u16 flags; 10 __u16 flags;
diff --git a/include/linux/netfilter/xt_ecn.h b/include/linux/netfilter/xt_ecn.h
new file mode 100644
index 000000000000..7158fca364f2
--- /dev/null
+++ b/include/linux/netfilter/xt_ecn.h
@@ -0,0 +1,35 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _XT_ECN_H
10#define _XT_ECN_H
11
12#include <linux/types.h>
13#include <linux/netfilter/xt_dscp.h>
14
15#define XT_ECN_IP_MASK (~XT_DSCP_MASK)
16
17#define XT_ECN_OP_MATCH_IP 0x01
18#define XT_ECN_OP_MATCH_ECE 0x10
19#define XT_ECN_OP_MATCH_CWR 0x20
20
21#define XT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct xt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33};
34
35#endif /* _XT_ECN_H */
diff --git a/include/linux/netfilter/xt_nfacct.h b/include/linux/netfilter/xt_nfacct.h
new file mode 100644
index 000000000000..3e19c8a86576
--- /dev/null
+++ b/include/linux/netfilter/xt_nfacct.h
@@ -0,0 +1,13 @@
1#ifndef _XT_NFACCT_MATCH_H
2#define _XT_NFACCT_MATCH_H
3
4#include <linux/netfilter/nfnetlink_acct.h>
5
6struct nf_acct;
7
8struct xt_nfacct_match_info {
9 char name[NFACCT_NAME_MAX];
10 struct nf_acct *nfacct;
11};
12
13#endif /* _XT_NFACCT_MATCH_H */
diff --git a/include/linux/netfilter/xt_rpfilter.h b/include/linux/netfilter/xt_rpfilter.h
new file mode 100644
index 000000000000..8358d4f71952
--- /dev/null
+++ b/include/linux/netfilter/xt_rpfilter.h
@@ -0,0 +1,23 @@
1#ifndef _XT_RPATH_H
2#define _XT_RPATH_H
3
4#include <linux/types.h>
5
6enum {
7 XT_RPFILTER_LOOSE = 1 << 0,
8 XT_RPFILTER_VALID_MARK = 1 << 1,
9 XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
10 XT_RPFILTER_INVERT = 1 << 3,
11#ifdef __KERNEL__
12 XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
13 XT_RPFILTER_VALID_MARK |
14 XT_RPFILTER_ACCEPT_LOCAL |
15 XT_RPFILTER_INVERT,
16#endif
17};
18
19struct xt_rpfilter_info {
20 __u8 flags;
21};
22
23#endif
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index c3b45480ecf7..f9930c87fff3 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -12,4 +12,3 @@ header-y += ipt_ah.h
12header-y += ipt_ecn.h 12header-y += ipt_ecn.h
13header-y += ipt_realm.h 13header-y += ipt_realm.h
14header-y += ipt_ttl.h 14header-y += ipt_ttl.h
15header-y += nf_nat.h
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index eabf95fb7d3e..0e0c063dbf60 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -1,35 +1,15 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _IPT_ECN_H 1#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 2#define _IPT_ECN_H
11 3
12#include <linux/types.h> 4#include <linux/netfilter/xt_ecn.h>
13#include <linux/netfilter/xt_dscp.h> 5#define ipt_ecn_info xt_ecn_info
14 6
15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 7enum {
16 8 IPT_ECN_IP_MASK = XT_ECN_IP_MASK,
17#define IPT_ECN_OP_MATCH_IP 0x01 9 IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP,
18#define IPT_ECN_OP_MATCH_ECE 0x10 10 IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE,
19#define IPT_ECN_OP_MATCH_CWR 0x20 11 IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR,
20 12 IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
21#define IPT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct ipt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33}; 13};
34 14
35#endif /* _IPT_ECN_H */ 15#endif /* IPT_ECN_H */
diff --git a/include/linux/netfilter_ipv4/nf_nat.h b/include/linux/netfilter_ipv4/nf_nat.h
deleted file mode 100644
index 7a861d09fc86..000000000000
--- a/include/linux/netfilter_ipv4/nf_nat.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_NF_NAT_H
2#define _LINUX_NF_NAT_H
3
4#include <linux/types.h>
5
6#define IP_NAT_RANGE_MAP_IPS 1
7#define IP_NAT_RANGE_PROTO_SPECIFIED 2
8#define IP_NAT_RANGE_PROTO_RANDOM 4
9#define IP_NAT_RANGE_PERSISTENT 8
10
11/* The protocol-specific manipulable parts of the tuple. */
12union nf_conntrack_man_proto {
13 /* Add other protocols here. */
14 __be16 all;
15
16 struct {
17 __be16 port;
18 } tcp;
19 struct {
20 __be16 port;
21 } udp;
22 struct {
23 __be16 id;
24 } icmp;
25 struct {
26 __be16 port;
27 } dccp;
28 struct {
29 __be16 port;
30 } sctp;
31 struct {
32 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
33 } gre;
34};
35
36/* Single range specification. */
37struct nf_nat_range {
38 /* Set to OR of flags above. */
39 unsigned int flags;
40
41 /* Inclusive: network order. */
42 __be32 min_ip, max_ip;
43
44 /* Inclusive: network order */
45 union nf_conntrack_man_proto min, max;
46};
47
48/* For backwards compat: don't use in modern code. */
49struct nf_nat_multi_range_compat {
50 unsigned int rangesize; /* Must be 1. */
51
52 /* hangs off end. */
53 struct nf_nat_range range[1];
54};
55
56#define nf_nat_multi_range nf_nat_multi_range_compat
57
58#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8374d2967362..52e48959cfa1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -27,6 +27,8 @@
27#define NETLINK_RDMA 20 27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */ 28#define NETLINK_CRYPTO 21 /* Crypto layer */
29 29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
30#define MAX_LINKS 32 32#define MAX_LINKS 32
31 33
32struct sockaddr_nl { 34struct sockaddr_nl {
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 36cb955b05cc..01d4e5d60325 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -62,6 +62,8 @@ enum nfc_commands {
62 NFC_CMD_GET_DEVICE, 62 NFC_CMD_GET_DEVICE,
63 NFC_CMD_DEV_UP, 63 NFC_CMD_DEV_UP,
64 NFC_CMD_DEV_DOWN, 64 NFC_CMD_DEV_DOWN,
65 NFC_CMD_DEP_LINK_UP,
66 NFC_CMD_DEP_LINK_DOWN,
65 NFC_CMD_START_POLL, 67 NFC_CMD_START_POLL,
66 NFC_CMD_STOP_POLL, 68 NFC_CMD_STOP_POLL,
67 NFC_CMD_GET_TARGET, 69 NFC_CMD_GET_TARGET,
@@ -86,6 +88,9 @@ enum nfc_commands {
86 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID 88 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
87 * @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
88 * 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
92 * @NFC_ATTR_COMM_MODE: Passive or active mode
93 * @NFC_ATTR_RF_MODE: Initiator or target
89 */ 94 */
90enum nfc_attrs { 95enum nfc_attrs {
91 NFC_ATTR_UNSPEC, 96 NFC_ATTR_UNSPEC,
@@ -95,6 +100,9 @@ enum nfc_attrs {
95 NFC_ATTR_TARGET_INDEX, 100 NFC_ATTR_TARGET_INDEX,
96 NFC_ATTR_TARGET_SENS_RES, 101 NFC_ATTR_TARGET_SENS_RES,
97 NFC_ATTR_TARGET_SEL_RES, 102 NFC_ATTR_TARGET_SEL_RES,
103 NFC_ATTR_TARGET_NFCID1,
104 NFC_ATTR_COMM_MODE,
105 NFC_ATTR_RF_MODE,
98/* private: internal use only */ 106/* private: internal use only */
99 __NFC_ATTR_AFTER_LAST 107 __NFC_ATTR_AFTER_LAST
100}; 108};
@@ -111,6 +119,14 @@ enum nfc_attrs {
111 119
112#define NFC_PROTO_MAX 6 120#define NFC_PROTO_MAX 6
113 121
122/* NFC communication modes */
123#define NFC_COMM_ACTIVE 0
124#define NFC_COMM_PASSIVE 1
125
126/* NFC RF modes */
127#define NFC_RF_INITIATOR 0
128#define NFC_RF_TARGET 1
129
114/* NFC protocols masks used in bitsets */ 130/* NFC protocols masks used in bitsets */
115#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) 131#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
116#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) 132#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
@@ -125,9 +141,22 @@ struct sockaddr_nfc {
125 __u32 nfc_protocol; 141 __u32 nfc_protocol;
126}; 142};
127 143
144#define NFC_LLCP_MAX_SERVICE_NAME 63
145struct sockaddr_nfc_llcp {
146 sa_family_t sa_family;
147 __u32 dev_idx;
148 __u32 target_idx;
149 __u32 nfc_protocol;
150 __u8 dsap; /* Destination SAP, if known */
151 __u8 ssap; /* Source SAP to be bound to */
152 char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
153 size_t service_name_len;
154};
155
128/* NFC socket protocols */ 156/* NFC socket protocols */
129#define NFC_SOCKPROTO_RAW 0 157#define NFC_SOCKPROTO_RAW 0
130#define NFC_SOCKPROTO_MAX 1 158#define NFC_SOCKPROTO_LLCP 1
159#define NFC_SOCKPROTO_MAX 2
131 160
132#define NFC_HEADER_SIZE 1 161#define NFC_HEADER_SIZE 1
133 162
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 92ecf5585fac..8c29950d2fa5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -373,7 +373,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
374extern void put_nfs_open_context(struct nfs_open_context *ctx); 374extern void put_nfs_open_context(struct nfs_open_context *ctx);
375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode); 376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8049bf77d799..0f5ff3739820 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -509,6 +509,38 @@
509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). 509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. 510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
511 * 511 *
512 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
513 * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
514 * implement sending deauth to stations that send unexpected class 3
515 * frames. Also used as the event sent by the kernel when such a frame
516 * is received.
517 * For the event, the %NL80211_ATTR_MAC attribute carries the TA and
518 * other attributes like the interface index are present.
519 * If used as the command it must have an interface index and you can
520 * only unsubscribe from the event by closing the socket. Subscription
521 * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
522 *
523 * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
524 * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
525 * and wasn't already in a 4-addr VLAN. The event will be sent similarly
526 * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
527 *
528 * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
529 * by sending a null data frame to it and reporting when the frame is
530 * acknowleged. This is used to allow timing out inactive clients. Uses
531 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
532 * direct reply with an %NL80211_ATTR_COOKIE that is later used to match
533 * up the event with the request. The event includes the same data and
534 * has %NL80211_ATTR_ACK set if the frame was ACKed.
535 *
536 * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
537 * other BSSes when any interfaces are in AP mode. This helps implement
538 * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
539 * messages. Note that per PHY only one application may register.
540 *
541 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
542 * No Acknowledgement Policy should be applied.
543 *
512 * @NL80211_CMD_MAX: highest used command number 544 * @NL80211_CMD_MAX: highest used command number
513 * @__NL80211_CMD_AFTER_LAST: internal use 545 * @__NL80211_CMD_AFTER_LAST: internal use
514 */ 546 */
@@ -638,6 +670,16 @@ enum nl80211_commands {
638 NL80211_CMD_TDLS_OPER, 670 NL80211_CMD_TDLS_OPER,
639 NL80211_CMD_TDLS_MGMT, 671 NL80211_CMD_TDLS_MGMT,
640 672
673 NL80211_CMD_UNEXPECTED_FRAME,
674
675 NL80211_CMD_PROBE_CLIENT,
676
677 NL80211_CMD_REGISTER_BEACONS,
678
679 NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
680
681 NL80211_CMD_SET_NOACK_MAP,
682
641 /* add new commands above here */ 683 /* add new commands above here */
642 684
643 /* used to define NL80211_CMD_MAX below */ 685 /* used to define NL80211_CMD_MAX below */
@@ -658,6 +700,8 @@ enum nl80211_commands {
658#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 700#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
659#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT 701#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
660 702
703#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
704
661/* source-level API compatibility */ 705/* source-level API compatibility */
662#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG 706#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
663#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG 707#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
@@ -1109,6 +1153,46 @@ enum nl80211_commands {
1109 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be 1153 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
1110 * used for asking the driver to perform a TDLS operation. 1154 * used for asking the driver to perform a TDLS operation.
1111 * 1155 *
1156 * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
1157 * that have AP support to indicate that they have the AP SME integrated
1158 * with support for the features listed in this attribute, see
1159 * &enum nl80211_ap_sme_features.
1160 *
1161 * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
1162 * the driver to not wait for an acknowledgement. Note that due to this,
1163 * it will also not give a status callback nor return a cookie. This is
1164 * mostly useful for probe responses to save airtime.
1165 *
1166 * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
1167 * &enum nl80211_feature_flags and is advertised in wiphy information.
1168 * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
1169 *
1170 * requests while operating in AP-mode.
1171 * This attribute holds a bitmap of the supported protocols for
1172 * offloading (see &enum nl80211_probe_resp_offload_support_attr).
1173 *
1174 * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
1175 * probe-response frame. The DA field in the 802.11 header is zero-ed out,
1176 * to be filled by the FW.
1177 * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable
1178 * this feature. Currently, only supported in mac80211 drivers.
1179 * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
1180 * ATTR_HT_CAPABILITY to which attention should be paid.
1181 * Currently, only mac80211 NICs support this feature.
1182 * The values that may be configured are:
1183 * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
1184 * AMPDU density and AMPDU factor.
1185 * All values are treated as suggestions and may be ignored
1186 * by the driver as required. The actual values may be seen in
1187 * the station debugfs ht_caps file.
1188 *
1189 * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country
1190 * abides to when initiating radiation on DFS channels. A country maps
1191 * to one DFS region.
1192 *
1193 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
1194 * up to 16 TIDs.
1195 *
1112 * @NL80211_ATTR_MAX: highest attribute number currently defined 1196 * @NL80211_ATTR_MAX: highest attribute number currently defined
1113 * @__NL80211_ATTR_AFTER_LAST: internal use 1197 * @__NL80211_ATTR_AFTER_LAST: internal use
1114 */ 1198 */
@@ -1337,6 +1421,23 @@ enum nl80211_attrs {
1337 NL80211_ATTR_TDLS_SUPPORT, 1421 NL80211_ATTR_TDLS_SUPPORT,
1338 NL80211_ATTR_TDLS_EXTERNAL_SETUP, 1422 NL80211_ATTR_TDLS_EXTERNAL_SETUP,
1339 1423
1424 NL80211_ATTR_DEVICE_AP_SME,
1425
1426 NL80211_ATTR_DONT_WAIT_FOR_ACK,
1427
1428 NL80211_ATTR_FEATURE_FLAGS,
1429
1430 NL80211_ATTR_PROBE_RESP_OFFLOAD,
1431
1432 NL80211_ATTR_PROBE_RESP,
1433
1434 NL80211_ATTR_DFS_REGION,
1435
1436 NL80211_ATTR_DISABLE_HT,
1437 NL80211_ATTR_HT_CAPABILITY_MASK,
1438
1439 NL80211_ATTR_NOACK_MAP,
1440
1340 /* add attributes here, update the policy in nl80211.c */ 1441 /* add attributes here, update the policy in nl80211.c */
1341 1442
1342 __NL80211_ATTR_AFTER_LAST, 1443 __NL80211_ATTR_AFTER_LAST,
@@ -1371,6 +1472,7 @@ enum nl80211_attrs {
1371#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES 1472#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
1372#define NL80211_ATTR_KEY NL80211_ATTR_KEY 1473#define NL80211_ATTR_KEY NL80211_ATTR_KEY
1373#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 1474#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
1475#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1374 1476
1375#define NL80211_MAX_SUPP_RATES 32 1477#define NL80211_MAX_SUPP_RATES 32
1376#define NL80211_MAX_SUPP_REG_RULES 32 1478#define NL80211_MAX_SUPP_REG_RULES 32
@@ -1434,7 +1536,11 @@ enum nl80211_iftype {
1434 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 1536 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
1435 * @NL80211_STA_FLAG_MFP: station uses management frame protection 1537 * @NL80211_STA_FLAG_MFP: station uses management frame protection
1436 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated 1538 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
1437 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer 1539 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should
1540 * only be used in managed mode (even in the flags mask). Note that the
1541 * flag can't be changed, it is only valid while adding a station, and
1542 * attempts to change it will silently be ignored (rather than rejected
1543 * as errors.)
1438 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined 1544 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
1439 * @__NL80211_STA_FLAG_AFTER_LAST: internal use 1545 * @__NL80211_STA_FLAG_AFTER_LAST: internal use
1440 */ 1546 */
@@ -1549,6 +1655,7 @@ enum nl80211_sta_bss_param {
1549 * containing info as possible, see &enum nl80211_sta_bss_param 1655 * containing info as possible, see &enum nl80211_sta_bss_param
1550 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1656 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1551 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1657 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1658 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1552 * @__NL80211_STA_INFO_AFTER_LAST: internal 1659 * @__NL80211_STA_INFO_AFTER_LAST: internal
1553 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1660 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1554 */ 1661 */
@@ -1571,6 +1678,7 @@ enum nl80211_sta_info {
1571 NL80211_STA_INFO_BSS_PARAM, 1678 NL80211_STA_INFO_BSS_PARAM,
1572 NL80211_STA_INFO_CONNECTED_TIME, 1679 NL80211_STA_INFO_CONNECTED_TIME,
1573 NL80211_STA_INFO_STA_FLAGS, 1680 NL80211_STA_INFO_STA_FLAGS,
1681 NL80211_STA_INFO_BEACON_LOSS,
1574 1682
1575 /* keep last */ 1683 /* keep last */
1576 __NL80211_STA_INFO_AFTER_LAST, 1684 __NL80211_STA_INFO_AFTER_LAST,
@@ -1845,6 +1953,21 @@ enum nl80211_reg_rule_flags {
1845}; 1953};
1846 1954
1847/** 1955/**
1956 * enum nl80211_dfs_regions - regulatory DFS regions
1957 *
1958 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1959 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC
1960 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI
1961 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec
1962 */
1963enum nl80211_dfs_regions {
1964 NL80211_DFS_UNSET = 0,
1965 NL80211_DFS_FCC = 1,
1966 NL80211_DFS_ETSI = 2,
1967 NL80211_DFS_JP = 3,
1968};
1969
1970/**
1848 * enum nl80211_survey_info - survey information 1971 * enum nl80211_survey_info - survey information
1849 * 1972 *
1850 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO 1973 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
@@ -1977,6 +2100,10 @@ enum nl80211_mntr_flags {
1977 * access to a broader network beyond the MBSS. This is done via Root 2100 * access to a broader network beyond the MBSS. This is done via Root
1978 * Announcement frames. 2101 * Announcement frames.
1979 * 2102 *
2103 * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in
2104 * TUs) during which a mesh STA can send only one Action frame containing a
2105 * PERR element.
2106 *
1980 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2107 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
1981 * 2108 *
1982 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2109 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -2000,6 +2127,7 @@ enum nl80211_meshconf_params {
2000 NL80211_MESHCONF_ELEMENT_TTL, 2127 NL80211_MESHCONF_ELEMENT_TTL,
2001 NL80211_MESHCONF_HWMP_RANN_INTERVAL, 2128 NL80211_MESHCONF_HWMP_RANN_INTERVAL,
2002 NL80211_MESHCONF_GATE_ANNOUNCEMENTS, 2129 NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
2130 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2003 2131
2004 /* keep last */ 2132 /* keep last */
2005 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2133 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2650,4 +2778,45 @@ enum nl80211_tdls_operation {
2650 NL80211_TDLS_DISABLE_LINK, 2778 NL80211_TDLS_DISABLE_LINK,
2651}; 2779};
2652 2780
2781/*
2782 * enum nl80211_ap_sme_features - device-integrated AP features
2783 * Reserved for future use, no bits are defined in
2784 * NL80211_ATTR_DEVICE_AP_SME yet.
2785enum nl80211_ap_sme_features {
2786};
2787 */
2788
2789/**
2790 * enum nl80211_feature_flags - device/driver features
2791 * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
2792 * TX status to the socket error queue when requested with the
2793 * socket option.
2794 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
2795 */
2796enum nl80211_feature_flags {
2797 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2798 NL80211_FEATURE_HT_IBSS = 1 << 1,
2799};
2800
2801/**
2802 * enum nl80211_probe_resp_offload_support_attr - optional supported
2803 * protocols for probe-response offloading by the driver/FW.
2804 * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
2805 * Each enum value represents a bit in the bitmap of supported
2806 * protocols. Typically a subset of probe-requests belonging to a
2807 * supported protocol will be excluded from offload and uploaded
2808 * to the host.
2809 *
2810 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
2811 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
2812 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
2813 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
2814 */
2815enum nl80211_probe_resp_offload_support_attr {
2816 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0,
2817 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1,
2818 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2,
2819 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
2820};
2821
2653#endif /* __LINUX_NL80211_H */ 2822#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/node.h b/include/linux/node.h
index 92370e22343c..624e53cecc02 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -14,12 +14,12 @@
14#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
21struct node { 21struct node {
22 struct sys_device sysdev; 22 struct device dev;
23 23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work; 25 struct work_struct node_work;
@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
80} 80}
81#endif 81#endif
82 82
83#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 83#define to_node(device) container_of(device, struct node, dev)
84 84
85#endif /* _LINUX_NODE_H_ */ 85#endif /* _LINUX_NODE_H_ */
diff --git a/include/linux/of.h b/include/linux/of.h
index 4948552d60f5..a75a831e2057 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -65,6 +65,27 @@ struct device_node {
65#endif 65#endif
66}; 66};
67 67
68#define MAX_PHANDLE_ARGS 8
69struct of_phandle_args {
70 struct device_node *np;
71 int args_count;
72 uint32_t args[MAX_PHANDLE_ARGS];
73};
74
75#if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
76/* Dummy ref counting routines - to be implemented later */
77static inline struct device_node *of_node_get(struct device_node *node)
78{
79 return node;
80}
81static inline void of_node_put(struct device_node *node)
82{
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
68#ifdef CONFIG_OF 89#ifdef CONFIG_OF
69 90
70/* Pointer for first entry in chain of all nodes. */ 91/* Pointer for first entry in chain of all nodes. */
@@ -95,21 +116,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
95 116
96extern struct device_node *of_find_all_nodes(struct device_node *prev); 117extern struct device_node *of_find_all_nodes(struct device_node *prev);
97 118
98#if defined(CONFIG_SPARC)
99/* Dummy ref counting routines - to be implemented later */
100static inline struct device_node *of_node_get(struct device_node *node)
101{
102 return node;
103}
104static inline void of_node_put(struct device_node *node)
105{
106}
107
108#else
109extern struct device_node *of_node_get(struct device_node *node);
110extern void of_node_put(struct device_node *node);
111#endif
112
113/* 119/*
114 * OF address retrieval & translation 120 * OF address retrieval & translation
115 */ 121 */
@@ -219,8 +225,8 @@ extern int of_device_is_available(const struct device_node *device);
219extern const void *of_get_property(const struct device_node *node, 225extern const void *of_get_property(const struct device_node *node,
220 const char *name, 226 const char *name,
221 int *lenp); 227 int *lenp);
222#define for_each_property(pp, properties) \ 228#define for_each_property_of_node(dn, pp) \
223 for (pp = properties; pp != NULL; pp = pp->next) 229 for (pp = dn->properties; pp != NULL; pp = pp->next)
224 230
225extern int of_n_addr_cells(struct device_node *np); 231extern int of_n_addr_cells(struct device_node *np);
226extern int of_n_size_cells(struct device_node *np); 232extern int of_n_size_cells(struct device_node *np);
@@ -230,9 +236,9 @@ extern int of_modalias_node(struct device_node *node, char *modalias, int len);
230extern struct device_node *of_parse_phandle(struct device_node *np, 236extern struct device_node *of_parse_phandle(struct device_node *np,
231 const char *phandle_name, 237 const char *phandle_name,
232 int index); 238 int index);
233extern int of_parse_phandles_with_args(struct device_node *np, 239extern int of_parse_phandle_with_args(struct device_node *np,
234 const char *list_name, const char *cells_name, int index, 240 const char *list_name, const char *cells_name, int index,
235 struct device_node **out_node, const void **out_args); 241 struct of_phandle_args *out_args);
236 242
237extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 243extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
238extern int of_alias_get_id(struct device_node *np, const char *stem); 244extern int of_alias_get_id(struct device_node *np, const char *stem);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index c84d900fbbb3..ed136ad698ce 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,7 +71,7 @@ extern int of_fdt_is_compatible(struct boot_param_header *blob,
71 unsigned long node, 71 unsigned long node,
72 const char *compat); 72 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, 73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
74 const char **compat); 74 const char *const *compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob, 75extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes); 76 struct device_node **mynodes);
77 77
@@ -88,7 +88,7 @@ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
88extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 88extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
89 unsigned long *size); 89 unsigned long *size);
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char **matches); 91extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
93 93
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 52280a2b5e63..b254052a49d7 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/of.h>
21 22
22struct device_node; 23struct device_node;
23 24
@@ -57,8 +58,9 @@ extern int of_mm_gpiochip_add(struct device_node *np,
57extern void of_gpiochip_add(struct gpio_chip *gc); 58extern void of_gpiochip_add(struct gpio_chip *gc);
58extern void of_gpiochip_remove(struct gpio_chip *gc); 59extern void of_gpiochip_remove(struct gpio_chip *gc);
59extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); 60extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
60extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, 61extern int of_gpio_simple_xlate(struct gpio_chip *gc,
61 const void *gpio_spec, u32 *flags); 62 const struct of_phandle_args *gpiospec,
63 u32 *flags);
62 64
63#else /* CONFIG_OF_GPIO */ 65#else /* CONFIG_OF_GPIO */
64 66
@@ -75,8 +77,8 @@ static inline unsigned int of_gpio_count(struct device_node *np)
75} 77}
76 78
77static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 79static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
78 struct device_node *np, 80 const struct of_phandle_args *gpiospec,
79 const void *gpio_spec, u32 *flags) 81 u32 *flags)
80{ 82{
81 return -ENOSYS; 83 return -ENOSYS;
82} 84}
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
new file mode 100644
index 000000000000..eb1efa54fe84
--- /dev/null
+++ b/include/linux/openvswitch.h
@@ -0,0 +1,452 @@
1/*
2 * Copyright (c) 2007-2011 Nicira Networks.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA
17 */
18
19#ifndef _LINUX_OPENVSWITCH_H
20#define _LINUX_OPENVSWITCH_H 1
21
22#include <linux/types.h>
23
24/**
25 * struct ovs_header - header for OVS Generic Netlink messages.
26 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
27 * specific to a datapath).
28 *
29 * Attributes following the header are specific to a particular OVS Generic
30 * Netlink family, but all of the OVS families use this header.
31 */
32
33struct ovs_header {
34 int dp_ifindex;
35};
36
37/* Datapaths. */
38
39#define OVS_DATAPATH_FAMILY "ovs_datapath"
40#define OVS_DATAPATH_MCGROUP "ovs_datapath"
41#define OVS_DATAPATH_VERSION 0x1
42
43enum ovs_datapath_cmd {
44 OVS_DP_CMD_UNSPEC,
45 OVS_DP_CMD_NEW,
46 OVS_DP_CMD_DEL,
47 OVS_DP_CMD_GET,
48 OVS_DP_CMD_SET
49};
50
51/**
52 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
53 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
54 * port". This is the name of the network device whose dp_ifindex is given in
55 * the &struct ovs_header. Always present in notifications. Required in
56 * %OVS_DP_NEW requests. May be used as an alternative to specifying
57 * dp_ifindex in other requests (with a dp_ifindex of 0).
58 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
59 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
60 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
61 * not be sent.
62 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
63 * datapath. Always present in notifications.
64 *
65 * These attributes follow the &struct ovs_header within the Generic Netlink
66 * payload for %OVS_DP_* commands.
67 */
68enum ovs_datapath_attr {
69 OVS_DP_ATTR_UNSPEC,
70 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
71 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
72 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
73 __OVS_DP_ATTR_MAX
74};
75
76#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
77
78struct ovs_dp_stats {
79 __u64 n_hit; /* Number of flow table matches. */
80 __u64 n_missed; /* Number of flow table misses. */
81 __u64 n_lost; /* Number of misses not sent to userspace. */
82 __u64 n_flows; /* Number of flows present */
83};
84
85struct ovs_vport_stats {
86 __u64 rx_packets; /* total packets received */
87 __u64 tx_packets; /* total packets transmitted */
88 __u64 rx_bytes; /* total bytes received */
89 __u64 tx_bytes; /* total bytes transmitted */
90 __u64 rx_errors; /* bad packets received */
91 __u64 tx_errors; /* packet transmit problems */
92 __u64 rx_dropped; /* no space in linux buffers */
93 __u64 tx_dropped; /* no space available in linux */
94};
95
96/* Fixed logical ports. */
97#define OVSP_LOCAL ((__u16)0)
98
99/* Packet transfer. */
100
101#define OVS_PACKET_FAMILY "ovs_packet"
102#define OVS_PACKET_VERSION 0x1
103
104enum ovs_packet_cmd {
105 OVS_PACKET_CMD_UNSPEC,
106
107 /* Kernel-to-user notifications. */
108 OVS_PACKET_CMD_MISS, /* Flow table miss. */
109 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
110
111 /* Userspace commands. */
112 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
113};
114
115/**
116 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
117 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
118 * packet as received, from the start of the Ethernet header onward. For
119 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
120 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
121 * the flow key extracted from the packet as originally received.
122 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
123 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
124 * userspace to adapt its flow setup strategy by comparing its notion of the
125 * flow key against the kernel's.
126 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
127 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
128 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
129 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
130 * %OVS_USERSPACE_ATTR_USERDATA attribute.
131 *
132 * These attributes follow the &struct ovs_header within the Generic Netlink
133 * payload for %OVS_PACKET_* commands.
134 */
135enum ovs_packet_attr {
136 OVS_PACKET_ATTR_UNSPEC,
137 OVS_PACKET_ATTR_PACKET, /* Packet data. */
138 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
139 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
140 OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
141 __OVS_PACKET_ATTR_MAX
142};
143
144#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
145
146/* Virtual ports. */
147
148#define OVS_VPORT_FAMILY "ovs_vport"
149#define OVS_VPORT_MCGROUP "ovs_vport"
150#define OVS_VPORT_VERSION 0x1
151
152enum ovs_vport_cmd {
153 OVS_VPORT_CMD_UNSPEC,
154 OVS_VPORT_CMD_NEW,
155 OVS_VPORT_CMD_DEL,
156 OVS_VPORT_CMD_GET,
157 OVS_VPORT_CMD_SET
158};
159
160enum ovs_vport_type {
161 OVS_VPORT_TYPE_UNSPEC,
162 OVS_VPORT_TYPE_NETDEV, /* network device */
163 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
164 __OVS_VPORT_TYPE_MAX
165};
166
167#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
168
169/**
170 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
171 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
172 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
173 * of vport.
174 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
175 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
176 * plus a null terminator.
177 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
178 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
179 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
180 * this port. A value of zero indicates that upcalls should not be sent.
181 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
182 * packets sent or received through the vport.
183 *
184 * These attributes follow the &struct ovs_header within the Generic Netlink
185 * payload for %OVS_VPORT_* commands.
186 *
187 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
188 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
189 * optional; if not specified a free port number is automatically selected.
190 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
191 * of vport.
192 * and other attributes are ignored.
193 *
194 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
195 * look up the vport to operate on; otherwise dp_idx from the &struct
196 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
197 */
198enum ovs_vport_attr {
199 OVS_VPORT_ATTR_UNSPEC,
200 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
201 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
202 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
203 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
204 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
205 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
206 __OVS_VPORT_ATTR_MAX
207};
208
209#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
210
211/* Flows. */
212
213#define OVS_FLOW_FAMILY "ovs_flow"
214#define OVS_FLOW_MCGROUP "ovs_flow"
215#define OVS_FLOW_VERSION 0x1
216
217enum ovs_flow_cmd {
218 OVS_FLOW_CMD_UNSPEC,
219 OVS_FLOW_CMD_NEW,
220 OVS_FLOW_CMD_DEL,
221 OVS_FLOW_CMD_GET,
222 OVS_FLOW_CMD_SET
223};
224
225struct ovs_flow_stats {
226 __u64 n_packets; /* Number of matched packets. */
227 __u64 n_bytes; /* Number of matched bytes. */
228};
229
230enum ovs_key_attr {
231 OVS_KEY_ATTR_UNSPEC,
232 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
233 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
234 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
235 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
236 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
237 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
238 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
239 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
240 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
241 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
242 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 __OVS_KEY_ATTR_MAX
247};
248
249#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
250
251/**
252 * enum ovs_frag_type - IPv4 and IPv6 fragment type
253 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
254 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
255 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
256 *
257 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
258 * ovs_key_ipv6.
259 */
260enum ovs_frag_type {
261 OVS_FRAG_TYPE_NONE,
262 OVS_FRAG_TYPE_FIRST,
263 OVS_FRAG_TYPE_LATER,
264 __OVS_FRAG_TYPE_MAX
265};
266
267#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
268
269struct ovs_key_ethernet {
270 __u8 eth_src[6];
271 __u8 eth_dst[6];
272};
273
274struct ovs_key_ipv4 {
275 __be32 ipv4_src;
276 __be32 ipv4_dst;
277 __u8 ipv4_proto;
278 __u8 ipv4_tos;
279 __u8 ipv4_ttl;
280 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
281};
282
283struct ovs_key_ipv6 {
284 __be32 ipv6_src[4];
285 __be32 ipv6_dst[4];
286 __be32 ipv6_label; /* 20-bits in least-significant bits. */
287 __u8 ipv6_proto;
288 __u8 ipv6_tclass;
289 __u8 ipv6_hlimit;
290 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
291};
292
293struct ovs_key_tcp {
294 __be16 tcp_src;
295 __be16 tcp_dst;
296};
297
298struct ovs_key_udp {
299 __be16 udp_src;
300 __be16 udp_dst;
301};
302
303struct ovs_key_icmp {
304 __u8 icmp_type;
305 __u8 icmp_code;
306};
307
308struct ovs_key_icmpv6 {
309 __u8 icmpv6_type;
310 __u8 icmpv6_code;
311};
312
313struct ovs_key_arp {
314 __be32 arp_sip;
315 __be32 arp_tip;
316 __be16 arp_op;
317 __u8 arp_sha[6];
318 __u8 arp_tha[6];
319};
320
321struct ovs_key_nd {
322 __u32 nd_target[4];
323 __u8 nd_sll[6];
324 __u8 nd_tll[6];
325};
326
327/**
328 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
329 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
330 * key. Always present in notifications. Required for all requests (except
331 * dumps).
332 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
333 * the actions to take for packets that match the key. Always present in
334 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
335 * %OVS_FLOW_CMD_SET requests.
336 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
337 * flow. Present in notifications if the stats would be nonzero. Ignored in
338 * requests.
339 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
340 * TCP flags seen on packets in this flow. Only present in notifications for
341 * TCP flows, and only if it would be nonzero. Ignored in requests.
342 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
343 * the system monotonic clock, at which a packet was last processed for this
344 * flow. Only present in notifications if a packet has been processed for this
345 * flow. Ignored in requests.
346 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
347 * last-used time, accumulated TCP flags, and statistics for this flow.
348 * Otherwise ignored in requests. Never present in notifications.
349 *
350 * These attributes follow the &struct ovs_header within the Generic Netlink
351 * payload for %OVS_FLOW_* commands.
352 */
353enum ovs_flow_attr {
354 OVS_FLOW_ATTR_UNSPEC,
355 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
356 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
357 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
358 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
359 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
360 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
361 __OVS_FLOW_ATTR_MAX
362};
363
364#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
365
366/**
367 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
368 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
369 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
370 * %UINT32_MAX samples all packets and intermediate values sample intermediate
371 * fractions of packets.
372 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
373 * Actions are passed as nested attributes.
374 *
375 * Executes the specified actions with the given probability on a per-packet
376 * basis.
377 */
378enum ovs_sample_attr {
379 OVS_SAMPLE_ATTR_UNSPEC,
380 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
381 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
382 __OVS_SAMPLE_ATTR_MAX,
383};
384
385#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
386
387/**
388 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
389 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
390 * message should be sent. Required.
391 * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the
392 * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA,
393 */
394enum ovs_userspace_attr {
395 OVS_USERSPACE_ATTR_UNSPEC,
396 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
397 OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
398 __OVS_USERSPACE_ATTR_MAX
399};
400
401#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
402
403/**
404 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
405 * @vlan_tpid: Tag protocol identifier (TPID) to push.
406 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
407 * (but it will not be set in the 802.1Q header that is pushed).
408 *
409 * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
410 * values are those that the kernel module also parses as 802.1Q headers, to
411 * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
412 * from having surprising results.
413 */
414struct ovs_action_push_vlan {
415 __be16 vlan_tpid; /* 802.1Q TPID. */
416 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
417};
418
419/**
420 * enum ovs_action_attr - Action types.
421 *
422 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
423 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
424 * %OVS_USERSPACE_ATTR_* attributes.
425 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
426 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
427 * value.
428 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
429 * packet.
430 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
431 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
432 * the nested %OVS_SAMPLE_ATTR_* attributes.
433 *
434 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
435 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
436 * type may not be changed.
437 */
438
439enum ovs_action_attr {
440 OVS_ACTION_ATTR_UNSPEC,
441 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
442 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
443 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
444 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
445 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
446 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
447 __OVS_ACTION_ATTR_MAX
448};
449
450#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
451
452#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 172ba70306d1..2aaee0ca9da8 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -517,8 +517,12 @@
517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600
521#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601
522#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602
520#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 523#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603
521#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 524#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604
525#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605
522#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 526#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
523#define PCI_DEVICE_ID_AMD_LANCE 0x2000 527#define PCI_DEVICE_ID_AMD_LANCE 0x2000
524#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 528#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 1e9ebe5e0091..08855613ceb3 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -54,6 +54,7 @@ enum perf_hw_id {
54 PERF_COUNT_HW_BUS_CYCLES = 6, 54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, 55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, 56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
57 PERF_COUNT_HW_REF_CPU_CYCLES = 9,
57 58
58 PERF_COUNT_HW_MAX, /* non-ABI */ 59 PERF_COUNT_HW_MAX, /* non-ABI */
59}; 60};
@@ -822,6 +823,7 @@ struct perf_event {
822 int mmap_locked; 823 int mmap_locked;
823 struct user_struct *mmap_user; 824 struct user_struct *mmap_user;
824 struct ring_buffer *rb; 825 struct ring_buffer *rb;
826 struct list_head rb_entry;
825 827
826 /* poll related */ 828 /* poll related */
827 wait_queue_head_t waitq; 829 wait_queue_head_t waitq;
@@ -889,6 +891,7 @@ struct perf_event_context {
889 int nr_active; 891 int nr_active;
890 int is_active; 892 int is_active;
891 int nr_stat; 893 int nr_stat;
894 int nr_freq;
892 int rotate_disable; 895 int rotate_disable;
893 atomic_t refcount; 896 atomic_t refcount;
894 struct task_struct *task; 897 struct task_struct *task;
@@ -1062,12 +1065,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1062 } 1065 }
1063} 1066}
1064 1067
1065extern struct jump_label_key perf_sched_events; 1068extern struct jump_label_key_deferred perf_sched_events;
1066 1069
1067static inline void perf_event_task_sched_in(struct task_struct *prev, 1070static inline void perf_event_task_sched_in(struct task_struct *prev,
1068 struct task_struct *task) 1071 struct task_struct *task)
1069{ 1072{
1070 if (static_branch(&perf_sched_events)) 1073 if (static_branch(&perf_sched_events.key))
1071 __perf_event_task_sched_in(prev, task); 1074 __perf_event_task_sched_in(prev, task);
1072} 1075}
1073 1076
@@ -1076,7 +1079,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
1076{ 1079{
1077 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1080 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1078 1081
1079 if (static_branch(&perf_sched_events)) 1082 if (static_branch(&perf_sched_events.key))
1080 __perf_event_task_sched_out(prev, next); 1083 __perf_event_task_sched_out(prev, next);
1081} 1084}
1082 1085
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f53a4167c5f4..f48bfc80cb4b 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,6 +38,7 @@
38#define PNPIPE_ENCAP 1 38#define PNPIPE_ENCAP 1
39#define PNPIPE_IFINDEX 2 39#define PNPIPE_IFINDEX 2
40#define PNPIPE_HANDLE 3 40#define PNPIPE_HANDLE 3
41#define PNPIPE_INITSTATE 4
41 42
42#define PNADDR_ANY 0 43#define PNADDR_ANY 0
43#define PNADDR_BROADCAST 0xFC 44#define PNADDR_BROADCAST 0xFC
@@ -49,6 +50,7 @@
49 50
50/* ioctls */ 51/* ioctls */
51#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) 52#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
53#define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13)
52#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) 54#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
53#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) 55#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
54 56
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index c5336705921f..8f1b928f777c 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -30,7 +30,7 @@
30 */ 30 */
31 31
32struct tc_stats { 32struct tc_stats {
33 __u64 bytes; /* NUmber of enqueues bytes */ 33 __u64 bytes; /* Number of enqueued bytes */
34 __u32 packets; /* Number of enqueued packets */ 34 __u32 packets; /* Number of enqueued packets */
35 __u32 drops; /* Packets dropped because of lack of resources */ 35 __u32 drops; /* Packets dropped because of lack of resources */
36 __u32 overlimits; /* Number of throttle events when this 36 __u32 overlimits; /* Number of throttle events when this
@@ -162,25 +162,24 @@ struct tc_sfq_qopt {
162 unsigned flows; /* Maximal number of flows */ 162 unsigned flows; /* Maximal number of flows */
163}; 163};
164 164
165struct tc_sfq_qopt_v1 {
166 struct tc_sfq_qopt v0;
167 unsigned int depth; /* max number of packets per flow */
168 unsigned int headdrop;
169};
170
171
165struct tc_sfq_xstats { 172struct tc_sfq_xstats {
166 __s32 allot; 173 __s32 allot;
167}; 174};
168 175
169/*
170 * NOTE: limit, divisor and flows are hardwired to code at the moment.
171 *
172 * limit=flows=128, divisor=1024;
173 *
174 * The only reason for this is efficiency, it is possible
175 * to change these parameters in compile time.
176 */
177
178/* RED section */ 176/* RED section */
179 177
180enum { 178enum {
181 TCA_RED_UNSPEC, 179 TCA_RED_UNSPEC,
182 TCA_RED_PARMS, 180 TCA_RED_PARMS,
183 TCA_RED_STAB, 181 TCA_RED_STAB,
182 TCA_RED_MAX_P,
184 __TCA_RED_MAX, 183 __TCA_RED_MAX,
185}; 184};
186 185
@@ -194,8 +193,9 @@ struct tc_red_qopt {
194 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 193 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
195 unsigned char Scell_log; /* cell size for idle damping */ 194 unsigned char Scell_log; /* cell size for idle damping */
196 unsigned char flags; 195 unsigned char flags;
197#define TC_RED_ECN 1 196#define TC_RED_ECN 1
198#define TC_RED_HARDDROP 2 197#define TC_RED_HARDDROP 2
198#define TC_RED_ADAPTATIVE 4
199}; 199};
200 200
201struct tc_red_xstats { 201struct tc_red_xstats {
@@ -214,6 +214,7 @@ enum {
214 TCA_GRED_PARMS, 214 TCA_GRED_PARMS,
215 TCA_GRED_STAB, 215 TCA_GRED_STAB,
216 TCA_GRED_DPS, 216 TCA_GRED_DPS,
217 TCA_GRED_MAX_P,
217 __TCA_GRED_MAX, 218 __TCA_GRED_MAX,
218}; 219};
219 220
@@ -253,6 +254,7 @@ enum {
253 TCA_CHOKE_UNSPEC, 254 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS, 255 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB, 256 TCA_CHOKE_STAB,
257 TCA_CHOKE_MAX_P,
256 __TCA_CHOKE_MAX, 258 __TCA_CHOKE_MAX,
257}; 259};
258 260
@@ -297,7 +299,7 @@ struct tc_htb_glob {
297 __u32 debug; /* debug flags */ 299 __u32 debug; /* debug flags */
298 300
299 /* stats */ 301 /* stats */
300 __u32 direct_pkts; /* count of non shapped packets */ 302 __u32 direct_pkts; /* count of non shaped packets */
301}; 303};
302enum { 304enum {
303 TCA_HTB_UNSPEC, 305 TCA_HTB_UNSPEC,
@@ -465,6 +467,7 @@ enum {
465 TCA_NETEM_REORDER, 467 TCA_NETEM_REORDER,
466 TCA_NETEM_CORRUPT, 468 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS, 469 TCA_NETEM_LOSS,
470 TCA_NETEM_RATE,
468 __TCA_NETEM_MAX, 471 __TCA_NETEM_MAX,
469}; 472};
470 473
@@ -495,6 +498,13 @@ struct tc_netem_corrupt {
495 __u32 correlation; 498 __u32 correlation;
496}; 499};
497 500
501struct tc_netem_rate {
502 __u32 rate; /* byte/s */
503 __s32 packet_overhead;
504 __u32 cell_size;
505 __s32 cell_overhead;
506};
507
498enum { 508enum {
499 NETEM_LOSS_UNSPEC, 509 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */ 510 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
@@ -503,7 +513,7 @@ enum {
503}; 513};
504#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) 514#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
505 515
506/* State transition probablities for 4 state model */ 516/* State transition probabilities for 4 state model */
507struct tc_netem_gimodel { 517struct tc_netem_gimodel {
508 __u32 p13; 518 __u32 p13;
509 __u32 p31; 519 __u32 p31;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2a23f7d1a825..60e9994ef405 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -63,7 +63,7 @@ struct platform_device_info {
63 u64 dma_mask; 63 u64 dma_mask;
64}; 64};
65extern struct platform_device *platform_device_register_full( 65extern struct platform_device *platform_device_register_full(
66 struct platform_device_info *pdevinfo); 66 const struct platform_device_info *pdevinfo);
67 67
68/** 68/**
69 * platform_device_register_resndata - add a platform-level device with 69 * platform_device_register_resndata - add a platform-level device with
@@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
196 * calling it replaces module_init() and module_exit() 196 * calling it replaces module_init() and module_exit()
197 */ 197 */
198#define module_platform_driver(__platform_driver) \ 198#define module_platform_driver(__platform_driver) \
199static int __init __platform_driver##_init(void) \ 199 module_driver(__platform_driver, platform_driver_register, \
200{ \ 200 platform_driver_unregister)
201 return platform_driver_register(&(__platform_driver)); \
202} \
203module_init(__platform_driver##_init); \
204static void __exit __platform_driver##_exit(void) \
205{ \
206 platform_driver_unregister(&(__platform_driver)); \
207} \
208module_exit(__platform_driver##_exit);
209 201
210extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 202extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
211 int (*probe)(struct platform_device *), 203 int (*probe)(struct platform_device *),
@@ -264,62 +256,34 @@ static inline char *early_platform_driver_setup_func(void) \
264} 256}
265#endif /* MODULE */ 257#endif /* MODULE */
266 258
267#ifdef CONFIG_PM_SLEEP
268extern int platform_pm_prepare(struct device *dev);
269extern void platform_pm_complete(struct device *dev);
270#else
271#define platform_pm_prepare NULL
272#define platform_pm_complete NULL
273#endif
274
275#ifdef CONFIG_SUSPEND 259#ifdef CONFIG_SUSPEND
276extern int platform_pm_suspend(struct device *dev); 260extern int platform_pm_suspend(struct device *dev);
277extern int platform_pm_suspend_noirq(struct device *dev);
278extern int platform_pm_resume(struct device *dev); 261extern int platform_pm_resume(struct device *dev);
279extern int platform_pm_resume_noirq(struct device *dev);
280#else 262#else
281#define platform_pm_suspend NULL 263#define platform_pm_suspend NULL
282#define platform_pm_resume NULL 264#define platform_pm_resume NULL
283#define platform_pm_suspend_noirq NULL
284#define platform_pm_resume_noirq NULL
285#endif 265#endif
286 266
287#ifdef CONFIG_HIBERNATE_CALLBACKS 267#ifdef CONFIG_HIBERNATE_CALLBACKS
288extern int platform_pm_freeze(struct device *dev); 268extern int platform_pm_freeze(struct device *dev);
289extern int platform_pm_freeze_noirq(struct device *dev);
290extern int platform_pm_thaw(struct device *dev); 269extern int platform_pm_thaw(struct device *dev);
291extern int platform_pm_thaw_noirq(struct device *dev);
292extern int platform_pm_poweroff(struct device *dev); 270extern int platform_pm_poweroff(struct device *dev);
293extern int platform_pm_poweroff_noirq(struct device *dev);
294extern int platform_pm_restore(struct device *dev); 271extern int platform_pm_restore(struct device *dev);
295extern int platform_pm_restore_noirq(struct device *dev);
296#else 272#else
297#define platform_pm_freeze NULL 273#define platform_pm_freeze NULL
298#define platform_pm_thaw NULL 274#define platform_pm_thaw NULL
299#define platform_pm_poweroff NULL 275#define platform_pm_poweroff NULL
300#define platform_pm_restore NULL 276#define platform_pm_restore NULL
301#define platform_pm_freeze_noirq NULL
302#define platform_pm_thaw_noirq NULL
303#define platform_pm_poweroff_noirq NULL
304#define platform_pm_restore_noirq NULL
305#endif 277#endif
306 278
307#ifdef CONFIG_PM_SLEEP 279#ifdef CONFIG_PM_SLEEP
308#define USE_PLATFORM_PM_SLEEP_OPS \ 280#define USE_PLATFORM_PM_SLEEP_OPS \
309 .prepare = platform_pm_prepare, \
310 .complete = platform_pm_complete, \
311 .suspend = platform_pm_suspend, \ 281 .suspend = platform_pm_suspend, \
312 .resume = platform_pm_resume, \ 282 .resume = platform_pm_resume, \
313 .freeze = platform_pm_freeze, \ 283 .freeze = platform_pm_freeze, \
314 .thaw = platform_pm_thaw, \ 284 .thaw = platform_pm_thaw, \
315 .poweroff = platform_pm_poweroff, \ 285 .poweroff = platform_pm_poweroff, \
316 .restore = platform_pm_restore, \ 286 .restore = platform_pm_restore,
317 .suspend_noirq = platform_pm_suspend_noirq, \
318 .resume_noirq = platform_pm_resume_noirq, \
319 .freeze_noirq = platform_pm_freeze_noirq, \
320 .thaw_noirq = platform_pm_thaw_noirq, \
321 .poweroff_noirq = platform_pm_poweroff_noirq, \
322 .restore_noirq = platform_pm_restore_noirq,
323#else 287#else
324#define USE_PLATFORM_PM_SLEEP_OPS 288#define USE_PLATFORM_PM_SLEEP_OPS
325#endif 289#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5c4c8b18c8b7..e4982ac3fbbc 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -54,118 +54,145 @@ typedef struct pm_message {
54/** 54/**
55 * struct dev_pm_ops - device PM callbacks 55 * struct dev_pm_ops - device PM callbacks
56 * 56 *
57 * Several driver power state transitions are externally visible, affecting 57 * Several device power state transitions are externally visible, affecting
58 * the state of pending I/O queues and (for drivers that touch hardware) 58 * the state of pending I/O queues and (for drivers that touch hardware)
59 * interrupts, wakeups, DMA, and other hardware state. There may also be 59 * interrupts, wakeups, DMA, and other hardware state. There may also be
60 * internal transitions to various low power modes, which are transparent 60 * internal transitions to various low-power modes which are transparent
61 * to the rest of the driver stack (such as a driver that's ON gating off 61 * to the rest of the driver stack (such as a driver that's ON gating off
62 * clocks which are not in active use). 62 * clocks which are not in active use).
63 * 63 *
64 * The externally visible transitions are handled with the help of the following 64 * The externally visible transitions are handled with the help of callbacks
65 * callbacks included in this structure: 65 * included in this structure in such a way that two levels of callbacks are
66 * 66 * involved. First, the PM core executes callbacks provided by PM domains,
67 * @prepare: Prepare the device for the upcoming transition, but do NOT change 67 * device types, classes and bus types. They are the subsystem-level callbacks
68 * its hardware state. Prevent new children of the device from being 68 * supposed to execute callbacks provided by device drivers, although they may
69 * registered after @prepare() returns (the driver's subsystem and 69 * choose not to do that. If the driver callbacks are executed, they have to
70 * generally the rest of the kernel is supposed to prevent new calls to the 70 * collaborate with the subsystem-level callbacks to achieve the goals
71 * probe method from being made too once @prepare() has succeeded). If 71 * appropriate for the given system transition, given transition phase and the
72 * @prepare() detects a situation it cannot handle (e.g. registration of a 72 * subsystem the device belongs to.
73 * child already in progress), it may return -EAGAIN, so that the PM core 73 *
74 * can execute it once again (e.g. after the new child has been registered) 74 * @prepare: The principal role of this callback is to prevent new children of
75 * to recover from the race condition. This method is executed for all 75 * the device from being registered after it has returned (the driver's
76 * kinds of suspend transitions and is followed by one of the suspend 76 * subsystem and generally the rest of the kernel is supposed to prevent
77 * callbacks: @suspend(), @freeze(), or @poweroff(). 77 * new calls to the probe method from being made too once @prepare() has
78 * The PM core executes @prepare() for all devices before starting to 78 * succeeded). If @prepare() detects a situation it cannot handle (e.g.
79 * execute suspend callbacks for any of them, so drivers may assume all of 79 * registration of a child already in progress), it may return -EAGAIN, so
80 * the other devices to be present and functional while @prepare() is being 80 * that the PM core can execute it once again (e.g. after a new child has
81 * executed. In particular, it is safe to make GFP_KERNEL memory 81 * been registered) to recover from the race condition.
82 * allocations from within @prepare(). However, drivers may NOT assume 82 * This method is executed for all kinds of suspend transitions and is
83 * anything about the availability of the user space at that time and it 83 * followed by one of the suspend callbacks: @suspend(), @freeze(), or
84 * is not correct to request firmware from within @prepare() (it's too 84 * @poweroff(). The PM core executes subsystem-level @prepare() for all
85 * late to do that). [To work around this limitation, drivers may 85 * devices before starting to invoke suspend callbacks for any of them, so
86 * register suspend and hibernation notifiers that are executed before the 86 * generally devices may be assumed to be functional or to respond to
87 * freezing of tasks.] 87 * runtime resume requests while @prepare() is being executed. However,
88 * device drivers may NOT assume anything about the availability of user
89 * space at that time and it is NOT valid to request firmware from within
90 * @prepare() (it's too late to do that). It also is NOT valid to allocate
91 * substantial amounts of memory from @prepare() in the GFP_KERNEL mode.
92 * [To work around these limitations, drivers may register suspend and
93 * hibernation notifiers to be executed before the freezing of tasks.]
88 * 94 *
89 * @complete: Undo the changes made by @prepare(). This method is executed for 95 * @complete: Undo the changes made by @prepare(). This method is executed for
90 * all kinds of resume transitions, following one of the resume callbacks: 96 * all kinds of resume transitions, following one of the resume callbacks:
91 * @resume(), @thaw(), @restore(). Also called if the state transition 97 * @resume(), @thaw(), @restore(). Also called if the state transition
92 * fails before the driver's suspend callback (@suspend(), @freeze(), 98 * fails before the driver's suspend callback: @suspend(), @freeze() or
93 * @poweroff()) can be executed (e.g. if the suspend callback fails for one 99 * @poweroff(), can be executed (e.g. if the suspend callback fails for one
94 * of the other devices that the PM core has unsuccessfully attempted to 100 * of the other devices that the PM core has unsuccessfully attempted to
95 * suspend earlier). 101 * suspend earlier).
96 * The PM core executes @complete() after it has executed the appropriate 102 * The PM core executes subsystem-level @complete() after it has executed
97 * resume callback for all devices. 103 * the appropriate resume callbacks for all devices.
98 * 104 *
99 * @suspend: Executed before putting the system into a sleep state in which the 105 * @suspend: Executed before putting the system into a sleep state in which the
100 * contents of main memory are preserved. Quiesce the device, put it into 106 * contents of main memory are preserved. The exact action to perform
101 * a low power state appropriate for the upcoming system state (such as 107 * depends on the device's subsystem (PM domain, device type, class or bus
102 * PCI_D3hot), and enable wakeup events as appropriate. 108 * type), but generally the device must be quiescent after subsystem-level
109 * @suspend() has returned, so that it doesn't do any I/O or DMA.
110 * Subsystem-level @suspend() is executed for all devices after invoking
111 * subsystem-level @prepare() for all of them.
103 * 112 *
104 * @resume: Executed after waking the system up from a sleep state in which the 113 * @resume: Executed after waking the system up from a sleep state in which the
105 * contents of main memory were preserved. Put the device into the 114 * contents of main memory were preserved. The exact action to perform
106 * appropriate state, according to the information saved in memory by the 115 * depends on the device's subsystem, but generally the driver is expected
107 * preceding @suspend(). The driver starts working again, responding to 116 * to start working again, responding to hardware events and software
108 * hardware events and software requests. The hardware may have gone 117 * requests (the device itself may be left in a low-power state, waiting
109 * through a power-off reset, or it may have maintained state from the 118 * for a runtime resume to occur). The state of the device at the time its
110 * previous suspend() which the driver may rely on while resuming. On most 119 * driver's @resume() callback is run depends on the platform and subsystem
111 * platforms, there are no restrictions on availability of resources like 120 * the device belongs to. On most platforms, there are no restrictions on
112 * clocks during @resume(). 121 * availability of resources like clocks during @resume().
122 * Subsystem-level @resume() is executed for all devices after invoking
123 * subsystem-level @resume_noirq() for all of them.
113 * 124 *
114 * @freeze: Hibernation-specific, executed before creating a hibernation image. 125 * @freeze: Hibernation-specific, executed before creating a hibernation image.
115 * Quiesce operations so that a consistent image can be created, but do NOT 126 * Analogous to @suspend(), but it should not enable the device to signal
116 * otherwise put the device into a low power device state and do NOT emit 127 * wakeup events or change its power state. The majority of subsystems
117 * system wakeup events. Save in main memory the device settings to be 128 * (with the notable exception of the PCI bus type) expect the driver-level
118 * used by @restore() during the subsequent resume from hibernation or by 129 * @freeze() to save the device settings in memory to be used by @restore()
119 * the subsequent @thaw(), if the creation of the image or the restoration 130 * during the subsequent resume from hibernation.
120 * of main memory contents from it fails. 131 * Subsystem-level @freeze() is executed for all devices after invoking
132 * subsystem-level @prepare() for all of them.
121 * 133 *
122 * @thaw: Hibernation-specific, executed after creating a hibernation image OR 134 * @thaw: Hibernation-specific, executed after creating a hibernation image OR
123 * if the creation of the image fails. Also executed after a failing 135 * if the creation of an image has failed. Also executed after a failing
124 * attempt to restore the contents of main memory from such an image. 136 * attempt to restore the contents of main memory from such an image.
125 * Undo the changes made by the preceding @freeze(), so the device can be 137 * Undo the changes made by the preceding @freeze(), so the device can be
126 * operated in the same way as immediately before the call to @freeze(). 138 * operated in the same way as immediately before the call to @freeze().
139 * Subsystem-level @thaw() is executed for all devices after invoking
140 * subsystem-level @thaw_noirq() for all of them. It also may be executed
141 * directly after @freeze() in case of a transition error.
127 * 142 *
128 * @poweroff: Hibernation-specific, executed after saving a hibernation image. 143 * @poweroff: Hibernation-specific, executed after saving a hibernation image.
129 * Quiesce the device, put it into a low power state appropriate for the 144 * Analogous to @suspend(), but it need not save the device's settings in
130 * upcoming system state (such as PCI_D3hot), and enable wakeup events as 145 * memory.
131 * appropriate. 146 * Subsystem-level @poweroff() is executed for all devices after invoking
147 * subsystem-level @prepare() for all of them.
132 * 148 *
133 * @restore: Hibernation-specific, executed after restoring the contents of main 149 * @restore: Hibernation-specific, executed after restoring the contents of main
134 * memory from a hibernation image. Driver starts working again, 150 * memory from a hibernation image, analogous to @resume().
135 * responding to hardware events and software requests. Drivers may NOT 151 *
136 * make ANY assumptions about the hardware state right prior to @restore(). 152 * @suspend_noirq: Complete the actions started by @suspend(). Carry out any
137 * On most platforms, there are no restrictions on availability of 153 * additional operations required for suspending the device that might be
138 * resources like clocks during @restore(). 154 * racing with its driver's interrupt handler, which is guaranteed not to
139 * 155 * run while @suspend_noirq() is being executed.
140 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 156 * It generally is expected that the device will be in a low-power state
141 * actions required for suspending the device that need interrupts to be 157 * (appropriate for the target system sleep state) after subsystem-level
142 * disabled 158 * @suspend_noirq() has returned successfully. If the device can generate
143 * 159 * system wakeup signals and is enabled to wake up the system, it should be
144 * @resume_noirq: Prepare for the execution of ->resume() by carrying out any 160 * configured to do so at that time. However, depending on the platform
145 * actions required for resuming the device that need interrupts to be 161 * and device's subsystem, @suspend() may be allowed to put the device into
146 * disabled 162 * the low-power state and configure it to generate wakeup signals, in
147 * 163 * which case it generally is not necessary to define @suspend_noirq().
148 * @freeze_noirq: Complete the operations of ->freeze() by carrying out any 164 *
149 * actions required for freezing the device that need interrupts to be 165 * @resume_noirq: Prepare for the execution of @resume() by carrying out any
150 * disabled 166 * operations required for resuming the device that might be racing with
151 * 167 * its driver's interrupt handler, which is guaranteed not to run while
152 * @thaw_noirq: Prepare for the execution of ->thaw() by carrying out any 168 * @resume_noirq() is being executed.
153 * actions required for thawing the device that need interrupts to be 169 *
154 * disabled 170 * @freeze_noirq: Complete the actions started by @freeze(). Carry out any
155 * 171 * additional operations required for freezing the device that might be
156 * @poweroff_noirq: Complete the operations of ->poweroff() by carrying out any 172 * racing with its driver's interrupt handler, which is guaranteed not to
157 * actions required for handling the device that need interrupts to be 173 * run while @freeze_noirq() is being executed.
158 * disabled 174 * The power state of the device should not be changed by either @freeze()
159 * 175 * or @freeze_noirq() and it should not be configured to signal system
160 * @restore_noirq: Prepare for the execution of ->restore() by carrying out any 176 * wakeup by any of these callbacks.
161 * actions required for restoring the operations of the device that need 177 *
162 * interrupts to be disabled 178 * @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
180 * driver's interrupt handler, which is guaranteed not to run while
181 * @thaw_noirq() is being executed.
182 *
183 * @poweroff_noirq: Complete the actions started by @poweroff(). Analogous to
184 * @suspend_noirq(), but it need not save the device's settings in memory.
185 *
186 * @restore_noirq: Prepare for the execution of @restore() by carrying out any
187 * operations required for thawing the device that might be racing with its
188 * driver's interrupt handler, which is guaranteed not to run while
189 * @restore_noirq() is being executed. Analogous to @resume_noirq().
163 * 190 *
164 * All of the above callbacks, except for @complete(), return error codes. 191 * All of the above callbacks, except for @complete(), return error codes.
165 * However, the error codes returned by the resume operations, @resume(), 192 * However, the error codes returned by the resume operations, @resume(),
166 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do 193 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq(), do
167 * not cause the PM core to abort the resume transition during which they are 194 * not cause the PM core to abort the resume transition during which they are
168 * returned. The error codes returned in that cases are only printed by the PM 195 * returned. The error codes returned in those cases are only printed by the PM
169 * core to the system logs for debugging purposes. Still, it is recommended 196 * core to the system logs for debugging purposes. Still, it is recommended
170 * that drivers only return error codes from their resume methods in case of an 197 * that drivers only return error codes from their resume methods in case of an
171 * unrecoverable failure (i.e. when the device being handled refuses to resume 198 * unrecoverable failure (i.e. when the device being handled refuses to resume
@@ -174,31 +201,43 @@ typedef struct pm_message {
174 * their children. 201 * their children.
175 * 202 *
176 * It is allowed to unregister devices while the above callbacks are being 203 * It is allowed to unregister devices while the above callbacks are being
177 * executed. However, it is not allowed to unregister a device from within any 204 * executed. However, a callback routine must NOT try to unregister the device
178 * of its own callbacks. 205 * it was called for, although it may unregister children of that device (for
206 * example, if it detects that a child was unplugged while the system was
207 * asleep).
179 * 208 *
180 * There also are the following callbacks related to run-time power management 209 * Refer to Documentation/power/devices.txt for more information about the role
181 * of devices: 210 * of the above callbacks in the system suspend process.
211 *
212 * There also are callbacks related to runtime power management of devices.
213 * Again, these callbacks are executed by the PM core only for subsystems
214 * (PM domains, device types, classes and bus types) and the subsystem-level
215 * callbacks are supposed to invoke the driver callbacks. Moreover, the exact
216 * actions to be performed by a device driver's callbacks generally depend on
217 * the platform and subsystem the device belongs to.
182 * 218 *
183 * @runtime_suspend: Prepare the device for a condition in which it won't be 219 * @runtime_suspend: Prepare the device for a condition in which it won't be
184 * able to communicate with the CPU(s) and RAM due to power management. 220 * able to communicate with the CPU(s) and RAM due to power management.
185 * This need not mean that the device should be put into a low power state. 221 * This need not mean that the device should be put into a low-power state.
186 * For example, if the device is behind a link which is about to be turned 222 * For example, if the device is behind a link which is about to be turned
187 * off, the device may remain at full power. If the device does go to low 223 * off, the device may remain at full power. If the device does go to low
188 * power and is capable of generating run-time wake-up events, remote 224 * power and is capable of generating runtime wakeup events, remote wakeup
189 * wake-up (i.e., a hardware mechanism allowing the device to request a 225 * (i.e., a hardware mechanism allowing the device to request a change of
190 * change of its power state via a wake-up event, such as PCI PME) should 226 * its power state via an interrupt) should be enabled for it.
191 * be enabled for it.
192 * 227 *
193 * @runtime_resume: Put the device into the fully active state in response to a 228 * @runtime_resume: Put the device into the fully active state in response to a
194 * wake-up event generated by hardware or at the request of software. If 229 * wakeup event generated by hardware or at the request of software. If
195 * necessary, put the device into the full power state and restore its 230 * necessary, put the device into the full-power state and restore its
196 * registers, so that it is fully operational. 231 * registers, so that it is fully operational.
197 * 232 *
198 * @runtime_idle: Device appears to be inactive and it might be put into a low 233 * @runtime_idle: Device appears to be inactive and it might be put into a
199 * power state if all of the necessary conditions are satisfied. Check 234 * low-power state if all of the necessary conditions are satisfied. Check
200 * these conditions and handle the device as appropriate, possibly queueing 235 * these conditions and handle the device as appropriate, possibly queueing
201 * a suspend request for it. The return value is ignored by the PM core. 236 * a suspend request for it. The return value is ignored by the PM core.
237 *
238 * Refer to Documentation/power/runtime_pm.txt for more information about the
239 * role of the above callbacks in device runtime power management.
240 *
202 */ 241 */
203 242
204struct dev_pm_ops { 243struct dev_pm_ops {
@@ -261,19 +300,6 @@ const struct dev_pm_ops name = { \
261 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ 300 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
262} 301}
263 302
264/*
265 * Use this for subsystems (bus types, device types, device classes) that don't
266 * need any special suspend/resume handling in addition to invoking the PM
267 * callbacks provided by device drivers supporting both the system sleep PM and
268 * runtime PM, make the pm member point to generic_subsys_pm_ops.
269 */
270#ifdef CONFIG_PM
271extern struct dev_pm_ops generic_subsys_pm_ops;
272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
273#else
274#define GENERIC_SUBSYS_PM_OPS NULL
275#endif
276
277/** 303/**
278 * PM_EVENT_ messages 304 * PM_EVENT_ messages
279 * 305 *
@@ -482,6 +508,8 @@ struct dev_pm_info {
482 unsigned long active_jiffies; 508 unsigned long active_jiffies;
483 unsigned long suspended_jiffies; 509 unsigned long suspended_jiffies;
484 unsigned long accounting_timestamp; 510 unsigned long accounting_timestamp;
511 ktime_t suspend_time;
512 s64 max_time_suspended_ns;
485#endif 513#endif
486 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 514 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
487 struct pm_qos_constraints *constraints; 515 struct pm_qos_constraints *constraints;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 65633e5a2bc0..a03a0ad998b8 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,6 +10,7 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/err.h>
13 14
14enum gpd_status { 15enum gpd_status {
15 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 16 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -21,6 +22,23 @@ enum gpd_status {
21 22
22struct dev_power_governor { 23struct dev_power_governor {
23 bool (*power_down_ok)(struct dev_pm_domain *domain); 24 bool (*power_down_ok)(struct dev_pm_domain *domain);
25 bool (*stop_ok)(struct device *dev);
26};
27
28struct gpd_dev_ops {
29 int (*start)(struct device *dev);
30 int (*stop)(struct device *dev);
31 int (*save_state)(struct device *dev);
32 int (*restore_state)(struct device *dev);
33 int (*suspend)(struct device *dev);
34 int (*suspend_late)(struct device *dev);
35 int (*resume_early)(struct device *dev);
36 int (*resume)(struct device *dev);
37 int (*freeze)(struct device *dev);
38 int (*freeze_late)(struct device *dev);
39 int (*thaw_early)(struct device *dev);
40 int (*thaw)(struct device *dev);
41 bool (*active_wakeup)(struct device *dev);
24}; 42};
25 43
26struct generic_pm_domain { 44struct generic_pm_domain {
@@ -32,6 +50,7 @@ struct generic_pm_domain {
32 struct mutex lock; 50 struct mutex lock;
33 struct dev_power_governor *gov; 51 struct dev_power_governor *gov;
34 struct work_struct power_off_work; 52 struct work_struct power_off_work;
53 char *name;
35 unsigned int in_progress; /* Number of devices being suspended now */ 54 unsigned int in_progress; /* Number of devices being suspended now */
36 atomic_t sd_count; /* Number of subdomains with power "on" */ 55 atomic_t sd_count; /* Number of subdomains with power "on" */
37 enum gpd_status status; /* Current state of the domain */ 56 enum gpd_status status; /* Current state of the domain */
@@ -44,10 +63,13 @@ struct generic_pm_domain {
44 bool suspend_power_off; /* Power status before system suspend */ 63 bool suspend_power_off; /* Power status before system suspend */
45 bool dev_irq_safe; /* Device callbacks are IRQ-safe */ 64 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
46 int (*power_off)(struct generic_pm_domain *domain); 65 int (*power_off)(struct generic_pm_domain *domain);
66 s64 power_off_latency_ns;
47 int (*power_on)(struct generic_pm_domain *domain); 67 int (*power_on)(struct generic_pm_domain *domain);
48 int (*start_device)(struct device *dev); 68 s64 power_on_latency_ns;
49 int (*stop_device)(struct device *dev); 69 struct gpd_dev_ops dev_ops;
50 bool (*active_wakeup)(struct device *dev); 70 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time;
51}; 73};
52 74
53static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -62,8 +84,18 @@ struct gpd_link {
62 struct list_head slave_node; 84 struct list_head slave_node;
63}; 85};
64 86
87struct gpd_timing_data {
88 s64 stop_latency_ns;
89 s64 start_latency_ns;
90 s64 save_state_latency_ns;
91 s64 restore_state_latency_ns;
92 s64 break_even_ns;
93};
94
65struct generic_pm_domain_data { 95struct generic_pm_domain_data {
66 struct pm_domain_data base; 96 struct pm_domain_data base;
97 struct gpd_dev_ops ops;
98 struct gpd_timing_data td;
67 bool need_restore; 99 bool need_restore;
68}; 100};
69 101
@@ -73,18 +105,54 @@ static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *
73} 105}
74 106
75#ifdef CONFIG_PM_GENERIC_DOMAINS 107#ifdef CONFIG_PM_GENERIC_DOMAINS
76extern int pm_genpd_add_device(struct generic_pm_domain *genpd, 108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
77 struct device *dev); 109{
110 return to_gpd_data(dev->power.subsys_data->domain_data);
111}
112
113extern struct dev_power_governor simple_qos_governor;
114
115extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
116extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev,
118 struct gpd_timing_data *td);
119
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev)
122{
123 return __pm_genpd_add_device(genpd, dev, NULL);
124}
125
78extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
79 struct device *dev); 127 struct device *dev);
80extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
81 struct generic_pm_domain *new_subdomain); 129 struct generic_pm_domain *new_subdomain);
82extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
83 struct generic_pm_domain *target); 131 struct generic_pm_domain *target);
132extern int pm_genpd_add_callbacks(struct device *dev,
133 struct gpd_dev_ops *ops,
134 struct gpd_timing_data *td);
135extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
84extern void pm_genpd_init(struct generic_pm_domain *genpd, 136extern void pm_genpd_init(struct generic_pm_domain *genpd,
85 struct dev_power_governor *gov, bool is_off); 137 struct dev_power_governor *gov, bool is_off);
138
86extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 139extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
140
141extern bool default_stop_ok(struct device *dev);
142
143extern struct dev_power_governor pm_domain_always_on_gov;
87#else 144#else
145
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{
148 return ERR_PTR(-ENOSYS);
149}
150static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
151 struct device *dev,
152 struct gpd_timing_data *td)
153{
154 return -ENOSYS;
155}
88static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 156static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
89 struct device *dev) 157 struct device *dev)
90{ 158{
@@ -105,14 +173,35 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
105{ 173{
106 return -ENOSYS; 174 return -ENOSYS;
107} 175}
108static inline void pm_genpd_init(struct generic_pm_domain *genpd, 176static inline int pm_genpd_add_callbacks(struct device *dev,
109 struct dev_power_governor *gov, bool is_off) {} 177 struct gpd_dev_ops *ops,
178 struct gpd_timing_data *td)
179{
180 return -ENOSYS;
181}
182static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{
184 return -ENOSYS;
185}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
187{
188}
110static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
111{ 190{
112 return -ENOSYS; 191 return -ENOSYS;
113} 192}
193static inline bool default_stop_ok(struct device *dev)
194{
195 return false;
196}
197#define pm_domain_always_on_gov NULL
114#endif 198#endif
115 199
200static inline int pm_genpd_remove_callbacks(struct device *dev)
201{
202 return __pm_genpd_remove_callbacks(dev, true);
203}
204
116#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 205#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
117extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); 206extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
118extern void pm_genpd_poweroff_unused(void); 207extern void pm_genpd_poweroff_unused(void);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 83b0ea302a80..e5bbcbaa6f57 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -78,6 +78,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
78int pm_qos_request_active(struct pm_qos_request *req); 78int pm_qos_request_active(struct pm_qos_request *req);
79s32 pm_qos_read_value(struct pm_qos_constraints *c); 79s32 pm_qos_read_value(struct pm_qos_constraints *c);
80 80
81s32 __dev_pm_qos_read_value(struct device *dev);
81s32 dev_pm_qos_read_value(struct device *dev); 82s32 dev_pm_qos_read_value(struct device *dev);
82int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 83int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
83 s32 value); 84 s32 value);
@@ -91,6 +92,8 @@ int dev_pm_qos_add_global_notifier(struct notifier_block *notifier);
91int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); 92int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
92void dev_pm_qos_constraints_init(struct device *dev); 93void dev_pm_qos_constraints_init(struct device *dev);
93void dev_pm_qos_constraints_destroy(struct device *dev); 94void dev_pm_qos_constraints_destroy(struct device *dev);
95int dev_pm_qos_add_ancestor_request(struct device *dev,
96 struct dev_pm_qos_request *req, s32 value);
94#else 97#else
95static inline int pm_qos_update_target(struct pm_qos_constraints *c, 98static inline int pm_qos_update_target(struct pm_qos_constraints *c,
96 struct plist_node *node, 99 struct plist_node *node,
@@ -119,6 +122,8 @@ static inline int pm_qos_request_active(struct pm_qos_request *req)
119static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) 122static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
120 { return 0; } 123 { return 0; }
121 124
125static inline s32 __dev_pm_qos_read_value(struct device *dev)
126 { return 0; }
122static inline s32 dev_pm_qos_read_value(struct device *dev) 127static inline s32 dev_pm_qos_read_value(struct device *dev)
123 { return 0; } 128 { return 0; }
124static inline int dev_pm_qos_add_request(struct device *dev, 129static inline int dev_pm_qos_add_request(struct device *dev,
@@ -150,6 +155,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
150{ 155{
151 dev->power.power_state = PMSG_INVALID; 156 dev->power.power_state = PMSG_INVALID;
152} 157}
158static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
159 struct dev_pm_qos_request *req, s32 value)
160 { return 0; }
153#endif 161#endif
154 162
155#endif 163#endif
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d3085e72a0ee..609daae7a014 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -45,6 +45,8 @@ extern void pm_runtime_irq_safe(struct device *dev);
45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); 45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); 46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
48extern void pm_runtime_update_max_time_suspended(struct device *dev,
49 s64 delta_ns);
48 50
49static inline bool pm_children_suspended(struct device *dev) 51static inline bool pm_children_suspended(struct device *dev)
50{ 52{
@@ -148,6 +150,9 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
148static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
149 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
150 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
151#endif /* !CONFIG_PM_RUNTIME */ 156#endif /* !CONFIG_PM_RUNTIME */
152 157
153static inline int pm_runtime_idle(struct device *dev) 158static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 79159de0e341..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -40,12 +40,6 @@
40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */ 40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */ 41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
42 42
43#ifdef CONFIG_PHYS_ADDR_T_64BIT
44#define MEMBLOCK_INACTIVE 0x3a84fb0144c9e71bULL
45#else
46#define MEMBLOCK_INACTIVE 0x44c9e71bUL
47#endif
48
49#define SLUB_RED_INACTIVE 0xbb 43#define SLUB_RED_INACTIVE 0xbb
50#define SLUB_RED_ACTIVE 0xcc 44#define SLUB_RED_ACTIVE 0xcc
51 45
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 643b96c7a94f..6d9e575519cc 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 mode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 uid_t uid;
56 gid_t gid; 56 gid_t gid;
@@ -106,9 +106,9 @@ extern void proc_root_init(void);
106 106
107void proc_flush_task(struct task_struct *task); 107void proc_flush_task(struct task_struct *task);
108 108
109extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 109extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
110 struct proc_dir_entry *parent); 110 struct proc_dir_entry *parent);
111struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 111struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
112 struct proc_dir_entry *parent, 112 struct proc_dir_entry *parent,
113 const struct file_operations *proc_fops, 113 const struct file_operations *proc_fops,
114 void *data); 114 void *data);
@@ -146,17 +146,17 @@ extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
146extern struct proc_dir_entry *proc_symlink(const char *, 146extern struct proc_dir_entry *proc_symlink(const char *,
147 struct proc_dir_entry *, const char *); 147 struct proc_dir_entry *, const char *);
148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
150 struct proc_dir_entry *parent); 150 struct proc_dir_entry *parent);
151 151
152static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, 152static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
153 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 153 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
154{ 154{
155 return proc_create_data(name, mode, parent, proc_fops, NULL); 155 return proc_create_data(name, mode, parent, proc_fops, NULL);
156} 156}
157 157
158static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 158static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
159 mode_t mode, struct proc_dir_entry *base, 159 umode_t mode, struct proc_dir_entry *base,
160 read_proc_t *read_proc, void * data) 160 read_proc_t *read_proc, void * data)
161{ 161{
162 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 162 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
@@ -168,7 +168,7 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
168} 168}
169 169
170extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 170extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
171 const char *name, mode_t mode, const struct file_operations *fops); 171 const char *name, umode_t mode, const struct file_operations *fops);
172extern void proc_net_remove(struct net *net, const char *name); 172extern void proc_net_remove(struct net *net, const char *name);
173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 174 struct proc_dir_entry *parent);
@@ -185,15 +185,15 @@ static inline void proc_flush_task(struct task_struct *task)
185} 185}
186 186
187static inline struct proc_dir_entry *create_proc_entry(const char *name, 187static inline struct proc_dir_entry *create_proc_entry(const char *name,
188 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 188 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
189static inline struct proc_dir_entry *proc_create(const char *name, 189static inline struct proc_dir_entry *proc_create(const char *name,
190 mode_t mode, struct proc_dir_entry *parent, 190 umode_t mode, struct proc_dir_entry *parent,
191 const struct file_operations *proc_fops) 191 const struct file_operations *proc_fops)
192{ 192{
193 return NULL; 193 return NULL;
194} 194}
195static inline struct proc_dir_entry *proc_create_data(const char *name, 195static inline struct proc_dir_entry *proc_create_data(const char *name,
196 mode_t mode, struct proc_dir_entry *parent, 196 umode_t mode, struct proc_dir_entry *parent,
197 const struct file_operations *proc_fops, void *data) 197 const struct file_operations *proc_fops, void *data)
198{ 198{
199 return NULL; 199 return NULL;
@@ -205,10 +205,10 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
205static inline struct proc_dir_entry *proc_mkdir(const char *name, 205static inline struct proc_dir_entry *proc_mkdir(const char *name,
206 struct proc_dir_entry *parent) {return NULL;} 206 struct proc_dir_entry *parent) {return NULL;}
207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
208 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 208 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
209 209
210static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 210static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
211 mode_t mode, struct proc_dir_entry *base, 211 umode_t mode, struct proc_dir_entry *base,
212 read_proc_t *read_proc, void * data) { return NULL; } 212 read_proc_t *read_proc, void * data) { return NULL; }
213 213
214struct tty_driver; 214struct tty_driver;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 2ca8cde5459d..e1461e143be2 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -22,6 +22,9 @@
22#ifndef _LINUX_PSTORE_H 22#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H 23#define _LINUX_PSTORE_H
24 24
25#include <linux/time.h>
26#include <linux/kmsg_dump.h>
27
25/* types */ 28/* types */
26enum pstore_type_id { 29enum pstore_type_id {
27 PSTORE_TYPE_DMESG = 0, 30 PSTORE_TYPE_DMESG = 0,
@@ -41,7 +44,8 @@ struct pstore_info {
41 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 44 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
42 struct timespec *time, char **buf, 45 struct timespec *time, char **buf,
43 struct pstore_info *psi); 46 struct pstore_info *psi);
44 int (*write)(enum pstore_type_id type, u64 *id, 47 int (*write)(enum pstore_type_id type,
48 enum kmsg_dump_reason reason, u64 *id,
45 unsigned int part, size_t size, struct pstore_info *psi); 49 unsigned int part, size_t size, struct pstore_info *psi);
46 int (*erase)(enum pstore_type_id type, u64 id, 50 int (*erase)(enum pstore_type_id type, u64 id,
47 struct pstore_info *psi); 51 struct pstore_info *psi);
@@ -50,18 +54,12 @@ struct pstore_info {
50 54
51#ifdef CONFIG_PSTORE 55#ifdef CONFIG_PSTORE
52extern int pstore_register(struct pstore_info *); 56extern int pstore_register(struct pstore_info *);
53extern int pstore_write(enum pstore_type_id type, char *buf, size_t size);
54#else 57#else
55static inline int 58static inline int
56pstore_register(struct pstore_info *psi) 59pstore_register(struct pstore_info *psi)
57{ 60{
58 return -ENODEV; 61 return -ENODEV;
59} 62}
60static inline int
61pstore_write(enum pstore_type_id type, char *buf, size_t size)
62{
63 return -ENODEV;
64}
65#endif 63#endif
66 64
67#endif /*_LINUX_PSTORE_H*/ 65#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 9e65d9e20662..6f6df86f1ae5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -277,7 +277,10 @@ struct mdp_superblock_1 {
277 */ 277 */
278#define MD_FEATURE_RESHAPE_ACTIVE 4 278#define MD_FEATURE_RESHAPE_ACTIVE 4
279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ 279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */
280 280#define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an
281#define MD_FEATURE_ALL (1|2|4|8) 281 * active device with same 'role'.
282 * 'recovery_offset' is also set.
283 */
284#define MD_FEATURE_ALL (1|2|4|8|16)
282 285
283#endif 286#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 2b59cc824395..53272e9860a7 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -132,7 +132,7 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
132 PROT_READ|PROT_WRITE, \ 132 PROT_READ|PROT_WRITE, \
133 MAP_PRIVATE|MAP_ANONYMOUS,\ 133 MAP_PRIVATE|MAP_ANONYMOUS,\
134 0, 0)) 134 0, 0))
135# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE) 135# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y))
136 136
137static inline void cpu_relax(void) 137static inline void cpu_relax(void)
138{ 138{
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 3a8f0c9b2933..5bf5500db83d 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,7 +2,7 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 umode_t mode, dev_t dev);
6extern struct dentry *ramfs_mount(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data); 7 int flags, const char *dev_name, void *data);
8 8
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 2cf4226ade7e..81c04f4348ec 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -51,6 +51,8 @@ extern int rcutorture_runnable; /* for sysctl */
51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
52extern void rcutorture_record_test_transition(void); 52extern void rcutorture_record_test_transition(void);
53extern void rcutorture_record_progress(unsigned long vernum); 53extern void rcutorture_record_progress(unsigned long vernum);
54extern void do_trace_rcu_torture_read(char *rcutorturename,
55 struct rcu_head *rhp);
54#else 56#else
55static inline void rcutorture_record_test_transition(void) 57static inline void rcutorture_record_test_transition(void)
56{ 58{
@@ -58,6 +60,12 @@ static inline void rcutorture_record_test_transition(void)
58static inline void rcutorture_record_progress(unsigned long vernum) 60static inline void rcutorture_record_progress(unsigned long vernum)
59{ 61{
60} 62}
63#ifdef CONFIG_RCU_TRACE
64extern void do_trace_rcu_torture_read(char *rcutorturename,
65 struct rcu_head *rhp);
66#else
67#define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
68#endif
61#endif 69#endif
62 70
63#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b)) 71#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b))
@@ -177,23 +185,10 @@ extern void rcu_sched_qs(int cpu);
177extern void rcu_bh_qs(int cpu); 185extern void rcu_bh_qs(int cpu);
178extern void rcu_check_callbacks(int cpu, int user); 186extern void rcu_check_callbacks(int cpu, int user);
179struct notifier_block; 187struct notifier_block;
180 188extern void rcu_idle_enter(void);
181#ifdef CONFIG_NO_HZ 189extern void rcu_idle_exit(void);
182 190extern void rcu_irq_enter(void);
183extern void rcu_enter_nohz(void); 191extern void rcu_irq_exit(void);
184extern void rcu_exit_nohz(void);
185
186#else /* #ifdef CONFIG_NO_HZ */
187
188static inline void rcu_enter_nohz(void)
189{
190}
191
192static inline void rcu_exit_nohz(void)
193{
194}
195
196#endif /* #else #ifdef CONFIG_NO_HZ */
197 192
198/* 193/*
199 * Infrastructure to implement the synchronize_() primitives in 194 * Infrastructure to implement the synchronize_() primitives in
@@ -233,22 +228,30 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
233 228
234#ifdef CONFIG_DEBUG_LOCK_ALLOC 229#ifdef CONFIG_DEBUG_LOCK_ALLOC
235 230
236extern struct lockdep_map rcu_lock_map; 231#ifdef CONFIG_PROVE_RCU
237# define rcu_read_acquire() \ 232extern int rcu_is_cpu_idle(void);
238 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 233#else /* !CONFIG_PROVE_RCU */
239# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 234static inline int rcu_is_cpu_idle(void)
235{
236 return 0;
237}
238#endif /* else !CONFIG_PROVE_RCU */
240 239
241extern struct lockdep_map rcu_bh_lock_map; 240static inline void rcu_lock_acquire(struct lockdep_map *map)
242# define rcu_read_acquire_bh() \ 241{
243 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 242 WARN_ON_ONCE(rcu_is_cpu_idle());
244# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) 243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244}
245 245
246extern struct lockdep_map rcu_sched_lock_map; 246static inline void rcu_lock_release(struct lockdep_map *map)
247# define rcu_read_acquire_sched() \ 247{
248 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 248 WARN_ON_ONCE(rcu_is_cpu_idle());
249# define rcu_read_release_sched() \ 249 lock_release(map, 1, _THIS_IP_);
250 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) 250}
251 251
252extern struct lockdep_map rcu_lock_map;
253extern struct lockdep_map rcu_bh_lock_map;
254extern struct lockdep_map rcu_sched_lock_map;
252extern int debug_lockdep_rcu_enabled(void); 255extern int debug_lockdep_rcu_enabled(void);
253 256
254/** 257/**
@@ -262,11 +265,18 @@ extern int debug_lockdep_rcu_enabled(void);
262 * 265 *
263 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot 266 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
264 * and while lockdep is disabled. 267 * and while lockdep is disabled.
268 *
269 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
270 * 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()
272 * was invoked from within an irq handler.
265 */ 273 */
266static inline int rcu_read_lock_held(void) 274static inline int rcu_read_lock_held(void)
267{ 275{
268 if (!debug_lockdep_rcu_enabled()) 276 if (!debug_lockdep_rcu_enabled())
269 return 1; 277 return 1;
278 if (rcu_is_cpu_idle())
279 return 0;
270 return lock_is_held(&rcu_lock_map); 280 return lock_is_held(&rcu_lock_map);
271} 281}
272 282
@@ -290,6 +300,19 @@ extern int rcu_read_lock_bh_held(void);
290 * 300 *
291 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot 301 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
292 * and while lockdep is disabled. 302 * and while lockdep is disabled.
303 *
304 * Note that if the CPU is in the idle loop from an RCU point of
305 * view (ie: that we are in the section between rcu_idle_enter() and
306 * rcu_idle_exit()) then rcu_read_lock_held() returns false even if the CPU
307 * did an rcu_read_lock(). The reason for this is that RCU ignores CPUs
308 * that are in such a section, considering these as in extended quiescent
309 * state, so such a CPU is effectively never in an RCU read-side critical
310 * section regardless of what RCU primitives it invokes. This state of
311 * affairs is required --- we need to keep an RCU-free window in idle
312 * where the CPU may possibly enter into low power mode. This way we can
313 * 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
315 * the idle task.
293 */ 316 */
294#ifdef CONFIG_PREEMPT_COUNT 317#ifdef CONFIG_PREEMPT_COUNT
295static inline int rcu_read_lock_sched_held(void) 318static inline int rcu_read_lock_sched_held(void)
@@ -298,6 +321,8 @@ static inline int rcu_read_lock_sched_held(void)
298 321
299 if (!debug_lockdep_rcu_enabled()) 322 if (!debug_lockdep_rcu_enabled())
300 return 1; 323 return 1;
324 if (rcu_is_cpu_idle())
325 return 0;
301 if (debug_locks) 326 if (debug_locks)
302 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 327 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
303 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 328 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
@@ -311,12 +336,8 @@ static inline int rcu_read_lock_sched_held(void)
311 336
312#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 337#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
313 338
314# define rcu_read_acquire() do { } while (0) 339# define rcu_lock_acquire(a) do { } while (0)
315# define rcu_read_release() do { } while (0) 340# define rcu_lock_release(a) do { } while (0)
316# define rcu_read_acquire_bh() do { } while (0)
317# define rcu_read_release_bh() do { } while (0)
318# define rcu_read_acquire_sched() do { } while (0)
319# define rcu_read_release_sched() do { } while (0)
320 341
321static inline int rcu_read_lock_held(void) 342static inline int rcu_read_lock_held(void)
322{ 343{
@@ -637,7 +658,7 @@ static inline void rcu_read_lock(void)
637{ 658{
638 __rcu_read_lock(); 659 __rcu_read_lock();
639 __acquire(RCU); 660 __acquire(RCU);
640 rcu_read_acquire(); 661 rcu_lock_acquire(&rcu_lock_map);
641} 662}
642 663
643/* 664/*
@@ -657,7 +678,7 @@ static inline void rcu_read_lock(void)
657 */ 678 */
658static inline void rcu_read_unlock(void) 679static inline void rcu_read_unlock(void)
659{ 680{
660 rcu_read_release(); 681 rcu_lock_release(&rcu_lock_map);
661 __release(RCU); 682 __release(RCU);
662 __rcu_read_unlock(); 683 __rcu_read_unlock();
663} 684}
@@ -673,12 +694,17 @@ static inline void rcu_read_unlock(void)
673 * critical sections in interrupt context can use just rcu_read_lock(), 694 * critical sections in interrupt context can use just rcu_read_lock(),
674 * though this should at least be commented to avoid confusing people 695 * though this should at least be commented to avoid confusing people
675 * reading the code. 696 * reading the code.
697 *
698 * Note that rcu_read_lock_bh() and the matching rcu_read_unlock_bh()
699 * must occur in the same context, for example, it is illegal to invoke
700 * rcu_read_unlock_bh() from one task if the matching rcu_read_lock_bh()
701 * was invoked from some other task.
676 */ 702 */
677static inline void rcu_read_lock_bh(void) 703static inline void rcu_read_lock_bh(void)
678{ 704{
679 local_bh_disable(); 705 local_bh_disable();
680 __acquire(RCU_BH); 706 __acquire(RCU_BH);
681 rcu_read_acquire_bh(); 707 rcu_lock_acquire(&rcu_bh_lock_map);
682} 708}
683 709
684/* 710/*
@@ -688,7 +714,7 @@ static inline void rcu_read_lock_bh(void)
688 */ 714 */
689static inline void rcu_read_unlock_bh(void) 715static inline void rcu_read_unlock_bh(void)
690{ 716{
691 rcu_read_release_bh(); 717 rcu_lock_release(&rcu_bh_lock_map);
692 __release(RCU_BH); 718 __release(RCU_BH);
693 local_bh_enable(); 719 local_bh_enable();
694} 720}
@@ -700,12 +726,17 @@ static inline void rcu_read_unlock_bh(void)
700 * are being done using call_rcu_sched() or synchronize_rcu_sched(). 726 * are being done using call_rcu_sched() or synchronize_rcu_sched().
701 * Read-side critical sections can also be introduced by anything that 727 * Read-side critical sections can also be introduced by anything that
702 * disables preemption, including local_irq_disable() and friends. 728 * disables preemption, including local_irq_disable() and friends.
729 *
730 * Note that rcu_read_lock_sched() and the matching rcu_read_unlock_sched()
731 * must occur in the same context, for example, it is illegal to invoke
732 * rcu_read_unlock_sched() from process context if the matching
733 * rcu_read_lock_sched() was invoked from an NMI handler.
703 */ 734 */
704static inline void rcu_read_lock_sched(void) 735static inline void rcu_read_lock_sched(void)
705{ 736{
706 preempt_disable(); 737 preempt_disable();
707 __acquire(RCU_SCHED); 738 __acquire(RCU_SCHED);
708 rcu_read_acquire_sched(); 739 rcu_lock_acquire(&rcu_sched_lock_map);
709} 740}
710 741
711/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 742/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -722,7 +753,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
722 */ 753 */
723static inline void rcu_read_unlock_sched(void) 754static inline void rcu_read_unlock_sched(void)
724{ 755{
725 rcu_read_release_sched(); 756 rcu_lock_release(&rcu_sched_lock_map);
726 __release(RCU_SCHED); 757 __release(RCU_SCHED);
727 preempt_enable(); 758 preempt_enable();
728} 759}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 690276a642cf..eb93921cdd30 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,9 +23,8 @@ struct spi_device;
23/* An enum of all the supported cache types */ 23/* An enum of all the supported cache types */
24enum regcache_type { 24enum regcache_type {
25 REGCACHE_NONE, 25 REGCACHE_NONE,
26 REGCACHE_INDEXED,
27 REGCACHE_RBTREE, 26 REGCACHE_RBTREE,
28 REGCACHE_LZO 27 REGCACHE_COMPRESSED
29}; 28};
30 29
31/** 30/**
@@ -83,7 +82,7 @@ struct regmap_config {
83 bool (*precious_reg)(struct device *dev, unsigned int reg); 82 bool (*precious_reg)(struct device *dev, unsigned int reg);
84 83
85 unsigned int max_register; 84 unsigned int max_register;
86 struct reg_default *reg_defaults; 85 const struct reg_default *reg_defaults;
87 unsigned int num_reg_defaults; 86 unsigned int num_reg_defaults;
88 enum regcache_type cache_type; 87 enum regcache_type cache_type;
89 const void *reg_defaults_raw; 88 const void *reg_defaults_raw;
@@ -129,6 +128,8 @@ struct regmap *regmap_init_spi(struct spi_device *dev,
129 const struct regmap_config *config); 128 const struct regmap_config *config);
130 129
131void regmap_exit(struct regmap *map); 130void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config);
132int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
133int regmap_raw_write(struct regmap *map, unsigned int reg, 134int regmap_raw_write(struct regmap *map, unsigned int reg,
134 const void *val, size_t val_len); 135 const void *val, size_t val_len);
@@ -139,9 +140,61 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
139 size_t val_count); 140 size_t val_count);
140int regmap_update_bits(struct regmap *map, unsigned int reg, 141int regmap_update_bits(struct regmap *map, unsigned int reg,
141 unsigned int mask, unsigned int val); 142 unsigned int mask, unsigned int val);
143int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val,
145 bool *change);
142 146
143int regcache_sync(struct regmap *map); 147int regcache_sync(struct regmap *map);
144void regcache_cache_only(struct regmap *map, bool enable); 148void regcache_cache_only(struct regmap *map, bool enable);
145void regcache_cache_bypass(struct regmap *map, bool enable); 149void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map);
151
152/**
153 * Description of an IRQ for the generic regmap irq_chip.
154 *
155 * @reg_offset: Offset of the status/mask register within the bank
156 * @mask: Mask used to flag/control the register.
157 */
158struct regmap_irq {
159 unsigned int reg_offset;
160 unsigned int mask;
161};
162
163/**
164 * Description of a generic regmap irq_chip. This is not intended to
165 * handle every possible interrupt controller, but it should handle a
166 * substantial proportion of those that are found in the wild.
167 *
168 * @name: Descriptive name for IRQ controller.
169 *
170 * @status_base: Base status register address.
171 * @mask_base: Base mask register address.
172 * @ack_base: Base ack address. If zero then the chip is clear on read.
173 *
174 * @num_regs: Number of registers in each control bank.
175 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
176 * assigned based on the index in the array of the interrupt.
177 * @num_irqs: Number of descriptors.
178 */
179struct regmap_irq_chip {
180 const char *name;
181
182 unsigned int status_base;
183 unsigned int mask_base;
184 unsigned int ack_base;
185
186 int num_regs;
187
188 const struct regmap_irq *irqs;
189 int num_irqs;
190};
191
192struct regmap_irq_chip_data;
193
194int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
195 int irq_base, struct regmap_irq_chip *chip,
196 struct regmap_irq_chip_data **data);
197void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
146 199
147#endif 200#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 96d465f8d3e6..2213ddcce20c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1759,13 +1759,14 @@ struct reiserfs_journal_header {
1759 REISERFS_QUOTA_TRANS_BLOCKS(sb))) 1759 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1760 1760
1761#ifdef CONFIG_QUOTA 1761#ifdef CONFIG_QUOTA
1762#define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA))
1762/* We need to update data and inode (atime) */ 1763/* We need to update data and inode (atime) */
1763#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1764#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0)
1764/* 1 balancing, 1 bitmap, 1 data per write + stat data update */ 1765/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1765#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1766#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1766(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) 1767(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1767/* same as with INIT */ 1768/* same as with INIT */
1768#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1769#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1769(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) 1770(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1770#else 1771#else
1771#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 1772#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
@@ -2056,7 +2057,7 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
2056 2057
2057struct reiserfs_security_handle; 2058struct reiserfs_security_handle;
2058int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 2059int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2059 struct inode *dir, int mode, 2060 struct inode *dir, umode_t mode,
2060 const char *symname, loff_t i_size, 2061 const char *symname, loff_t i_size,
2061 struct dentry *dentry, struct inode *inode, 2062 struct dentry *dentry, struct inode *inode,
2062 struct reiserfs_security_handle *security); 2063 struct reiserfs_security_handle *security);
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 52c83b6a758a..8c9e85c64b46 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -417,6 +417,7 @@ struct reiserfs_sb_info {
417 char *s_qf_names[MAXQUOTAS]; 417 char *s_qf_names[MAXQUOTAS];
418 int s_jquota_fmt; 418 int s_jquota_fmt;
419#endif 419#endif
420 char *s_jdev; /* Stored jdev for mount option showing */
420#ifdef CONFIG_REISERFS_CHECK 421#ifdef CONFIG_REISERFS_CHECK
421 422
422 struct tree_balance *cur_tb; /* 423 struct tree_balance *cur_tb; /*
@@ -482,7 +483,8 @@ enum reiserfs_mount_options {
482 REISERFS_ERROR_RO, 483 REISERFS_ERROR_RO,
483 REISERFS_ERROR_CONTINUE, 484 REISERFS_ERROR_CONTINUE,
484 485
485 REISERFS_QUOTA, /* Some quota option specified */ 486 REISERFS_USRQUOTA, /* User quota option specified */
487 REISERFS_GRPQUOTA, /* Group quota option specified */
486 488
487 REISERFS_TEST1, 489 REISERFS_TEST1,
488 REISERFS_TEST2, 490 REISERFS_TEST2,
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 14a86bc7102b..a822fd71fd64 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -144,7 +144,7 @@ struct rchan_callbacks
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
147 int mode, 147 umode_t mode,
148 struct rchan_buf *buf, 148 struct rchan_buf *buf,
149 int *is_global); 149 int *is_global);
150 150
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1c4f3e9b9bc5..ad93e1ec8c65 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -220,7 +220,7 @@ extern char ___assert_task_state[1 - 2*!!(
220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
221#define task_contributes_to_load(task) \ 221#define task_contributes_to_load(task) \
222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ 222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
223 (task->flags & PF_FREEZING) == 0) 223 (task->flags & PF_FROZEN) == 0)
224 224
225#define __set_task_state(tsk, state_value) \ 225#define __set_task_state(tsk, state_value) \
226 do { (tsk)->state = (state_value); } while (0) 226 do { (tsk)->state = (state_value); } while (0)
@@ -273,9 +273,11 @@ extern int runqueue_is_locked(int cpu);
273 273
274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
275extern void select_nohz_load_balancer(int stop_tick); 275extern void select_nohz_load_balancer(int stop_tick);
276extern void set_cpu_sd_state_idle(void);
276extern int get_nohz_timer_target(void); 277extern int get_nohz_timer_target(void);
277#else 278#else
278static inline void select_nohz_load_balancer(int stop_tick) { } 279static inline void select_nohz_load_balancer(int stop_tick) { }
280static inline void set_cpu_sd_state_idle(void) { }
279#endif 281#endif
280 282
281/* 283/*
@@ -483,8 +485,8 @@ struct task_cputime {
483 485
484#define INIT_CPUTIME \ 486#define INIT_CPUTIME \
485 (struct task_cputime) { \ 487 (struct task_cputime) { \
486 .utime = cputime_zero, \ 488 .utime = 0, \
487 .stime = cputime_zero, \ 489 .stime = 0, \
488 .sum_exec_runtime = 0, \ 490 .sum_exec_runtime = 0, \
489 } 491 }
490 492
@@ -901,6 +903,10 @@ struct sched_group_power {
901 * single CPU. 903 * single CPU.
902 */ 904 */
903 unsigned int power, power_orig; 905 unsigned int power, power_orig;
906 /*
907 * Number of busy cpus in this group.
908 */
909 atomic_t nr_busy_cpus;
904}; 910};
905 911
906struct sched_group { 912struct sched_group {
@@ -925,6 +931,15 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
925 return to_cpumask(sg->cpumask); 931 return to_cpumask(sg->cpumask);
926} 932}
927 933
934/**
935 * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
936 * @group: The group whose first cpu is to be returned.
937 */
938static inline unsigned int group_first_cpu(struct sched_group *group)
939{
940 return cpumask_first(sched_group_cpus(group));
941}
942
928struct sched_domain_attr { 943struct sched_domain_attr {
929 int relax_domain_level; 944 int relax_domain_level;
930}; 945};
@@ -1315,8 +1330,8 @@ struct task_struct {
1315 * older sibling, respectively. (p->father can be replaced with 1330 * older sibling, respectively. (p->father can be replaced with
1316 * p->real_parent->pid) 1331 * p->real_parent->pid)
1317 */ 1332 */
1318 struct task_struct *real_parent; /* real parent process */ 1333 struct task_struct __rcu *real_parent; /* real parent process */
1319 struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */ 1334 struct task_struct __rcu *parent; /* recipient of SIGCHLD, wait4() reports */
1320 /* 1335 /*
1321 * children/sibling forms the list of my natural children 1336 * children/sibling forms the list of my natural children
1322 */ 1337 */
@@ -1772,7 +1787,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1772#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1787#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1773#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ 1788#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1774#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1789#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1775#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1776#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1790#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1777#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1791#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1778#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1792#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
@@ -1788,7 +1802,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1788#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1802#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1789#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1803#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1790#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1804#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1791#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1792 1805
1793/* 1806/*
1794 * Only the _current_ task can read/write to tsk->flags, but other 1807 * Only the _current_ task can read/write to tsk->flags, but other
@@ -2070,6 +2083,14 @@ extern int sched_setscheduler(struct task_struct *, int,
2070extern int sched_setscheduler_nocheck(struct task_struct *, int, 2083extern int sched_setscheduler_nocheck(struct task_struct *, int,
2071 const struct sched_param *); 2084 const struct sched_param *);
2072extern struct task_struct *idle_task(int cpu); 2085extern struct task_struct *idle_task(int cpu);
2086/**
2087 * is_idle_task - is the specified task an idle task?
2088 * @tsk: the task in question.
2089 */
2090static inline bool is_idle_task(struct task_struct *p)
2091{
2092 return p->pid == 0;
2093}
2073extern struct task_struct *curr_task(int cpu); 2094extern struct task_struct *curr_task(int cpu);
2074extern void set_curr_task(int cpu, struct task_struct *p); 2095extern void set_curr_task(int cpu, struct task_struct *p);
2075 2096
diff --git a/include/linux/security.h b/include/linux/security.h
index 19d8e04e1688..98112cf93884 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -186,7 +186,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
186 * Security module identifier. 186 * Security module identifier.
187 * 187 *
188 * @name: 188 * @name:
189 * A string that acts as a unique identifeir for the LSM with max number 189 * A string that acts as a unique identifier for the LSM with max number
190 * of characters = SECURITY_NAME_MAX. 190 * of characters = SECURITY_NAME_MAX.
191 * 191 *
192 * Security hooks for program execution operations. 192 * Security hooks for program execution operations.
@@ -275,7 +275,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
275 * @copy copied data which will be passed to the security module. 275 * @copy copied data which will be passed to the security module.
276 * Returns 0 if the copy was successful. 276 * Returns 0 if the copy was successful.
277 * @sb_remount: 277 * @sb_remount:
278 * Extracts security system specifc mount options and verifys no changes 278 * Extracts security system specific mount options and verifies no changes
279 * are being made to those options. 279 * are being made to those options.
280 * @sb superblock being remounted 280 * @sb superblock being remounted
281 * @data contains the filesystem-specific data. 281 * @data contains the filesystem-specific data.
@@ -380,15 +380,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
380 * Return 0 if permission is granted. 380 * Return 0 if permission is granted.
381 * @inode_mkdir: 381 * @inode_mkdir:
382 * Check permissions to create a new directory in the existing directory 382 * Check permissions to create a new directory in the existing directory
383 * associated with inode strcture @dir. 383 * associated with inode structure @dir.
384 * @dir containst the inode structure of parent of the directory to be created. 384 * @dir contains the inode structure of parent of the directory to be created.
385 * @dentry contains the dentry structure of new directory. 385 * @dentry contains the dentry structure of new directory.
386 * @mode contains the mode of new directory. 386 * @mode contains the mode of new directory.
387 * Return 0 if permission is granted. 387 * Return 0 if permission is granted.
388 * @path_mkdir: 388 * @path_mkdir:
389 * Check permissions to create a new directory in the existing directory 389 * Check permissions to create a new directory in the existing directory
390 * associated with path strcture @path. 390 * associated with path structure @path.
391 * @dir containst the path structure of parent of the directory 391 * @dir contains the path structure of parent of the directory
392 * to be created. 392 * to be created.
393 * @dentry contains the dentry structure of new directory. 393 * @dentry contains the dentry structure of new directory.
394 * @mode contains the mode of new directory. 394 * @mode contains the mode of new directory.
@@ -578,7 +578,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
578 * @file contains the file structure. 578 * @file contains the file structure.
579 * @cmd contains the operation to perform. 579 * @cmd contains the operation to perform.
580 * @arg contains the operational arguments. 580 * @arg contains the operational arguments.
581 * Check permission for an ioctl operation on @file. Note that @arg can 581 * Check permission for an ioctl operation on @file. Note that @arg
582 * sometimes represents a user space pointer; in other cases, it may be a 582 * sometimes represents a user space pointer; in other cases, it may be a
583 * simple integer value. When @arg represents a user space pointer, it 583 * simple integer value. When @arg represents a user space pointer, it
584 * should never be used by the security module. 584 * should never be used by the security module.
@@ -606,7 +606,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * Return 0 if permission is granted. 606 * Return 0 if permission is granted.
607 * @file_fcntl: 607 * @file_fcntl:
608 * Check permission before allowing the file operation specified by @cmd 608 * Check permission before allowing the file operation specified by @cmd
609 * from being performed on the file @file. Note that @arg can sometimes 609 * from being performed on the file @file. Note that @arg sometimes
610 * represents a user space pointer; in other cases, it may be a simple 610 * represents a user space pointer; in other cases, it may be a simple
611 * integer value. When @arg represents a user space pointer, it should 611 * integer value. When @arg represents a user space pointer, it should
612 * never be used by the security module. 612 * never be used by the security module.
@@ -793,7 +793,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
793 * information can be saved using the eff_cap field of the 793 * information can be saved using the eff_cap field of the
794 * netlink_skb_parms structure. Also may be used to provide fine 794 * netlink_skb_parms structure. Also may be used to provide fine
795 * grained control over message transmission. 795 * grained control over message transmission.
796 * @sk associated sock of task sending the message., 796 * @sk associated sock of task sending the message.
797 * @skb contains the sk_buff structure for the netlink message. 797 * @skb contains the sk_buff structure for the netlink message.
798 * Return 0 if the information was successfully saved and message 798 * Return 0 if the information was successfully saved and message
799 * is allowed to be transmitted. 799 * is allowed to be transmitted.
@@ -1080,9 +1080,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1080 * should free it. 1080 * should free it.
1081 * @key points to the key to be queried. 1081 * @key points to the key to be queried.
1082 * @_buffer points to a pointer that should be set to point to the 1082 * @_buffer points to a pointer that should be set to point to the
1083 * resulting string (if no label or an error occurs). 1083 * resulting string (if no label or an error occurs).
1084 * Return the length of the string (including terminating NUL) or -ve if 1084 * Return the length of the string (including terminating NUL) or -ve if
1085 * an error. 1085 * an error.
1086 * May also return 0 (and a NULL buffer pointer) if there is no label. 1086 * May also return 0 (and a NULL buffer pointer) if there is no label.
1087 * 1087 *
1088 * Security hooks affecting all System V IPC operations. 1088 * Security hooks affecting all System V IPC operations.
@@ -1268,7 +1268,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1268 * credentials. 1268 * credentials.
1269 * @tsk contains the task_struct for the process. 1269 * @tsk contains the task_struct for the process.
1270 * @cred contains the credentials to use. 1270 * @cred contains the credentials to use.
1271 * @ns contains the user namespace we want the capability in 1271 * @ns contains the user namespace we want the capability in
1272 * @cap contains the capability <include/linux/capability.h>. 1272 * @cap contains the capability <include/linux/capability.h>.
1273 * @audit: Whether to write an audit message or not 1273 * @audit: Whether to write an audit message or not
1274 * Return 0 if the capability is granted for @tsk. 1274 * Return 0 if the capability is granted for @tsk.
@@ -1370,7 +1370,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1370 * @ctxlen contains the length of @ctx. 1370 * @ctxlen contains the length of @ctx.
1371 * 1371 *
1372 * @inode_getsecctx: 1372 * @inode_getsecctx:
1373 * Returns a string containing all relavent security context information 1373 * Returns a string containing all relevant security context information
1374 * 1374 *
1375 * @inode we wish to get the security context of. 1375 * @inode we wish to get the security context of.
1376 * @ctx is a pointer in which to place the allocated security context. 1376 * @ctx is a pointer in which to place the allocated security context.
@@ -1424,9 +1424,9 @@ struct security_operations {
1424 1424
1425#ifdef CONFIG_SECURITY_PATH 1425#ifdef CONFIG_SECURITY_PATH
1426 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1426 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); 1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
1430 unsigned int dev); 1430 unsigned int dev);
1431 int (*path_truncate) (struct path *path); 1431 int (*path_truncate) (struct path *path);
1432 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1432 int (*path_symlink) (struct path *dir, struct dentry *dentry,
@@ -1435,8 +1435,7 @@ struct security_operations {
1435 struct dentry *new_dentry); 1435 struct dentry *new_dentry);
1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 struct path *new_dir, struct dentry *new_dentry); 1437 struct path *new_dir, struct dentry *new_dentry);
1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, 1438 int (*path_chmod) (struct path *path, umode_t mode);
1439 mode_t mode);
1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1439 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 int (*path_chroot) (struct path *path); 1440 int (*path_chroot) (struct path *path);
1442#endif 1441#endif
@@ -1447,16 +1446,16 @@ struct security_operations {
1447 const struct qstr *qstr, char **name, 1446 const struct qstr *qstr, char **name,
1448 void **value, size_t *len); 1447 void **value, size_t *len);
1449 int (*inode_create) (struct inode *dir, 1448 int (*inode_create) (struct inode *dir,
1450 struct dentry *dentry, int mode); 1449 struct dentry *dentry, umode_t mode);
1451 int (*inode_link) (struct dentry *old_dentry, 1450 int (*inode_link) (struct dentry *old_dentry,
1452 struct inode *dir, struct dentry *new_dentry); 1451 struct inode *dir, struct dentry *new_dentry);
1453 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1452 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1454 int (*inode_symlink) (struct inode *dir, 1453 int (*inode_symlink) (struct inode *dir,
1455 struct dentry *dentry, const char *old_name); 1454 struct dentry *dentry, const char *old_name);
1456 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1455 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
1457 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1456 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1458 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1457 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1459 int mode, dev_t dev); 1458 umode_t mode, dev_t dev);
1460 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1459 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1461 struct inode *new_dir, struct dentry *new_dentry); 1460 struct inode *new_dir, struct dentry *new_dentry);
1462 int (*inode_readlink) (struct dentry *dentry); 1461 int (*inode_readlink) (struct dentry *dentry);
@@ -1716,15 +1715,15 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1716int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1715int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1717 const struct qstr *qstr, char **name, 1716 const struct qstr *qstr, char **name,
1718 void **value, size_t *len); 1717 void **value, size_t *len);
1719int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1718int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1720int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1719int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1721 struct dentry *new_dentry); 1720 struct dentry *new_dentry);
1722int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1721int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1723int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1722int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1724 const char *old_name); 1723 const char *old_name);
1725int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1724int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
1726int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1725int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1727int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1726int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1728int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1727int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1729 struct inode *new_dir, struct dentry *new_dentry); 1728 struct inode *new_dir, struct dentry *new_dentry);
1730int security_inode_readlink(struct dentry *dentry); 1729int security_inode_readlink(struct dentry *dentry);
@@ -2056,12 +2055,12 @@ static inline int security_old_inode_init_security(struct inode *inode,
2056 char **name, void **value, 2055 char **name, void **value,
2057 size_t *len) 2056 size_t *len)
2058{ 2057{
2059 return 0; 2058 return -EOPNOTSUPP;
2060} 2059}
2061 2060
2062static inline int security_inode_create(struct inode *dir, 2061static inline int security_inode_create(struct inode *dir,
2063 struct dentry *dentry, 2062 struct dentry *dentry,
2064 int mode) 2063 umode_t mode)
2065{ 2064{
2066 return 0; 2065 return 0;
2067} 2066}
@@ -2855,9 +2854,9 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2855 2854
2856#ifdef CONFIG_SECURITY_PATH 2855#ifdef CONFIG_SECURITY_PATH
2857int security_path_unlink(struct path *dir, struct dentry *dentry); 2856int security_path_unlink(struct path *dir, struct dentry *dentry);
2858int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); 2857int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
2859int security_path_rmdir(struct path *dir, struct dentry *dentry); 2858int security_path_rmdir(struct path *dir, struct dentry *dentry);
2860int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2859int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
2861 unsigned int dev); 2860 unsigned int dev);
2862int security_path_truncate(struct path *path); 2861int security_path_truncate(struct path *path);
2863int security_path_symlink(struct path *dir, struct dentry *dentry, 2862int security_path_symlink(struct path *dir, struct dentry *dentry,
@@ -2866,8 +2865,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2866 struct dentry *new_dentry); 2865 struct dentry *new_dentry);
2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2866int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 struct path *new_dir, struct dentry *new_dentry); 2867 struct path *new_dir, struct dentry *new_dentry);
2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 2868int security_path_chmod(struct path *path, umode_t mode);
2870 mode_t mode);
2871int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2869int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872int security_path_chroot(struct path *path); 2870int security_path_chroot(struct path *path);
2873#else /* CONFIG_SECURITY_PATH */ 2871#else /* CONFIG_SECURITY_PATH */
@@ -2877,7 +2875,7 @@ static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
2877} 2875}
2878 2876
2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, 2877static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
2880 int mode) 2878 umode_t mode)
2881{ 2879{
2882 return 0; 2880 return 0;
2883} 2881}
@@ -2888,7 +2886,7 @@ static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
2888} 2886}
2889 2887
2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry, 2888static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2891 int mode, unsigned int dev) 2889 umode_t mode, unsigned int dev)
2892{ 2890{
2893 return 0; 2891 return 0;
2894} 2892}
@@ -2919,9 +2917,7 @@ static inline int security_path_rename(struct path *old_dir,
2919 return 0; 2917 return 0;
2920} 2918}
2921 2919
2922static inline int security_path_chmod(struct dentry *dentry, 2920static inline int security_path_chmod(struct path *path, umode_t mode)
2923 struct vfsmount *mnt,
2924 mode_t mode)
2925{ 2921{
2926 return 0; 2922 return 0;
2927} 2923}
@@ -3010,7 +3006,7 @@ static inline void security_audit_rule_free(void *lsmrule)
3010 3006
3011#ifdef CONFIG_SECURITYFS 3007#ifdef CONFIG_SECURITYFS
3012 3008
3013extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 3009extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
3014 struct dentry *parent, void *data, 3010 struct dentry *parent, void *data,
3015 const struct file_operations *fops); 3011 const struct file_operations *fops);
3016extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 3012extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
@@ -3025,7 +3021,7 @@ static inline struct dentry *securityfs_create_dir(const char *name,
3025} 3021}
3026 3022
3027static inline struct dentry *securityfs_create_file(const char *name, 3023static inline struct dentry *securityfs_create_file(const char *name,
3028 mode_t mode, 3024 umode_t mode,
3029 struct dentry *parent, 3025 struct dentry *parent,
3030 void *data, 3026 void *data,
3031 const struct file_operations *fops) 3027 const struct file_operations *fops)
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0b69a4684216..44f1514b00ba 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -74,7 +74,7 @@ static inline void seq_commit(struct seq_file *m, int num)
74 } 74 }
75} 75}
76 76
77char *mangle_path(char *s, char *p, char *esc); 77char *mangle_path(char *s, const char *p, const char *esc);
78int seq_open(struct file *, const struct seq_operations *); 78int seq_open(struct file *, const struct seq_operations *);
79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
80loff_t seq_lseek(struct file *, loff_t, int); 80loff_t seq_lseek(struct file *, loff_t, int);
@@ -86,10 +86,10 @@ int seq_write(struct seq_file *seq, const void *data, size_t len);
86 86
87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); 87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
88 88
89int seq_path(struct seq_file *, struct path *, char *); 89int seq_path(struct seq_file *, const struct path *, const char *);
90int seq_dentry(struct seq_file *, struct dentry *, char *); 90int seq_dentry(struct seq_file *, struct dentry *, const char *);
91int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 91int seq_path_root(struct seq_file *m, const struct path *path,
92 char *esc); 92 const struct path *root, const char *esc);
93int seq_bitmap(struct seq_file *m, const unsigned long *bits, 93int seq_bitmap(struct seq_file *m, const unsigned long *bits,
94 unsigned int nr_bits); 94 unsigned int nr_bits);
95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) 95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 5812fefbcedf..b160645f5599 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -95,6 +95,7 @@ struct intc_desc {
95 unsigned int num_resources; 95 unsigned int num_resources;
96 intc_enum force_enable; 96 intc_enum force_enable;
97 intc_enum force_disable; 97 intc_enum force_disable;
98 bool skip_syscore_suspend;
98 struct intc_hw_desc hw; 99 struct intc_hw_desc hw;
99}; 100};
100 101
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9291ac3cc627..e4c711c6f321 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -30,7 +30,7 @@ struct shmem_sb_info {
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 uid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 gid_t gid; /* Mount gid for root directory */
33 mode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
36 36
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index a83833a1f7a2..07ceb97d53fa 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -35,7 +35,7 @@ struct shrinker {
35 35
36 /* These are for internal use */ 36 /* These are for internal use */
37 struct list_head list; 37 struct list_head list;
38 long nr; /* objs pending delete */ 38 atomic_long_t nr_in_batch; /* objs pending delete */
39}; 39};
40#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ 40#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
41extern void register_shrinker(struct shrinker *); 41extern void register_shrinker(struct shrinker *);
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
index e2accb3164d8..d0de882c0d96 100644
--- a/include/linux/sigma.h
+++ b/include/linux/sigma.h
@@ -24,7 +24,7 @@ struct sigma_firmware {
24struct sigma_firmware_header { 24struct sigma_firmware_header {
25 unsigned char magic[7]; 25 unsigned char magic[7];
26 u8 version; 26 u8 version;
27 u32 crc; 27 __le32 crc;
28}; 28};
29 29
30enum { 30enum {
@@ -40,19 +40,14 @@ enum {
40struct sigma_action { 40struct sigma_action {
41 u8 instr; 41 u8 instr;
42 u8 len_hi; 42 u8 len_hi;
43 u16 len; 43 __le16 len;
44 u16 addr; 44 __be16 addr;
45 unsigned char payload[]; 45 unsigned char payload[];
46}; 46};
47 47
48static inline u32 sigma_action_len(struct sigma_action *sa) 48static inline u32 sigma_action_len(struct sigma_action *sa)
49{ 49{
50 return (sa->len_hi << 16) | sa->len; 50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51}
52
53static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
54{
55 return sizeof(*sa) + payload_len + (payload_len % 2);
56} 51}
57 52
58extern int process_sigma_firmware(struct i2c_client *client, const char *name); 53extern int process_sigma_firmware(struct i2c_client *client, const char *name);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fe864885c1ed..50db9b04a552 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -30,6 +30,7 @@
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/netdev_features.h>
33 34
34/* Don't change this without changing skb_csum_unnecessary! */ 35/* Don't change this without changing skb_csum_unnecessary! */
35#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
@@ -87,7 +88,6 @@
87 * at device setup time. 88 * at device setup time.
88 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum 89 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum
89 * everything. 90 * everything.
90 * NETIF_F_NO_CSUM - loopback or reliable single hop media.
91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only 91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only
92 * TCP/UDP over IPv4. Sigh. Vendors like this 92 * TCP/UDP over IPv4. Sigh. Vendors like this
93 * way by an unknown reason. Though, see comment above 93 * way by an unknown reason. Though, see comment above
@@ -128,13 +128,17 @@ struct sk_buff_head {
128 128
129struct sk_buff; 129struct sk_buff;
130 130
131/* To allow 64K frame to be packed as single skb without frag_list. Since 131/* To allow 64K frame to be packed as single skb without frag_list we
132 * GRO uses frags we allocate at least 16 regardless of page size. 132 * require 64K/PAGE_SIZE pages plus 1 additional page to allow for
133 * buffers which do not start on a page boundary.
134 *
135 * Since GRO uses frags we allocate at least 16 regardless of page
136 * size.
133 */ 137 */
134#if (65536/PAGE_SIZE + 2) < 16 138#if (65536/PAGE_SIZE + 1) < 16
135#define MAX_SKB_FRAGS 16UL 139#define MAX_SKB_FRAGS 16UL
136#else 140#else
137#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 141#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
138#endif 142#endif
139 143
140typedef struct skb_frag_struct skb_frag_t; 144typedef struct skb_frag_struct skb_frag_t;
@@ -218,6 +222,9 @@ enum {
218 222
219 /* device driver supports TX zero-copy buffers */ 223 /* device driver supports TX zero-copy buffers */
220 SKBTX_DEV_ZEROCOPY = 1 << 4, 224 SKBTX_DEV_ZEROCOPY = 1 << 4,
225
226 /* generate wifi status information (where possible) */
227 SKBTX_WIFI_STATUS = 1 << 5,
221}; 228};
222 229
223/* 230/*
@@ -235,15 +242,15 @@ struct ubuf_info {
235 * the end of the header data, ie. at skb->end. 242 * the end of the header data, ie. at skb->end.
236 */ 243 */
237struct skb_shared_info { 244struct skb_shared_info {
238 unsigned short nr_frags; 245 unsigned char nr_frags;
246 __u8 tx_flags;
239 unsigned short gso_size; 247 unsigned short gso_size;
240 /* Warning: this field is not always filled in (UFO)! */ 248 /* Warning: this field is not always filled in (UFO)! */
241 unsigned short gso_segs; 249 unsigned short gso_segs;
242 unsigned short gso_type; 250 unsigned short gso_type;
243 __be32 ip6_frag_id;
244 __u8 tx_flags;
245 struct sk_buff *frag_list; 251 struct sk_buff *frag_list;
246 struct skb_shared_hwtstamps hwtstamps; 252 struct skb_shared_hwtstamps hwtstamps;
253 __be32 ip6_frag_id;
247 254
248 /* 255 /*
249 * Warning : all fields before dataref are cleared in __alloc_skb() 256 * Warning : all fields before dataref are cleared in __alloc_skb()
@@ -352,6 +359,8 @@ typedef unsigned char *sk_buff_data_t;
352 * @ooo_okay: allow the mapping of a socket to a queue to be changed 359 * @ooo_okay: allow the mapping of a socket to a queue to be changed
353 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 360 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
354 * ports. 361 * ports.
362 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not
355 * @dma_cookie: a cookie to one of several possible DMA operations 364 * @dma_cookie: a cookie to one of several possible DMA operations
356 * done by skb DMA functions 365 * done by skb DMA functions
357 * @secmark: security marking 366 * @secmark: security marking
@@ -445,10 +454,11 @@ struct sk_buff {
445#endif 454#endif
446 __u8 ooo_okay:1; 455 __u8 ooo_okay:1;
447 __u8 l4_rxhash:1; 456 __u8 l4_rxhash:1;
457 __u8 wifi_acked_valid:1;
458 __u8 wifi_acked:1;
459 /* 10/12 bit hole (depending on ndisc_nodetype presence) */
448 kmemcheck_bitfield_end(flags2); 460 kmemcheck_bitfield_end(flags2);
449 461
450 /* 0/13 bit hole */
451
452#ifdef CONFIG_NET_DMA 462#ifdef CONFIG_NET_DMA
453 dma_cookie_t dma_cookie; 463 dma_cookie_t dma_cookie;
454#endif 464#endif
@@ -540,6 +550,7 @@ extern void consume_skb(struct sk_buff *skb);
540extern void __kfree_skb(struct sk_buff *skb); 550extern void __kfree_skb(struct sk_buff *skb);
541extern struct sk_buff *__alloc_skb(unsigned int size, 551extern struct sk_buff *__alloc_skb(unsigned int size,
542 gfp_t priority, int fclone, int node); 552 gfp_t priority, int fclone, int node);
553extern struct sk_buff *build_skb(void *data);
543static inline struct sk_buff *alloc_skb(unsigned int size, 554static inline struct sk_buff *alloc_skb(unsigned int size,
544 gfp_t priority) 555 gfp_t priority)
545{ 556{
@@ -561,8 +572,9 @@ extern struct sk_buff *skb_clone(struct sk_buff *skb,
561 gfp_t priority); 572 gfp_t priority);
562extern struct sk_buff *skb_copy(const struct sk_buff *skb, 573extern struct sk_buff *skb_copy(const struct sk_buff *skb,
563 gfp_t priority); 574 gfp_t priority);
564extern struct sk_buff *pskb_copy(struct sk_buff *skb, 575extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
565 gfp_t gfp_mask); 576 int headroom, gfp_t gfp_mask);
577
566extern int pskb_expand_head(struct sk_buff *skb, 578extern int pskb_expand_head(struct sk_buff *skb,
567 int nhead, int ntail, 579 int nhead, int ntail,
568 gfp_t gfp_mask); 580 gfp_t gfp_mask);
@@ -1662,38 +1674,6 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1662} 1674}
1663 1675
1664/** 1676/**
1665 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1666 * @dev: network device to receive on
1667 * @gfp_mask: alloc_pages_node mask
1668 *
1669 * Allocate a new page. dev currently unused.
1670 *
1671 * %NULL is returned if there is no free memory.
1672 */
1673static inline struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask)
1674{
1675 return alloc_pages_node(NUMA_NO_NODE, gfp_mask, 0);
1676}
1677
1678/**
1679 * netdev_alloc_page - allocate a page for ps-rx on a specific device
1680 * @dev: network device to receive on
1681 *
1682 * Allocate a new page. dev currently unused.
1683 *
1684 * %NULL is returned if there is no free memory.
1685 */
1686static inline struct page *netdev_alloc_page(struct net_device *dev)
1687{
1688 return __netdev_alloc_page(dev, GFP_ATOMIC);
1689}
1690
1691static inline void netdev_free_page(struct net_device *dev, struct page *page)
1692{
1693 __free_page(page);
1694}
1695
1696/**
1697 * skb_frag_page - retrieve the page refered to by a paged fragment 1677 * skb_frag_page - retrieve the page refered to by a paged fragment
1698 * @frag: the paged fragment 1678 * @frag: the paged fragment
1699 * 1679 *
@@ -1824,6 +1804,12 @@ static inline dma_addr_t skb_frag_dma_map(struct device *dev,
1824 frag->page_offset + offset, size, dir); 1804 frag->page_offset + offset, size, dir);
1825} 1805}
1826 1806
1807static inline struct sk_buff *pskb_copy(struct sk_buff *skb,
1808 gfp_t gfp_mask)
1809{
1810 return __pskb_copy(skb, skb_headroom(skb), gfp_mask);
1811}
1812
1827/** 1813/**
1828 * skb_clone_writable - is the header of a clone writable 1814 * skb_clone_writable - is the header of a clone writable
1829 * @skb: buffer to check 1815 * @skb: buffer to check
@@ -2105,7 +2091,8 @@ extern void skb_split(struct sk_buff *skb,
2105extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2091extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2106 int shiftlen); 2092 int shiftlen);
2107 2093
2108extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); 2094extern struct sk_buff *skb_segment(struct sk_buff *skb,
2095 netdev_features_t features);
2109 2096
2110static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2097static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2111 int len, void *buffer) 2098 int len, void *buffer)
@@ -2263,6 +2250,15 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2263 sw_tx_timestamp(skb); 2250 sw_tx_timestamp(skb);
2264} 2251}
2265 2252
2253/**
2254 * skb_complete_wifi_ack - deliver skb with wifi status
2255 *
2256 * @skb: the original outgoing packet
2257 * @acked: ack status
2258 *
2259 */
2260void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2261
2266extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2262extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2267extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2263extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
2268 2264
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
new file mode 100644
index 000000000000..ce718cbce435
--- /dev/null
+++ b/include/linux/smscphy.h
@@ -0,0 +1,25 @@
1#ifndef __LINUX_SMSCPHY_H__
2#define __LINUX_SMSCPHY_H__
3
4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
5#define MII_LAN83C185_IM 30 /* Interrupt Mask */
6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
7
8#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
9#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
10#define MII_LAN83C185_ISF_INT3 (1<<3) /* Auto-Negotiation LP Ack */
11#define MII_LAN83C185_ISF_INT4 (1<<4) /* Link Down */
12#define MII_LAN83C185_ISF_INT5 (1<<5) /* Remote Fault Detected */
13#define MII_LAN83C185_ISF_INT6 (1<<6) /* Auto-Negotiation complete */
14#define MII_LAN83C185_ISF_INT7 (1<<7) /* ENERGYON */
15
16#define MII_LAN83C185_ISF_INT_ALL (0x0e)
17
18#define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
19 (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4 | \
20 MII_LAN83C185_ISF_INT7)
21
22#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
23#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */
24
25#endif /* __LINUX_SMSCPHY_H__ */
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
new file mode 100644
index 000000000000..251729a47880
--- /dev/null
+++ b/include/linux/sock_diag.h
@@ -0,0 +1,48 @@
1#ifndef __SOCK_DIAG_H__
2#define __SOCK_DIAG_H__
3
4#include <linux/types.h>
5
6#define SOCK_DIAG_BY_FAMILY 20
7
8struct sock_diag_req {
9 __u8 sdiag_family;
10 __u8 sdiag_protocol;
11};
12
13enum {
14 SK_MEMINFO_RMEM_ALLOC,
15 SK_MEMINFO_RCVBUF,
16 SK_MEMINFO_WMEM_ALLOC,
17 SK_MEMINFO_SNDBUF,
18 SK_MEMINFO_FWD_ALLOC,
19 SK_MEMINFO_WMEM_QUEUED,
20 SK_MEMINFO_OPTMEM,
21
22 SK_MEMINFO_VARS,
23};
24
25#ifdef __KERNEL__
26struct sk_buff;
27struct nlmsghdr;
28struct sock;
29
30struct sock_diag_handler {
31 __u8 family;
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33};
34
35int sock_diag_register(struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h);
37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
40
41int sock_diag_check_cookie(void *sk, __u32 *cookie);
42void sock_diag_save_cookie(void *sk, __u32 *cookie);
43
44int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
45
46extern struct sock *sock_diag_nlsk;
47#endif /* KERNEL */
48#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fbbbd8e..176fce9cc6b1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -200,6 +200,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
200 driver_unregister(&sdrv->driver); 200 driver_unregister(&sdrv->driver);
201} 201}
202 202
203/**
204 * module_spi_driver() - Helper macro for registering a SPI driver
205 * @__spi_driver: spi_driver struct
206 *
207 * Helper macro for SPI drivers which do not do anything special in module
208 * init/exit. This eliminates a lot of boilerplate. Each module may only
209 * use this macro once, and calling it replaces module_init() and module_exit()
210 */
211#define module_spi_driver(__spi_driver) \
212 module_driver(__spi_driver, spi_register_driver, \
213 spi_unregister_driver)
203 214
204/** 215/**
205 * struct spi_master - interface to SPI master controller 216 * struct spi_master - interface to SPI master controller
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 58971e891f48..e1b005918bbb 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -28,6 +28,7 @@
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h>
31 32
32struct srcu_struct_array { 33struct srcu_struct_array {
33 int c[2]; 34 int c[2];
@@ -60,18 +61,10 @@ int __init_srcu_struct(struct srcu_struct *sp, const char *name,
60 __init_srcu_struct((sp), #sp, &__srcu_key); \ 61 __init_srcu_struct((sp), #sp, &__srcu_key); \
61}) 62})
62 63
63# define srcu_read_acquire(sp) \
64 lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_)
65# define srcu_read_release(sp) \
66 lock_release(&(sp)->dep_map, 1, _THIS_IP_)
67
68#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 64#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 65
70int init_srcu_struct(struct srcu_struct *sp); 66int init_srcu_struct(struct srcu_struct *sp);
71 67
72# define srcu_read_acquire(sp) do { } while (0)
73# define srcu_read_release(sp) do { } while (0)
74
75#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
76 69
77void cleanup_srcu_struct(struct srcu_struct *sp); 70void cleanup_srcu_struct(struct srcu_struct *sp);
@@ -90,12 +83,32 @@ long srcu_batches_completed(struct srcu_struct *sp);
90 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, 83 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
91 * this assumes we are in an SRCU read-side critical section unless it can 84 * this assumes we are in an SRCU read-side critical section unless it can
92 * prove otherwise. 85 * prove otherwise.
86 *
87 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
88 * and while lockdep is disabled.
89 *
90 * Note that if the CPU is in the idle loop from an RCU point of view
91 * (ie: that we are in the section between rcu_idle_enter() and
92 * rcu_idle_exit()) then srcu_read_lock_held() returns false even if
93 * the CPU did an srcu_read_lock(). The reason for this is that RCU
94 * ignores CPUs that are in such a section, considering these as in
95 * extended quiescent state, so such a CPU is effectively never in an
96 * RCU read-side critical section regardless of what RCU primitives it
97 * invokes. This state of affairs is required --- we need to keep an
98 * RCU-free window in idle where the CPU may possibly enter into low
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
101 * grace period as long as we run in the idle task.
93 */ 102 */
94static inline int srcu_read_lock_held(struct srcu_struct *sp) 103static inline int srcu_read_lock_held(struct srcu_struct *sp)
95{ 104{
96 if (debug_locks) 105 if (rcu_is_cpu_idle())
97 return lock_is_held(&sp->dep_map); 106 return 0;
98 return 1; 107
108 if (!debug_lockdep_rcu_enabled())
109 return 1;
110
111 return lock_is_held(&sp->dep_map);
99} 112}
100 113
101#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 114#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
@@ -145,12 +158,17 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
145 * one way to indirectly wait on an SRCU grace period is to acquire 158 * one way to indirectly wait on an SRCU grace period is to acquire
146 * a mutex that is held elsewhere while calling synchronize_srcu() or 159 * a mutex that is held elsewhere while calling synchronize_srcu() or
147 * synchronize_srcu_expedited(). 160 * synchronize_srcu_expedited().
161 *
162 * Note that srcu_read_lock() and the matching srcu_read_unlock() must
163 * occur in the same context, for example, it is illegal to invoke
164 * srcu_read_unlock() in an irq handler if the matching srcu_read_lock()
165 * was invoked in process context.
148 */ 166 */
149static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) 167static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
150{ 168{
151 int retval = __srcu_read_lock(sp); 169 int retval = __srcu_read_lock(sp);
152 170
153 srcu_read_acquire(sp); 171 rcu_lock_acquire(&(sp)->dep_map);
154 return retval; 172 return retval;
155} 173}
156 174
@@ -164,8 +182,51 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
164static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 182static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
165 __releases(sp) 183 __releases(sp)
166{ 184{
167 srcu_read_release(sp); 185 rcu_lock_release(&(sp)->dep_map);
186 __srcu_read_unlock(sp, idx);
187}
188
189/**
190 * srcu_read_lock_raw - register a new reader for an SRCU-protected structure.
191 * @sp: srcu_struct in which to register the new reader.
192 *
193 * Enter an SRCU read-side critical section. Similar to srcu_read_lock(),
194 * but avoids the RCU-lockdep checking. This means that it is legal to
195 * use srcu_read_lock_raw() in one context, for example, in an exception
196 * handler, and then have the matching srcu_read_unlock_raw() in another
197 * context, for example in the task that took the exception.
198 *
199 * However, the entire SRCU read-side critical section must reside within a
200 * single task. For example, beware of using srcu_read_lock_raw() in
201 * a device interrupt handler and srcu_read_unlock() in the interrupted
202 * task: This will not work if interrupts are threaded.
203 */
204static inline int srcu_read_lock_raw(struct srcu_struct *sp)
205{
206 unsigned long flags;
207 int ret;
208
209 local_irq_save(flags);
210 ret = __srcu_read_lock(sp);
211 local_irq_restore(flags);
212 return ret;
213}
214
215/**
216 * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure.
217 * @sp: srcu_struct in which to unregister the old reader.
218 * @idx: return value from corresponding srcu_read_lock_raw().
219 *
220 * Exit an SRCU read-side critical section without lockdep-RCU checking.
221 * See srcu_read_lock_raw() for more details.
222 */
223static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx)
224{
225 unsigned long flags;
226
227 local_irq_save(flags);
168 __srcu_read_unlock(sp, idx); 228 __srcu_read_unlock(sp, idx);
229 local_irq_restore(flags);
169} 230}
170 231
171#endif 232#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 061e560251b4..dcf35b0f303a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -94,6 +94,15 @@ struct ssb_sprom {
94 } ghz5; /* 5GHz band */ 94 } ghz5; /* 5GHz band */
95 } antenna_gain; 95 } antenna_gain;
96 96
97 struct {
98 struct {
99 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
100 } ghz2;
101 struct {
102 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
103 } ghz5;
104 } fem;
105
97 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ 106 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
98}; 107};
99 108
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 98941203a27f..c814ae6eeb22 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -432,6 +432,23 @@
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 434#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE
436#define SSB_SPROM8_FEM5G 0x00B0
437#define SSB_SROM8_FEM_TSSIPOS 0x0001
438#define SSB_SROM8_FEM_TSSIPOS_SHIFT 0
439#define SSB_SROM8_FEM_EXTPA_GAIN 0x0006
440#define SSB_SROM8_FEM_EXTPA_GAIN_SHIFT 1
441#define SSB_SROM8_FEM_PDET_RANGE 0x00F8
442#define SSB_SROM8_FEM_PDET_RANGE_SHIFT 3
443#define SSB_SROM8_FEM_TR_ISO 0x0700
444#define SSB_SROM8_FEM_TR_ISO_SHIFT 8
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
435#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ 452#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
436#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 453#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
437#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 454#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5efd8cef389e..57531f8e5956 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -203,7 +203,7 @@ extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 203extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 204
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 mode_t, struct cache_detail *); 206 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
208 208
209extern void qword_add(char **bpp, int *lp, char *str); 209extern void qword_add(char **bpp, int *lp, char *str);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 3d8f9c44e27d..2c5993a17c33 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -215,7 +215,7 @@ static inline bool __rpc_copy_addr4(struct sockaddr *dst,
215 return true; 215 return true;
216} 216}
217 217
218#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 218#if IS_ENABLED(CONFIG_IPV6)
219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
220 const struct sockaddr *sap2) 220 const struct sockaddr *sap2)
221{ 221{
@@ -237,10 +237,10 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst; 237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
238 238
239 dsin6->sin6_family = ssin6->sin6_family; 239 dsin6->sin6_family = ssin6->sin6_family;
240 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr); 240 dsin6->sin6_addr = ssin6->sin6_addr;
241 return true; 241 return true;
242} 242}
243#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 243#else /* !(IS_ENABLED(CONFIG_IPV6) */
244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
245 const struct sockaddr *sap2) 245 const struct sockaddr *sap2)
246{ 246{
@@ -252,7 +252,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
252{ 252{
253 return false; 253 return false;
254} 254}
255#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 255#endif /* !(IS_ENABLED(CONFIG_IPV6) */
256 256
257/** 257/**
258 * rpc_cmp_addr - compare the address portion of two sockaddrs. 258 * rpc_cmp_addr - compare the address portion of two sockaddrs.
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index e4ea43058d8f..2bb03d77375a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -55,7 +55,7 @@ extern int rpc_remove_client_dir(struct dentry *);
55struct cache_detail; 55struct cache_detail;
56extern struct dentry *rpc_create_cache_dir(struct dentry *, 56extern struct dentry *rpc_create_cache_dir(struct dentry *,
57 struct qstr *, 57 struct qstr *,
58 mode_t umode, 58 umode_t umode,
59 struct cache_detail *); 59 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 60extern void rpc_remove_cache_dir(struct dentry *);
61 61
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 57a692432f8a..95040cc33107 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -6,6 +6,7 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/freezer.h>
9#include <asm/errno.h> 10#include <asm/errno.h>
10 11
11#ifdef CONFIG_VT 12#ifdef CONFIG_VT
@@ -331,6 +332,8 @@ static inline bool system_entering_hibernation(void) { return false; }
331#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ 332#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
332#define PM_POST_RESTORE 0x0006 /* Restore failed */ 333#define PM_POST_RESTORE 0x0006 /* Restore failed */
333 334
335extern struct mutex pm_mutex;
336
334#ifdef CONFIG_PM_SLEEP 337#ifdef CONFIG_PM_SLEEP
335void save_processor_state(void); 338void save_processor_state(void);
336void restore_processor_state(void); 339void restore_processor_state(void);
@@ -351,6 +354,19 @@ extern bool events_check_enabled;
351extern bool pm_wakeup_pending(void); 354extern bool pm_wakeup_pending(void);
352extern bool pm_get_wakeup_count(unsigned int *count); 355extern bool pm_get_wakeup_count(unsigned int *count);
353extern bool pm_save_wakeup_count(unsigned int count); 356extern bool pm_save_wakeup_count(unsigned int count);
357
358static inline void lock_system_sleep(void)
359{
360 freezer_do_not_count();
361 mutex_lock(&pm_mutex);
362}
363
364static inline void unlock_system_sleep(void)
365{
366 mutex_unlock(&pm_mutex);
367 freezer_count();
368}
369
354#else /* !CONFIG_PM_SLEEP */ 370#else /* !CONFIG_PM_SLEEP */
355 371
356static inline int register_pm_notifier(struct notifier_block *nb) 372static inline int register_pm_notifier(struct notifier_block *nb)
@@ -366,28 +382,11 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
366#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 382#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
367 383
368static inline bool pm_wakeup_pending(void) { return false; } 384static inline bool pm_wakeup_pending(void) { return false; }
369#endif /* !CONFIG_PM_SLEEP */
370
371extern struct mutex pm_mutex;
372 385
373#ifndef CONFIG_HIBERNATE_CALLBACKS
374static inline void lock_system_sleep(void) {} 386static inline void lock_system_sleep(void) {}
375static inline void unlock_system_sleep(void) {} 387static inline void unlock_system_sleep(void) {}
376 388
377#else 389#endif /* !CONFIG_PM_SLEEP */
378
379/* Let some subsystems like memory hotadd exclude hibernation */
380
381static inline void lock_system_sleep(void)
382{
383 mutex_lock(&pm_mutex);
384}
385
386static inline void unlock_system_sleep(void)
387{
388 mutex_unlock(&pm_mutex);
389}
390#endif
391 390
392#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 391#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
393/* 392/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 86a24b1166d1..515669fa3c1d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -475,7 +475,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
475asmlinkage long sys_pivot_root(const char __user *new_root, 475asmlinkage long sys_pivot_root(const char __user *new_root,
476 const char __user *put_old); 476 const char __user *put_old);
477asmlinkage long sys_chroot(const char __user *filename); 477asmlinkage long sys_chroot(const char __user *filename);
478asmlinkage long sys_mknod(const char __user *filename, int mode, 478asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
479 unsigned dev); 479 unsigned dev);
480asmlinkage long sys_link(const char __user *oldname, 480asmlinkage long sys_link(const char __user *oldname,
481 const char __user *newname); 481 const char __user *newname);
@@ -483,8 +483,8 @@ asmlinkage long sys_symlink(const char __user *old, const char __user *new);
483asmlinkage long sys_unlink(const char __user *pathname); 483asmlinkage long sys_unlink(const char __user *pathname);
484asmlinkage long sys_rename(const char __user *oldname, 484asmlinkage long sys_rename(const char __user *oldname,
485 const char __user *newname); 485 const char __user *newname);
486asmlinkage long sys_chmod(const char __user *filename, mode_t mode); 486asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
487asmlinkage long sys_fchmod(unsigned int fd, mode_t mode); 487asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
488 488
489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); 489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
490#if BITS_PER_LONG == 32 490#if BITS_PER_LONG == 32
@@ -517,9 +517,9 @@ asmlinkage long sys_sendfile64(int out_fd, int in_fd,
517 loff_t __user *offset, size_t count); 517 loff_t __user *offset, size_t count);
518asmlinkage long sys_readlink(const char __user *path, 518asmlinkage long sys_readlink(const char __user *path,
519 char __user *buf, int bufsiz); 519 char __user *buf, int bufsiz);
520asmlinkage long sys_creat(const char __user *pathname, int mode); 520asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
521asmlinkage long sys_open(const char __user *filename, 521asmlinkage long sys_open(const char __user *filename,
522 int flags, int mode); 522 int flags, umode_t mode);
523asmlinkage long sys_close(unsigned int fd); 523asmlinkage long sys_close(unsigned int fd);
524asmlinkage long sys_access(const char __user *filename, int mode); 524asmlinkage long sys_access(const char __user *filename, int mode);
525asmlinkage long sys_vhangup(void); 525asmlinkage long sys_vhangup(void);
@@ -582,7 +582,7 @@ asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, 582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
584asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 584asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
585asmlinkage long sys_mkdir(const char __user *pathname, int mode); 585asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
586asmlinkage long sys_chdir(const char __user *filename); 586asmlinkage long sys_chdir(const char __user *filename);
587asmlinkage long sys_fchdir(unsigned int fd); 587asmlinkage long sys_fchdir(unsigned int fd);
588asmlinkage long sys_rmdir(const char __user *pathname); 588asmlinkage long sys_rmdir(const char __user *pathname);
@@ -679,7 +679,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
680 unsigned long third, void __user *ptr, long fifth); 680 unsigned long third, void __user *ptr, long fifth);
681 681
682asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 682asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
683asmlinkage long sys_mq_unlink(const char __user *name); 683asmlinkage long sys_mq_unlink(const char __user *name);
684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
@@ -753,11 +753,11 @@ asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
754 __u32 __user *ustatus); 754 __u32 __user *ustatus);
755asmlinkage long sys_spu_create(const char __user *name, 755asmlinkage long sys_spu_create(const char __user *name,
756 unsigned int flags, mode_t mode, int fd); 756 unsigned int flags, umode_t mode, int fd);
757 757
758asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 758asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
759 unsigned dev); 759 unsigned dev);
760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, int mode); 760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); 761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
762asmlinkage long sys_symlinkat(const char __user * oldname, 762asmlinkage long sys_symlinkat(const char __user * oldname,
763 int newdfd, const char __user * newname); 763 int newdfd, const char __user * newname);
@@ -769,11 +769,11 @@ asmlinkage long sys_futimesat(int dfd, const char __user *filename,
769 struct timeval __user *utimes); 769 struct timeval __user *utimes);
770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
771asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 771asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
772 mode_t mode); 772 umode_t mode);
773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
774 gid_t group, int flag); 774 gid_t group, int flag);
775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
776 int mode); 776 umode_t mode);
777asmlinkage long sys_newfstatat(int dfd, const char __user *filename, 777asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
778 struct stat __user *statbuf, int flag); 778 struct stat __user *statbuf, int flag);
779asmlinkage long sys_fstatat64(int dfd, const char __user *filename, 779asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 703cfa33a3ca..bb9127dd814b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1038,7 +1038,7 @@ struct ctl_table
1038 const char *procname; /* Text ID for /proc/sys, or zero */ 1038 const char *procname; /* Text ID for /proc/sys, or zero */
1039 void *data; 1039 void *data;
1040 int maxlen; 1040 int maxlen;
1041 mode_t mode; 1041 umode_t mode;
1042 struct ctl_table *child; 1042 struct ctl_table *child;
1043 struct ctl_table *parent; /* Automatically set */ 1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1044 proc_handler *proc_handler; /* Callback for text formatting */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index dac0859e6440..0010009b2f00 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -25,7 +25,7 @@ enum kobj_ns_type;
25 25
26struct attribute { 26struct attribute {
27 const char *name; 27 const char *name;
28 mode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lock_class_key *key; 30 struct lock_class_key *key;
31 struct lock_class_key skey; 31 struct lock_class_key skey;
@@ -55,7 +55,7 @@ do { \
55 55
56struct attribute_group { 56struct attribute_group {
57 const char *name; 57 const char *name;
58 mode_t (*is_visible)(struct kobject *, 58 umode_t (*is_visible)(struct kobject *,
59 struct attribute *, int); 59 struct attribute *, int);
60 struct attribute **attrs; 60 struct attribute **attrs;
61}; 61};
@@ -133,7 +133,7 @@ int __must_check sysfs_create_file(struct kobject *kobj,
133int __must_check sysfs_create_files(struct kobject *kobj, 133int __must_check sysfs_create_files(struct kobject *kobj,
134 const struct attribute **attr); 134 const struct attribute **attr);
135int __must_check sysfs_chmod_file(struct kobject *kobj, 135int __must_check sysfs_chmod_file(struct kobject *kobj,
136 const struct attribute *attr, mode_t mode); 136 const struct attribute *attr, umode_t mode);
137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
139 139
@@ -221,7 +221,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
221} 221}
222 222
223static inline int sysfs_chmod_file(struct kobject *kobj, 223static inline int sysfs_chmod_file(struct kobject *kobj,
224 const struct attribute *attr, mode_t mode) 224 const struct attribute *attr, umode_t mode)
225{ 225{
226 return 0; 226 return 0;
227} 227}
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7f59ee946983..46a85c9e1f25 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -238,6 +238,11 @@ struct tcp_sack_block {
238 u32 end_seq; 238 u32 end_seq;
239}; 239};
240 240
241/*These are used to set the sack_ok field in struct tcp_options_received */
242#define TCP_SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */
243#define TCP_FACK_ENABLED (1 << 1) /*1 = FACK is enabled locally*/
244#define TCP_DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/
245
241struct tcp_options_received { 246struct tcp_options_received {
242/* PAWS/RTTM data */ 247/* PAWS/RTTM data */
243 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 248 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc0ee29..ab8be90b5cc9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -7,6 +7,7 @@
7#define _LINUX_TICK_H 7#define _LINUX_TICK_H
8 8
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/irqflags.h>
10 11
11#ifdef CONFIG_GENERIC_CLOCKEVENTS 12#ifdef CONFIG_GENERIC_CLOCKEVENTS
12 13
@@ -121,14 +122,16 @@ static inline int tick_oneshot_mode_active(void) { return 0; }
121#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 122#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
122 123
123# ifdef CONFIG_NO_HZ 124# ifdef CONFIG_NO_HZ
124extern void tick_nohz_stop_sched_tick(int inidle); 125extern void tick_nohz_idle_enter(void);
125extern void tick_nohz_restart_sched_tick(void); 126extern void tick_nohz_idle_exit(void);
127extern void tick_nohz_irq_exit(void);
126extern ktime_t tick_nohz_get_sleep_length(void); 128extern ktime_t tick_nohz_get_sleep_length(void);
127extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 129extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
128extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 130extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
129# else 131# else
130static inline void tick_nohz_stop_sched_tick(int inidle) { } 132static inline void tick_nohz_idle_enter(void) { }
131static inline void tick_nohz_restart_sched_tick(void) { } 133static inline void tick_nohz_idle_exit(void) { }
134
132static inline ktime_t tick_nohz_get_sleep_length(void) 135static inline ktime_t tick_nohz_get_sleep_length(void)
133{ 136{
134 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; 137 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
diff --git a/include/linux/types.h b/include/linux/types.h
index 57a97234bec1..e5fa50345516 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -24,6 +24,7 @@ typedef __kernel_fd_set fd_set;
24typedef __kernel_dev_t dev_t; 24typedef __kernel_dev_t dev_t;
25typedef __kernel_ino_t ino_t; 25typedef __kernel_ino_t ino_t;
26typedef __kernel_mode_t mode_t; 26typedef __kernel_mode_t mode_t;
27typedef unsigned short umode_t;
27typedef __kernel_nlink_t nlink_t; 28typedef __kernel_nlink_t nlink_t;
28typedef __kernel_off_t off_t; 29typedef __kernel_off_t off_t;
29typedef __kernel_pid_t pid_t; 30typedef __kernel_pid_t pid_t;
@@ -188,7 +189,7 @@ typedef __u32 __bitwise __wsum;
188 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 189 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
189 * common 32/64-bit compat problems. 190 * common 32/64-bit compat problems.
190 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 191 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
191 * architectures) and to 8-byte boundaries on 64-bit architetures. The new 192 * architectures) and to 8-byte boundaries on 64-bit architectures. The new
192 * aligned_64 type enforces 8-byte alignment so that structs containing 193 * aligned_64 type enforces 8-byte alignment so that structs containing
193 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 194 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
194 * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 195 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
new file mode 100644
index 000000000000..b1d2bf16b33c
--- /dev/null
+++ b/include/linux/unix_diag.h
@@ -0,0 +1,54 @@
1#ifndef __UNIX_DIAG_H__
2#define __UNIX_DIAG_H__
3
4#include <linux/types.h>
5
6struct unix_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 udiag_states;
11 __u32 udiag_ino;
12 __u32 udiag_show;
13 __u32 udiag_cookie[2];
14};
15
16#define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */
17#define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */
18#define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */
19#define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */
20#define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */
21#define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */
22
23struct unix_diag_msg {
24 __u8 udiag_family;
25 __u8 udiag_type;
26 __u8 udiag_state;
27 __u8 pad;
28
29 __u32 udiag_ino;
30 __u32 udiag_cookie[2];
31};
32
33enum {
34 UNIX_DIAG_NAME,
35 UNIX_DIAG_VFS,
36 UNIX_DIAG_PEER,
37 UNIX_DIAG_ICONS,
38 UNIX_DIAG_RQLEN,
39 UNIX_DIAG_MEMINFO,
40
41 UNIX_DIAG_MAX,
42};
43
44struct unix_diag_vfs {
45 __u32 udiag_vfs_ino;
46 __u32 udiag_vfs_dev;
47};
48
49struct unix_diag_rqlen {
50 __u32 udiag_rqueue;
51 __u32 udiag_wqueue;
52};
53
54#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d3d0c1374334..7f8d4d61ca47 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -935,7 +935,7 @@ extern struct bus_type usb_bus_type;
935 */ 935 */
936struct usb_class_driver { 936struct usb_class_driver {
937 char *name; 937 char *name;
938 char *(*devnode)(struct device *dev, mode_t *mode); 938 char *(*devnode)(struct device *dev, umode_t *mode);
939 const struct file_operations *fops; 939 const struct file_operations *fops;
940 int minor_base; 940 int minor_base;
941}; 941};
@@ -953,6 +953,18 @@ extern int usb_register_driver(struct usb_driver *, struct module *,
953 953
954extern void usb_deregister(struct usb_driver *); 954extern void usb_deregister(struct usb_driver *);
955 955
956/**
957 * module_usb_driver() - Helper macro for registering a USB driver
958 * @__usb_driver: usb_driver struct
959 *
960 * Helper macro for USB drivers which do not do anything special in module
961 * init/exit. This eliminates a lot of boilerplate. Each module may only
962 * use this macro once, and calling it replaces module_init() and module_exit()
963 */
964#define module_usb_driver(__usb_driver) \
965 module_driver(__usb_driver, usb_register, \
966 usb_deregister)
967
956extern int usb_register_device_driver(struct usb_device_driver *, 968extern int usb_register_device_driver(struct usb_device_driver *,
957 struct module *); 969 struct module *);
958extern void usb_deregister_device_driver(struct usb_device_driver *); 970extern void usb_deregister_device_driver(struct usb_device_driver *);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e9e72bda1b72..5206d6541da5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -102,6 +102,10 @@
102 * vdev: the virtio_device 102 * vdev: the virtio_device
103 * This gives the final feature bits for the device: it can change 103 * This gives the final feature bits for the device: it can change
104 * the dev->feature bits if it wants. 104 * the dev->feature bits if it wants.
105 * @bus_name: return the bus name associated with the device
106 * vdev: the virtio_device
107 * This returns a pointer to the bus name a la pci_name from which
108 * the caller can then copy.
105 */ 109 */
106typedef void vq_callback_t(struct virtqueue *); 110typedef void vq_callback_t(struct virtqueue *);
107struct virtio_config_ops { 111struct virtio_config_ops {
@@ -119,6 +123,7 @@ struct virtio_config_ops {
119 void (*del_vqs)(struct virtio_device *); 123 void (*del_vqs)(struct virtio_device *);
120 u32 (*get_features)(struct virtio_device *vdev); 124 u32 (*get_features)(struct virtio_device *vdev);
121 void (*finalize_features)(struct virtio_device *vdev); 125 void (*finalize_features)(struct virtio_device *vdev);
126 const char *(*bus_name)(struct virtio_device *vdev);
122}; 127};
123 128
124/* If driver didn't advertise the feature, it will never appear. */ 129/* If driver didn't advertise the feature, it will never appear. */
@@ -184,5 +189,14 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
184 return ERR_PTR(err); 189 return ERR_PTR(err);
185 return vq; 190 return vq;
186} 191}
192
193static inline
194const char *virtio_bus_name(struct virtio_device *vdev)
195{
196 if (!vdev->config->bus_name)
197 return "virtio";
198 return vdev->config->bus_name(vdev);
199}
200
187#endif /* __KERNEL__ */ 201#endif /* __KERNEL__ */
188#endif /* _LINUX_VIRTIO_CONFIG_H */ 202#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4bde182fcf93..dcdfc2bda922 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -131,6 +131,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
131 */ 131 */
132extern rwlock_t vmlist_lock; 132extern rwlock_t vmlist_lock;
133extern struct vm_struct *vmlist; 133extern struct vm_struct *vmlist;
134extern __init void vm_area_add_early(struct vm_struct *vm);
134extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 135extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
135 136
136#ifdef CONFIG_SMP 137#ifdef CONFIG_SMP
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 3efc9f3f43a0..a9ce45e8501c 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -77,13 +77,13 @@ struct task_struct;
77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
78 { .flags = word, .bit_nr = bit, } 78 { .flags = word, .bit_nr = bit, }
79 79
80extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); 80extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
81 81
82#define init_waitqueue_head(q) \ 82#define init_waitqueue_head(q) \
83 do { \ 83 do { \
84 static struct lock_class_key __key; \ 84 static struct lock_class_key __key; \
85 \ 85 \
86 __init_waitqueue_head((q), &__key); \ 86 __init_waitqueue_head((q), #q, &__key); \
87 } while (0) 87 } while (0)
88 88
89#ifdef CONFIG_LOCKDEP 89#ifdef CONFIG_LOCKDEP
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index e0aa39612eba..3157cc1fada6 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -309,7 +309,7 @@ typedef struct wandev_conf
309#define WANOPT_EVEN 2 309#define WANOPT_EVEN 2
310 310
311/* CHDLC Protocol Options */ 311/* CHDLC Protocol Options */
312/* DF Commmented out for now. 312/* DF Commented out for now.
313 313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT 314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT 315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4b697395326e..0d6373195d32 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -54,6 +54,9 @@ struct wl12xx_platform_data {
54 int board_ref_clock; 54 int board_ref_clock;
55 int board_tcxo_clock; 55 int board_tcxo_clock;
56 unsigned long platform_quirks; 56 unsigned long platform_quirks;
57 bool pwr_in_suspend;
58
59 struct wl1271_if_operations *ops;
57}; 60};
58 61
59/* Platform does not support level trigger interrupts */ 62/* Platform does not support level trigger interrupts */
@@ -73,6 +76,6 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
73 76
74#endif 77#endif
75 78
76const struct wl12xx_platform_data *wl12xx_get_platform_data(void); 79struct wl12xx_platform_data *wl12xx_get_platform_data(void);
77 80
78#endif 81#endif