aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acexcep.h8
-rw-r--r--include/acpi/acnames.h26
-rw-r--r--include/acpi/acpi_bus.h31
-rw-r--r--include/acpi/acpiosxf.h155
-rw-r--r--include/acpi/acpixf.h93
-rw-r--r--include/acpi/actbl.h19
-rw-r--r--include/acpi/actbl1.h14
-rw-r--r--include/acpi/actbl2.h4
-rw-r--r--include/acpi/actypes.h77
-rw-r--r--include/acpi/ghes.h2
-rw-r--r--include/acpi/platform/acenv.h8
-rw-r--r--include/acpi/platform/aclinux.h131
-rw-r--r--include/acpi/processor.h4
-rw-r--r--include/asm-generic/bitops/find.h12
-rw-r--r--include/asm-generic/dma-contiguous.h28
-rw-r--r--include/asm-generic/gpio.h235
-rw-r--r--include/asm-generic/hugetlb.h4
-rw-r--r--include/asm-generic/preempt.h105
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-generic/simd.h14
-rw-r--r--include/asm-generic/vmlinux.lds.h1
-rw-r--r--include/asm-generic/vtime.h1
-rw-r--r--include/asm-generic/word-at-a-time.h8
-rw-r--r--include/clocksource/arm_arch_timer.h10
-rw-r--r--include/clocksource/samsung_pwm.h7
-rw-r--r--include/crypto/ablk_helper.h31
-rw-r--r--include/crypto/algapi.h18
-rw-r--r--include/crypto/authenc.h12
-rw-r--r--include/crypto/hash_info.h40
-rw-r--r--include/crypto/public_key.h25
-rw-r--r--include/crypto/scatterwalk.h5
-rw-r--r--include/drm/drmP.h118
-rw-r--r--include/drm/drm_crtc.h39
-rw-r--r--include/drm/drm_crtc_helper.h2
-rw-r--r--include/drm/drm_dp_helper.h31
-rw-r--r--include/drm/drm_pciids.h15
-rw-r--r--include/drm/i915_drm.h38
-rw-r--r--include/drm/i915_pciids.h236
-rw-r--r--include/drm/ttm/ttm_bo_api.h4
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h3
-rw-r--r--include/drm/ttm/ttm_object.h61
-rw-r--r--include/drm/ttm/ttm_page_alloc.h11
-rw-r--r--include/dt-bindings/clock/efm32-cmu.h42
-rw-r--r--include/dt-bindings/clock/samsung,s3c64xx-clock.h178
-rw-r--r--include/dt-bindings/input/input.h525
-rw-r--r--include/dt-bindings/mfd/as3722.h52
-rw-r--r--include/dt-bindings/mfd/dbx500-prcmu.h83
-rw-r--r--include/dt-bindings/pinctrl/am43xx.h31
-rw-r--r--include/dt-bindings/pinctrl/at91.h2
-rw-r--r--include/dt-bindings/pinctrl/dra.h50
-rw-r--r--include/dt-bindings/pinctrl/nomadik.h36
-rw-r--r--include/dt-bindings/pinctrl/omap.h4
-rw-r--r--include/keys/big_key-type.h25
-rw-r--r--include/keys/keyring-type.h17
-rw-r--r--include/keys/system_keyring.h23
-rw-r--r--include/linux/acpi.h107
-rw-r--r--include/linux/acpi_gpio.h31
-rw-r--r--include/linux/aio.h21
-rw-r--r--include/linux/amba/bus.h4
-rw-r--r--include/linux/amba/pl080.h1
-rw-r--r--include/linux/assoc_array.h92
-rw-r--r--include/linux/assoc_array_priv.h182
-rw-r--r--include/linux/ata.h7
-rw-r--r--include/linux/atmel_serial.h1
-rw-r--r--include/linux/audit.h15
-rw-r--r--include/linux/backing-dev.h7
-rw-r--r--include/linux/backlight.h4
-rw-r--r--include/linux/balloon_compaction.h25
-rw-r--r--include/linux/bcma/bcma_driver_pci.h1
-rw-r--r--include/linux/binfmts.h8
-rw-r--r--include/linux/bio.h3
-rw-r--r--include/linux/bitops.h11
-rw-r--r--include/linux/blk-mq.h183
-rw-r--r--include/linux/blk_types.h68
-rw-r--r--include/linux/blkdev.h74
-rw-r--r--include/linux/blktrace_api.h4
-rw-r--r--include/linux/capability.h1
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--include/linux/cgroup.h37
-rw-r--r--include/linux/clk-private.h3
-rw-r--r--include/linux/clk-provider.h32
-rw-r--r--include/linux/clk/mxs.h2
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cmdline-parser.h45
-rw-r--r--include/linux/compat.h7
-rw-r--r--include/linux/compiler-gcc4.h15
-rw-r--r--include/linux/compiler-intel.h2
-rw-r--r--include/linux/completion.h30
-rw-r--r--include/linux/coredump.h10
-rw-r--r--include/linux/cper.h13
-rw-r--r--include/linux/cpu.h16
-rw-r--r--include/linux/cpu_rmap.h3
-rw-r--r--include/linux/cpufreq.h84
-rw-r--r--include/linux/cpuidle.h8
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/crash_dump.h9
-rw-r--r--include/linux/crc-t10dif.h4
-rw-r--r--include/linux/crc32.h40
-rw-r--r--include/linux/dcache.h132
-rw-r--r--include/linux/debugfs.h12
-rw-r--r--include/linux/devfreq.h6
-rw-r--r--include/linux/device-mapper.h12
-rw-r--r--include/linux/device.h78
-rw-r--r--include/linux/dma-contiguous.h62
-rw-r--r--include/linux/dma-mapping.h31
-rw-r--r--include/linux/dma/mmp-pdma.h15
-rw-r--r--include/linux/dmaengine.h128
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/edac.h2
-rw-r--r--include/linux/efi.h62
-rw-r--r--include/linux/elf.h6
-rw-r--r--include/linux/elfcore.h7
-rw-r--r--include/linux/etherdevice.h35
-rw-r--r--include/linux/eventfd.h3
-rw-r--r--include/linux/export.h4
-rw-r--r--include/linux/extcon.h72
-rw-r--r--include/linux/extcon/extcon-adc-jack.h42
-rw-r--r--include/linux/extcon/extcon-gpio.h20
-rw-r--r--include/linux/fb.h12
-rw-r--r--include/linux/fcdevice.h2
-rw-r--r--include/linux/fddidevice.h7
-rw-r--r--include/linux/filter.h15
-rw-r--r--include/linux/fs.h146
-rw-r--r--include/linux/fs_struct.h11
-rw-r--r--include/linux/fscache-cache.h54
-rw-r--r--include/linux/fscache.h153
-rw-r--r--include/linux/fsl/mxs-dma.h20
-rw-r--r--include/linux/ftrace.h5
-rw-r--r--include/linux/ftrace_event.h41
-rw-r--r--include/linux/genalloc.h6
-rw-r--r--include/linux/genl_magic_func.h53
-rw-r--r--include/linux/gpio.h67
-rw-r--r--include/linux/gpio/consumer.h253
-rw-r--r--include/linux/gpio/driver.h194
-rw-r--r--include/linux/hardirq.h12
-rw-r--r--include/linux/hashtable.h15
-rw-r--r--include/linux/hid-sensor-hub.h23
-rw-r--r--include/linux/hid-sensor-ids.h12
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/hippidevice.h10
-rw-r--r--include/linux/host1x.h284
-rw-r--r--include/linux/huge_mm.h20
-rw-r--r--include/linux/hugetlb.h60
-rw-r--r--include/linux/hwmon-vid.h2
-rw-r--r--include/linux/hwmon.h10
-rw-r--r--include/linux/hyperv.h44
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/i8042.h24
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h24
-rw-r--r--include/linux/if_macvlan.h18
-rw-r--r--include/linux/if_vlan.h101
-rw-r--r--include/linux/iio/buffer.h61
-rw-r--r--include/linux/iio/common/st_sensors.h6
-rw-r--r--include/linux/iio/consumer.h2
-rw-r--r--include/linux/iio/events.h14
-rw-r--r--include/linux/iio/iio.h93
-rw-r--r--include/linux/iio/sysfs.h15
-rw-r--r--include/linux/iio/types.h20
-rw-r--r--include/linux/inetdevice.h28
-rw-r--r--include/linux/init.h7
-rw-r--r--include/linux/init_task.h8
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h108
-rw-r--r--include/linux/iommu.h18
-rw-r--r--include/linux/ipc_namespace.h8
-rw-r--r--include/linux/ipv6.h77
-rw-r--r--include/linux/irq.h16
-rw-r--r--include/linux/irqchip/arm-gic.h8
-rw-r--r--include/linux/irqchip/mmp.h6
-rw-r--r--include/linux/irqdesc.h3
-rw-r--r--include/linux/irqnr.h19
-rw-r--r--include/linux/irqreturn.h2
-rw-r--r--include/linux/jump_label.h14
-rw-r--r--include/linux/jump_label_ratelimit.h2
-rw-r--r--include/linux/kdb.h1
-rw-r--r--include/linux/kernel-page-flags.h1
-rw-r--r--include/linux/kernel.h16
-rw-r--r--include/linux/kernel_stat.h34
-rw-r--r--include/linux/kexec.h3
-rw-r--r--include/linux/key-type.h6
-rw-r--r--include/linux/key.h52
-rw-r--r--include/linux/kfifo.h47
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kobj_completion.h18
-rw-r--r--include/linux/kobject.h1
-rw-r--r--include/linux/kobject_ns.h2
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/kvm_host.h43
-rw-r--r--include/linux/lglock.h10
-rw-r--r--include/linux/list.h79
-rw-r--r--include/linux/list_lru.h131
-rw-r--r--include/linux/llist.h2
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/lockref.h16
-rw-r--r--include/linux/lz4.h8
-rw-r--r--include/linux/math64.h13
-rw-r--r--include/linux/mbus.h16
-rw-r--r--include/linux/memblock.h26
-rw-r--r--include/linux/memcontrol.h65
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mempolicy.h17
-rw-r--r--include/linux/mfd/arizona/registers.h2
-rw-r--r--include/linux/mfd/as3722.h423
-rw-r--r--include/linux/mfd/core.h8
-rw-r--r--include/linux/mfd/da9052/da9052.h20
-rw-r--r--include/linux/mfd/da9063/core.h93
-rw-r--r--include/linux/mfd/da9063/pdata.h111
-rw-r--r--include/linux/mfd/da9063/registers.h1028
-rw-r--r--include/linux/mfd/davinci_voicecodec.h3
-rw-r--r--include/linux/mfd/dbx500-prcmu.h70
-rw-r--r--include/linux/mfd/max77693-private.h1
-rw-r--r--include/linux/mfd/max77693.h2
-rw-r--r--include/linux/mfd/mc13xxx.h7
-rw-r--r--include/linux/mfd/mcp.h2
-rw-r--r--include/linux/mfd/palmas.h50
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h119
-rw-r--r--include/linux/mfd/samsung/core.h4
-rw-r--r--include/linux/mfd/samsung/rtc.h11
-rw-r--r--include/linux/mfd/samsung/s2mps11.h6
-rw-r--r--include/linux/mfd/stw481x.h56
-rw-r--r--include/linux/mfd/syscon.h25
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h13
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h30
-rw-r--r--include/linux/mfd/tmio.h1
-rw-r--r--include/linux/mfd/twl6040.h2
-rw-r--r--include/linux/mfd/ucb1x00.h1
-rw-r--r--include/linux/mfd/wm8994/core.h47
-rw-r--r--include/linux/micrel_phy.h8
-rw-r--r--include/linux/migrate.h15
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/cmd.h6
-rw-r--r--include/linux/mlx4/device.h25
-rw-r--r--include/linux/mlx5/device.h17
-rw-r--r--include/linux/mlx5/driver.h24
-rw-r--r--include/linux/mm.h304
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mm_types.h67
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mmc/card.h7
-rw-r--r--include/linux/mmc/core.h6
-rw-r--r--include/linux/mmc/dw_mmc.h4
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/mmc/sdhci.h1
-rw-r--r--include/linux/mmc/sh_mmcif.h6
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h2
-rw-r--r--include/linux/mmc/slot-gpio.h3
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h2
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/msi.h33
-rw-r--r--include/linux/mtd/bbm.h4
-rw-r--r--include/linux/mtd/fsmc.h1
-rw-r--r--include/linux/mtd/map.h4
-rw-r--r--include/linux/mtd/mtd.h11
-rw-r--r--include/linux/mtd/nand.h99
-rw-r--r--include/linux/mutex.h8
-rw-r--r--include/linux/namei.h6
-rw-r--r--include/linux/net.h119
-rw-r--r--include/linux/netdev_features.h6
-rw-r--r--include/linux/netdevice.h551
-rw-r--r--include/linux/netfilter.h24
-rw-r--r--include/linux/netfilter/ipset/ip_set.h167
-rw-r--r--include/linux/netfilter/ipset/ip_set_comment.h57
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h14
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h162
-rw-r--r--include/linux/netfilter/nfnetlink.h29
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h6
-rw-r--r--include/linux/netfilter/x_tables.h128
-rw-r--r--include/linux/netfilter_bridge.h4
-rw-r--r--include/linux/netfilter_ipv4.h6
-rw-r--r--include/linux/netfilter_ipv6.h10
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nfs4.h18
-rw-r--r--include/linux/nfs_fs.h27
-rw-r--r--include/linux/nfs_fs_sb.h23
-rw-r--r--include/linux/nfs_xdr.h52
-rw-r--r--include/linux/nvme.h466
-rw-r--r--include/linux/of.h84
-rw-r--r--include/linux/of_address.h39
-rw-r--r--include/linux/of_fdt.h23
-rw-r--r--include/linux/of_gpio.h29
-rw-r--r--include/linux/of_irq.h67
-rw-r--r--include/linux/of_mtd.h21
-rw-r--r--include/linux/of_net.h4
-rw-r--r--include/linux/of_pci.h17
-rw-r--r--include/linux/oom.h5
-rw-r--r--include/linux/opp.h134
-rw-r--r--include/linux/padata.h3
-rw-r--r--include/linux/page-flags-layout.h28
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/pci-acpi.h4
-rw-r--r--include/linux/pci.h106
-rw-r--r--include/linux/pci_hotplug.h5
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pcieport_if.h2
-rw-r--r--include/linux/percpu.h40
-rw-r--r--include/linux/percpu_ida.h81
-rw-r--r--include/linux/perf_event.h29
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/phy/phy.h270
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/platform_data/at24.h (renamed from include/linux/i2c/at24.h)2
-rw-r--r--include/linux/platform_data/atmel.h4
-rw-r--r--include/linux/platform_data/bd6107.h19
-rw-r--r--include/linux/platform_data/clk-nomadik.h2
-rw-r--r--include/linux/platform_data/clk-ux500.h3
-rw-r--r--include/linux/platform_data/davinci_asp.h2
-rw-r--r--include/linux/platform_data/dma-rcar-hpbdma.h103
-rw-r--r--include/linux/platform_data/dma-s3c24xx.h46
-rw-r--r--include/linux/platform_data/edma.h10
-rw-r--r--include/linux/platform_data/exynos_thermal.h119
-rw-r--r--include/linux/platform_data/gpio-davinci.h60
-rw-r--r--include/linux/platform_data/gpio-em.h1
-rw-r--r--include/linux/platform_data/gpio_backlight.h21
-rw-r--r--include/linux/platform_data/leds-lp55xx.h17
-rw-r--r--include/linux/platform_data/leds-pca963x.h (renamed from include/linux/platform_data/leds-pca9633.h)25
-rw-r--r--include/linux/platform_data/leds-pca9685.h35
-rw-r--r--include/linux/platform_data/leds-renesas-tpu.h14
-rw-r--r--include/linux/platform_data/lm3630_bl.h57
-rw-r--r--include/linux/platform_data/lm3630a_bl.h65
-rw-r--r--include/linux/platform_data/lp855x.h19
-rw-r--r--include/linux/platform_data/lv5207lp.h19
-rw-r--r--include/linux/platform_data/mipi-csis.h9
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h5
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h18
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h13
-rw-r--r--include/linux/platform_data/pca953x.h (renamed from include/linux/i2c/pca953x.h)0
-rw-r--r--include/linux/platform_data/pinctrl-adi2.h40
-rw-r--r--include/linux/platform_data/pinctrl-single.h12
-rw-r--r--include/linux/platform_data/usb-ehci-s5p.h21
-rw-r--r--include/linux/platform_data/usb-ohci-exynos.h21
-rw-r--r--include/linux/platform_data/usb-rcar-gen2-phy.h22
-rw-r--r--include/linux/platform_data/zforce_ts.h26
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm_opp.h139
-rw-r--r--include/linux/power/bq24190_charger.h16
-rw-r--r--include/linux/power/bq24735-charger.h (renamed from include/linux/irqchip/bcm2835.h)26
-rw-r--r--include/linux/power/twl4030_madc_battery.h39
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/powercap.h325
-rw-r--r--include/linux/preempt.h112
-rw-r--r--include/linux/preempt_mask.h41
-rw-r--r--include/linux/printk.h16
-rw-r--r--include/linux/pwm_backlight.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/pq.h1
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/random.h15
-rw-r--r--include/linux/rbtree.h24
-rw-r--r--include/linux/rculist.h23
-rw-r--r--include/linux/rcupdate.h24
-rw-r--r--include/linux/rcutiny.h17
-rw-r--r--include/linux/rcutree.h2
-rw-r--r--include/linux/regmap.h53
-rw-r--r--include/linux/regulator/consumer.h79
-rw-r--r--include/linux/regulator/driver.h20
-rw-r--r--include/linux/regulator/machine.h7
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/sched.h202
-rw-r--r--include/linux/sched/sysctl.h3
-rw-r--r--include/linux/sched_clock.h4
-rw-r--r--include/linux/security.h34
-rw-r--r--include/linux/seq_file.h15
-rw-r--r--include/linux/seqlock.h176
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/sfi.h3
-rw-r--r--include/linux/sh_dma.h55
-rw-r--r--include/linux/shdma-base.h3
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/shrinker.h54
-rw-r--r--include/linux/skbuff.h322
-rw-r--r--include/linux/slab.h265
-rw-r--r--include/linux/slab_def.h110
-rw-r--r--include/linux/slob_def.h31
-rw-r--r--include/linux/slub_def.h112
-rw-r--r--include/linux/smp.h89
-rw-r--r--include/linux/spi/mmc_spi.h19
-rw-r--r--include/linux/spi/rspi.h2
-rw-r--r--include/linux/spi/spi.h61
-rw-r--r--include/linux/srcu.h14
-rw-r--r--include/linux/ssb/ssb_driver_gige.h14
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/auth.h28
-rw-r--r--include/linux/sunrpc/cache.h22
-rw-r--r--include/linux/sunrpc/clnt.h12
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h39
-rw-r--r--include/linux/sunrpc/sched.h3
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/xprt.h2
-rw-r--r--include/linux/swap.h54
-rw-r--r--include/linux/swapops.h7
-rw-r--r--include/linux/syscalls.h9
-rw-r--r--include/linux/sysfs.h88
-rw-r--r--include/linux/sysrq.h3
-rw-r--r--include/linux/tegra-cpuidle.h25
-rw-r--r--include/linux/tegra-powergate.h36
-rw-r--r--include/linux/thermal.h18
-rw-r--r--include/linux/thinkpad_acpi.h15
-rw-r--r--include/linux/thread_info.h17
-rw-r--r--include/linux/time-armada-370-xp.h18
-rw-r--r--include/linux/timex.h15
-rw-r--r--include/linux/topology.h6
-rw-r--r--include/linux/tracepoint.h4
-rw-r--r--include/linux/tty.h29
-rw-r--r--include/linux/u64_stats_sync.h7
-rw-r--r--include/linux/uaccess.h8
-rw-r--r--include/linux/uprobes.h15
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/linux/usb/cdc_ncm.h33
-rw-r--r--include/linux/usb/hcd.h16
-rw-r--r--include/linux/usb/intel_mid_otg.h180
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/omap_control_usb.h33
-rw-r--r--include/linux/usb/serial.h2
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h5
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/usb/wusb-wa.h51
-rw-r--r--include/linux/usb/wusb.h2
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/user_namespace.h10
-rw-r--r--include/linux/vfio.h7
-rw-r--r--include/linux/virtio.h6
-rw-r--r--include/linux/virtio_config.h161
-rw-r--r--include/linux/virtio_ring.h2
-rw-r--r--include/linux/vm_event_item.h7
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/wait.h393
-rw-r--r--include/linux/writeback.h4
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/yam.h2
-rw-r--r--include/media/lm3560.h97
-rw-r--r--include/media/soc_camera.h27
-rw-r--r--include/media/v4l2-clk.h17
-rw-r--r--include/media/v4l2-common.h4
-rw-r--r--include/media/v4l2-ctrls.h2
-rw-r--r--include/media/v4l2-fh.h2
-rw-r--r--include/media/v4l2-subdev.h19
-rw-r--r--include/media/videobuf2-core.h6
-rw-r--r--include/media/videobuf2-dma-sg.h10
-rw-r--r--include/net/9p/client.h5
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/bluetooth/a2mp.h150
-rw-r--r--include/net/bluetooth/amp.h54
-rw-r--r--include/net/bluetooth/bluetooth.h27
-rw-r--r--include/net/bluetooth/hci.h156
-rw-r--r--include/net/bluetooth/hci_core.h193
-rw-r--r--include/net/bluetooth/l2cap.h35
-rw-r--r--include/net/bluetooth/mgmt.h18
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/bluetooth/sco.h5
-rw-r--r--include/net/bluetooth/smp.h146
-rw-r--r--include/net/caif/caif_hsi.h2
-rw-r--r--include/net/cfg80211.h32
-rw-r--r--include/net/checksum.h11
-rw-r--r--include/net/cipso_ipv4.h6
-rw-r--r--include/net/codel.h19
-rw-r--r--include/net/compat.h48
-rw-r--r--include/net/dcbevent.h6
-rw-r--r--include/net/dn.h20
-rw-r--r--include/net/dn_dev.h30
-rw-r--r--include/net/dn_fib.h47
-rw-r--r--include/net/dn_neigh.h12
-rw-r--r--include/net/dn_nsp.h49
-rw-r--r--include/net/dn_route.h13
-rw-r--r--include/net/dst.h37
-rw-r--r--include/net/esp.h12
-rw-r--r--include/net/fib_rules.h17
-rw-r--r--include/net/flow.h11
-rw-r--r--include/net/flow_keys.h3
-rw-r--r--include/net/garp.h27
-rw-r--r--include/net/gen_stats.h51
-rw-r--r--include/net/genetlink.h139
-rw-r--r--include/net/gre.h8
-rw-r--r--include/net/icmp.h10
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet6_connection_sock.h32
-rw-r--r--include/net/inet6_hashtables.h67
-rw-r--r--include/net/inet_common.h48
-rw-r--r--include/net/inet_connection_sock.h79
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/net/inet_hashtables.h99
-rw-r--r--include/net/inet_sock.h49
-rw-r--r--include/net/inet_timewait_sock.h69
-rw-r--r--include/net/inetpeer.h12
-rw-r--r--include/net/ip.h201
-rw-r--r--include/net/ip6_checksum.h4
-rw-r--r--include/net/ip6_fib.h52
-rw-r--r--include/net/ip6_route.h104
-rw-r--r--include/net/ip_fib.h61
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/ip_vs.h292
-rw-r--r--include/net/ipv6.h276
-rw-r--r--include/net/ipx.h12
-rw-r--r--include/net/irda/ircomm_tty.h14
-rw-r--r--include/net/irda/irda.h21
-rw-r--r--include/net/irda/irda_device.h2
-rw-r--r--include/net/irda/irlap_event.h2
-rw-r--r--include/net/irda/irlap_frame.h4
-rw-r--r--include/net/iw_handler.h38
-rw-r--r--include/net/lapb.h52
-rw-r--r--include/net/llc.h50
-rw-r--r--include/net/llc_c_ac.h190
-rw-r--r--include/net/llc_c_ev.h207
-rw-r--r--include/net/llc_conn.h36
-rw-r--r--include/net/llc_if.h7
-rw-r--r--include/net/llc_pdu.h33
-rw-r--r--include/net/llc_s_ac.h20
-rw-r--r--include/net/llc_s_ev.h21
-rw-r--r--include/net/llc_sap.h22
-rw-r--r--include/net/mac80211.h60
-rw-r--r--include/net/mac802154.h2
-rw-r--r--include/net/mrp.h23
-rw-r--r--include/net/ndisc.h59
-rw-r--r--include/net/net_namespace.h33
-rw-r--r--include/net/netevent.h6
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h6
-rw-r--r--include/net/netfilter/ipv4/nf_defrag_ipv4.h2
-rw-r--r--include/net/netfilter/ipv6/nf_defrag_ipv6.h13
-rw-r--r--include/net/netfilter/nf_conntrack.h69
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h22
-rw-r--r--include/net/netfilter/nf_conntrack_core.h69
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h22
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h6
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h40
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h16
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h32
-rw-r--r--include/net/netfilter/nf_conntrack_seqadj.h30
-rw-r--r--include/net/netfilter/nf_conntrack_synproxy.h28
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h4
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h8
-rw-r--r--include/net/netfilter/nf_nat.h13
-rw-r--r--include/net/netfilter/nf_nat_core.h8
-rw-r--r--include/net/netfilter/nf_nat_helper.h29
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h23
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h30
-rw-r--r--include/net/netfilter/nf_queue.h2
-rw-r--r--include/net/netfilter/nf_tables.h519
-rw-r--r--include/net/netfilter/nf_tables_core.h42
-rw-r--r--include/net/netfilter/nf_tables_ipv4.h23
-rw-r--r--include/net/netfilter/nf_tables_ipv6.h30
-rw-r--r--include/net/netfilter/xt_rateest.h4
-rw-r--r--include/net/netlink.h63
-rw-r--r--include/net/netns/ipv4.h7
-rw-r--r--include/net/netns/nftables.h19
-rw-r--r--include/net/netrom.h89
-rw-r--r--include/net/nfc/digital.h227
-rw-r--r--include/net/nfc/hci.h6
-rw-r--r--include/net/nfc/nci.h4
-rw-r--r--include/net/nfc/nci_core.h46
-rw-r--r--include/net/nfc/nfc.h25
-rw-r--r--include/net/p8022.h18
-rw-r--r--include/net/ping.h7
-rw-r--r--include/net/protocol.h24
-rw-r--r--include/net/psnap.h4
-rw-r--r--include/net/raw.h6
-rw-r--r--include/net/rawv6.h3
-rw-r--r--include/net/request_sock.h15
-rw-r--r--include/net/rose.h114
-rw-r--r--include/net/route.h78
-rw-r--r--include/net/rtnetlink.h40
-rw-r--r--include/net/sch_generic.h11
-rw-r--r--include/net/scm.h10
-rw-r--r--include/net/sctp/checksum.h56
-rw-r--r--include/net/sctp/sctp.h13
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/secure_seq.h27
-rw-r--r--include/net/sock.h289
-rw-r--r--include/net/stp.h4
-rw-r--r--include/net/tcp.h452
-rw-r--r--include/net/tcp_memcontrol.h12
-rw-r--r--include/net/udp.h109
-rw-r--r--include/net/udplite.h6
-rw-r--r--include/net/vxlan.h11
-rw-r--r--include/net/wext.h16
-rw-r--r--include/net/wimax.h33
-rw-r--r--include/net/x25.h141
-rw-r--r--include/net/xfrm.h382
-rw-r--r--include/rdma/ib_verbs.h20
-rw-r--r--include/scsi/fc/fc_fc2.h2
-rw-r--r--include/scsi/iscsi_if.h17
-rw-r--r--include/scsi/libfc.h9
-rw-r--r--include/scsi/libfcoe.h7
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/scsi/scsi_host.h11
-rw-r--r--include/scsi/scsi_transport_iscsi.h1
-rw-r--r--include/scsi/scsi_transport_srp.h83
-rw-r--r--include/sound/ak4114.h4
-rw-r--r--include/sound/compress_driver.h9
-rw-r--r--include/sound/cs42l52.h2
-rw-r--r--include/sound/cs42l73.h22
-rw-r--r--include/sound/dmaengine_pcm.h8
-rw-r--r--include/sound/memalloc.h7
-rw-r--r--include/sound/rcar_snd.h4
-rw-r--r--include/sound/soc-dai.h17
-rw-r--r--include/sound/soc-dapm.h7
-rw-r--r--include/sound/soc.h100
-rw-r--r--include/target/iscsi/iscsi_transport.h8
-rw-r--r--include/target/target_core_backend.h12
-rw-r--r--include/target/target_core_base.h110
-rw-r--r--include/target/target_core_configfs.h1
-rw-r--r--include/target/target_core_fabric.h32
-rw-r--r--include/trace/events/asoc.h1
-rw-r--r--include/trace/events/bcache.h47
-rw-r--r--include/trace/events/block.h6
-rw-r--r--include/trace/events/btrfs.h65
-rw-r--r--include/trace/events/f2fs.h51
-rw-r--r--include/trace/events/iommu.h162
-rw-r--r--include/trace/events/kmem.h10
-rw-r--r--include/trace/events/kvm.h10
-rw-r--r--include/trace/events/power_cpu_migrate.h67
-rw-r--r--include/trace/events/random.h183
-rw-r--r--include/trace/events/rcu.h80
-rw-r--r--include/trace/events/sched.h21
-rw-r--r--include/trace/events/spi.h156
-rw-r--r--include/trace/events/sunrpc.h181
-rw-r--r--include/trace/events/swiotlb.h46
-rw-r--r--include/trace/events/target.h4
-rw-r--r--include/trace/events/vmscan.h4
-rw-r--r--include/trace/events/writeback.h6
-rw-r--r--include/trace/ftrace.h19
-rw-r--r--include/uapi/asm-generic/errno.h2
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/drm/armada_drm.h45
-rw-r--r--include/uapi/drm/drm.h37
-rw-r--r--include/uapi/drm/drm_mode.h47
-rw-r--r--include/uapi/drm/i915_drm.h8
-rw-r--r--include/uapi/drm/radeon_drm.h4
-rw-r--r--include/uapi/drm/tegra_drm.h29
-rw-r--r--include/uapi/linux/Kbuild3
-rw-r--r--include/uapi/linux/audit.h27
-rw-r--r--include/uapi/linux/bcache.h373
-rw-r--r--include/uapi/linux/btrfs.h30
-rw-r--r--include/uapi/linux/can/bcm.h32
-rw-r--r--include/uapi/linux/can/error.h32
-rw-r--r--include/uapi/linux/can/gw.h32
-rw-r--r--include/uapi/linux/can/netlink.h8
-rw-r--r--include/uapi/linux/can/raw.h32
-rw-r--r--include/uapi/linux/cifs/cifs_mount.h27
-rw-r--r--include/uapi/linux/dm-ioctl.h15
-rw-r--r--include/uapi/linux/dqblk_xfs.h47
-rw-r--r--include/uapi/linux/elf-em.h3
-rw-r--r--include/uapi/linux/eventpoll.h13
-rw-r--r--include/uapi/linux/fs.h6
-rw-r--r--include/uapi/linux/genetlink.h2
-rw-r--r--include/uapi/linux/hash_info.h37
-rw-r--r--include/uapi/linux/hsr_netlink.h50
-rw-r--r--include/uapi/linux/if.h1
-rw-r--r--include/uapi/linux/if_bonding.h2
-rw-r--r--include/uapi/linux/if_ether.h1
-rw-r--r--include/uapi/linux/if_link.h26
-rw-r--r--include/uapi/linux/in.h5
-rw-r--r--include/uapi/linux/input.h29
-rw-r--r--include/uapi/linux/ip_vs.h2
-rw-r--r--include/uapi/linux/keyctl.h1
-rw-r--r--include/uapi/linux/kvm.h11
-rw-r--r--include/uapi/linux/magic.h2
-rw-r--r--include/uapi/linux/major.h2
-rw-r--r--include/uapi/linux/mic_common.h232
-rw-r--r--include/uapi/linux/mic_ioctl.h76
-rw-r--r--include/uapi/linux/netfilter/Kbuild2
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h16
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h718
-rw-r--r--include/uapi/linux/netfilter/nf_tables_compat.h38
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h10
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_cttimeout.h2
-rw-r--r--include/uapi/linux/netlink_diag.h1
-rw-r--r--include/uapi/linux/nfc.h4
-rw-r--r--include/uapi/linux/nfs_mount.h2
-rw-r--r--include/uapi/linux/nl80211.h27
-rw-r--r--include/uapi/linux/nvme.h477
-rw-r--r--include/uapi/linux/openvswitch.h18
-rw-r--r--include/uapi/linux/packet_diag.h1
-rw-r--r--include/uapi/linux/pci_regs.h76
-rw-r--r--include/uapi/linux/perf_event.h54
-rw-r--r--include/uapi/linux/pkt_cls.h14
-rw-r--r--include/uapi/linux/pkt_sched.h11
-rw-r--r--include/uapi/linux/raid/md_p.h1
-rw-r--r--include/uapi/linux/random.h7
-rw-r--r--include/uapi/linux/reiserfs_xattr.h2
-rw-r--r--include/uapi/linux/serial_core.h3
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/tc_defact.h (renamed from include/linux/tc_act/tc_defact.h)2
-rw-r--r--include/uapi/linux/unix_diag.h1
-rw-r--r--include/uapi/linux/v4l2-controls.h4
-rw-r--r--include/uapi/linux/vfio.h38
-rw-r--r--include/uapi/mtd/mtd-abi.h9
-rw-r--r--include/uapi/rdma/ib_user_verbs.h89
-rw-r--r--include/uapi/sound/Kbuild1
-rw-r--r--include/uapi/sound/asound.h3
-rw-r--r--include/uapi/sound/compress_offload.h6
-rw-r--r--include/uapi/sound/firewire.h51
-rw-r--r--include/video/atmel_lcdc.h25
-rw-r--r--include/video/exynos_dp.h131
-rw-r--r--include/video/exynos_mipi_dsim.h5
-rw-r--r--include/video/mmp_disp.h6
-rw-r--r--include/video/omap-panel-data.h13
-rw-r--r--include/xen/interface/io/netif.h18
-rw-r--r--include/xen/interface/physdev.h11
-rw-r--r--include/xen/swiotlb-xen.h3
-rw-r--r--include/xen/xen-ops.h7
716 files changed, 21602 insertions, 8875 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 1c16f821434f..3ea214cff349 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -83,7 +83,9 @@
83 * Should the subsystem abort the loading of an ACPI table if the 83 * Should the subsystem abort the loading of an ACPI table if the
84 * table checksum is incorrect? 84 * table checksum is incorrect?
85 */ 85 */
86#ifndef ACPI_CHECKSUM_ABORT
86#define ACPI_CHECKSUM_ABORT FALSE 87#define ACPI_CHECKSUM_ABORT FALSE
88#endif
87 89
88/* 90/*
89 * Generate a version of ACPICA that only supports "reduced hardware" 91 * Generate a version of ACPICA that only supports "reduced hardware"
@@ -100,7 +102,9 @@
100 * ACPI PM timer 102 * ACPI PM timer
101 * FACS table (Waking vectors and Global Lock) 103 * FACS table (Waking vectors and Global Lock)
102 */ 104 */
105#ifndef ACPI_REDUCED_HARDWARE
103#define ACPI_REDUCED_HARDWARE FALSE 106#define ACPI_REDUCED_HARDWARE FALSE
107#endif
104 108
105/****************************************************************************** 109/******************************************************************************
106 * 110 *
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index cf051e05a8fe..4e280bd226dd 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -125,8 +125,9 @@ struct acpi_exception_info {
125#define AE_NO_HANDLER EXCEP_ENV (0x001A) 125#define AE_NO_HANDLER EXCEP_ENV (0x001A)
126#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) 126#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
127#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) 127#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
128#define AE_ACCESS EXCEP_ENV (0x001D)
128 129
129#define AE_CODE_ENV_MAX 0x001C 130#define AE_CODE_ENV_MAX 0x001D
130 131
131/* 132/*
132 * Programmer exceptions 133 * Programmer exceptions
@@ -227,7 +228,7 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
227 EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"), 228 EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
228 EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"), 229 EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"),
229 EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"), 230 EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"),
230 EXCEP_TXT("AE_NOT_FOUND", "The name was not found in the namespace"), 231 EXCEP_TXT("AE_NOT_FOUND", "A requested entity is not found"),
231 EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"), 232 EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"),
232 EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"), 233 EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"),
233 EXCEP_TXT("AE_TYPE", "The object type is incorrect"), 234 EXCEP_TXT("AE_TYPE", "The object type is incorrect"),
@@ -259,7 +260,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
259 EXCEP_TXT("AE_OWNER_ID_LIMIT", 260 EXCEP_TXT("AE_OWNER_ID_LIMIT",
260 "There are no more Owner IDs available for ACPI tables or control methods"), 261 "There are no more Owner IDs available for ACPI tables or control methods"),
261 EXCEP_TXT("AE_NOT_CONFIGURED", 262 EXCEP_TXT("AE_NOT_CONFIGURED",
262 "The interface is not part of the current subsystem configuration") 263 "The interface is not part of the current subsystem configuration"),
264 EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation")
263}; 265};
264 266
265static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { 267static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index ce08ef7d969c..1f36777e26fe 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -46,25 +46,25 @@
46 46
47/* Method names - these methods can appear anywhere in the namespace */ 47/* Method names - these methods can appear anywhere in the namespace */
48 48
49#define METHOD_NAME__SB_ "_SB_"
50#define METHOD_NAME__HID "_HID"
51#define METHOD_NAME__CID "_CID"
52#define METHOD_NAME__UID "_UID"
53#define METHOD_NAME__SUB "_SUB"
54#define METHOD_NAME__ADR "_ADR" 49#define METHOD_NAME__ADR "_ADR"
55#define METHOD_NAME__INI "_INI" 50#define METHOD_NAME__AEI "_AEI"
56#define METHOD_NAME__STA "_STA"
57#define METHOD_NAME__REG "_REG"
58#define METHOD_NAME__SEG "_SEG"
59#define METHOD_NAME__BBN "_BBN" 51#define METHOD_NAME__BBN "_BBN"
60#define METHOD_NAME__PRT "_PRT" 52#define METHOD_NAME__CBA "_CBA"
53#define METHOD_NAME__CID "_CID"
61#define METHOD_NAME__CRS "_CRS" 54#define METHOD_NAME__CRS "_CRS"
55#define METHOD_NAME__HID "_HID"
56#define METHOD_NAME__INI "_INI"
57#define METHOD_NAME__PLD "_PLD"
62#define METHOD_NAME__PRS "_PRS" 58#define METHOD_NAME__PRS "_PRS"
63#define METHOD_NAME__AEI "_AEI" 59#define METHOD_NAME__PRT "_PRT"
64#define METHOD_NAME__PRW "_PRW" 60#define METHOD_NAME__PRW "_PRW"
61#define METHOD_NAME__REG "_REG"
62#define METHOD_NAME__SB_ "_SB_"
63#define METHOD_NAME__SEG "_SEG"
65#define METHOD_NAME__SRS "_SRS" 64#define METHOD_NAME__SRS "_SRS"
66#define METHOD_NAME__CBA "_CBA" 65#define METHOD_NAME__STA "_STA"
67#define METHOD_NAME__PLD "_PLD" 66#define METHOD_NAME__SUB "_SUB"
67#define METHOD_NAME__UID "_UID"
68 68
69/* Method names - these methods must appear at the namespace root */ 69/* Method names - these methods must appear at the namespace root */
70 70
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 02e113bb8b7d..c602c7718421 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -100,6 +100,7 @@ enum acpi_hotplug_mode {
100struct acpi_hotplug_profile { 100struct acpi_hotplug_profile {
101 struct kobject kobj; 101 struct kobject kobj;
102 bool enabled:1; 102 bool enabled:1;
103 bool ignore:1;
103 enum acpi_hotplug_mode mode; 104 enum acpi_hotplug_mode mode;
104}; 105};
105 106
@@ -222,7 +223,8 @@ struct acpi_device_power_flags {
222 u32 power_resources:1; /* Power resources */ 223 u32 power_resources:1; /* Power resources */
223 u32 inrush_current:1; /* Serialize Dx->D0 */ 224 u32 inrush_current:1; /* Serialize Dx->D0 */
224 u32 power_removed:1; /* Optimize Dx->D0 */ 225 u32 power_removed:1; /* Optimize Dx->D0 */
225 u32 reserved:28; 226 u32 ignore_parent:1; /* Power is independent of parent power state */
227 u32 reserved:27;
226}; 228};
227 229
228struct acpi_device_power_state { 230struct acpi_device_power_state {
@@ -311,7 +313,6 @@ struct acpi_device {
311 unsigned int physical_node_count; 313 unsigned int physical_node_count;
312 struct list_head physical_node_list; 314 struct list_head physical_node_list;
313 struct mutex physical_node_lock; 315 struct mutex physical_node_lock;
314 struct list_head power_dependent;
315 void (*remove)(struct acpi_device *); 316 void (*remove)(struct acpi_device *);
316}; 317};
317 318
@@ -339,20 +340,6 @@ struct acpi_bus_event {
339 u32 data; 340 u32 data;
340}; 341};
341 342
342struct acpi_eject_event {
343 struct acpi_device *device;
344 u32 event;
345};
346
347struct acpi_hp_work {
348 struct work_struct work;
349 acpi_handle handle;
350 u32 type;
351 void *context;
352};
353void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
354 void (*func)(struct work_struct *work));
355
356extern struct kobject *acpi_kobj; 343extern struct kobject *acpi_kobj;
357extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 344extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
358void acpi_bus_private_data_handler(acpi_handle, void *); 345void acpi_bus_private_data_handler(acpi_handle, void *);
@@ -391,7 +378,6 @@ int acpi_scan_add_handler(struct acpi_scan_handler *handler);
391int acpi_bus_register_driver(struct acpi_driver *driver); 378int acpi_bus_register_driver(struct acpi_driver *driver);
392void acpi_bus_unregister_driver(struct acpi_driver *driver); 379void acpi_bus_unregister_driver(struct acpi_driver *driver);
393int acpi_bus_scan(acpi_handle handle); 380int acpi_bus_scan(acpi_handle handle);
394void acpi_bus_hot_remove_device(void *context);
395void acpi_bus_trim(struct acpi_device *start); 381void acpi_bus_trim(struct acpi_device *start);
396acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 382acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
397int acpi_match_device_ids(struct acpi_device *device, 383int acpi_match_device_ids(struct acpi_device *device,
@@ -399,6 +385,9 @@ int acpi_match_device_ids(struct acpi_device *device,
399int acpi_create_dir(struct acpi_device *); 385int acpi_create_dir(struct acpi_device *);
400void acpi_remove_dir(struct acpi_device *); 386void acpi_remove_dir(struct acpi_device *);
401 387
388typedef void (*acpi_hp_callback)(void *data, u32 src);
389
390acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src);
402 391
403/** 392/**
404 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver 393 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
@@ -443,9 +432,9 @@ static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
443{ 432{
444 return acpi_find_child(handle, addr, false); 433 return acpi_find_child(handle, addr, false);
445} 434}
435void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr);
446int acpi_is_root_bridge(acpi_handle); 436int acpi_is_root_bridge(acpi_handle);
447struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 437struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
448#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
449 438
450int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 439int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
451int acpi_disable_wakeup_device_power(struct acpi_device *dev); 440int acpi_disable_wakeup_device_power(struct acpi_device *dev);
@@ -456,8 +445,6 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
456acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 445acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
457 acpi_notify_handler handler); 446 acpi_notify_handler handler);
458int acpi_pm_device_sleep_state(struct device *, int *, int); 447int acpi_pm_device_sleep_state(struct device *, int *, int);
459void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
460void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
461#else 448#else
462static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 449static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
463 acpi_notify_handler handler, 450 acpi_notify_handler handler,
@@ -478,10 +465,6 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
478 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? 465 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
479 m : ACPI_STATE_D0; 466 m : ACPI_STATE_D0;
480} 467}
481static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
482 struct device *depdev) {}
483static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
484 struct device *depdev) {}
485#endif 468#endif
486 469
487#ifdef CONFIG_PM_RUNTIME 470#ifdef CONFIG_PM_RUNTIME
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 64b8c7639520..01e6c6d8b7e1 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -77,54 +77,80 @@ struct acpi_signal_fatal_info {
77/* 77/*
78 * OSL Initialization and shutdown primitives 78 * OSL Initialization and shutdown primitives
79 */ 79 */
80acpi_status __init acpi_os_initialize(void); 80#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
81acpi_status acpi_os_initialize(void);
82#endif
81 83
84#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
82acpi_status acpi_os_terminate(void); 85acpi_status acpi_os_terminate(void);
86#endif
83 87
84/* 88/*
85 * ACPI Table interfaces 89 * ACPI Table interfaces
86 */ 90 */
91#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer
87acpi_physical_address acpi_os_get_root_pointer(void); 92acpi_physical_address acpi_os_get_root_pointer(void);
93#endif
88 94
95#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
89acpi_status 96acpi_status
90acpi_os_predefined_override(const struct acpi_predefined_names *init_val, 97acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
91 acpi_string * new_val); 98 acpi_string * new_val);
99#endif
92 100
101#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
93acpi_status 102acpi_status
94acpi_os_table_override(struct acpi_table_header *existing_table, 103acpi_os_table_override(struct acpi_table_header *existing_table,
95 struct acpi_table_header **new_table); 104 struct acpi_table_header **new_table);
105#endif
96 106
107#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
97acpi_status 108acpi_status
98acpi_os_physical_table_override(struct acpi_table_header *existing_table, 109acpi_os_physical_table_override(struct acpi_table_header *existing_table,
99 acpi_physical_address * new_address, 110 acpi_physical_address * new_address,
100 u32 *new_table_length); 111 u32 *new_table_length);
112#endif
101 113
102/* 114/*
103 * Spinlock primitives 115 * Spinlock primitives
104 */ 116 */
105#ifndef acpi_os_create_lock 117#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
106acpi_status acpi_os_create_lock(acpi_spinlock * out_handle); 118acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
107#endif 119#endif
108 120
121#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock
109void acpi_os_delete_lock(acpi_spinlock handle); 122void acpi_os_delete_lock(acpi_spinlock handle);
123#endif
110 124
125#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock
111acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle); 126acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
127#endif
112 128
129#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock
113void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags); 130void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags);
131#endif
114 132
115/* 133/*
116 * Semaphore primitives 134 * Semaphore primitives
117 */ 135 */
136#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore
118acpi_status 137acpi_status
119acpi_os_create_semaphore(u32 max_units, 138acpi_os_create_semaphore(u32 max_units,
120 u32 initial_units, acpi_semaphore * out_handle); 139 u32 initial_units, acpi_semaphore * out_handle);
140#endif
121 141
142#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore
122acpi_status acpi_os_delete_semaphore(acpi_semaphore handle); 143acpi_status acpi_os_delete_semaphore(acpi_semaphore handle);
144#endif
123 145
146#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore
124acpi_status 147acpi_status
125acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout); 148acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
149#endif
126 150
151#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore
127acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); 152acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
153#endif
128 154
129/* 155/*
130 * Mutex primitives. May be configured to use semaphores instead via 156 * Mutex primitives. May be configured to use semaphores instead via
@@ -132,29 +158,48 @@ acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
132 */ 158 */
133#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) 159#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
134 160
161#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex
135acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); 162acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
163#endif
136 164
165#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex
137void acpi_os_delete_mutex(acpi_mutex handle); 166void acpi_os_delete_mutex(acpi_mutex handle);
167#endif
138 168
169#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex
139acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); 170acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
171#endif
140 172
173#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex
141void acpi_os_release_mutex(acpi_mutex handle); 174void acpi_os_release_mutex(acpi_mutex handle);
142#endif 175#endif
143 176
177#endif
178
144/* 179/*
145 * Memory allocation and mapping 180 * Memory allocation and mapping
146 */ 181 */
182#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
147void *acpi_os_allocate(acpi_size size); 183void *acpi_os_allocate(acpi_size size);
184#endif
148 185
186#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
187void *acpi_os_allocate_zeroed(acpi_size size);
188#endif
189
190#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
149void acpi_os_free(void *memory); 191void acpi_os_free(void *memory);
192#endif
150 193
151void __iomem *acpi_os_map_memory(acpi_physical_address where, 194#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
152 acpi_size length); 195void *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
196#endif
153 197
154void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); 198#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
155void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); 199void acpi_os_unmap_memory(void *logical_address, acpi_size size);
200#endif
156 201
157#ifdef ACPI_FUTURE_USAGE 202#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
158acpi_status 203acpi_status
159acpi_os_get_physical_address(void *logical_address, 204acpi_os_get_physical_address(void *logical_address,
160 acpi_physical_address * physical_address); 205 acpi_physical_address * physical_address);
@@ -163,117 +208,195 @@ acpi_os_get_physical_address(void *logical_address,
163/* 208/*
164 * Memory/Object Cache 209 * Memory/Object Cache
165 */ 210 */
211#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache
166acpi_status 212acpi_status
167acpi_os_create_cache(char *cache_name, 213acpi_os_create_cache(char *cache_name,
168 u16 object_size, 214 u16 object_size,
169 u16 max_depth, acpi_cache_t ** return_cache); 215 u16 max_depth, acpi_cache_t ** return_cache);
216#endif
170 217
218#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache
171acpi_status acpi_os_delete_cache(acpi_cache_t * cache); 219acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
220#endif
172 221
222#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache
173acpi_status acpi_os_purge_cache(acpi_cache_t * cache); 223acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
224#endif
174 225
226#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
175void *acpi_os_acquire_object(acpi_cache_t * cache); 227void *acpi_os_acquire_object(acpi_cache_t * cache);
228#endif
176 229
230#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object
177acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object); 231acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
232#endif
178 233
179/* 234/*
180 * Interrupt handlers 235 * Interrupt handlers
181 */ 236 */
237#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler
182acpi_status 238acpi_status
183acpi_os_install_interrupt_handler(u32 interrupt_number, 239acpi_os_install_interrupt_handler(u32 interrupt_number,
184 acpi_osd_handler service_routine, 240 acpi_osd_handler service_routine,
185 void *context); 241 void *context);
242#endif
186 243
244#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler
187acpi_status 245acpi_status
188acpi_os_remove_interrupt_handler(u32 interrupt_number, 246acpi_os_remove_interrupt_handler(u32 interrupt_number,
189 acpi_osd_handler service_routine); 247 acpi_osd_handler service_routine);
190 248#endif
191void acpi_os_gpe_count(u32 gpe_number);
192void acpi_os_fixed_event_count(u32 fixed_event_number);
193 249
194/* 250/*
195 * Threads and Scheduling 251 * Threads and Scheduling
196 */ 252 */
253#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
197acpi_thread_id acpi_os_get_thread_id(void); 254acpi_thread_id acpi_os_get_thread_id(void);
255#endif
198 256
257#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute
199acpi_status 258acpi_status
200acpi_os_execute(acpi_execute_type type, 259acpi_os_execute(acpi_execute_type type,
201 acpi_osd_exec_callback function, void *context); 260 acpi_osd_exec_callback function, void *context);
261#endif
202 262
203acpi_status 263#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete
204acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
205
206void acpi_os_wait_events_complete(void); 264void acpi_os_wait_events_complete(void);
265#endif
207 266
267#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep
208void acpi_os_sleep(u64 milliseconds); 268void acpi_os_sleep(u64 milliseconds);
269#endif
209 270
271#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall
210void acpi_os_stall(u32 microseconds); 272void acpi_os_stall(u32 microseconds);
273#endif
211 274
212/* 275/*
213 * Platform and hardware-independent I/O interfaces 276 * Platform and hardware-independent I/O interfaces
214 */ 277 */
215acpi_status acpi_os_read_port(acpi_io_address address, u32 * value, u32 width); 278#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port
279acpi_status acpi_os_read_port(acpi_io_address address, u32 *value, u32 width);
280#endif
216 281
282#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port
217acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width); 283acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
284#endif
218 285
219/* 286/*
220 * Platform and hardware-independent physical memory interfaces 287 * Platform and hardware-independent physical memory interfaces
221 */ 288 */
289#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory
222acpi_status 290acpi_status
223acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width); 291acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width);
292#endif
224 293
294#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory
225acpi_status 295acpi_status
226acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width); 296acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width);
297#endif
227 298
228/* 299/*
229 * Platform and hardware-independent PCI configuration space access 300 * Platform and hardware-independent PCI configuration space access
230 * Note: Can't use "Register" as a parameter, changed to "Reg" -- 301 * Note: Can't use "Register" as a parameter, changed to "Reg" --
231 * certain compilers complain. 302 * certain compilers complain.
232 */ 303 */
304#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration
233acpi_status 305acpi_status
234acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, 306acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
235 u32 reg, u64 *value, u32 width); 307 u32 reg, u64 *value, u32 width);
308#endif
236 309
310#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration
237acpi_status 311acpi_status
238acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, 312acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
239 u32 reg, u64 value, u32 width); 313 u32 reg, u64 value, u32 width);
314#endif
240 315
241/* 316/*
242 * Miscellaneous 317 * Miscellaneous
243 */ 318 */
319#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
320u8 acpi_os_readable(void *pointer, acpi_size length);
321#endif
322
323#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
324u8 acpi_os_writable(void *pointer, acpi_size length);
325#endif
326
327#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer
244u64 acpi_os_get_timer(void); 328u64 acpi_os_get_timer(void);
329#endif
245 330
331#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal
246acpi_status acpi_os_signal(u32 function, void *info); 332acpi_status acpi_os_signal(u32 function, void *info);
333#endif
247 334
248/* 335/*
249 * Debug print routines 336 * Debug print routines
250 */ 337 */
338#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
251void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...); 339void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
340#endif
252 341
342#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf
253void acpi_os_vprintf(const char *format, va_list args); 343void acpi_os_vprintf(const char *format, va_list args);
344#endif
254 345
346#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
255void acpi_os_redirect_output(void *destination); 347void acpi_os_redirect_output(void *destination);
348#endif
256 349
257#ifdef ACPI_FUTURE_USAGE
258/* 350/*
259 * Debug input 351 * Debug input
260 */ 352 */
261u32 acpi_os_get_line(char *buffer); 353#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
354acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read);
355#endif
356
357/*
358 * Obtain ACPI table(s)
359 */
360#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
361acpi_status
362acpi_os_get_table_by_name(char *signature,
363 u32 instance,
364 struct acpi_table_header **table,
365 acpi_physical_address * address);
366#endif
367
368#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
369acpi_status
370acpi_os_get_table_by_index(u32 index,
371 struct acpi_table_header **table,
372 u32 *instance, acpi_physical_address * address);
373#endif
374
375#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
376acpi_status
377acpi_os_get_table_by_address(acpi_physical_address address,
378 struct acpi_table_header **table);
262#endif 379#endif
263 380
264/* 381/*
265 * Directory manipulation 382 * Directory manipulation
266 */ 383 */
384#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
267void *acpi_os_open_directory(char *pathname, 385void *acpi_os_open_directory(char *pathname,
268 char *wildcard_spec, char requested_file_type); 386 char *wildcard_spec, char requested_file_type);
387#endif
269 388
270/* requeste_file_type values */ 389/* requeste_file_type values */
271 390
272#define REQUEST_FILE_ONLY 0 391#define REQUEST_FILE_ONLY 0
273#define REQUEST_DIR_ONLY 1 392#define REQUEST_DIR_ONLY 1
274 393
394#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
275char *acpi_os_get_next_filename(void *dir_handle); 395char *acpi_os_get_next_filename(void *dir_handle);
396#endif
276 397
398#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
277void acpi_os_close_directory(void *dir_handle); 399void acpi_os_close_directory(void *dir_handle);
400#endif
278 401
279#endif /* __ACPIOSXF_H__ */ 402#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 85bfdbe17805..4278aba96503 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20130725 49#define ACPI_CA_VERSION 0x20131115
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -54,6 +54,7 @@
54#include <acpi/acbuffer.h> 54#include <acpi/acbuffer.h>
55 55
56extern u8 acpi_gbl_permanent_mmap; 56extern u8 acpi_gbl_permanent_mmap;
57extern u32 acpi_rsdt_forced;
57 58
58/* 59/*
59 * Globals that are publically available 60 * Globals that are publically available
@@ -106,39 +107,41 @@ extern u8 acpi_gbl_disable_ssdt_table_load;
106 static ACPI_INLINE prototype {return(AE_OK);} 107 static ACPI_INLINE prototype {return(AE_OK);}
107 108
108#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ 109#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
109 static ACPI_INLINE prototype {} 110 static ACPI_INLINE prototype {return;}
110 111
111#endif /* !ACPI_REDUCED_HARDWARE */ 112#endif /* !ACPI_REDUCED_HARDWARE */
112 113
113extern u32 acpi_rsdt_forced;
114/* 114/*
115 * Initialization 115 * Initialization
116 */ 116 */
117acpi_status 117acpi_status __init
118acpi_initialize_tables(struct acpi_table_desc *initial_storage, 118acpi_initialize_tables(struct acpi_table_desc *initial_storage,
119 u32 initial_table_count, u8 allow_resize); 119 u32 initial_table_count, u8 allow_resize);
120 120
121acpi_status __init acpi_initialize_subsystem(void); 121acpi_status __init acpi_initialize_subsystem(void);
122 122
123acpi_status acpi_enable_subsystem(u32 flags); 123acpi_status __init acpi_enable_subsystem(u32 flags);
124 124
125acpi_status acpi_initialize_objects(u32 flags); 125acpi_status __init acpi_initialize_objects(u32 flags);
126 126
127acpi_status acpi_terminate(void); 127acpi_status __init acpi_terminate(void);
128 128
129/* 129/*
130 * Miscellaneous global interfaces 130 * Miscellaneous global interfaces
131 */ 131 */
132ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) 132ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
133
133ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) 134ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
134#ifdef ACPI_FUTURE_USAGE 135#ifdef ACPI_FUTURE_USAGE
135acpi_status acpi_subsystem_status(void); 136 acpi_status acpi_subsystem_status(void);
136#endif 137#endif
137 138
138#ifdef ACPI_FUTURE_USAGE 139#ifdef ACPI_FUTURE_USAGE
139acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); 140acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
140#endif 141#endif
141 142
143acpi_status acpi_get_statistics(struct acpi_statistics *stats);
144
142const char *acpi_format_exception(acpi_status exception); 145const char *acpi_format_exception(acpi_status exception);
143 146
144acpi_status acpi_purge_cached_objects(void); 147acpi_status acpi_purge_cached_objects(void);
@@ -159,29 +162,20 @@ acpi_decode_pld_buffer(u8 *in_buffer,
159 acpi_size length, struct acpi_pld_info **return_buffer); 162 acpi_size length, struct acpi_pld_info **return_buffer);
160 163
161/* 164/*
162 * ACPI Memory management
163 */
164void *acpi_allocate(u32 size);
165
166void *acpi_callocate(u32 size);
167
168void acpi_free(void *address);
169
170/*
171 * ACPI table load/unload interfaces 165 * ACPI table load/unload interfaces
172 */ 166 */
173acpi_status acpi_load_table(struct acpi_table_header *table); 167acpi_status acpi_load_table(struct acpi_table_header *table);
174 168
175acpi_status acpi_unload_parent_table(acpi_handle object); 169acpi_status acpi_unload_parent_table(acpi_handle object);
176 170
177acpi_status acpi_load_tables(void); 171acpi_status __init acpi_load_tables(void);
178 172
179/* 173/*
180 * ACPI table manipulation interfaces 174 * ACPI table manipulation interfaces
181 */ 175 */
182acpi_status acpi_reallocate_root_table(void); 176acpi_status __init acpi_reallocate_root_table(void);
183 177
184acpi_status acpi_find_root_pointer(acpi_size *rsdp_address); 178acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address);
185 179
186acpi_status acpi_unload_table_id(acpi_owner_id id); 180acpi_status acpi_unload_table_id(acpi_owner_id id);
187 181
@@ -193,6 +187,7 @@ acpi_status
193acpi_get_table_with_size(acpi_string signature, 187acpi_get_table_with_size(acpi_string signature,
194 u32 instance, struct acpi_table_header **out_table, 188 u32 instance, struct acpi_table_header **out_table,
195 acpi_size *tbl_size); 189 acpi_size *tbl_size);
190
196acpi_status 191acpi_status
197acpi_get_table(acpi_string signature, 192acpi_get_table(acpi_string signature,
198 u32 instance, struct acpi_table_header **out_table); 193 u32 instance, struct acpi_table_header **out_table);
@@ -280,8 +275,18 @@ acpi_status
280acpi_install_initialization_handler(acpi_init_handler handler, u32 function); 275acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
281 276
282ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 277ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
283 acpi_install_global_event_handler 278 acpi_install_sci_handler(acpi_sci_handler
284 (acpi_gbl_event_handler handler, void *context)) 279 address,
280 void *context))
281
282ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
283 acpi_remove_sci_handler(acpi_sci_handler
284 address))
285
286ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
287 acpi_install_global_event_handler
288 (acpi_gbl_event_handler handler,
289 void *context))
285 290
286ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 291ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
287 acpi_install_fixed_event_handler(u32 292 acpi_install_fixed_event_handler(u32
@@ -290,10 +295,12 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
290 handler, 295 handler,
291 void 296 void
292 *context)) 297 *context))
298
293ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 299ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
294 acpi_remove_fixed_event_handler(u32 acpi_event, 300 acpi_remove_fixed_event_handler(u32 acpi_event,
295 acpi_event_handler 301 acpi_event_handler
296 handler)) 302 handler))
303
297ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 304ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
298 acpi_install_gpe_handler(acpi_handle 305 acpi_install_gpe_handler(acpi_handle
299 gpe_device, 306 gpe_device,
@@ -302,6 +309,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
302 acpi_gpe_handler 309 acpi_gpe_handler
303 address, 310 address,
304 void *context)) 311 void *context))
312
305ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 313ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
306 acpi_remove_gpe_handler(acpi_handle gpe_device, 314 acpi_remove_gpe_handler(acpi_handle gpe_device,
307 u32 gpe_number, 315 u32 gpe_number,
@@ -338,6 +346,7 @@ acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
338ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 346ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
339 acpi_acquire_global_lock(u16 timeout, 347 acpi_acquire_global_lock(u16 timeout,
340 u32 *handle)) 348 u32 *handle))
349
341ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 350ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
342 acpi_release_global_lock(u32 handle)) 351 acpi_release_global_lock(u32 handle))
343 352
@@ -364,6 +373,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
364 acpi_get_event_status(u32 event, 373 acpi_get_event_status(u32 event,
365 acpi_event_status 374 acpi_event_status
366 *event_status)) 375 *event_status))
376
367/* 377/*
368 * General Purpose Event (GPE) Interfaces 378 * General Purpose Event (GPE) Interfaces
369 */ 379 */
@@ -394,10 +404,12 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
394 parent_device, 404 parent_device,
395 acpi_handle gpe_device, 405 acpi_handle gpe_device,
396 u32 gpe_number)) 406 u32 gpe_number))
407
397ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 408ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
398 acpi_set_gpe_wake_mask(acpi_handle gpe_device, 409 acpi_set_gpe_wake_mask(acpi_handle gpe_device,
399 u32 gpe_number, 410 u32 gpe_number,
400 u8 action)) 411 u8 action))
412
401ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 413ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
402 acpi_get_gpe_status(acpi_handle gpe_device, 414 acpi_get_gpe_status(acpi_handle gpe_device,
403 u32 gpe_number, 415 u32 gpe_number,
@@ -419,6 +431,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
419 *gpe_block_address, 431 *gpe_block_address,
420 u32 register_count, 432 u32 register_count,
421 u32 interrupt_number)) 433 u32 interrupt_number))
434
422ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 435ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
423 acpi_remove_gpe_block(acpi_handle gpe_device)) 436 acpi_remove_gpe_block(acpi_handle gpe_device))
424 437
@@ -493,13 +506,13 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
493 * Sleep/Wake interfaces 506 * Sleep/Wake interfaces
494 */ 507 */
495acpi_status 508acpi_status
496acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 509acpi_get_sleep_type_data(u8 sleep_state, u8 *slp_typ_a, u8 *slp_typ_b);
497 510
498acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); 511acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
499 512
500acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); 513acpi_status acpi_enter_sleep_state(u8 sleep_state);
501 514
502ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)) 515ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void))
503 516
504acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); 517acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
505 518
@@ -508,7 +521,6 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state);
508ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 521ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
509 acpi_set_firmware_waking_vector(u32 522 acpi_set_firmware_waking_vector(u32
510 physical_address)) 523 physical_address))
511
512#if ACPI_MACHINE_WIDTH == 64 524#if ACPI_MACHINE_WIDTH == 64
513ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 525ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
514 acpi_set_firmware_waking_vector64(u64 526 acpi_set_firmware_waking_vector64(u64
@@ -532,50 +544,53 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
532/* 544/*
533 * Error/Warning output 545 * Error/Warning output
534 */ 546 */
547ACPI_PRINTF_LIKE(3)
535void ACPI_INTERNAL_VAR_XFACE 548void ACPI_INTERNAL_VAR_XFACE
536acpi_error(const char *module_name, 549acpi_error(const char *module_name, u32 line_number, const char *format, ...);
537 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
538 550
551ACPI_PRINTF_LIKE(4)
539void ACPI_INTERNAL_VAR_XFACE 552void ACPI_INTERNAL_VAR_XFACE
540acpi_exception(const char *module_name, 553acpi_exception(const char *module_name,
541 u32 line_number, 554 u32 line_number, acpi_status status, const char *format, ...);
542 acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4);
543 555
556ACPI_PRINTF_LIKE(3)
544void ACPI_INTERNAL_VAR_XFACE 557void ACPI_INTERNAL_VAR_XFACE
545acpi_warning(const char *module_name, 558acpi_warning(const char *module_name, u32 line_number, const char *format, ...);
546 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
547 559
560ACPI_PRINTF_LIKE(3)
548void ACPI_INTERNAL_VAR_XFACE 561void ACPI_INTERNAL_VAR_XFACE
549acpi_info(const char *module_name, 562acpi_info(const char *module_name, u32 line_number, const char *format, ...);
550 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
551 563
564ACPI_PRINTF_LIKE(3)
552void ACPI_INTERNAL_VAR_XFACE 565void ACPI_INTERNAL_VAR_XFACE
553acpi_bios_error(const char *module_name, 566acpi_bios_error(const char *module_name,
554 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 567 u32 line_number, const char *format, ...);
555 568
569ACPI_PRINTF_LIKE(3)
556void ACPI_INTERNAL_VAR_XFACE 570void ACPI_INTERNAL_VAR_XFACE
557acpi_bios_warning(const char *module_name, 571acpi_bios_warning(const char *module_name,
558 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 572 u32 line_number, const char *format, ...);
559 573
560/* 574/*
561 * Debug output 575 * Debug output
562 */ 576 */
563#ifdef ACPI_DEBUG_OUTPUT 577#ifdef ACPI_DEBUG_OUTPUT
564 578
579ACPI_PRINTF_LIKE(6)
565void ACPI_INTERNAL_VAR_XFACE 580void ACPI_INTERNAL_VAR_XFACE
566acpi_debug_print(u32 requested_debug_level, 581acpi_debug_print(u32 requested_debug_level,
567 u32 line_number, 582 u32 line_number,
568 const char *function_name, 583 const char *function_name,
569 const char *module_name, 584 const char *module_name,
570 u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6); 585 u32 component_id, const char *format, ...);
571 586
587ACPI_PRINTF_LIKE(6)
572void ACPI_INTERNAL_VAR_XFACE 588void ACPI_INTERNAL_VAR_XFACE
573acpi_debug_print_raw(u32 requested_debug_level, 589acpi_debug_print_raw(u32 requested_debug_level,
574 u32 line_number, 590 u32 line_number,
575 const char *function_name, 591 const char *function_name,
576 const char *module_name, 592 const char *module_name,
577 u32 component_id, 593 u32 component_id, const char *format, ...);
578 const char *format, ...) ACPI_PRINTF_LIKE(6);
579#endif 594#endif
580 595
581#endif /* __ACXFACE_H__ */ 596#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 9b58a8f43771..94970880126f 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -146,7 +146,24 @@ struct acpi_table_rsdp {
146 u8 reserved[3]; /* Reserved, must be zero */ 146 u8 reserved[3]; /* Reserved, must be zero */
147}; 147};
148 148
149#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ 149/* Standalone struct for the ACPI 1.0 RSDP */
150
151struct acpi_rsdp_common {
152 char signature[8];
153 u8 checksum;
154 char oem_id[ACPI_OEM_ID_SIZE];
155 u8 revision;
156 u32 rsdt_physical_address;
157};
158
159/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */
160
161struct acpi_rsdp_extension {
162 u32 length;
163 u64 xsdt_physical_address;
164 u8 extended_checksum;
165 u8 reserved[3];
166};
150 167
151/******************************************************************************* 168/*******************************************************************************
152 * 169 *
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 0bd750ebeb49..556c83ee6b42 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -596,7 +596,7 @@ struct acpi_hest_generic {
596 596
597/* Generic Error Status block */ 597/* Generic Error Status block */
598 598
599struct acpi_hest_generic_status { 599struct acpi_generic_status {
600 u32 block_status; 600 u32 block_status;
601 u32 raw_data_offset; 601 u32 raw_data_offset;
602 u32 raw_data_length; 602 u32 raw_data_length;
@@ -606,15 +606,15 @@ struct acpi_hest_generic_status {
606 606
607/* Values for block_status flags above */ 607/* Values for block_status flags above */
608 608
609#define ACPI_HEST_UNCORRECTABLE (1) 609#define ACPI_GEN_ERR_UC BIT(0)
610#define ACPI_HEST_CORRECTABLE (1<<1) 610#define ACPI_GEN_ERR_CE BIT(1)
611#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) 611#define ACPI_GEN_ERR_MULTI_UC BIT(2)
612#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) 612#define ACPI_GEN_ERR_MULTI_CE BIT(3)
613#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ 613#define ACPI_GEN_ERR_COUNT_SHIFT (0xFF<<4) /* 8 bits, error count */
614 614
615/* Generic Error Data entry */ 615/* Generic Error Data entry */
616 616
617struct acpi_hest_generic_data { 617struct acpi_generic_data {
618 u8 section_type[16]; 618 u8 section_type[16];
619 u32 error_severity; 619 u32 error_severity;
620 u16 revision; 620 u16 revision;
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index ffaac0e7e0c6..40f7ed115452 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -444,8 +444,8 @@ enum acpi_dmar_scope_type {
444}; 444};
445 445
446struct acpi_dmar_pci_path { 446struct acpi_dmar_pci_path {
447 u8 dev; 447 u8 device;
448 u8 fn; 448 u8 function;
449}; 449};
450 450
451/* 451/*
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index b748aefce929..809b1a0fee7f 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -299,13 +299,57 @@ typedef u32 acpi_physical_address;
299#endif 299#endif
300 300
301/* 301/*
302 * All ACPICA functions that are available to the rest of the kernel are 302 * All ACPICA external functions that are available to the rest of the kernel
303 * tagged with this macro which can be defined as appropriate for the host. 303 * are tagged with thes macros which can be defined as appropriate for the host.
304 *
305 * Notes:
306 * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
307 * interfaces that may need special processing.
308 * ACPI_EXPORT_SYMBOL is used for all other public external functions.
304 */ 309 */
310#ifndef ACPI_EXPORT_SYMBOL_INIT
311#define ACPI_EXPORT_SYMBOL_INIT(symbol)
312#endif
313
305#ifndef ACPI_EXPORT_SYMBOL 314#ifndef ACPI_EXPORT_SYMBOL
306#define ACPI_EXPORT_SYMBOL(symbol) 315#define ACPI_EXPORT_SYMBOL(symbol)
307#endif 316#endif
308 317
318/*
319 * Compiler/Clibrary-dependent debug initialization. Used for ACPICA
320 * utilities only.
321 */
322#ifndef ACPI_DEBUG_INITIALIZE
323#define ACPI_DEBUG_INITIALIZE()
324#endif
325
326/*******************************************************************************
327 *
328 * Configuration
329 *
330 ******************************************************************************/
331
332#ifdef ACPI_DBG_TRACK_ALLOCATIONS
333/*
334 * Memory allocation tracking (used by acpi_exec to detect memory leaks)
335 */
336#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__
337#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track ((acpi_size) (a), ACPI_MEM_PARAMETERS)
338#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track ((acpi_size) (a), ACPI_MEM_PARAMETERS)
339#define ACPI_FREE(a) acpi_ut_free_and_track (a, ACPI_MEM_PARAMETERS)
340#define ACPI_MEM_TRACKING(a) a
341
342#else
343/*
344 * Normal memory allocation directly via the OS services layer
345 */
346#define ACPI_ALLOCATE(a) acpi_os_allocate ((acpi_size) (a))
347#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed ((acpi_size) (a))
348#define ACPI_FREE(a) acpi_os_free (a)
349#define ACPI_MEM_TRACKING(a)
350
351#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
352
309/****************************************************************************** 353/******************************************************************************
310 * 354 *
311 * ACPI Specification constants (Do not change unless the specification changes) 355 * ACPI Specification constants (Do not change unless the specification changes)
@@ -322,6 +366,7 @@ typedef u32 acpi_physical_address;
322#define ACPI_PM1_REGISTER_WIDTH 16 366#define ACPI_PM1_REGISTER_WIDTH 16
323#define ACPI_PM2_REGISTER_WIDTH 8 367#define ACPI_PM2_REGISTER_WIDTH 8
324#define ACPI_PM_TIMER_WIDTH 32 368#define ACPI_PM_TIMER_WIDTH 32
369#define ACPI_RESET_REGISTER_WIDTH 8
325 370
326/* Names within the namespace are 4 bytes long */ 371/* Names within the namespace are 4 bytes long */
327 372
@@ -474,6 +519,11 @@ typedef u64 acpi_integer;
474#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) 519#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
475#endif 520#endif
476 521
522/* Support for the special RSDP signature (8 characters) */
523
524#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
525#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
526
477/******************************************************************************* 527/*******************************************************************************
478 * 528 *
479 * Miscellaneous constants 529 * Miscellaneous constants
@@ -886,9 +936,13 @@ struct acpi_buffer {
886 void *pointer; /* pointer to buffer */ 936 void *pointer; /* pointer to buffer */
887}; 937};
888 938
889/* Free a buffer created in an struct acpi_buffer via ACPI_ALLOCATE_LOCAL_BUFFER */ 939/*
890 940 * Free a buffer created in an struct acpi_buffer via ACPI_ALLOCATE_BUFFER.
891#define ACPI_FREE_BUFFER(b) ACPI_FREE(b.pointer) 941 * Note: We use acpi_os_free here because acpi_os_allocate was used to allocate
942 * the buffer. This purposefully bypasses the internal allocation tracking
943 * mechanism (if it is enabled).
944 */
945#define ACPI_FREE_BUFFER(b) acpi_os_free((b).pointer)
892 946
893/* 947/*
894 * name_type for acpi_get_name 948 * name_type for acpi_get_name
@@ -927,6 +981,16 @@ struct acpi_system_info {
927 u32 debug_layer; 981 u32 debug_layer;
928}; 982};
929 983
984/*
985 * System statistics returned by acpi_get_statistics()
986 */
987struct acpi_statistics {
988 u32 sci_count;
989 u32 gpe_count;
990 u32 fixed_event_count[ACPI_NUM_FIXED_EVENTS];
991 u32 method_count;
992};
993
930/* Table Event Types */ 994/* Table Event Types */
931 995
932#define ACPI_TABLE_EVENT_LOAD 0x0 996#define ACPI_TABLE_EVENT_LOAD 0x0
@@ -946,6 +1010,9 @@ typedef void
946 * Various handlers and callback procedures 1010 * Various handlers and callback procedures
947 */ 1011 */
948typedef 1012typedef
1013u32 (*acpi_sci_handler) (void *context);
1014
1015typedef
949void (*acpi_gbl_event_handler) (u32 event_type, 1016void (*acpi_gbl_event_handler) (u32 event_type,
950 acpi_handle device, 1017 acpi_handle device,
951 u32 event_number, void *context); 1018 u32 event_number, void *context);
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
index 720446cb243e..dfd60d0bfd27 100644
--- a/include/acpi/ghes.h
+++ b/include/acpi/ghes.h
@@ -14,7 +14,7 @@
14 14
15struct ghes { 15struct ghes {
16 struct acpi_hest_generic *generic; 16 struct acpi_hest_generic *generic;
17 struct acpi_hest_generic_status *estatus; 17 struct acpi_generic_status *estatus;
18 u64 buffer_paddr; 18 u64 buffer_paddr;
19 unsigned long flags; 19 unsigned long flags;
20 union { 20 union {
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index ef04b36ca6ed..974d3ef7c141 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -96,10 +96,11 @@
96#endif 96#endif
97 97
98/* 98/*
99 * acpi_bin/acpi_help/acpi_src configuration. All single threaded, with 99 * acpi_bin/acpi_dump/acpi_src/acpi_xtract configuration. All single
100 * no debug output. 100 * threaded, with no debug output.
101 */ 101 */
102#if (defined ACPI_BIN_APP) || \ 102#if (defined ACPI_BIN_APP) || \
103 (defined ACPI_DUMP_APP) || \
103 (defined ACPI_SRC_APP) || \ 104 (defined ACPI_SRC_APP) || \
104 (defined ACPI_XTRACT_APP) 105 (defined ACPI_XTRACT_APP)
105#define ACPI_APPLICATION 106#define ACPI_APPLICATION
@@ -147,6 +148,9 @@
147#if defined(_LINUX) || defined(__linux__) 148#if defined(_LINUX) || defined(__linux__)
148#include <acpi/platform/aclinux.h> 149#include <acpi/platform/aclinux.h>
149 150
151#elif defined(_APPLE) || defined(__APPLE__)
152#include "acmacosx.h"
153
150#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) 154#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
151#include "acfreebsd.h" 155#include "acfreebsd.h"
152 156
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 68534ef86ec8..28f4f4dba0b6 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -50,7 +50,6 @@
50#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
52 52
53
54#ifdef __KERNEL__ 53#ifdef __KERNEL__
55 54
56#include <linux/string.h> 55#include <linux/string.h>
@@ -58,11 +57,13 @@
58#include <linux/ctype.h> 57#include <linux/ctype.h>
59#include <linux/sched.h> 58#include <linux/sched.h>
60#include <linux/atomic.h> 59#include <linux/atomic.h>
61#include <asm/div64.h> 60#include <linux/math64.h>
62#include <asm/acpi.h>
63#include <linux/slab.h> 61#include <linux/slab.h>
64#include <linux/spinlock_types.h> 62#include <linux/spinlock_types.h>
65#include <asm/current.h> 63#ifdef EXPORT_ACPI_INTERFACES
64#include <linux/export.h>
65#endif
66#include <asm/acpi.h>
66 67
67/* Host-dependent types and defines for in-kernel ACPICA */ 68/* Host-dependent types and defines for in-kernel ACPICA */
68 69
@@ -74,7 +75,7 @@
74#define acpi_spinlock spinlock_t * 75#define acpi_spinlock spinlock_t *
75#define acpi_cpu_flags unsigned long 76#define acpi_cpu_flags unsigned long
76 77
77#else /* !__KERNEL__ */ 78#else /* !__KERNEL__ */
78 79
79#include <stdarg.h> 80#include <stdarg.h>
80#include <string.h> 81#include <string.h>
@@ -87,7 +88,7 @@
87#define ACPI_FLUSH_CPU_CACHE() 88#define ACPI_FLUSH_CPU_CACHE()
88#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) 89#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread))
89 90
90#if defined(__ia64__) || defined(__x86_64__) 91#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
91#define ACPI_MACHINE_WIDTH 64 92#define ACPI_MACHINE_WIDTH 64
92#define COMPILER_DEPENDENT_INT64 long 93#define COMPILER_DEPENDENT_INT64 long
93#define COMPILER_DEPENDENT_UINT64 unsigned long 94#define COMPILER_DEPENDENT_UINT64 unsigned long
@@ -102,21 +103,35 @@
102#define __cdecl 103#define __cdecl
103#endif 104#endif
104 105
105#endif /* __KERNEL__ */ 106#endif /* __KERNEL__ */
106 107
107/* Linux uses GCC */ 108/* Linux uses GCC */
108 109
109#include <acpi/platform/acgcc.h> 110#include <acpi/platform/acgcc.h>
110 111
111#ifdef __KERNEL__ 112#ifdef __KERNEL__
113
114/*
115 * FIXME: Inclusion of actypes.h
116 * Linux kernel need this before defining inline OSL interfaces as
117 * actypes.h need to be included to find ACPICA type definitions.
118 * Since from ACPICA's perspective, the actypes.h should be included after
119 * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
120 */
112#include <acpi/actypes.h> 121#include <acpi/actypes.h>
122
113/* 123/*
114 * Overrides for in-kernel ACPICA 124 * Overrides for in-kernel ACPICA
115 */ 125 */
116static inline acpi_thread_id acpi_os_get_thread_id(void) 126acpi_status __init acpi_os_initialize(void);
117{ 127#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
118 return (acpi_thread_id)(unsigned long)current; 128
119} 129acpi_status acpi_os_terminate(void);
130#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
131
132/*
133 * Memory allocation/deallocation
134 */
120 135
121/* 136/*
122 * The irqs_disabled() check is for resume from RAM. 137 * The irqs_disabled() check is for resume from RAM.
@@ -126,25 +141,45 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
126 */ 141 */
127static inline void *acpi_os_allocate(acpi_size size) 142static inline void *acpi_os_allocate(acpi_size size)
128{ 143{
129 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 144 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
130} 145}
131 146
147#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
148
149/* Use native linux version of acpi_os_allocate_zeroed */
150
132static inline void *acpi_os_allocate_zeroed(acpi_size size) 151static inline void *acpi_os_allocate_zeroed(acpi_size size)
133{ 152{
134 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 153 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
154}
155
156#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
157#define USE_NATIVE_ALLOCATE_ZEROED
158
159static inline void acpi_os_free(void *memory)
160{
161 kfree(memory);
135} 162}
136 163
164#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
165
137static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 166static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
138{ 167{
139 return kmem_cache_zalloc(cache, 168 return kmem_cache_zalloc(cache,
140 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 169 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
170}
171
172#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
173
174static inline acpi_thread_id acpi_os_get_thread_id(void)
175{
176 return (acpi_thread_id) (unsigned long)current;
141} 177}
142 178
143#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 179#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
144#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
145#define ACPI_FREE(a) kfree(a)
146 180
147#ifndef CONFIG_PREEMPT 181#ifndef CONFIG_PREEMPT
182
148/* 183/*
149 * Used within ACPICA to show where it is safe to preempt execution 184 * Used within ACPICA to show where it is safe to preempt execution
150 * when CONFIG_PREEMPT=n 185 * when CONFIG_PREEMPT=n
@@ -154,6 +189,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
154 if (!irqs_disabled()) \ 189 if (!irqs_disabled()) \
155 cond_resched(); \ 190 cond_resched(); \
156 } while (0) 191 } while (0)
192
157#endif 193#endif
158 194
159/* 195/*
@@ -163,17 +199,50 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
163 * all locks to the name of the argument of acpi_os_create_lock(), which 199 * all locks to the name of the argument of acpi_os_create_lock(), which
164 * prevents lockdep from reporting false positives for ACPICA locks. 200 * prevents lockdep from reporting false positives for ACPICA locks.
165 */ 201 */
166#define acpi_os_create_lock(__handle) \ 202#define acpi_os_create_lock(__handle) \
167({ \ 203 ({ \
168 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ 204 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
169 \ 205 if (lock) { \
170 if (lock) { \ 206 *(__handle) = lock; \
171 *(__handle) = lock; \ 207 spin_lock_init(*(__handle)); \
172 spin_lock_init(*(__handle)); \ 208 } \
173 } \ 209 lock ? AE_OK : AE_NO_MEMORY; \
174 lock ? AE_OK : AE_NO_MEMORY; \ 210 })
175}) 211#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
176 212
177#endif /* __KERNEL__ */ 213void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
178 214#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
179#endif /* __ACLINUX_H__ */ 215
216void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
217#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
218
219/*
220 * OSL interfaces used by debugger/disassembler
221 */
222#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
223#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
224
225/*
226 * OSL interfaces used by utilities
227 */
228#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
229#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
230#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
231#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
232#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
233#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
234#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
235#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
236
237/*
238 * OSL interfaces added by Linux
239 */
240void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
241
242void acpi_os_gpe_count(u32 gpe_number);
243
244void acpi_os_fixed_event_count(u32 fixed_event_number);
245
246#endif /* __KERNEL__ */
247
248#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 66096d06925e..6eb1d3cb5104 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -199,6 +199,7 @@ struct acpi_processor_flags {
199struct acpi_processor { 199struct acpi_processor {
200 acpi_handle handle; 200 acpi_handle handle;
201 u32 acpi_id; 201 u32 acpi_id;
202 u32 apic_id;
202 u32 id; 203 u32 id;
203 u32 pblk; 204 u32 pblk;
204 int performance_platform_limit; 205 int performance_platform_limit;
@@ -224,7 +225,6 @@ struct acpi_processor_errata {
224 } piix4; 225 } piix4;
225}; 226};
226 227
227extern void acpi_processor_load_module(struct acpi_processor *pr);
228extern int acpi_processor_preregister_performance(struct 228extern int acpi_processor_preregister_performance(struct
229 acpi_processor_performance 229 acpi_processor_performance
230 __percpu *performance); 230 __percpu *performance);
@@ -314,6 +314,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
314 314
315/* in processor_core.c */ 315/* in processor_core.c */
316void acpi_processor_set_pdc(acpi_handle handle); 316void acpi_processor_set_pdc(acpi_handle handle);
317int acpi_get_apicid(acpi_handle, int type, u32 acpi_id);
318int acpi_map_cpuid(int apic_id, u32 acpi_id);
317int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); 319int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
318 320
319/* in processor_throttling.c */ 321/* in processor_throttling.c */
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h
index 71c778033f57..998d4d544f18 100644
--- a/include/asm-generic/bitops/find.h
+++ b/include/asm-generic/bitops/find.h
@@ -7,6 +7,9 @@
7 * @addr: The address to base the search on 7 * @addr: The address to base the search on
8 * @offset: The bitnumber to start searching at 8 * @offset: The bitnumber to start searching at
9 * @size: The bitmap size in bits 9 * @size: The bitmap size in bits
10 *
11 * Returns the bit number for the next set bit
12 * If no bits are set, returns @size.
10 */ 13 */
11extern unsigned long find_next_bit(const unsigned long *addr, unsigned long 14extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
12 size, unsigned long offset); 15 size, unsigned long offset);
@@ -18,6 +21,9 @@ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
18 * @addr: The address to base the search on 21 * @addr: The address to base the search on
19 * @offset: The bitnumber to start searching at 22 * @offset: The bitnumber to start searching at
20 * @size: The bitmap size in bits 23 * @size: The bitmap size in bits
24 *
25 * Returns the bit number of the next zero bit
26 * If no bits are zero, returns @size.
21 */ 27 */
22extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned 28extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
23 long size, unsigned long offset); 29 long size, unsigned long offset);
@@ -28,9 +34,10 @@ extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
28/** 34/**
29 * find_first_bit - find the first set bit in a memory region 35 * find_first_bit - find the first set bit in a memory region
30 * @addr: The address to start the search at 36 * @addr: The address to start the search at
31 * @size: The maximum size to search 37 * @size: The maximum number of bits to search
32 * 38 *
33 * Returns the bit number of the first set bit. 39 * Returns the bit number of the first set bit.
40 * If no bits are set, returns @size.
34 */ 41 */
35extern unsigned long find_first_bit(const unsigned long *addr, 42extern unsigned long find_first_bit(const unsigned long *addr,
36 unsigned long size); 43 unsigned long size);
@@ -38,9 +45,10 @@ extern unsigned long find_first_bit(const unsigned long *addr,
38/** 45/**
39 * find_first_zero_bit - find the first cleared bit in a memory region 46 * find_first_zero_bit - find the first cleared bit in a memory region
40 * @addr: The address to start the search at 47 * @addr: The address to start the search at
41 * @size: The maximum size to search 48 * @size: The maximum number of bits to search
42 * 49 *
43 * Returns the bit number of the first cleared bit. 50 * Returns the bit number of the first cleared bit.
51 * If no bits are zero, returns @size.
44 */ 52 */
45extern unsigned long find_first_zero_bit(const unsigned long *addr, 53extern unsigned long find_first_zero_bit(const unsigned long *addr,
46 unsigned long size); 54 unsigned long size);
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h
deleted file mode 100644
index 294b1e755ab2..000000000000
--- a/include/asm-generic/dma-contiguous.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef ASM_DMA_CONTIGUOUS_H
2#define ASM_DMA_CONTIGUOUS_H
3
4#ifdef __KERNEL__
5#ifdef CONFIG_CMA
6
7#include <linux/device.h>
8#include <linux/dma-contiguous.h>
9
10static inline struct cma *dev_get_cma_area(struct device *dev)
11{
12 if (dev && dev->cma_area)
13 return dev->cma_area;
14 return dma_contiguous_default_area;
15}
16
17static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
18{
19 if (dev)
20 dev->cma_area = cma;
21 if (!dev && !dma_contiguous_default_area)
22 dma_contiguous_default_area = cma;
23}
24
25#endif
26#endif
27
28#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index bde646995d10..a5f56a0213a7 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -10,6 +10,8 @@
10#ifdef CONFIG_GPIOLIB 10#ifdef CONFIG_GPIOLIB
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/gpio/driver.h>
14#include <linux/gpio/consumer.h>
13 15
14/* Platforms may implement their GPIO interface with library code, 16/* Platforms may implement their GPIO interface with library code,
15 * at a small performance cost for non-inlined operations and some 17 * at a small performance cost for non-inlined operations and some
@@ -49,122 +51,11 @@ struct module;
49struct device_node; 51struct device_node;
50struct gpio_desc; 52struct gpio_desc;
51 53
52/** 54/* caller holds gpio_lock *OR* gpio is marked as requested */
53 * struct gpio_chip - abstract a GPIO controller 55static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
54 * @label: for diagnostics 56{
55 * @dev: optional device providing the GPIOs 57 return gpiod_to_chip(gpio_to_desc(gpio));
56 * @owner: helps prevent removal of modules exporting active GPIOs 58}
57 * @list: links gpio_chips together for traversal
58 * @request: optional hook for chip-specific activation, such as
59 * enabling module power and clock; may sleep
60 * @free: optional hook for chip-specific deactivation, such as
61 * disabling module power and clock; may sleep
62 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
63 * (same as GPIOF_DIR_XXX), or negative error
64 * @direction_input: configures signal "offset" as input, or returns error
65 * @get: returns value for signal "offset"; for output signals this
66 * returns either the value actually sensed, or zero
67 * @direction_output: configures signal "offset" as output, or returns error
68 * @set_debounce: optional hook for setting debounce time for specified gpio in
69 * interrupt triggered gpio chips
70 * @set: assigns output value for signal "offset"
71 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
72 * implementation may not sleep
73 * @dbg_show: optional routine to show contents in debugfs; default code
74 * will be used when this is omitted, but custom code can show extra
75 * state (such as pullup/pulldown configuration).
76 * @base: identifies the first GPIO number handled by this chip; or, if
77 * negative during registration, requests dynamic ID allocation.
78 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
79 * handled is (base + ngpio - 1).
80 * @desc: array of ngpio descriptors. Private.
81 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
82 * must while accessing GPIO expander chips over I2C or SPI
83 * @names: if set, must be an array of strings to use as alternative
84 * names for the GPIOs in this chip. Any entry in the array
85 * may be NULL if there is no alias for the GPIO, however the
86 * array must be @ngpio entries long. A name can include a single printk
87 * format specifier for an unsigned int. It is substituted by the actual
88 * number of the gpio.
89 *
90 * A gpio_chip can help platforms abstract various sources of GPIOs so
91 * they can all be accessed through a common programing interface.
92 * Example sources would be SOC controllers, FPGAs, multifunction
93 * chips, dedicated GPIO expanders, and so on.
94 *
95 * Each chip controls a number of signals, identified in method calls
96 * by "offset" values in the range 0..(@ngpio - 1). When those signals
97 * are referenced through calls like gpio_get_value(gpio), the offset
98 * is calculated by subtracting @base from the gpio number.
99 */
100struct gpio_chip {
101 const char *label;
102 struct device *dev;
103 struct module *owner;
104 struct list_head list;
105
106 int (*request)(struct gpio_chip *chip,
107 unsigned offset);
108 void (*free)(struct gpio_chip *chip,
109 unsigned offset);
110 int (*get_direction)(struct gpio_chip *chip,
111 unsigned offset);
112 int (*direction_input)(struct gpio_chip *chip,
113 unsigned offset);
114 int (*get)(struct gpio_chip *chip,
115 unsigned offset);
116 int (*direction_output)(struct gpio_chip *chip,
117 unsigned offset, int value);
118 int (*set_debounce)(struct gpio_chip *chip,
119 unsigned offset, unsigned debounce);
120
121 void (*set)(struct gpio_chip *chip,
122 unsigned offset, int value);
123
124 int (*to_irq)(struct gpio_chip *chip,
125 unsigned offset);
126
127 void (*dbg_show)(struct seq_file *s,
128 struct gpio_chip *chip);
129 int base;
130 u16 ngpio;
131 struct gpio_desc *desc;
132 const char *const *names;
133 unsigned can_sleep:1;
134 unsigned exported:1;
135
136#if defined(CONFIG_OF_GPIO)
137 /*
138 * If CONFIG_OF is enabled, then all GPIO controllers described in the
139 * device tree automatically may have an OF translation
140 */
141 struct device_node *of_node;
142 int of_gpio_n_cells;
143 int (*of_xlate)(struct gpio_chip *gc,
144 const struct of_phandle_args *gpiospec, u32 *flags);
145#endif
146#ifdef CONFIG_PINCTRL
147 /*
148 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
149 * describe the actual pin range which they serve in an SoC. This
150 * information would be used by pinctrl subsystem to configure
151 * corresponding pins for gpio usage.
152 */
153 struct list_head pin_ranges;
154#endif
155};
156
157extern const char *gpiochip_is_requested(struct gpio_chip *chip,
158 unsigned offset);
159extern struct gpio_chip *gpio_to_chip(unsigned gpio);
160
161/* add/remove chips */
162extern int gpiochip_add(struct gpio_chip *chip);
163extern int __must_check gpiochip_remove(struct gpio_chip *chip);
164extern struct gpio_chip *gpiochip_find(void *data,
165 int (*match)(struct gpio_chip *chip,
166 void *data));
167
168 59
169/* Always use the library code for GPIO management calls, 60/* Always use the library code for GPIO management calls,
170 * or when sleeping may be involved. 61 * or when sleeping may be involved.
@@ -172,43 +63,84 @@ extern struct gpio_chip *gpiochip_find(void *data,
172extern int gpio_request(unsigned gpio, const char *label); 63extern int gpio_request(unsigned gpio, const char *label);
173extern void gpio_free(unsigned gpio); 64extern void gpio_free(unsigned gpio);
174 65
175extern int gpio_direction_input(unsigned gpio); 66static inline int gpio_direction_input(unsigned gpio)
176extern int gpio_direction_output(unsigned gpio, int value); 67{
68 return gpiod_direction_input(gpio_to_desc(gpio));
69}
70static inline int gpio_direction_output(unsigned gpio, int value)
71{
72 return gpiod_direction_output(gpio_to_desc(gpio), value);
73}
177 74
178extern int gpio_set_debounce(unsigned gpio, unsigned debounce); 75static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
76{
77 return gpiod_set_debounce(gpio_to_desc(gpio), debounce);
78}
179 79
180extern int gpio_get_value_cansleep(unsigned gpio); 80static inline int gpio_get_value_cansleep(unsigned gpio)
181extern void gpio_set_value_cansleep(unsigned gpio, int value); 81{
82 return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
83}
84static inline void gpio_set_value_cansleep(unsigned gpio, int value)
85{
86 return gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value);
87}
182 88
183 89
184/* A platform's <asm/gpio.h> code may want to inline the I/O calls when 90/* A platform's <asm/gpio.h> code may want to inline the I/O calls when
185 * the GPIO is constant and refers to some always-present controller, 91 * the GPIO is constant and refers to some always-present controller,
186 * giving direct access to chip registers and tight bitbanging loops. 92 * giving direct access to chip registers and tight bitbanging loops.
187 */ 93 */
188extern int __gpio_get_value(unsigned gpio); 94static inline int __gpio_get_value(unsigned gpio)
189extern void __gpio_set_value(unsigned gpio, int value); 95{
96 return gpiod_get_raw_value(gpio_to_desc(gpio));
97}
98static inline void __gpio_set_value(unsigned gpio, int value)
99{
100 return gpiod_set_raw_value(gpio_to_desc(gpio), value);
101}
190 102
191extern int __gpio_cansleep(unsigned gpio); 103static inline int __gpio_cansleep(unsigned gpio)
104{
105 return gpiod_cansleep(gpio_to_desc(gpio));
106}
192 107
193extern int __gpio_to_irq(unsigned gpio); 108static inline int __gpio_to_irq(unsigned gpio)
109{
110 return gpiod_to_irq(gpio_to_desc(gpio));
111}
112
113extern int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
114extern void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
194 115
195extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 116extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
196extern int gpio_request_array(const struct gpio *array, size_t num); 117extern int gpio_request_array(const struct gpio *array, size_t num);
197extern void gpio_free_array(const struct gpio *array, size_t num); 118extern void gpio_free_array(const struct gpio *array, size_t num);
198 119
199#ifdef CONFIG_GPIO_SYSFS
200
201/* 120/*
202 * A sysfs interface can be exported by individual drivers if they want, 121 * A sysfs interface can be exported by individual drivers if they want,
203 * but more typically is configured entirely from userspace. 122 * but more typically is configured entirely from userspace.
204 */ 123 */
205extern int gpio_export(unsigned gpio, bool direction_may_change); 124static inline int gpio_export(unsigned gpio, bool direction_may_change)
206extern int gpio_export_link(struct device *dev, const char *name, 125{
207 unsigned gpio); 126 return gpiod_export(gpio_to_desc(gpio), direction_may_change);
208extern int gpio_sysfs_set_active_low(unsigned gpio, int value); 127}
209extern void gpio_unexport(unsigned gpio); 128
129static inline int gpio_export_link(struct device *dev, const char *name,
130 unsigned gpio)
131{
132 return gpiod_export_link(dev, name, gpio_to_desc(gpio));
133}
134
135static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
136{
137 return gpiod_sysfs_set_active_low(gpio_to_desc(gpio), value);
138}
210 139
211#endif /* CONFIG_GPIO_SYSFS */ 140static inline void gpio_unexport(unsigned gpio)
141{
142 gpiod_unexport(gpio_to_desc(gpio));
143}
212 144
213#ifdef CONFIG_PINCTRL 145#ifdef CONFIG_PINCTRL
214 146
@@ -228,6 +160,9 @@ struct gpio_pin_range {
228int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, 160int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
229 unsigned int gpio_offset, unsigned int pin_offset, 161 unsigned int gpio_offset, unsigned int pin_offset,
230 unsigned int npins); 162 unsigned int npins);
163int gpiochip_add_pingroup_range(struct gpio_chip *chip,
164 struct pinctrl_dev *pctldev,
165 unsigned int gpio_offset, const char *pin_group);
231void gpiochip_remove_pin_ranges(struct gpio_chip *chip); 166void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
232 167
233#else 168#else
@@ -239,6 +174,13 @@ gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
239{ 174{
240 return 0; 175 return 0;
241} 176}
177static inline int
178gpiochip_add_pingroup_range(struct gpio_chip *chip,
179 struct pinctrl_dev *pctldev,
180 unsigned int gpio_offset, const char *pin_group)
181{
182 return 0;
183}
242 184
243static inline void 185static inline void
244gpiochip_remove_pin_ranges(struct gpio_chip *chip) 186gpiochip_remove_pin_ranges(struct gpio_chip *chip)
@@ -278,31 +220,4 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
278 220
279#endif /* !CONFIG_GPIOLIB */ 221#endif /* !CONFIG_GPIOLIB */
280 222
281#ifndef CONFIG_GPIO_SYSFS
282
283struct device;
284
285/* sysfs support is only available with gpiolib, where it's optional */
286
287static inline int gpio_export(unsigned gpio, bool direction_may_change)
288{
289 return -ENOSYS;
290}
291
292static inline int gpio_export_link(struct device *dev, const char *name,
293 unsigned gpio)
294{
295 return -ENOSYS;
296}
297
298static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
299{
300 return -ENOSYS;
301}
302
303static inline void gpio_unexport(unsigned gpio)
304{
305}
306#endif /* CONFIG_GPIO_SYSFS */
307
308#endif /* _ASM_GENERIC_GPIO_H */ 223#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h
index d06079c774a0..99b490b4d05a 100644
--- a/include/asm-generic/hugetlb.h
+++ b/include/asm-generic/hugetlb.h
@@ -6,12 +6,12 @@ static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
6 return mk_pte(page, pgprot); 6 return mk_pte(page, pgprot);
7} 7}
8 8
9static inline int huge_pte_write(pte_t pte) 9static inline unsigned long huge_pte_write(pte_t pte)
10{ 10{
11 return pte_write(pte); 11 return pte_write(pte);
12} 12}
13 13
14static inline int huge_pte_dirty(pte_t pte) 14static inline unsigned long huge_pte_dirty(pte_t pte)
15{ 15{
16 return pte_dirty(pte); 16 return pte_dirty(pte);
17} 17}
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
new file mode 100644
index 000000000000..ddf2b420ac8f
--- /dev/null
+++ b/include/asm-generic/preempt.h
@@ -0,0 +1,105 @@
1#ifndef __ASM_PREEMPT_H
2#define __ASM_PREEMPT_H
3
4#include <linux/thread_info.h>
5
6/*
7 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
8 * that think a non-zero value indicates we cannot preempt.
9 */
10static __always_inline int preempt_count(void)
11{
12 return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
13}
14
15static __always_inline int *preempt_count_ptr(void)
16{
17 return &current_thread_info()->preempt_count;
18}
19
20/*
21 * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
22 * alternative is loosing a reschedule. Better schedule too often -- also this
23 * should be a very rare operation.
24 */
25static __always_inline void preempt_count_set(int pc)
26{
27 *preempt_count_ptr() = pc;
28}
29
30/*
31 * must be macros to avoid header recursion hell
32 */
33#define task_preempt_count(p) \
34 (task_thread_info(p)->preempt_count & ~PREEMPT_NEED_RESCHED)
35
36#define init_task_preempt_count(p) do { \
37 task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \
38} while (0)
39
40#define init_idle_preempt_count(p, cpu) do { \
41 task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \
42} while (0)
43
44/*
45 * We fold the NEED_RESCHED bit into the preempt count such that
46 * preempt_enable() can decrement and test for needing to reschedule with a
47 * single instruction.
48 *
49 * We invert the actual bit, so that when the decrement hits 0 we know we both
50 * need to resched (the bit is cleared) and can resched (no preempt count).
51 */
52
53static __always_inline void set_preempt_need_resched(void)
54{
55 *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
56}
57
58static __always_inline void clear_preempt_need_resched(void)
59{
60 *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
61}
62
63static __always_inline bool test_preempt_need_resched(void)
64{
65 return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
66}
67
68/*
69 * The various preempt_count add/sub methods
70 */
71
72static __always_inline void __preempt_count_add(int val)
73{
74 *preempt_count_ptr() += val;
75}
76
77static __always_inline void __preempt_count_sub(int val)
78{
79 *preempt_count_ptr() -= val;
80}
81
82static __always_inline bool __preempt_count_dec_and_test(void)
83{
84 return !--*preempt_count_ptr();
85}
86
87/*
88 * Returns true when we need to resched and can (barring IRQ state).
89 */
90static __always_inline bool should_resched(void)
91{
92 return unlikely(!*preempt_count_ptr());
93}
94
95#ifdef CONFIG_PREEMPT
96extern asmlinkage void preempt_schedule(void);
97#define __preempt_schedule() preempt_schedule()
98
99#ifdef CONFIG_CONTEXT_TRACKING
100extern asmlinkage void preempt_schedule_context(void);
101#define __preempt_schedule_context() preempt_schedule_context()
102#endif
103#endif /* CONFIG_PREEMPT */
104
105#endif /* __ASM_PREEMPT_H */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index b685d3bd32e2..3d1a3af5cf59 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -32,6 +32,6 @@ static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
32 32
33#endif 33#endif
34 34
35extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from); 35extern int copy_siginfo_to_user(struct siginfo __user *to, const struct siginfo *from);
36 36
37#endif 37#endif
diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h
new file mode 100644
index 000000000000..f57eb7b5c23b
--- /dev/null
+++ b/include/asm-generic/simd.h
@@ -0,0 +1,14 @@
1
2#include <linux/hardirq.h>
3
4/*
5 * may_use_simd - whether it is allowable at this time to issue SIMD
6 * instructions or access the SIMD register file
7 *
8 * As architectures typically don't preserve the SIMD register file when
9 * taking an interrupt, !in_interrupt() should be a reasonable default.
10 */
11static __must_check inline bool may_use_simd(void)
12{
13 return !in_interrupt();
14}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 83e2c31e8b00..bc2121fa9132 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -473,6 +473,7 @@
473#define KERNEL_CTORS() . = ALIGN(8); \ 473#define KERNEL_CTORS() . = ALIGN(8); \
474 VMLINUX_SYMBOL(__ctors_start) = .; \ 474 VMLINUX_SYMBOL(__ctors_start) = .; \
475 *(.ctors) \ 475 *(.ctors) \
476 *(.init_array) \
476 VMLINUX_SYMBOL(__ctors_end) = .; 477 VMLINUX_SYMBOL(__ctors_end) = .;
477#else 478#else
478#define KERNEL_CTORS() 479#define KERNEL_CTORS()
diff --git a/include/asm-generic/vtime.h b/include/asm-generic/vtime.h
index e69de29bb2d1..b1a49677fe25 100644
--- a/include/asm-generic/vtime.h
+++ b/include/asm-generic/vtime.h
@@ -0,0 +1 @@
/* no content, but patch(1) dislikes empty files */
diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h
index 3f21f1b72e45..d3909effd725 100644
--- a/include/asm-generic/word-at-a-time.h
+++ b/include/asm-generic/word-at-a-time.h
@@ -49,4 +49,12 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
49 return (val + c->high_bits) & ~rhs; 49 return (val + c->high_bits) & ~rhs;
50} 50}
51 51
52#ifndef zero_bytemask
53#ifdef CONFIG_64BIT
54#define zero_bytemask(mask) (~0ul << fls64(mask))
55#else
56#define zero_bytemask(mask) (~0ul << fls(mask))
57#endif /* CONFIG_64BIT */
58#endif /* zero_bytemask */
59
52#endif /* _ASM_WORD_AT_A_TIME_H */ 60#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index 93b7f96f9c59..6d26b40cbf5d 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -33,6 +33,16 @@ enum arch_timer_reg {
33#define ARCH_TIMER_MEM_PHYS_ACCESS 2 33#define ARCH_TIMER_MEM_PHYS_ACCESS 2
34#define ARCH_TIMER_MEM_VIRT_ACCESS 3 34#define ARCH_TIMER_MEM_VIRT_ACCESS 3
35 35
36#define ARCH_TIMER_USR_PCT_ACCESS_EN (1 << 0) /* physical counter */
37#define ARCH_TIMER_USR_VCT_ACCESS_EN (1 << 1) /* virtual counter */
38#define ARCH_TIMER_VIRT_EVT_EN (1 << 2)
39#define ARCH_TIMER_EVT_TRIGGER_SHIFT (4)
40#define ARCH_TIMER_EVT_TRIGGER_MASK (0xF << ARCH_TIMER_EVT_TRIGGER_SHIFT)
41#define ARCH_TIMER_USR_VT_ACCESS_EN (1 << 8) /* virtual timer registers */
42#define ARCH_TIMER_USR_PT_ACCESS_EN (1 << 9) /* physical timer registers */
43
44#define ARCH_TIMER_EVT_STREAM_FREQ 10000 /* 100us */
45
36#ifdef CONFIG_ARM_ARCH_TIMER 46#ifdef CONFIG_ARM_ARCH_TIMER
37 47
38extern u32 arch_timer_get_rate(void); 48extern u32 arch_timer_get_rate(void);
diff --git a/include/clocksource/samsung_pwm.h b/include/clocksource/samsung_pwm.h
index 5c449c8199e9..0c7d48b8b396 100644
--- a/include/clocksource/samsung_pwm.h
+++ b/include/clocksource/samsung_pwm.h
@@ -20,7 +20,14 @@
20 20
21#define SAMSUNG_PWM_NUM 5 21#define SAMSUNG_PWM_NUM 5
22 22
23/*
24 * Following declaration must be in an ifdef due to this symbol being static
25 * in pwm-samsung driver if the clocksource driver is not compiled in and the
26 * spinlock is not shared between both drivers.
27 */
28#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
23extern spinlock_t samsung_pwm_lock; 29extern spinlock_t samsung_pwm_lock;
30#endif
24 31
25struct samsung_pwm_variant { 32struct samsung_pwm_variant {
26 u8 bits; 33 u8 bits;
diff --git a/include/crypto/ablk_helper.h b/include/crypto/ablk_helper.h
new file mode 100644
index 000000000000..4f93df50c23e
--- /dev/null
+++ b/include/crypto/ablk_helper.h
@@ -0,0 +1,31 @@
1/*
2 * Shared async block cipher helpers
3 */
4
5#ifndef _CRYPTO_ABLK_HELPER_H
6#define _CRYPTO_ABLK_HELPER_H
7
8#include <linux/crypto.h>
9#include <linux/kernel.h>
10#include <crypto/cryptd.h>
11
12struct async_helper_ctx {
13 struct cryptd_ablkcipher *cryptd_tfm;
14};
15
16extern int ablk_set_key(struct crypto_ablkcipher *tfm, const u8 *key,
17 unsigned int key_len);
18
19extern int __ablk_encrypt(struct ablkcipher_request *req);
20
21extern int ablk_encrypt(struct ablkcipher_request *req);
22
23extern int ablk_decrypt(struct ablkcipher_request *req);
24
25extern void ablk_exit(struct crypto_tfm *tfm);
26
27extern int ablk_init_common(struct crypto_tfm *tfm, const char *drv_name);
28
29extern int ablk_init(struct crypto_tfm *tfm);
30
31#endif /* _CRYPTO_ABLK_HELPER_H */
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 418d270e1806..e73c19e90e38 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -386,5 +386,21 @@ static inline int crypto_requires_sync(u32 type, u32 mask)
386 return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC; 386 return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC;
387} 387}
388 388
389#endif /* _CRYPTO_ALGAPI_H */ 389noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size);
390
391/**
392 * crypto_memneq - Compare two areas of memory without leaking
393 * timing information.
394 *
395 * @a: One area of memory
396 * @b: Another area of memory
397 * @size: The size of the area.
398 *
399 * Returns 0 when data is equal, 1 otherwise.
400 */
401static inline int crypto_memneq(const void *a, const void *b, size_t size)
402{
403 return __crypto_memneq(a, b, size) != 0UL ? 1 : 0;
404}
390 405
406#endif /* _CRYPTO_ALGAPI_H */
diff --git a/include/crypto/authenc.h b/include/crypto/authenc.h
index e47b044929a8..6775059539b5 100644
--- a/include/crypto/authenc.h
+++ b/include/crypto/authenc.h
@@ -23,5 +23,15 @@ struct crypto_authenc_key_param {
23 __be32 enckeylen; 23 __be32 enckeylen;
24}; 24};
25 25
26#endif /* _CRYPTO_AUTHENC_H */ 26struct crypto_authenc_keys {
27 const u8 *authkey;
28 const u8 *enckey;
29
30 unsigned int authkeylen;
31 unsigned int enckeylen;
32};
27 33
34int crypto_authenc_extractkeys(struct crypto_authenc_keys *keys, const u8 *key,
35 unsigned int keylen);
36
37#endif /* _CRYPTO_AUTHENC_H */
diff --git a/include/crypto/hash_info.h b/include/crypto/hash_info.h
new file mode 100644
index 000000000000..e1e5a3e5dd1b
--- /dev/null
+++ b/include/crypto/hash_info.h
@@ -0,0 +1,40 @@
1/*
2 * Hash Info: Hash algorithms information
3 *
4 * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _CRYPTO_HASH_INFO_H
14#define _CRYPTO_HASH_INFO_H
15
16#include <crypto/sha.h>
17#include <crypto/md5.h>
18
19#include <uapi/linux/hash_info.h>
20
21/* not defined in include/crypto/ */
22#define RMD128_DIGEST_SIZE 16
23#define RMD160_DIGEST_SIZE 20
24#define RMD256_DIGEST_SIZE 32
25#define RMD320_DIGEST_SIZE 40
26
27/* not defined in include/crypto/ */
28#define WP512_DIGEST_SIZE 64
29#define WP384_DIGEST_SIZE 48
30#define WP256_DIGEST_SIZE 32
31
32/* not defined in include/crypto/ */
33#define TGR128_DIGEST_SIZE 16
34#define TGR160_DIGEST_SIZE 20
35#define TGR192_DIGEST_SIZE 24
36
37extern const char *const hash_algo_name[HASH_ALGO__LAST];
38extern const int hash_digest_size[HASH_ALGO__LAST];
39
40#endif /* _CRYPTO_HASH_INFO_H */
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index f5b0224c9967..fc09732613ad 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -15,6 +15,7 @@
15#define _LINUX_PUBLIC_KEY_H 15#define _LINUX_PUBLIC_KEY_H
16 16
17#include <linux/mpi.h> 17#include <linux/mpi.h>
18#include <crypto/hash_info.h>
18 19
19enum pkey_algo { 20enum pkey_algo {
20 PKEY_ALGO_DSA, 21 PKEY_ALGO_DSA,
@@ -22,21 +23,11 @@ enum pkey_algo {
22 PKEY_ALGO__LAST 23 PKEY_ALGO__LAST
23}; 24};
24 25
25extern const char *const pkey_algo[PKEY_ALGO__LAST]; 26extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
27extern const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST];
26 28
27enum pkey_hash_algo { 29/* asymmetric key implementation supports only up to SHA224 */
28 PKEY_HASH_MD4, 30#define PKEY_HASH__LAST (HASH_ALGO_SHA224 + 1)
29 PKEY_HASH_MD5,
30 PKEY_HASH_SHA1,
31 PKEY_HASH_RIPE_MD_160,
32 PKEY_HASH_SHA256,
33 PKEY_HASH_SHA384,
34 PKEY_HASH_SHA512,
35 PKEY_HASH_SHA224,
36 PKEY_HASH__LAST
37};
38
39extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
40 31
41enum pkey_id_type { 32enum pkey_id_type {
42 PKEY_ID_PGP, /* OpenPGP generated key ID */ 33 PKEY_ID_PGP, /* OpenPGP generated key ID */
@@ -44,7 +35,7 @@ enum pkey_id_type {
44 PKEY_ID_TYPE__LAST 35 PKEY_ID_TYPE__LAST
45}; 36};
46 37
47extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST]; 38extern const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST];
48 39
49/* 40/*
50 * Cryptographic data for the public-key subtype of the asymmetric key type. 41 * Cryptographic data for the public-key subtype of the asymmetric key type.
@@ -59,6 +50,7 @@ struct public_key {
59#define PKEY_CAN_DECRYPT 0x02 50#define PKEY_CAN_DECRYPT 0x02
60#define PKEY_CAN_SIGN 0x04 51#define PKEY_CAN_SIGN 0x04
61#define PKEY_CAN_VERIFY 0x08 52#define PKEY_CAN_VERIFY 0x08
53 enum pkey_algo pkey_algo : 8;
62 enum pkey_id_type id_type : 8; 54 enum pkey_id_type id_type : 8;
63 union { 55 union {
64 MPI mpi[5]; 56 MPI mpi[5];
@@ -88,7 +80,8 @@ struct public_key_signature {
88 u8 *digest; 80 u8 *digest;
89 u8 digest_size; /* Number of bytes in digest */ 81 u8 digest_size; /* Number of bytes in digest */
90 u8 nr_mpi; /* Occupancy of mpi[] */ 82 u8 nr_mpi; /* Occupancy of mpi[] */
91 enum pkey_hash_algo pkey_hash_algo : 8; 83 enum pkey_algo pkey_algo : 8;
84 enum hash_algo pkey_hash_algo : 8;
92 union { 85 union {
93 MPI mpi[2]; 86 MPI mpi[2];
94 struct { 87 struct {
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 3744d2a642df..6a626a507b8c 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -36,6 +36,7 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
36{ 36{
37 sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); 37 sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
38 sg1[num - 1].page_link &= ~0x02; 38 sg1[num - 1].page_link &= ~0x02;
39 sg1[num - 1].page_link |= 0x01;
39} 40}
40 41
41static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) 42static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
@@ -43,7 +44,7 @@ static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
43 if (sg_is_last(sg)) 44 if (sg_is_last(sg))
44 return NULL; 45 return NULL;
45 46
46 return (++sg)->length ? sg : (void *)sg_page(sg); 47 return (++sg)->length ? sg : sg_chain_ptr(sg);
47} 48}
48 49
49static inline void scatterwalk_crypto_chain(struct scatterlist *head, 50static inline void scatterwalk_crypto_chain(struct scatterlist *head,
@@ -113,4 +114,6 @@ void scatterwalk_done(struct scatter_walk *walk, int out, int more);
113void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, 114void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
114 unsigned int start, unsigned int nbytes, int out); 115 unsigned int start, unsigned int nbytes, int out);
115 116
117int scatterwalk_bytes_sglen(struct scatterlist *sg, int num_bytes);
118
116#endif /* _CRYPTO_SCATTERWALK_H */ 119#endif /* _CRYPTO_SCATTERWALK_H */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 290734191f72..1d4a920ef7ff 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -150,6 +150,7 @@ int drm_err(const char *func, const char *format, ...);
150#define DRIVER_BUS_PCI 0x1 150#define DRIVER_BUS_PCI 0x1
151#define DRIVER_BUS_PLATFORM 0x2 151#define DRIVER_BUS_PLATFORM 0x2
152#define DRIVER_BUS_USB 0x3 152#define DRIVER_BUS_USB 0x3
153#define DRIVER_BUS_HOST1X 0x4
153 154
154/***********************************************************************/ 155/***********************************************************************/
155/** \name Begin the DRM... */ 156/** \name Begin the DRM... */
@@ -412,7 +413,12 @@ struct drm_prime_file_private {
412 413
413/** File private data */ 414/** File private data */
414struct drm_file { 415struct drm_file {
415 int authenticated; 416 unsigned always_authenticated :1;
417 unsigned authenticated :1;
418 unsigned is_master :1; /* this file private is a master for a minor */
419 /* true when the client has asked us to expose stereo 3D mode flags */
420 unsigned stereo_allowed :1;
421
416 struct pid *pid; 422 struct pid *pid;
417 kuid_t uid; 423 kuid_t uid;
418 drm_magic_t magic; 424 drm_magic_t magic;
@@ -429,10 +435,8 @@ struct drm_file {
429 struct file *filp; 435 struct file *filp;
430 void *driver_priv; 436 void *driver_priv;
431 437
432 int is_master; /* this file private is a master for a minor */
433 struct drm_master *master; /* master this node is currently associated with 438 struct drm_master *master; /* master this node is currently associated with
434 N.B. not always minor->master */ 439 N.B. not always minor->master */
435
436 /** 440 /**
437 * fbs - List of framebuffers associated with this file. 441 * fbs - List of framebuffers associated with this file.
438 * 442 *
@@ -667,8 +671,6 @@ struct drm_gem_object {
667 uint32_t pending_read_domains; 671 uint32_t pending_read_domains;
668 uint32_t pending_write_domain; 672 uint32_t pending_write_domain;
669 673
670 void *driver_private;
671
672 /** 674 /**
673 * dma_buf - dma buf associated with this GEM object 675 * dma_buf - dma buf associated with this GEM object
674 * 676 *
@@ -834,12 +836,17 @@ struct drm_driver {
834 /** 836 /**
835 * Called by vblank timestamping code. 837 * Called by vblank timestamping code.
836 * 838 *
837 * Return the current display scanout position from a crtc. 839 * Return the current display scanout position from a crtc, and an
840 * optional accurate ktime_get timestamp of when position was measured.
838 * 841 *
839 * \param dev DRM device. 842 * \param dev DRM device.
840 * \param crtc Id of the crtc to query. 843 * \param crtc Id of the crtc to query.
841 * \param *vpos Target location for current vertical scanout position. 844 * \param *vpos Target location for current vertical scanout position.
842 * \param *hpos Target location for current horizontal scanout position. 845 * \param *hpos Target location for current horizontal scanout position.
846 * \param *stime Target location for timestamp taken immediately before
847 * scanout position query. Can be NULL to skip timestamp.
848 * \param *etime Target location for timestamp taken immediately after
849 * scanout position query. Can be NULL to skip timestamp.
843 * 850 *
844 * Returns vpos as a positive number while in active scanout area. 851 * Returns vpos as a positive number while in active scanout area.
845 * Returns vpos as a negative number inside vblank, counting the number 852 * Returns vpos as a negative number inside vblank, counting the number
@@ -856,7 +863,8 @@ struct drm_driver {
856 * 863 *
857 */ 864 */
858 int (*get_scanout_position) (struct drm_device *dev, int crtc, 865 int (*get_scanout_position) (struct drm_device *dev, int crtc,
859 int *vpos, int *hpos); 866 int *vpos, int *hpos, ktime_t *stime,
867 ktime_t *etime);
860 868
861 /** 869 /**
862 * Called by \c drm_get_last_vbltimestamp. Should return a precise 870 * Called by \c drm_get_last_vbltimestamp. Should return a precise
@@ -922,7 +930,6 @@ struct drm_driver {
922 * 930 *
923 * Returns 0 on success. 931 * Returns 0 on success.
924 */ 932 */
925 int (*gem_init_object) (struct drm_gem_object *obj);
926 void (*gem_free_object) (struct drm_gem_object *obj); 933 void (*gem_free_object) (struct drm_gem_object *obj);
927 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); 934 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
928 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 935 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
@@ -997,27 +1004,6 @@ struct drm_driver {
997#define DRM_MINOR_CONTROL 2 1004#define DRM_MINOR_CONTROL 2
998#define DRM_MINOR_RENDER 3 1005#define DRM_MINOR_RENDER 3
999 1006
1000
1001/**
1002 * debugfs node list. This structure represents a debugfs file to
1003 * be created by the drm core
1004 */
1005struct drm_debugfs_list {
1006 const char *name; /** file name */
1007 int (*show)(struct seq_file*, void*); /** show callback */
1008 u32 driver_features; /**< Required driver features for this entry */
1009};
1010
1011/**
1012 * debugfs node structure. This structure represents a debugfs file.
1013 */
1014struct drm_debugfs_node {
1015 struct list_head list;
1016 struct drm_minor *minor;
1017 struct drm_debugfs_list *debugfs_ent;
1018 struct dentry *dent;
1019};
1020
1021/** 1007/**
1022 * Info file list entry. This structure represents a debugfs or proc file to 1008 * Info file list entry. This structure represents a debugfs or proc file to
1023 * be created by the drm core 1009 * be created by the drm core
@@ -1046,7 +1032,7 @@ struct drm_minor {
1046 int index; /**< Minor device number */ 1032 int index; /**< Minor device number */
1047 int type; /**< Control or render */ 1033 int type; /**< Control or render */
1048 dev_t device; /**< Device number for mknod */ 1034 dev_t device; /**< Device number for mknod */
1049 struct device kdev; /**< Linux device */ 1035 struct device *kdev; /**< Linux device */
1050 struct drm_device *dev; 1036 struct drm_device *dev;
1051 1037
1052 struct dentry *debugfs_root; 1038 struct dentry *debugfs_root;
@@ -1081,6 +1067,19 @@ struct drm_pending_vblank_event {
1081 struct drm_event_vblank event; 1067 struct drm_event_vblank event;
1082}; 1068};
1083 1069
1070struct drm_vblank_crtc {
1071 wait_queue_head_t queue; /**< VBLANK wait queue */
1072 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */
1073 atomic_t count; /**< number of VBLANK interrupts */
1074 atomic_t refcount; /* number of users of vblank interruptsper crtc */
1075 u32 last; /* protected by dev->vbl_lock, used */
1076 /* for wraparound handling */
1077 u32 last_wait; /* Last vblank seqno waited per CRTC */
1078 unsigned int inmodeset; /* Display driver is setting mode */
1079 bool enabled; /* so we don't call enable more than
1080 once per disable */
1081};
1082
1084/** 1083/**
1085 * DRM device structure. This structure represent a complete card that 1084 * DRM device structure. This structure represent a complete card that
1086 * may contain multiple heads. 1085 * may contain multiple heads.
@@ -1105,25 +1104,16 @@ struct drm_device {
1105 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1104 atomic_t buf_alloc; /**< Buffer allocation in progress */
1106 /*@} */ 1105 /*@} */
1107 1106
1108 /** \name Performance counters */
1109 /*@{ */
1110 unsigned long counters;
1111 enum drm_stat_type types[15];
1112 atomic_t counts[15];
1113 /*@} */
1114
1115 struct list_head filelist; 1107 struct list_head filelist;
1116 1108
1117 /** \name Memory management */ 1109 /** \name Memory management */
1118 /*@{ */ 1110 /*@{ */
1119 struct list_head maplist; /**< Linked list of regions */ 1111 struct list_head maplist; /**< Linked list of regions */
1120 int map_count; /**< Number of mappable regions */
1121 struct drm_open_hash map_hash; /**< User token hash table for maps */ 1112 struct drm_open_hash map_hash; /**< User token hash table for maps */
1122 1113
1123 /** \name Context handle management */ 1114 /** \name Context handle management */
1124 /*@{ */ 1115 /*@{ */
1125 struct list_head ctxlist; /**< Linked list of context handles */ 1116 struct list_head ctxlist; /**< Linked list of context handles */
1126 int ctx_count; /**< Number of context handles */
1127 struct mutex ctxlist_mutex; /**< For ctxlist */ 1117 struct mutex ctxlist_mutex; /**< For ctxlist */
1128 1118
1129 struct idr ctx_idr; 1119 struct idr ctx_idr;
@@ -1139,12 +1129,11 @@ struct drm_device {
1139 1129
1140 /** \name Context support */ 1130 /** \name Context support */
1141 /*@{ */ 1131 /*@{ */
1142 int irq_enabled; /**< True if irq handler is enabled */ 1132 bool irq_enabled; /**< True if irq handler is enabled */
1143 __volatile__ long context_flag; /**< Context swapping flag */ 1133 __volatile__ long context_flag; /**< Context swapping flag */
1144 int last_context; /**< Last current context */ 1134 int last_context; /**< Last current context */
1145 /*@} */ 1135 /*@} */
1146 1136
1147 struct work_struct work;
1148 /** \name VBLANK IRQ support */ 1137 /** \name VBLANK IRQ support */
1149 /*@{ */ 1138 /*@{ */
1150 1139
@@ -1154,20 +1143,13 @@ struct drm_device {
1154 * Once the modeset ioctl *has* been called though, we can safely 1143 * Once the modeset ioctl *has* been called though, we can safely
1155 * disable them when unused. 1144 * disable them when unused.
1156 */ 1145 */
1157 int vblank_disable_allowed; 1146 bool vblank_disable_allowed;
1147
1148 /* array of size num_crtcs */
1149 struct drm_vblank_crtc *vblank;
1158 1150
1159 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
1160 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
1161 struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */
1162 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ 1151 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
1163 spinlock_t vbl_lock; 1152 spinlock_t vbl_lock;
1164 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
1165 u32 *last_vblank; /* protected by dev->vbl_lock, used */
1166 /* for wraparound handling */
1167 int *vblank_enabled; /* so we don't call enable more than
1168 once per disable */
1169 int *vblank_inmodeset; /* Display driver is setting mode */
1170 u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */
1171 struct timer_list vblank_disable_timer; 1153 struct timer_list vblank_disable_timer;
1172 1154
1173 u32 max_vblank_count; /**< size of vblank counter register */ 1155 u32 max_vblank_count; /**< size of vblank counter register */
@@ -1184,8 +1166,6 @@ struct drm_device {
1184 1166
1185 struct device *dev; /**< Device structure */ 1167 struct device *dev; /**< Device structure */
1186 struct pci_dev *pdev; /**< PCI device structure */ 1168 struct pci_dev *pdev; /**< PCI device structure */
1187 int pci_vendor; /**< PCI vendor id */
1188 int pci_device; /**< PCI device id */
1189#ifdef __alpha__ 1169#ifdef __alpha__
1190 struct pci_controller *hose; 1170 struct pci_controller *hose;
1191#endif 1171#endif
@@ -1303,6 +1283,8 @@ extern int drm_getstats(struct drm_device *dev, void *data,
1303 struct drm_file *file_priv); 1283 struct drm_file *file_priv);
1304extern int drm_getcap(struct drm_device *dev, void *data, 1284extern int drm_getcap(struct drm_device *dev, void *data,
1305 struct drm_file *file_priv); 1285 struct drm_file *file_priv);
1286extern int drm_setclientcap(struct drm_device *dev, void *data,
1287 struct drm_file *file_priv);
1306extern int drm_setversion(struct drm_device *dev, void *data, 1288extern int drm_setversion(struct drm_device *dev, void *data,
1307 struct drm_file *file_priv); 1289 struct drm_file *file_priv);
1308extern int drm_noop(struct drm_device *dev, void *data, 1290extern int drm_noop(struct drm_device *dev, void *data,
@@ -1322,10 +1304,9 @@ extern int drm_newctx(struct drm_device *dev, void *data,
1322extern int drm_rmctx(struct drm_device *dev, void *data, 1304extern int drm_rmctx(struct drm_device *dev, void *data,
1323 struct drm_file *file_priv); 1305 struct drm_file *file_priv);
1324 1306
1325extern void drm_legacy_ctxbitmap_init(struct drm_device *dev); 1307extern int drm_ctxbitmap_init(struct drm_device *dev);
1326extern void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); 1308extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1327extern void drm_legacy_ctxbitmap_release(struct drm_device *dev, 1309extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1328 struct drm_file *file_priv);
1329 1310
1330extern int drm_setsareactx(struct drm_device *dev, void *data, 1311extern int drm_setsareactx(struct drm_device *dev, void *data,
1331 struct drm_file *file_priv); 1312 struct drm_file *file_priv);
@@ -1455,7 +1436,6 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1455extern void drm_master_put(struct drm_master **master); 1436extern void drm_master_put(struct drm_master **master);
1456 1437
1457extern void drm_put_dev(struct drm_device *dev); 1438extern void drm_put_dev(struct drm_device *dev);
1458extern int drm_put_minor(struct drm_minor **minor);
1459extern void drm_unplug_dev(struct drm_device *dev); 1439extern void drm_unplug_dev(struct drm_device *dev);
1460extern unsigned int drm_debug; 1440extern unsigned int drm_debug;
1461extern unsigned int drm_rnodes; 1441extern unsigned int drm_rnodes;
@@ -1475,10 +1455,11 @@ extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1475#if defined(CONFIG_DEBUG_FS) 1455#if defined(CONFIG_DEBUG_FS)
1476extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, 1456extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1477 struct dentry *root); 1457 struct dentry *root);
1478extern int drm_debugfs_create_files(struct drm_info_list *files, int count, 1458extern int drm_debugfs_create_files(const struct drm_info_list *files,
1479 struct dentry *root, struct drm_minor *minor); 1459 int count, struct dentry *root,
1480extern int drm_debugfs_remove_files(struct drm_info_list *files, int count, 1460 struct drm_minor *minor);
1481 struct drm_minor *minor); 1461extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1462 int count, struct drm_minor *minor);
1482extern int drm_debugfs_cleanup(struct drm_minor *minor); 1463extern int drm_debugfs_cleanup(struct drm_minor *minor);
1483#endif 1464#endif
1484 1465
@@ -1557,8 +1538,6 @@ int drm_gem_init(struct drm_device *dev);
1557void drm_gem_destroy(struct drm_device *dev); 1538void drm_gem_destroy(struct drm_device *dev);
1558void drm_gem_object_release(struct drm_gem_object *obj); 1539void drm_gem_object_release(struct drm_gem_object *obj);
1559void drm_gem_object_free(struct kref *kref); 1540void drm_gem_object_free(struct kref *kref);
1560struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1561 size_t size);
1562int drm_gem_object_init(struct drm_device *dev, 1541int drm_gem_object_init(struct drm_device *dev,
1563 struct drm_gem_object *obj, size_t size); 1542 struct drm_gem_object *obj, size_t size);
1564void drm_gem_private_object_init(struct drm_device *dev, 1543void drm_gem_private_object_init(struct drm_device *dev,
@@ -1646,10 +1625,11 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1646 1625
1647#include <drm/drm_mem_util.h> 1626#include <drm/drm_mem_util.h>
1648 1627
1649extern int drm_fill_in_dev(struct drm_device *dev, 1628struct drm_device *drm_dev_alloc(struct drm_driver *driver,
1650 const struct pci_device_id *ent, 1629 struct device *parent);
1651 struct drm_driver *driver); 1630void drm_dev_free(struct drm_device *dev);
1652int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); 1631int drm_dev_register(struct drm_device *dev, unsigned long flags);
1632void drm_dev_unregister(struct drm_device *dev);
1653/*@}*/ 1633/*@}*/
1654 1634
1655/* PCI section */ 1635/* PCI section */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 24f499569a2f..f32c5cd51f41 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -108,6 +108,7 @@ enum drm_mode_status {
108 MODE_ONE_HEIGHT, /* only one height is supported */ 108 MODE_ONE_HEIGHT, /* only one height is supported */
109 MODE_ONE_SIZE, /* only one resolution is supported */ 109 MODE_ONE_SIZE, /* only one resolution is supported */
110 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ 110 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
111 MODE_NO_STEREO, /* stereo modes not supported */
111 MODE_UNVERIFIED = -3, /* mode needs to reverified */ 112 MODE_UNVERIFIED = -3, /* mode needs to reverified */
112 MODE_BAD = -2, /* unspecified reason */ 113 MODE_BAD = -2, /* unspecified reason */
113 MODE_ERROR = -1 /* error condition */ 114 MODE_ERROR = -1 /* error condition */
@@ -124,7 +125,10 @@ enum drm_mode_status {
124 .vscan = (vs), .flags = (f), \ 125 .vscan = (vs), .flags = (f), \
125 .base.type = DRM_MODE_OBJECT_MODE 126 .base.type = DRM_MODE_OBJECT_MODE
126 127
127#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ 128#define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */
129#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */
130
131#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
128 132
129struct drm_display_mode { 133struct drm_display_mode {
130 /* Header */ 134 /* Header */
@@ -155,8 +159,7 @@ struct drm_display_mode {
155 int height_mm; 159 int height_mm;
156 160
157 /* Actual mode we give to hw */ 161 /* Actual mode we give to hw */
158 int clock_index; 162 int crtc_clock; /* in KHz */
159 int synth_clock;
160 int crtc_hdisplay; 163 int crtc_hdisplay;
161 int crtc_hblank_start; 164 int crtc_hblank_start;
162 int crtc_hblank_end; 165 int crtc_hblank_end;
@@ -180,6 +183,11 @@ struct drm_display_mode {
180 int hsync; /* in kHz */ 183 int hsync; /* in kHz */
181}; 184};
182 185
186static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
187{
188 return mode->flags & DRM_MODE_FLAG_3D_MASK;
189}
190
183enum drm_connector_status { 191enum drm_connector_status {
184 connector_status_connected = 1, 192 connector_status_connected = 1,
185 connector_status_disconnected = 2, 193 connector_status_disconnected = 2,
@@ -587,7 +595,7 @@ enum drm_connector_force {
587 */ 595 */
588struct drm_connector { 596struct drm_connector {
589 struct drm_device *dev; 597 struct drm_device *dev;
590 struct device kdev; 598 struct device *kdev;
591 struct device_attribute *attr; 599 struct device_attribute *attr;
592 struct list_head head; 600 struct list_head head;
593 601
@@ -597,6 +605,7 @@ struct drm_connector {
597 int connector_type_id; 605 int connector_type_id;
598 bool interlace_allowed; 606 bool interlace_allowed;
599 bool doublescan_allowed; 607 bool doublescan_allowed;
608 bool stereo_allowed;
600 struct list_head modes; /* list of modes on this connector */ 609 struct list_head modes; /* list of modes on this connector */
601 610
602 enum drm_connector_status status; 611 enum drm_connector_status status;
@@ -964,6 +973,7 @@ extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_m
964extern bool drm_probe_ddc(struct i2c_adapter *adapter); 973extern bool drm_probe_ddc(struct i2c_adapter *adapter);
965extern struct edid *drm_get_edid(struct drm_connector *connector, 974extern struct edid *drm_get_edid(struct drm_connector *connector,
966 struct i2c_adapter *adapter); 975 struct i2c_adapter *adapter);
976extern struct edid *drm_edid_duplicate(const struct edid *edid);
967extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 977extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
968extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 978extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
969extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); 979extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
@@ -975,7 +985,7 @@ extern void drm_mode_config_reset(struct drm_device *dev);
975extern void drm_mode_config_cleanup(struct drm_device *dev); 985extern void drm_mode_config_cleanup(struct drm_device *dev);
976extern void drm_mode_set_name(struct drm_display_mode *mode); 986extern void drm_mode_set_name(struct drm_display_mode *mode);
977extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); 987extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
978extern bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); 988extern bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
979extern int drm_mode_width(const struct drm_display_mode *mode); 989extern int drm_mode_width(const struct drm_display_mode *mode);
980extern int drm_mode_height(const struct drm_display_mode *mode); 990extern int drm_mode_height(const struct drm_display_mode *mode);
981 991
@@ -1108,6 +1118,8 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
1108 int GTF_2C, int GTF_K, int GTF_2J); 1118 int GTF_2C, int GTF_K, int GTF_2J);
1109extern int drm_add_modes_noedid(struct drm_connector *connector, 1119extern int drm_add_modes_noedid(struct drm_connector *connector,
1110 int hdisplay, int vdisplay); 1120 int hdisplay, int vdisplay);
1121extern void drm_set_preferred_mode(struct drm_connector *connector,
1122 int hpref, int vpref);
1111 1123
1112extern int drm_edid_header_is_valid(const u8 *raw_edid); 1124extern int drm_edid_header_is_valid(const u8 *raw_edid);
1113extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1125extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
@@ -1135,4 +1147,21 @@ extern int drm_format_horz_chroma_subsampling(uint32_t format);
1135extern int drm_format_vert_chroma_subsampling(uint32_t format); 1147extern int drm_format_vert_chroma_subsampling(uint32_t format);
1136extern const char *drm_get_format_name(uint32_t format); 1148extern const char *drm_get_format_name(uint32_t format);
1137 1149
1150/* Helpers */
1151static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
1152 uint32_t id)
1153{
1154 struct drm_mode_object *mo;
1155 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC);
1156 return mo ? obj_to_crtc(mo) : NULL;
1157}
1158
1159static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
1160 uint32_t id)
1161{
1162 struct drm_mode_object *mo;
1163 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
1164 return mo ? obj_to_encoder(mo) : NULL;
1165}
1166
1138#endif /* __DRM_CRTC_H__ */ 1167#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index f43d556bf40b..ef6ad3a8e58e 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -163,7 +163,7 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
163extern int drm_helper_resume_force_mode(struct drm_device *dev); 163extern int drm_helper_resume_force_mode(struct drm_device *dev);
164extern void drm_kms_helper_poll_init(struct drm_device *dev); 164extern void drm_kms_helper_poll_init(struct drm_device *dev);
165extern void drm_kms_helper_poll_fini(struct drm_device *dev); 165extern void drm_kms_helper_poll_fini(struct drm_device *dev);
166extern void drm_helper_hpd_irq_event(struct drm_device *dev); 166extern bool drm_helper_hpd_irq_event(struct drm_device *dev);
167extern void drm_kms_helper_hotplug_event(struct drm_device *dev); 167extern void drm_kms_helper_hotplug_event(struct drm_device *dev);
168 168
169extern void drm_kms_helper_poll_disable(struct drm_device *dev); 169extern void drm_kms_helper_poll_disable(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index ae8dbfb1207c..a92c3754e3bb 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -77,10 +77,10 @@
77#define DP_DOWNSTREAMPORT_PRESENT 0x005 77#define DP_DOWNSTREAMPORT_PRESENT 0x005
78# define DP_DWN_STRM_PORT_PRESENT (1 << 0) 78# define DP_DWN_STRM_PORT_PRESENT (1 << 0)
79# define DP_DWN_STRM_PORT_TYPE_MASK 0x06 79# define DP_DWN_STRM_PORT_TYPE_MASK 0x06
80/* 00b = DisplayPort */ 80# define DP_DWN_STRM_PORT_TYPE_DP (0 << 1)
81/* 01b = Analog */ 81# define DP_DWN_STRM_PORT_TYPE_ANALOG (1 << 1)
82/* 10b = TMDS or HDMI */ 82# define DP_DWN_STRM_PORT_TYPE_TMDS (2 << 1)
83/* 11b = Other */ 83# define DP_DWN_STRM_PORT_TYPE_OTHER (3 << 1)
84# define DP_FORMAT_CONVERSION (1 << 3) 84# define DP_FORMAT_CONVERSION (1 << 3)
85# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */ 85# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */
86 86
@@ -333,20 +333,20 @@ i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
333 333
334 334
335#define DP_LINK_STATUS_SIZE 6 335#define DP_LINK_STATUS_SIZE 6
336bool drm_dp_channel_eq_ok(u8 link_status[DP_LINK_STATUS_SIZE], 336bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
337 int lane_count); 337 int lane_count);
338bool drm_dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE], 338bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
339 int lane_count); 339 int lane_count);
340u8 drm_dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE], 340u8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE],
341 int lane); 341 int lane);
342u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE], 342u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIZE],
343 int lane); 343 int lane);
344 344
345#define DP_RECEIVER_CAP_SIZE 0xf 345#define DP_RECEIVER_CAP_SIZE 0xf
346#define EDP_PSR_RECEIVER_CAP_SIZE 2 346#define EDP_PSR_RECEIVER_CAP_SIZE 2
347 347
348void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); 348void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
349void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); 349void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
350 350
351u8 drm_dp_link_rate_to_bw_code(int link_rate); 351u8 drm_dp_link_rate_to_bw_code(int link_rate);
352int drm_dp_bw_code_to_link_rate(u8 link_bw); 352int drm_dp_bw_code_to_link_rate(u8 link_bw);
@@ -379,15 +379,22 @@ struct edp_vsc_psr {
379#define EDP_VSC_PSR_CRC_VALUES_VALID (1<<2) 379#define EDP_VSC_PSR_CRC_VALUES_VALID (1<<2)
380 380
381static inline int 381static inline int
382drm_dp_max_link_rate(u8 dpcd[DP_RECEIVER_CAP_SIZE]) 382drm_dp_max_link_rate(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
383{ 383{
384 return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]); 384 return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]);
385} 385}
386 386
387static inline u8 387static inline u8
388drm_dp_max_lane_count(u8 dpcd[DP_RECEIVER_CAP_SIZE]) 388drm_dp_max_lane_count(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
389{ 389{
390 return dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK; 390 return dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK;
391} 391}
392 392
393static inline bool
394drm_dp_enhanced_frame_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
395{
396 return dpcd[DP_DPCD_REV] >= 0x11 &&
397 (dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP);
398}
399
393#endif /* _DRM_DP_HELPER_H_ */ 400#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index fd54a14a7c2a..87578c109e48 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -12,11 +12,14 @@
12 {0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 12 {0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
13 {0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 13 {0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
14 {0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 14 {0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
15 {0x1002, 0x1312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
15 {0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 16 {0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
16 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 17 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
17 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 18 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
19 {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
18 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 20 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
19 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 21 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
22 {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
20 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 23 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
21 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 24 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
22 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 25 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -258,6 +261,18 @@
258 {0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 261 {0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 262 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 263 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
264 {0x1002, 0x67A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
265 {0x1002, 0x67A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
266 {0x1002, 0x67A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
267 {0x1002, 0x67A8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
268 {0x1002, 0x67A9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
269 {0x1002, 0x67AA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
270 {0x1002, 0x67B0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
271 {0x1002, 0x67B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
272 {0x1002, 0x67B8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
273 {0x1002, 0x67B9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x67BA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x67BE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAWAII|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 276 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
262 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 277 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
263 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 278 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 63d609d8a3f6..97d5497debc1 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -26,6 +26,7 @@
26#ifndef _I915_DRM_H_ 26#ifndef _I915_DRM_H_
27#define _I915_DRM_H_ 27#define _I915_DRM_H_
28 28
29#include <drm/i915_pciids.h>
29#include <uapi/drm/i915_drm.h> 30#include <uapi/drm/i915_drm.h>
30 31
31/* For use by IPS driver */ 32/* For use by IPS driver */
@@ -34,4 +35,41 @@ extern bool i915_gpu_raise(void);
34extern bool i915_gpu_lower(void); 35extern bool i915_gpu_lower(void);
35extern bool i915_gpu_busy(void); 36extern bool i915_gpu_busy(void);
36extern bool i915_gpu_turbo_disable(void); 37extern bool i915_gpu_turbo_disable(void);
38
39/*
40 * The Bridge device's PCI config space has information about the
41 * fb aperture size and the amount of pre-reserved memory.
42 * This is all handled in the intel-gtt.ko module. i915.ko only
43 * cares about the vga bit for the vga rbiter.
44 */
45#define INTEL_GMCH_CTRL 0x52
46#define INTEL_GMCH_VGA_DISABLE (1 << 1)
47#define SNB_GMCH_CTRL 0x50
48#define SNB_GMCH_GGMS_SHIFT 8 /* GTT Graphics Memory Size */
49#define SNB_GMCH_GGMS_MASK 0x3
50#define SNB_GMCH_GMS_SHIFT 3 /* Graphics Mode Select */
51#define SNB_GMCH_GMS_MASK 0x1f
52#define BDW_GMCH_GGMS_SHIFT 6
53#define BDW_GMCH_GGMS_MASK 0x3
54#define BDW_GMCH_GMS_SHIFT 8
55#define BDW_GMCH_GMS_MASK 0xff
56
57#define I830_GMCH_CTRL 0x52
58
59#define I855_GMCH_GMS_MASK 0xF0
60#define I855_GMCH_GMS_STOLEN_0M 0x0
61#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
62#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4)
63#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4)
64#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4)
65#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4)
66#define I915_GMCH_GMS_STOLEN_48M (0x6 << 4)
67#define I915_GMCH_GMS_STOLEN_64M (0x7 << 4)
68#define G33_GMCH_GMS_STOLEN_128M (0x8 << 4)
69#define G33_GMCH_GMS_STOLEN_256M (0x9 << 4)
70#define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
71#define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
72#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
73#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
74
37#endif /* _I915_DRM_H_ */ 75#endif /* _I915_DRM_H_ */
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
new file mode 100644
index 000000000000..940ece4934ba
--- /dev/null
+++ b/include/drm/i915_pciids.h
@@ -0,0 +1,236 @@
1/*
2 * Copyright 2013 Intel Corporation
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 */
25#ifndef _I915_PCIIDS_H
26#define _I915_PCIIDS_H
27
28/*
29 * A pci_device_id struct {
30 * __u32 vendor, device;
31 * __u32 subvendor, subdevice;
32 * __u32 class, class_mask;
33 * kernel_ulong_t driver_data;
34 * };
35 * Don't use C99 here because "class" is reserved and we want to
36 * give userspace flexibility.
37 */
38#define INTEL_VGA_DEVICE(id, info) { \
39 0x8086, id, \
40 ~0, ~0, \
41 0x030000, 0xff0000, \
42 (unsigned long) info }
43
44#define INTEL_QUANTA_VGA_DEVICE(info) { \
45 0x8086, 0x16a, \
46 0x152d, 0x8990, \
47 0x030000, 0xff0000, \
48 (unsigned long) info }
49
50#define INTEL_I830_IDS(info) \
51 INTEL_VGA_DEVICE(0x3577, info)
52
53#define INTEL_I845G_IDS(info) \
54 INTEL_VGA_DEVICE(0x2562, info)
55
56#define INTEL_I85X_IDS(info) \
57 INTEL_VGA_DEVICE(0x3582, info), /* I855_GM */ \
58 INTEL_VGA_DEVICE(0x358e, info)
59
60#define INTEL_I865G_IDS(info) \
61 INTEL_VGA_DEVICE(0x2572, info) /* I865_G */
62
63#define INTEL_I915G_IDS(info) \
64 INTEL_VGA_DEVICE(0x2582, info), /* I915_G */ \
65 INTEL_VGA_DEVICE(0x258a, info) /* E7221_G */
66
67#define INTEL_I915GM_IDS(info) \
68 INTEL_VGA_DEVICE(0x2592, info) /* I915_GM */
69
70#define INTEL_I945G_IDS(info) \
71 INTEL_VGA_DEVICE(0x2772, info) /* I945_G */
72
73#define INTEL_I945GM_IDS(info) \
74 INTEL_VGA_DEVICE(0x27a2, info), /* I945_GM */ \
75 INTEL_VGA_DEVICE(0x27ae, info) /* I945_GME */
76
77#define INTEL_I965G_IDS(info) \
78 INTEL_VGA_DEVICE(0x2972, info), /* I946_GZ */ \
79 INTEL_VGA_DEVICE(0x2982, info), /* G35_G */ \
80 INTEL_VGA_DEVICE(0x2992, info), /* I965_Q */ \
81 INTEL_VGA_DEVICE(0x29a2, info) /* I965_G */
82
83#define INTEL_G33_IDS(info) \
84 INTEL_VGA_DEVICE(0x29b2, info), /* Q35_G */ \
85 INTEL_VGA_DEVICE(0x29c2, info), /* G33_G */ \
86 INTEL_VGA_DEVICE(0x29d2, info) /* Q33_G */
87
88#define INTEL_I965GM_IDS(info) \
89 INTEL_VGA_DEVICE(0x2a02, info), /* I965_GM */ \
90 INTEL_VGA_DEVICE(0x2a12, info) /* I965_GME */
91
92#define INTEL_GM45_IDS(info) \
93 INTEL_VGA_DEVICE(0x2a42, info) /* GM45_G */
94
95#define INTEL_G45_IDS(info) \
96 INTEL_VGA_DEVICE(0x2e02, info), /* IGD_E_G */ \
97 INTEL_VGA_DEVICE(0x2e12, info), /* Q45_G */ \
98 INTEL_VGA_DEVICE(0x2e22, info), /* G45_G */ \
99 INTEL_VGA_DEVICE(0x2e32, info), /* G41_G */ \
100 INTEL_VGA_DEVICE(0x2e42, info), /* B43_G */ \
101 INTEL_VGA_DEVICE(0x2e92, info) /* B43_G.1 */
102
103#define INTEL_PINEVIEW_IDS(info) \
104 INTEL_VGA_DEVICE(0xa001, info), \
105 INTEL_VGA_DEVICE(0xa011, info)
106
107#define INTEL_IRONLAKE_D_IDS(info) \
108 INTEL_VGA_DEVICE(0x0042, info)
109
110#define INTEL_IRONLAKE_M_IDS(info) \
111 INTEL_VGA_DEVICE(0x0046, info)
112
113#define INTEL_SNB_D_IDS(info) \
114 INTEL_VGA_DEVICE(0x0102, info), \
115 INTEL_VGA_DEVICE(0x0112, info), \
116 INTEL_VGA_DEVICE(0x0122, info), \
117 INTEL_VGA_DEVICE(0x010A, info)
118
119#define INTEL_SNB_M_IDS(info) \
120 INTEL_VGA_DEVICE(0x0106, info), \
121 INTEL_VGA_DEVICE(0x0116, info), \
122 INTEL_VGA_DEVICE(0x0126, info)
123
124#define INTEL_IVB_M_IDS(info) \
125 INTEL_VGA_DEVICE(0x0156, info), /* GT1 mobile */ \
126 INTEL_VGA_DEVICE(0x0166, info) /* GT2 mobile */
127
128#define INTEL_IVB_D_IDS(info) \
129 INTEL_VGA_DEVICE(0x0152, info), /* GT1 desktop */ \
130 INTEL_VGA_DEVICE(0x0162, info), /* GT2 desktop */ \
131 INTEL_VGA_DEVICE(0x015a, info), /* GT1 server */ \
132 INTEL_VGA_DEVICE(0x016a, info) /* GT2 server */
133
134#define INTEL_IVB_Q_IDS(info) \
135 INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */
136
137#define INTEL_HSW_D_IDS(info) \
138 INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \
139 INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \
140 INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \
141 INTEL_VGA_DEVICE(0x040a, info), /* GT1 server */ \
142 INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \
143 INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \
144 INTEL_VGA_DEVICE(0x040B, info), /* GT1 reserved */ \
145 INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \
146 INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \
147 INTEL_VGA_DEVICE(0x040E, info), /* GT1 reserved */ \
148 INTEL_VGA_DEVICE(0x041E, info), /* GT2 reserved */ \
149 INTEL_VGA_DEVICE(0x042E, info), /* GT3 reserved */ \
150 INTEL_VGA_DEVICE(0x0C02, info), /* SDV GT1 desktop */ \
151 INTEL_VGA_DEVICE(0x0C12, info), /* SDV GT2 desktop */ \
152 INTEL_VGA_DEVICE(0x0C22, info), /* SDV GT3 desktop */ \
153 INTEL_VGA_DEVICE(0x0C0A, info), /* SDV GT1 server */ \
154 INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \
155 INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \
156 INTEL_VGA_DEVICE(0x0C0B, info), /* SDV GT1 reserved */ \
157 INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \
158 INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \
159 INTEL_VGA_DEVICE(0x0C0E, info), /* SDV GT1 reserved */ \
160 INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \
161 INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \
162 INTEL_VGA_DEVICE(0x0A02, info), /* ULT GT1 desktop */ \
163 INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \
164 INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \
165 INTEL_VGA_DEVICE(0x0A0A, info), /* ULT GT1 server */ \
166 INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \
167 INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \
168 INTEL_VGA_DEVICE(0x0A0B, info), /* ULT GT1 reserved */ \
169 INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \
170 INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \
171 INTEL_VGA_DEVICE(0x0D02, info), /* CRW GT1 desktop */ \
172 INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \
173 INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \
174 INTEL_VGA_DEVICE(0x0D0A, info), /* CRW GT1 server */ \
175 INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \
176 INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \
177 INTEL_VGA_DEVICE(0x0D0B, info), /* CRW GT1 reserved */ \
178 INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \
179 INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \
180 INTEL_VGA_DEVICE(0x0D0E, info), /* CRW GT1 reserved */ \
181 INTEL_VGA_DEVICE(0x0D1E, info), /* CRW GT2 reserved */ \
182 INTEL_VGA_DEVICE(0x0D2E, info) /* CRW GT3 reserved */ \
183
184#define INTEL_HSW_M_IDS(info) \
185 INTEL_VGA_DEVICE(0x0406, info), /* GT1 mobile */ \
186 INTEL_VGA_DEVICE(0x0416, info), /* GT2 mobile */ \
187 INTEL_VGA_DEVICE(0x0426, info), /* GT2 mobile */ \
188 INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \
189 INTEL_VGA_DEVICE(0x0C16, info), /* SDV GT2 mobile */ \
190 INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \
191 INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \
192 INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \
193 INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \
194 INTEL_VGA_DEVICE(0x0A0E, info), /* ULT GT1 reserved */ \
195 INTEL_VGA_DEVICE(0x0A1E, info), /* ULT GT2 reserved */ \
196 INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \
197 INTEL_VGA_DEVICE(0x0D06, info), /* CRW GT1 mobile */ \
198 INTEL_VGA_DEVICE(0x0D16, info), /* CRW GT2 mobile */ \
199 INTEL_VGA_DEVICE(0x0D26, info) /* CRW GT3 mobile */
200
201#define INTEL_VLV_M_IDS(info) \
202 INTEL_VGA_DEVICE(0x0f30, info), \
203 INTEL_VGA_DEVICE(0x0f31, info), \
204 INTEL_VGA_DEVICE(0x0f32, info), \
205 INTEL_VGA_DEVICE(0x0f33, info), \
206 INTEL_VGA_DEVICE(0x0157, info)
207
208#define INTEL_VLV_D_IDS(info) \
209 INTEL_VGA_DEVICE(0x0155, info)
210
211#define _INTEL_BDW_M(gt, id, info) \
212 INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info)
213#define _INTEL_BDW_D(gt, id, info) \
214 INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info)
215
216#define _INTEL_BDW_M_IDS(gt, info) \
217 _INTEL_BDW_M(gt, 0x1602, info), /* ULT */ \
218 _INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \
219 _INTEL_BDW_M(gt, 0x160B, info), /* Iris */ \
220 _INTEL_BDW_M(gt, 0x160E, info) /* ULX */
221
222#define _INTEL_BDW_D_IDS(gt, info) \
223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \
224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */
225
226#define INTEL_BDW_M_IDS(info) \
227 _INTEL_BDW_M_IDS(1, info), \
228 _INTEL_BDW_M_IDS(2, info), \
229 _INTEL_BDW_M_IDS(3, info)
230
231#define INTEL_BDW_D_IDS(info) \
232 _INTEL_BDW_D_IDS(1, info), \
233 _INTEL_BDW_D_IDS(2, info), \
234 _INTEL_BDW_D_IDS(3, info)
235
236#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 751eaffbf0d5..ee127ec33c60 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -169,6 +169,7 @@ struct ttm_tt;
169 * @offset: The current GPU offset, which can have different meanings 169 * @offset: The current GPU offset, which can have different meanings
170 * depending on the memory type. For SYSTEM type memory, it should be 0. 170 * depending on the memory type. For SYSTEM type memory, it should be 0.
171 * @cur_placement: Hint of current placement. 171 * @cur_placement: Hint of current placement.
172 * @wu_mutex: Wait unreserved mutex.
172 * 173 *
173 * Base class for TTM buffer object, that deals with data placement and CPU 174 * Base class for TTM buffer object, that deals with data placement and CPU
174 * mappings. GPU mappings are really up to the driver, but for simpler GPUs 175 * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -250,6 +251,7 @@ struct ttm_buffer_object {
250 251
251 struct reservation_object *resv; 252 struct reservation_object *resv;
252 struct reservation_object ttm_resv; 253 struct reservation_object ttm_resv;
254 struct mutex wu_mutex;
253}; 255};
254 256
255/** 257/**
@@ -702,5 +704,5 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
702 size_t count, loff_t *f_pos, bool write); 704 size_t count, loff_t *f_pos, bool write);
703 705
704extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); 706extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
705 707extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
706#endif 708#endif
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index ec8a1d306510..16db7d01a336 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -70,7 +70,8 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
70/** 70/**
71 * function ttm_eu_reserve_buffers 71 * function ttm_eu_reserve_buffers
72 * 72 *
73 * @ticket: [out] ww_acquire_ctx returned by call. 73 * @ticket: [out] ww_acquire_ctx filled in by call, or NULL if only
74 * non-blocking reserves should be tried.
74 * @list: thread private list of ttm_validate_buffer structs. 75 * @list: thread private list of ttm_validate_buffer structs.
75 * 76 *
76 * Tries to reserve bos pointed to by the list entries for validation. 77 * Tries to reserve bos pointed to by the list entries for validation.
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index fc0cf0649901..58b029894eb3 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -41,6 +41,7 @@
41#include <drm/drm_hashtab.h> 41#include <drm/drm_hashtab.h>
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <linux/rcupdate.h> 43#include <linux/rcupdate.h>
44#include <linux/dma-buf.h>
44#include <ttm/ttm_memory.h> 45#include <ttm/ttm_memory.h>
45 46
46/** 47/**
@@ -77,6 +78,7 @@ enum ttm_object_type {
77 ttm_fence_type, 78 ttm_fence_type,
78 ttm_buffer_type, 79 ttm_buffer_type,
79 ttm_lock_type, 80 ttm_lock_type,
81 ttm_prime_type,
80 ttm_driver_type0 = 256, 82 ttm_driver_type0 = 256,
81 ttm_driver_type1, 83 ttm_driver_type1,
82 ttm_driver_type2, 84 ttm_driver_type2,
@@ -132,6 +134,30 @@ struct ttm_base_object {
132 enum ttm_ref_type ref_type); 134 enum ttm_ref_type ref_type);
133}; 135};
134 136
137
138/**
139 * struct ttm_prime_object - Modified base object that is prime-aware
140 *
141 * @base: struct ttm_base_object that we derive from
142 * @mutex: Mutex protecting the @dma_buf member.
143 * @size: Size of the dma_buf associated with this object
144 * @real_type: Type of the underlying object. Needed since we're setting
145 * the value of @base::object_type to ttm_prime_type
146 * @dma_buf: Non ref-coutned pointer to a struct dma_buf created from this
147 * object.
148 * @refcount_release: The underlying object's release method. Needed since
149 * we set @base::refcount_release to our own release method.
150 */
151
152struct ttm_prime_object {
153 struct ttm_base_object base;
154 struct mutex mutex;
155 size_t size;
156 enum ttm_object_type real_type;
157 struct dma_buf *dma_buf;
158 void (*refcount_release) (struct ttm_base_object **);
159};
160
135/** 161/**
136 * ttm_base_object_init 162 * ttm_base_object_init
137 * 163 *
@@ -248,14 +274,18 @@ extern void ttm_object_file_release(struct ttm_object_file **p_tfile);
248/** 274/**
249 * ttm_object device init - initialize a struct ttm_object_device 275 * ttm_object device init - initialize a struct ttm_object_device
250 * 276 *
277 * @mem_glob: struct ttm_mem_global for memory accounting.
251 * @hash_order: Order of hash table used to hash the base objects. 278 * @hash_order: Order of hash table used to hash the base objects.
279 * @ops: DMA buf ops for prime objects of this device.
252 * 280 *
253 * This function is typically called on device initialization to prepare 281 * This function is typically called on device initialization to prepare
254 * data structures needed for ttm base and ref objects. 282 * data structures needed for ttm base and ref objects.
255 */ 283 */
256 284
257extern struct ttm_object_device *ttm_object_device_init 285extern struct ttm_object_device *
258 (struct ttm_mem_global *mem_glob, unsigned int hash_order); 286ttm_object_device_init(struct ttm_mem_global *mem_glob,
287 unsigned int hash_order,
288 const struct dma_buf_ops *ops);
259 289
260/** 290/**
261 * ttm_object_device_release - release data held by a ttm_object_device 291 * ttm_object_device_release - release data held by a ttm_object_device
@@ -272,4 +302,31 @@ extern void ttm_object_device_release(struct ttm_object_device **p_tdev);
272 302
273#define ttm_base_object_kfree(__object, __base)\ 303#define ttm_base_object_kfree(__object, __base)\
274 kfree_rcu(__object, __base.rhead) 304 kfree_rcu(__object, __base.rhead)
305
306extern int ttm_prime_object_init(struct ttm_object_file *tfile,
307 size_t size,
308 struct ttm_prime_object *prime,
309 bool shareable,
310 enum ttm_object_type type,
311 void (*refcount_release)
312 (struct ttm_base_object **),
313 void (*ref_obj_release)
314 (struct ttm_base_object *,
315 enum ttm_ref_type ref_type));
316
317static inline enum ttm_object_type
318ttm_base_object_type(struct ttm_base_object *base)
319{
320 return (base->object_type == ttm_prime_type) ?
321 container_of(base, struct ttm_prime_object, base)->real_type :
322 base->object_type;
323}
324extern int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
325 int fd, u32 *handle);
326extern int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
327 uint32_t handle, uint32_t flags,
328 int *prime_fd);
329
330#define ttm_prime_object_kfree(__obj, __prime) \
331 kfree_rcu(__obj, __prime.base.rhead)
275#endif 332#endif
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 706b962c6467..d1f61bfe0ebe 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -62,7 +62,7 @@ extern void ttm_pool_unpopulate(struct ttm_tt *ttm);
62extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 62extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
63 63
64 64
65#ifdef CONFIG_SWIOTLB 65#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
66/** 66/**
67 * Initialize pool allocator. 67 * Initialize pool allocator.
68 */ 68 */
@@ -94,6 +94,15 @@ static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
94{ 94{
95 return 0; 95 return 0;
96} 96}
97static inline int ttm_dma_populate(struct ttm_dma_tt *ttm_dma,
98 struct device *dev)
99{
100 return -ENOMEM;
101}
102static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,
103 struct device *dev)
104{
105}
97#endif 106#endif
98 107
99#endif 108#endif
diff --git a/include/dt-bindings/clock/efm32-cmu.h b/include/dt-bindings/clock/efm32-cmu.h
new file mode 100644
index 000000000000..b21b91e736af
--- /dev/null
+++ b/include/dt-bindings/clock/efm32-cmu.h
@@ -0,0 +1,42 @@
1#ifndef __DT_BINDINGS_CLOCK_EFM32_CMU_H
2#define __DT_BINDINGS_CLOCK_EFM32_CMU_H
3
4#define clk_HFXO 0
5#define clk_HFRCO 1
6#define clk_LFXO 2
7#define clk_LFRCO 3
8#define clk_ULFRCO 4
9#define clk_AUXHFRCO 5
10#define clk_HFCLKNODIV 6
11#define clk_HFCLK 7
12#define clk_HFPERCLK 8
13#define clk_HFCORECLK 9
14#define clk_LFACLK 10
15#define clk_LFBCLK 11
16#define clk_WDOGCLK 12
17#define clk_HFCORECLKDMA 13
18#define clk_HFCORECLKAES 14
19#define clk_HFCORECLKUSBC 15
20#define clk_HFCORECLKUSB 16
21#define clk_HFCORECLKLE 17
22#define clk_HFCORECLKEBI 18
23#define clk_HFPERCLKUSART0 19
24#define clk_HFPERCLKUSART1 20
25#define clk_HFPERCLKUSART2 21
26#define clk_HFPERCLKUART0 22
27#define clk_HFPERCLKUART1 23
28#define clk_HFPERCLKTIMER0 24
29#define clk_HFPERCLKTIMER1 25
30#define clk_HFPERCLKTIMER2 26
31#define clk_HFPERCLKTIMER3 27
32#define clk_HFPERCLKACMP0 28
33#define clk_HFPERCLKACMP1 29
34#define clk_HFPERCLKI2C0 30
35#define clk_HFPERCLKI2C1 31
36#define clk_HFPERCLKGPIO 32
37#define clk_HFPERCLKVCMP 33
38#define clk_HFPERCLKPRS 34
39#define clk_HFPERCLKADC0 35
40#define clk_HFPERCLKDAC0 36
41
42#endif /* __DT_BINDINGS_CLOCK_EFM32_CMU_H */
diff --git a/include/dt-bindings/clock/samsung,s3c64xx-clock.h b/include/dt-bindings/clock/samsung,s3c64xx-clock.h
new file mode 100644
index 000000000000..ad95c7f50090
--- /dev/null
+++ b/include/dt-bindings/clock/samsung,s3c64xx-clock.h
@@ -0,0 +1,178 @@
1/*
2 * Copyright (c) 2013 Tomasz Figa <tomasz.figa at gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Device Tree binding constants for Samsung S3C64xx clock controller.
9*/
10
11#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C64XX_CLOCK_H
12#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C64XX_CLOCK_H
13
14/*
15 * Let each exported clock get a unique index, which is used on DT-enabled
16 * platforms to lookup the clock from a clock specifier. These indices are
17 * therefore considered an ABI and so must not be changed. This implies
18 * that new clocks should be added either in free spaces between clock groups
19 * or at the end.
20 */
21
22/* Core clocks. */
23#define CLK27M 1
24#define CLK48M 2
25#define FOUT_APLL 3
26#define FOUT_MPLL 4
27#define FOUT_EPLL 5
28#define ARMCLK 6
29#define HCLKX2 7
30#define HCLK 8
31#define PCLK 9
32
33/* HCLK bus clocks. */
34#define HCLK_3DSE 16
35#define HCLK_UHOST 17
36#define HCLK_SECUR 18
37#define HCLK_SDMA1 19
38#define HCLK_SDMA0 20
39#define HCLK_IROM 21
40#define HCLK_DDR1 22
41#define HCLK_MEM1 23
42#define HCLK_MEM0 24
43#define HCLK_USB 25
44#define HCLK_HSMMC2 26
45#define HCLK_HSMMC1 27
46#define HCLK_HSMMC0 28
47#define HCLK_MDP 29
48#define HCLK_DHOST 30
49#define HCLK_IHOST 31
50#define HCLK_DMA1 32
51#define HCLK_DMA0 33
52#define HCLK_JPEG 34
53#define HCLK_CAMIF 35
54#define HCLK_SCALER 36
55#define HCLK_2D 37
56#define HCLK_TV 38
57#define HCLK_POST0 39
58#define HCLK_ROT 40
59#define HCLK_LCD 41
60#define HCLK_TZIC 42
61#define HCLK_INTC 43
62#define HCLK_MFC 44
63#define HCLK_DDR0 45
64
65/* PCLK bus clocks. */
66#define PCLK_IIC1 48
67#define PCLK_IIS2 49
68#define PCLK_SKEY 50
69#define PCLK_CHIPID 51
70#define PCLK_SPI1 52
71#define PCLK_SPI0 53
72#define PCLK_HSIRX 54
73#define PCLK_HSITX 55
74#define PCLK_GPIO 56
75#define PCLK_IIC0 57
76#define PCLK_IIS1 58
77#define PCLK_IIS0 59
78#define PCLK_AC97 60
79#define PCLK_TZPC 61
80#define PCLK_TSADC 62
81#define PCLK_KEYPAD 63
82#define PCLK_IRDA 64
83#define PCLK_PCM1 65
84#define PCLK_PCM0 66
85#define PCLK_PWM 67
86#define PCLK_RTC 68
87#define PCLK_WDT 69
88#define PCLK_UART3 70
89#define PCLK_UART2 71
90#define PCLK_UART1 72
91#define PCLK_UART0 73
92#define PCLK_MFC 74
93
94/* Special clocks. */
95#define SCLK_UHOST 80
96#define SCLK_MMC2_48 81
97#define SCLK_MMC1_48 82
98#define SCLK_MMC0_48 83
99#define SCLK_MMC2 84
100#define SCLK_MMC1 85
101#define SCLK_MMC0 86
102#define SCLK_SPI1_48 87
103#define SCLK_SPI0_48 88
104#define SCLK_SPI1 89
105#define SCLK_SPI0 90
106#define SCLK_DAC27 91
107#define SCLK_TV27 92
108#define SCLK_SCALER27 93
109#define SCLK_SCALER 94
110#define SCLK_LCD27 95
111#define SCLK_LCD 96
112#define SCLK_FIMC 97
113#define SCLK_POST0_27 98
114#define SCLK_AUDIO2 99
115#define SCLK_POST0 100
116#define SCLK_AUDIO1 101
117#define SCLK_AUDIO0 102
118#define SCLK_SECUR 103
119#define SCLK_IRDA 104
120#define SCLK_UART 105
121#define SCLK_MFC 106
122#define SCLK_CAM 107
123#define SCLK_JPEG 108
124#define SCLK_ONENAND 109
125
126/* MEM0 bus clocks - S3C6410-specific. */
127#define MEM0_CFCON 112
128#define MEM0_ONENAND1 113
129#define MEM0_ONENAND0 114
130#define MEM0_NFCON 115
131#define MEM0_SROM 116
132
133/* Muxes. */
134#define MOUT_APLL 128
135#define MOUT_MPLL 129
136#define MOUT_EPLL 130
137#define MOUT_MFC 131
138#define MOUT_AUDIO0 132
139#define MOUT_AUDIO1 133
140#define MOUT_UART 134
141#define MOUT_SPI0 135
142#define MOUT_SPI1 136
143#define MOUT_MMC0 137
144#define MOUT_MMC1 138
145#define MOUT_MMC2 139
146#define MOUT_UHOST 140
147#define MOUT_IRDA 141
148#define MOUT_LCD 142
149#define MOUT_SCALER 143
150#define MOUT_DAC27 144
151#define MOUT_TV27 145
152#define MOUT_AUDIO2 146
153
154/* Dividers. */
155#define DOUT_MPLL 160
156#define DOUT_SECUR 161
157#define DOUT_CAM 162
158#define DOUT_JPEG 163
159#define DOUT_MFC 164
160#define DOUT_MMC0 165
161#define DOUT_MMC1 166
162#define DOUT_MMC2 167
163#define DOUT_LCD 168
164#define DOUT_SCALER 169
165#define DOUT_UHOST 170
166#define DOUT_SPI0 171
167#define DOUT_SPI1 172
168#define DOUT_AUDIO0 173
169#define DOUT_AUDIO1 174
170#define DOUT_UART 175
171#define DOUT_IRDA 176
172#define DOUT_FIMC 177
173#define DOUT_AUDIO2 178
174
175/* Total number of clocks. */
176#define NR_CLKS (DOUT_AUDIO2 + 1)
177
178#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C64XX_CLOCK_H */
diff --git a/include/dt-bindings/input/input.h b/include/dt-bindings/input/input.h
new file mode 100644
index 000000000000..042e7b3b6296
--- /dev/null
+++ b/include/dt-bindings/input/input.h
@@ -0,0 +1,525 @@
1/*
2 * This header provides constants for most input bindings.
3 *
4 * Most input bindings include key code, matrix key code format.
5 * In most cases, key code and matrix key code format uses
6 * the standard values/macro defined in this header.
7 */
8
9#ifndef _DT_BINDINGS_INPUT_INPUT_H
10#define _DT_BINDINGS_INPUT_INPUT_H
11
12#define KEY_RESERVED 0
13#define KEY_ESC 1
14#define KEY_1 2
15#define KEY_2 3
16#define KEY_3 4
17#define KEY_4 5
18#define KEY_5 6
19#define KEY_6 7
20#define KEY_7 8
21#define KEY_8 9
22#define KEY_9 10
23#define KEY_0 11
24#define KEY_MINUS 12
25#define KEY_EQUAL 13
26#define KEY_BACKSPACE 14
27#define KEY_TAB 15
28#define KEY_Q 16
29#define KEY_W 17
30#define KEY_E 18
31#define KEY_R 19
32#define KEY_T 20
33#define KEY_Y 21
34#define KEY_U 22
35#define KEY_I 23
36#define KEY_O 24
37#define KEY_P 25
38#define KEY_LEFTBRACE 26
39#define KEY_RIGHTBRACE 27
40#define KEY_ENTER 28
41#define KEY_LEFTCTRL 29
42#define KEY_A 30
43#define KEY_S 31
44#define KEY_D 32
45#define KEY_F 33
46#define KEY_G 34
47#define KEY_H 35
48#define KEY_J 36
49#define KEY_K 37
50#define KEY_L 38
51#define KEY_SEMICOLON 39
52#define KEY_APOSTROPHE 40
53#define KEY_GRAVE 41
54#define KEY_LEFTSHIFT 42
55#define KEY_BACKSLASH 43
56#define KEY_Z 44
57#define KEY_X 45
58#define KEY_C 46
59#define KEY_V 47
60#define KEY_B 48
61#define KEY_N 49
62#define KEY_M 50
63#define KEY_COMMA 51
64#define KEY_DOT 52
65#define KEY_SLASH 53
66#define KEY_RIGHTSHIFT 54
67#define KEY_KPASTERISK 55
68#define KEY_LEFTALT 56
69#define KEY_SPACE 57
70#define KEY_CAPSLOCK 58
71#define KEY_F1 59
72#define KEY_F2 60
73#define KEY_F3 61
74#define KEY_F4 62
75#define KEY_F5 63
76#define KEY_F6 64
77#define KEY_F7 65
78#define KEY_F8 66
79#define KEY_F9 67
80#define KEY_F10 68
81#define KEY_NUMLOCK 69
82#define KEY_SCROLLLOCK 70
83#define KEY_KP7 71
84#define KEY_KP8 72
85#define KEY_KP9 73
86#define KEY_KPMINUS 74
87#define KEY_KP4 75
88#define KEY_KP5 76
89#define KEY_KP6 77
90#define KEY_KPPLUS 78
91#define KEY_KP1 79
92#define KEY_KP2 80
93#define KEY_KP3 81
94#define KEY_KP0 82
95#define KEY_KPDOT 83
96
97#define KEY_ZENKAKUHANKAKU 85
98#define KEY_102ND 86
99#define KEY_F11 87
100#define KEY_F12 88
101#define KEY_RO 89
102#define KEY_KATAKANA 90
103#define KEY_HIRAGANA 91
104#define KEY_HENKAN 92
105#define KEY_KATAKANAHIRAGANA 93
106#define KEY_MUHENKAN 94
107#define KEY_KPJPCOMMA 95
108#define KEY_KPENTER 96
109#define KEY_RIGHTCTRL 97
110#define KEY_KPSLASH 98
111#define KEY_SYSRQ 99
112#define KEY_RIGHTALT 100
113#define KEY_LINEFEED 101
114#define KEY_HOME 102
115#define KEY_UP 103
116#define KEY_PAGEUP 104
117#define KEY_LEFT 105
118#define KEY_RIGHT 106
119#define KEY_END 107
120#define KEY_DOWN 108
121#define KEY_PAGEDOWN 109
122#define KEY_INSERT 110
123#define KEY_DELETE 111
124#define KEY_MACRO 112
125#define KEY_MUTE 113
126#define KEY_VOLUMEDOWN 114
127#define KEY_VOLUMEUP 115
128#define KEY_POWER 116 /* SC System Power Down */
129#define KEY_KPEQUAL 117
130#define KEY_KPPLUSMINUS 118
131#define KEY_PAUSE 119
132#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
133
134#define KEY_KPCOMMA 121
135#define KEY_HANGEUL 122
136#define KEY_HANGUEL KEY_HANGEUL
137#define KEY_HANJA 123
138#define KEY_YEN 124
139#define KEY_LEFTMETA 125
140#define KEY_RIGHTMETA 126
141#define KEY_COMPOSE 127
142
143#define KEY_STOP 128 /* AC Stop */
144#define KEY_AGAIN 129
145#define KEY_PROPS 130 /* AC Properties */
146#define KEY_UNDO 131 /* AC Undo */
147#define KEY_FRONT 132
148#define KEY_COPY 133 /* AC Copy */
149#define KEY_OPEN 134 /* AC Open */
150#define KEY_PASTE 135 /* AC Paste */
151#define KEY_FIND 136 /* AC Search */
152#define KEY_CUT 137 /* AC Cut */
153#define KEY_HELP 138 /* AL Integrated Help Center */
154#define KEY_MENU 139 /* Menu (show menu) */
155#define KEY_CALC 140 /* AL Calculator */
156#define KEY_SETUP 141
157#define KEY_SLEEP 142 /* SC System Sleep */
158#define KEY_WAKEUP 143 /* System Wake Up */
159#define KEY_FILE 144 /* AL Local Machine Browser */
160#define KEY_SENDFILE 145
161#define KEY_DELETEFILE 146
162#define KEY_XFER 147
163#define KEY_PROG1 148
164#define KEY_PROG2 149
165#define KEY_WWW 150 /* AL Internet Browser */
166#define KEY_MSDOS 151
167#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
168#define KEY_SCREENLOCK KEY_COFFEE
169#define KEY_DIRECTION 153
170#define KEY_CYCLEWINDOWS 154
171#define KEY_MAIL 155
172#define KEY_BOOKMARKS 156 /* AC Bookmarks */
173#define KEY_COMPUTER 157
174#define KEY_BACK 158 /* AC Back */
175#define KEY_FORWARD 159 /* AC Forward */
176#define KEY_CLOSECD 160
177#define KEY_EJECTCD 161
178#define KEY_EJECTCLOSECD 162
179#define KEY_NEXTSONG 163
180#define KEY_PLAYPAUSE 164
181#define KEY_PREVIOUSSONG 165
182#define KEY_STOPCD 166
183#define KEY_RECORD 167
184#define KEY_REWIND 168
185#define KEY_PHONE 169 /* Media Select Telephone */
186#define KEY_ISO 170
187#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
188#define KEY_HOMEPAGE 172 /* AC Home */
189#define KEY_REFRESH 173 /* AC Refresh */
190#define KEY_EXIT 174 /* AC Exit */
191#define KEY_MOVE 175
192#define KEY_EDIT 176
193#define KEY_SCROLLUP 177
194#define KEY_SCROLLDOWN 178
195#define KEY_KPLEFTPAREN 179
196#define KEY_KPRIGHTPAREN 180
197#define KEY_NEW 181 /* AC New */
198#define KEY_REDO 182 /* AC Redo/Repeat */
199
200#define KEY_F13 183
201#define KEY_F14 184
202#define KEY_F15 185
203#define KEY_F16 186
204#define KEY_F17 187
205#define KEY_F18 188
206#define KEY_F19 189
207#define KEY_F20 190
208#define KEY_F21 191
209#define KEY_F22 192
210#define KEY_F23 193
211#define KEY_F24 194
212
213#define KEY_PLAYCD 200
214#define KEY_PAUSECD 201
215#define KEY_PROG3 202
216#define KEY_PROG4 203
217#define KEY_DASHBOARD 204 /* AL Dashboard */
218#define KEY_SUSPEND 205
219#define KEY_CLOSE 206 /* AC Close */
220#define KEY_PLAY 207
221#define KEY_FASTFORWARD 208
222#define KEY_BASSBOOST 209
223#define KEY_PRINT 210 /* AC Print */
224#define KEY_HP 211
225#define KEY_CAMERA 212
226#define KEY_SOUND 213
227#define KEY_QUESTION 214
228#define KEY_EMAIL 215
229#define KEY_CHAT 216
230#define KEY_SEARCH 217
231#define KEY_CONNECT 218
232#define KEY_FINANCE 219 /* AL Checkbook/Finance */
233#define KEY_SPORT 220
234#define KEY_SHOP 221
235#define KEY_ALTERASE 222
236#define KEY_CANCEL 223 /* AC Cancel */
237#define KEY_BRIGHTNESSDOWN 224
238#define KEY_BRIGHTNESSUP 225
239#define KEY_MEDIA 226
240
241#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
242 outputs (Monitor/LCD/TV-out/etc) */
243#define KEY_KBDILLUMTOGGLE 228
244#define KEY_KBDILLUMDOWN 229
245#define KEY_KBDILLUMUP 230
246
247#define KEY_SEND 231 /* AC Send */
248#define KEY_REPLY 232 /* AC Reply */
249#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
250#define KEY_SAVE 234 /* AC Save */
251#define KEY_DOCUMENTS 235
252
253#define KEY_BATTERY 236
254
255#define KEY_BLUETOOTH 237
256#define KEY_WLAN 238
257#define KEY_UWB 239
258
259#define KEY_UNKNOWN 240
260
261#define KEY_VIDEO_NEXT 241 /* drive next video source */
262#define KEY_VIDEO_PREV 242 /* drive previous video source */
263#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
264#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
265#define KEY_DISPLAY_OFF 245 /* display device to off state */
266
267#define KEY_WIMAX 246
268#define KEY_RFKILL 247 /* Key that controls all radios */
269
270#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
271
272/* Code 255 is reserved for special needs of AT keyboard driver */
273
274#define BTN_MISC 0x100
275#define BTN_0 0x100
276#define BTN_1 0x101
277#define BTN_2 0x102
278#define BTN_3 0x103
279#define BTN_4 0x104
280#define BTN_5 0x105
281#define BTN_6 0x106
282#define BTN_7 0x107
283#define BTN_8 0x108
284#define BTN_9 0x109
285
286#define BTN_MOUSE 0x110
287#define BTN_LEFT 0x110
288#define BTN_RIGHT 0x111
289#define BTN_MIDDLE 0x112
290#define BTN_SIDE 0x113
291#define BTN_EXTRA 0x114
292#define BTN_FORWARD 0x115
293#define BTN_BACK 0x116
294#define BTN_TASK 0x117
295
296#define BTN_JOYSTICK 0x120
297#define BTN_TRIGGER 0x120
298#define BTN_THUMB 0x121
299#define BTN_THUMB2 0x122
300#define BTN_TOP 0x123
301#define BTN_TOP2 0x124
302#define BTN_PINKIE 0x125
303#define BTN_BASE 0x126
304#define BTN_BASE2 0x127
305#define BTN_BASE3 0x128
306#define BTN_BASE4 0x129
307#define BTN_BASE5 0x12a
308#define BTN_BASE6 0x12b
309#define BTN_DEAD 0x12f
310
311#define BTN_GAMEPAD 0x130
312#define BTN_SOUTH 0x130
313#define BTN_A BTN_SOUTH
314#define BTN_EAST 0x131
315#define BTN_B BTN_EAST
316#define BTN_C 0x132
317#define BTN_NORTH 0x133
318#define BTN_X BTN_NORTH
319#define BTN_WEST 0x134
320#define BTN_Y BTN_WEST
321#define BTN_Z 0x135
322#define BTN_TL 0x136
323#define BTN_TR 0x137
324#define BTN_TL2 0x138
325#define BTN_TR2 0x139
326#define BTN_SELECT 0x13a
327#define BTN_START 0x13b
328#define BTN_MODE 0x13c
329#define BTN_THUMBL 0x13d
330#define BTN_THUMBR 0x13e
331
332#define BTN_DIGI 0x140
333#define BTN_TOOL_PEN 0x140
334#define BTN_TOOL_RUBBER 0x141
335#define BTN_TOOL_BRUSH 0x142
336#define BTN_TOOL_PENCIL 0x143
337#define BTN_TOOL_AIRBRUSH 0x144
338#define BTN_TOOL_FINGER 0x145
339#define BTN_TOOL_MOUSE 0x146
340#define BTN_TOOL_LENS 0x147
341#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
342#define BTN_TOUCH 0x14a
343#define BTN_STYLUS 0x14b
344#define BTN_STYLUS2 0x14c
345#define BTN_TOOL_DOUBLETAP 0x14d
346#define BTN_TOOL_TRIPLETAP 0x14e
347#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
348
349#define BTN_WHEEL 0x150
350#define BTN_GEAR_DOWN 0x150
351#define BTN_GEAR_UP 0x151
352
353#define KEY_OK 0x160
354#define KEY_SELECT 0x161
355#define KEY_GOTO 0x162
356#define KEY_CLEAR 0x163
357#define KEY_POWER2 0x164
358#define KEY_OPTION 0x165
359#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
360#define KEY_TIME 0x167
361#define KEY_VENDOR 0x168
362#define KEY_ARCHIVE 0x169
363#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
364#define KEY_CHANNEL 0x16b
365#define KEY_FAVORITES 0x16c
366#define KEY_EPG 0x16d
367#define KEY_PVR 0x16e /* Media Select Home */
368#define KEY_MHP 0x16f
369#define KEY_LANGUAGE 0x170
370#define KEY_TITLE 0x171
371#define KEY_SUBTITLE 0x172
372#define KEY_ANGLE 0x173
373#define KEY_ZOOM 0x174
374#define KEY_MODE 0x175
375#define KEY_KEYBOARD 0x176
376#define KEY_SCREEN 0x177
377#define KEY_PC 0x178 /* Media Select Computer */
378#define KEY_TV 0x179 /* Media Select TV */
379#define KEY_TV2 0x17a /* Media Select Cable */
380#define KEY_VCR 0x17b /* Media Select VCR */
381#define KEY_VCR2 0x17c /* VCR Plus */
382#define KEY_SAT 0x17d /* Media Select Satellite */
383#define KEY_SAT2 0x17e
384#define KEY_CD 0x17f /* Media Select CD */
385#define KEY_TAPE 0x180 /* Media Select Tape */
386#define KEY_RADIO 0x181
387#define KEY_TUNER 0x182 /* Media Select Tuner */
388#define KEY_PLAYER 0x183
389#define KEY_TEXT 0x184
390#define KEY_DVD 0x185 /* Media Select DVD */
391#define KEY_AUX 0x186
392#define KEY_MP3 0x187
393#define KEY_AUDIO 0x188 /* AL Audio Browser */
394#define KEY_VIDEO 0x189 /* AL Movie Browser */
395#define KEY_DIRECTORY 0x18a
396#define KEY_LIST 0x18b
397#define KEY_MEMO 0x18c /* Media Select Messages */
398#define KEY_CALENDAR 0x18d
399#define KEY_RED 0x18e
400#define KEY_GREEN 0x18f
401#define KEY_YELLOW 0x190
402#define KEY_BLUE 0x191
403#define KEY_CHANNELUP 0x192 /* Channel Increment */
404#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
405#define KEY_FIRST 0x194
406#define KEY_LAST 0x195 /* Recall Last */
407#define KEY_AB 0x196
408#define KEY_NEXT 0x197
409#define KEY_RESTART 0x198
410#define KEY_SLOW 0x199
411#define KEY_SHUFFLE 0x19a
412#define KEY_BREAK 0x19b
413#define KEY_PREVIOUS 0x19c
414#define KEY_DIGITS 0x19d
415#define KEY_TEEN 0x19e
416#define KEY_TWEN 0x19f
417#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
418#define KEY_GAMES 0x1a1 /* Media Select Games */
419#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
420#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
421#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
422#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
423#define KEY_EDITOR 0x1a6 /* AL Text Editor */
424#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
425#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
426#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
427#define KEY_DATABASE 0x1aa /* AL Database App */
428#define KEY_NEWS 0x1ab /* AL Newsreader */
429#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
430#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
431#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
432#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
433#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
434#define KEY_LOGOFF 0x1b1 /* AL Logoff */
435
436#define KEY_DOLLAR 0x1b2
437#define KEY_EURO 0x1b3
438
439#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
440#define KEY_FRAMEFORWARD 0x1b5
441#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
442#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
443#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
444#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
445#define KEY_IMAGES 0x1ba /* AL Image Browser */
446
447#define KEY_DEL_EOL 0x1c0
448#define KEY_DEL_EOS 0x1c1
449#define KEY_INS_LINE 0x1c2
450#define KEY_DEL_LINE 0x1c3
451
452#define KEY_FN 0x1d0
453#define KEY_FN_ESC 0x1d1
454#define KEY_FN_F1 0x1d2
455#define KEY_FN_F2 0x1d3
456#define KEY_FN_F3 0x1d4
457#define KEY_FN_F4 0x1d5
458#define KEY_FN_F5 0x1d6
459#define KEY_FN_F6 0x1d7
460#define KEY_FN_F7 0x1d8
461#define KEY_FN_F8 0x1d9
462#define KEY_FN_F9 0x1da
463#define KEY_FN_F10 0x1db
464#define KEY_FN_F11 0x1dc
465#define KEY_FN_F12 0x1dd
466#define KEY_FN_1 0x1de
467#define KEY_FN_2 0x1df
468#define KEY_FN_D 0x1e0
469#define KEY_FN_E 0x1e1
470#define KEY_FN_F 0x1e2
471#define KEY_FN_S 0x1e3
472#define KEY_FN_B 0x1e4
473
474#define KEY_BRL_DOT1 0x1f1
475#define KEY_BRL_DOT2 0x1f2
476#define KEY_BRL_DOT3 0x1f3
477#define KEY_BRL_DOT4 0x1f4
478#define KEY_BRL_DOT5 0x1f5
479#define KEY_BRL_DOT6 0x1f6
480#define KEY_BRL_DOT7 0x1f7
481#define KEY_BRL_DOT8 0x1f8
482#define KEY_BRL_DOT9 0x1f9
483#define KEY_BRL_DOT10 0x1fa
484
485#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
486#define KEY_NUMERIC_1 0x201 /* and other keypads */
487#define KEY_NUMERIC_2 0x202
488#define KEY_NUMERIC_3 0x203
489#define KEY_NUMERIC_4 0x204
490#define KEY_NUMERIC_5 0x205
491#define KEY_NUMERIC_6 0x206
492#define KEY_NUMERIC_7 0x207
493#define KEY_NUMERIC_8 0x208
494#define KEY_NUMERIC_9 0x209
495#define KEY_NUMERIC_STAR 0x20a
496#define KEY_NUMERIC_POUND 0x20b
497
498#define KEY_CAMERA_FOCUS 0x210
499#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
500
501#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
502#define KEY_TOUCHPAD_ON 0x213
503#define KEY_TOUCHPAD_OFF 0x214
504
505#define KEY_CAMERA_ZOOMIN 0x215
506#define KEY_CAMERA_ZOOMOUT 0x216
507#define KEY_CAMERA_UP 0x217
508#define KEY_CAMERA_DOWN 0x218
509#define KEY_CAMERA_LEFT 0x219
510#define KEY_CAMERA_RIGHT 0x21a
511
512#define KEY_ATTENDANT_ON 0x21b
513#define KEY_ATTENDANT_OFF 0x21c
514#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
515#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
516
517#define BTN_DPAD_UP 0x220
518#define BTN_DPAD_DOWN 0x221
519#define BTN_DPAD_LEFT 0x222
520#define BTN_DPAD_RIGHT 0x223
521
522#define MATRIX_KEY(row, col, code) \
523 ((((row) & 0xFF) << 24) | (((col) & 0xFF) << 16) | ((code) & 0xFFFF))
524
525#endif /* _DT_BINDINGS_INPUT_INPUT_H */
diff --git a/include/dt-bindings/mfd/as3722.h b/include/dt-bindings/mfd/as3722.h
new file mode 100644
index 000000000000..0e692562d77b
--- /dev/null
+++ b/include/dt-bindings/mfd/as3722.h
@@ -0,0 +1,52 @@
1/*
2 * This header provides macros for ams AS3722 device bindings.
3 *
4 * Copyright (c) 2013, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 */
9
10#ifndef __DT_BINDINGS_AS3722_H__
11#define __DT_BINDINGS_AS3722_H__
12
13/* External control pins */
14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1
15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2
16#define AS3722_EXT_CONTROL_PIN_ENABLE2 3
17
18/* Interrupt numbers for AS3722 */
19#define AS3722_IRQ_LID 0
20#define AS3722_IRQ_ACOK 1
21#define AS3722_IRQ_ENABLE1 2
22#define AS3722_IRQ_OCCUR_ALARM_SD0 3
23#define AS3722_IRQ_ONKEY_LONG_PRESS 4
24#define AS3722_IRQ_ONKEY 5
25#define AS3722_IRQ_OVTMP 6
26#define AS3722_IRQ_LOWBAT 7
27#define AS3722_IRQ_SD0_LV 8
28#define AS3722_IRQ_SD1_LV 9
29#define AS3722_IRQ_SD2_LV 10
30#define AS3722_IRQ_PWM1_OV_PROT 11
31#define AS3722_IRQ_PWM2_OV_PROT 12
32#define AS3722_IRQ_ENABLE2 13
33#define AS3722_IRQ_SD6_LV 14
34#define AS3722_IRQ_RTC_REP 15
35#define AS3722_IRQ_RTC_ALARM 16
36#define AS3722_IRQ_GPIO1 17
37#define AS3722_IRQ_GPIO2 18
38#define AS3722_IRQ_GPIO3 19
39#define AS3722_IRQ_GPIO4 20
40#define AS3722_IRQ_GPIO5 21
41#define AS3722_IRQ_WATCHDOG 22
42#define AS3722_IRQ_ENABLE3 23
43#define AS3722_IRQ_TEMP_SD0_SHUTDOWN 24
44#define AS3722_IRQ_TEMP_SD1_SHUTDOWN 25
45#define AS3722_IRQ_TEMP_SD2_SHUTDOWN 26
46#define AS3722_IRQ_TEMP_SD0_ALARM 27
47#define AS3722_IRQ_TEMP_SD1_ALARM 28
48#define AS3722_IRQ_TEMP_SD6_ALARM 29
49#define AS3722_IRQ_OCCUR_ALARM_SD6 30
50#define AS3722_IRQ_ADC 31
51
52#endif /* __DT_BINDINGS_AS3722_H__ */
diff --git a/include/dt-bindings/mfd/dbx500-prcmu.h b/include/dt-bindings/mfd/dbx500-prcmu.h
new file mode 100644
index 000000000000..552a2d174f01
--- /dev/null
+++ b/include/dt-bindings/mfd/dbx500-prcmu.h
@@ -0,0 +1,83 @@
1/*
2 * This header provides constants for the PRCMU bindings.
3 *
4 */
5
6#ifndef _DT_BINDINGS_MFD_PRCMU_H
7#define _DT_BINDINGS_MFD_PRCMU_H
8
9/*
10 * Clock identifiers.
11 */
12#define ARMCLK 0
13#define PRCMU_ACLK 1
14#define PRCMU_SVAMMCSPCLK 2
15#define PRCMU_SDMMCHCLK 2 /* DBx540 only. */
16#define PRCMU_SIACLK 3
17#define PRCMU_SIAMMDSPCLK 3 /* DBx540 only. */
18#define PRCMU_SGACLK 4
19#define PRCMU_UARTCLK 5
20#define PRCMU_MSP02CLK 6
21#define PRCMU_MSP1CLK 7
22#define PRCMU_I2CCLK 8
23#define PRCMU_SDMMCCLK 9
24#define PRCMU_SLIMCLK 10
25#define PRCMU_CAMCLK 10 /* DBx540 only. */
26#define PRCMU_PER1CLK 11
27#define PRCMU_PER2CLK 12
28#define PRCMU_PER3CLK 13
29#define PRCMU_PER5CLK 14
30#define PRCMU_PER6CLK 15
31#define PRCMU_PER7CLK 16
32#define PRCMU_LCDCLK 17
33#define PRCMU_BMLCLK 18
34#define PRCMU_HSITXCLK 19
35#define PRCMU_HSIRXCLK 20
36#define PRCMU_HDMICLK 21
37#define PRCMU_APEATCLK 22
38#define PRCMU_APETRACECLK 23
39#define PRCMU_MCDECLK 24
40#define PRCMU_IPI2CCLK 25
41#define PRCMU_DSIALTCLK 26
42#define PRCMU_DMACLK 27
43#define PRCMU_B2R2CLK 28
44#define PRCMU_TVCLK 29
45#define SPARE_UNIPROCLK 30
46#define PRCMU_SSPCLK 31
47#define PRCMU_RNGCLK 32
48#define PRCMU_UICCCLK 33
49#define PRCMU_G1CLK 34 /* DBx540 only. */
50#define PRCMU_HVACLK 35 /* DBx540 only. */
51#define PRCMU_SPARE1CLK 36
52#define PRCMU_SPARE2CLK 37
53
54#define PRCMU_NUM_REG_CLOCKS 38
55
56#define PRCMU_RTCCLK PRCMU_NUM_REG_CLOCKS
57#define PRCMU_SYSCLK 39
58#define PRCMU_CDCLK 40
59#define PRCMU_TIMCLK 41
60#define PRCMU_PLLSOC0 42
61#define PRCMU_PLLSOC1 43
62#define PRCMU_ARMSS 44
63#define PRCMU_PLLDDR 45
64
65/* DSI Clocks */
66#define PRCMU_PLLDSI 46
67#define PRCMU_DSI0CLK 47
68#define PRCMU_DSI1CLK 48
69#define PRCMU_DSI0ESCCLK 49
70#define PRCMU_DSI1ESCCLK 50
71#define PRCMU_DSI2ESCCLK 51
72
73/* LCD DSI PLL - Ux540 only */
74#define PRCMU_PLLDSI_LCD 52
75#define PRCMU_DSI0CLK_LCD 53
76#define PRCMU_DSI1CLK_LCD 54
77#define PRCMU_DSI0ESCCLK_LCD 55
78#define PRCMU_DSI1ESCCLK_LCD 56
79#define PRCMU_DSI2ESCCLK_LCD 57
80
81#define PRCMU_NUM_CLKS 58
82
83#endif
diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h
new file mode 100644
index 000000000000..eb6c366adfba
--- /dev/null
+++ b/include/dt-bindings/pinctrl/am43xx.h
@@ -0,0 +1,31 @@
1/*
2 * This header provides constants specific to AM43XX pinctrl bindings.
3 */
4
5#ifndef _DT_BINDINGS_PINCTRL_AM43XX_H
6#define _DT_BINDINGS_PINCTRL_AM43XX_H
7
8#define MUX_MODE0 0
9#define MUX_MODE1 1
10#define MUX_MODE2 2
11#define MUX_MODE3 3
12#define MUX_MODE4 4
13#define MUX_MODE5 5
14#define MUX_MODE6 6
15#define MUX_MODE7 7
16
17#define PULL_DISABLE (1 << 16)
18#define PULL_UP (1 << 17)
19#define INPUT_EN (1 << 18)
20#define SLEWCTRL_FAST (1 << 19)
21#define DS0_PULL_UP_DOWN_EN (1 << 27)
22
23#define PIN_OUTPUT (PULL_DISABLE)
24#define PIN_OUTPUT_PULLUP (PULL_UP)
25#define PIN_OUTPUT_PULLDOWN 0
26#define PIN_INPUT (INPUT_EN | PULL_DISABLE)
27#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP)
28#define PIN_INPUT_PULLDOWN (INPUT_EN)
29
30#endif
31
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
index d7988b4d8af9..0fee6ff77ffc 100644
--- a/include/dt-bindings/pinctrl/at91.h
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -16,7 +16,7 @@
16#define AT91_PINCTRL_PULL_DOWN (1 << 3) 16#define AT91_PINCTRL_PULL_DOWN (1 << 3)
17#define AT91_PINCTRL_DIS_SCHMIT (1 << 4) 17#define AT91_PINCTRL_DIS_SCHMIT (1 << 4)
18#define AT91_PINCTRL_DEBOUNCE (1 << 16) 18#define AT91_PINCTRL_DEBOUNCE (1 << 16)
19#define AT91_PINCTRL_DEBOUNCE_VA(x) (x << 17) 19#define AT91_PINCTRL_DEBOUNCE_VAL(x) (x << 17)
20 20
21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH) 21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
22 22
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
new file mode 100644
index 000000000000..002a2855c046
--- /dev/null
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -0,0 +1,50 @@
1/*
2 * This header provides constants for DRA pinctrl bindings.
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Author: Rajendra Nayak <rnayak@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _DT_BINDINGS_PINCTRL_DRA_H
13#define _DT_BINDINGS_PINCTRL_DRA_H
14
15/* DRA7 mux mode options for each pin. See TRM for options */
16#define MUX_MODE0 0x0
17#define MUX_MODE1 0x1
18#define MUX_MODE2 0x2
19#define MUX_MODE3 0x3
20#define MUX_MODE4 0x4
21#define MUX_MODE5 0x5
22#define MUX_MODE6 0x6
23#define MUX_MODE7 0x7
24#define MUX_MODE8 0x8
25#define MUX_MODE9 0x9
26#define MUX_MODE10 0xa
27#define MUX_MODE11 0xb
28#define MUX_MODE12 0xc
29#define MUX_MODE13 0xd
30#define MUX_MODE14 0xe
31#define MUX_MODE15 0xf
32
33#define PULL_ENA (1 << 16)
34#define PULL_UP (1 << 17)
35#define INPUT_EN (1 << 18)
36#define SLEWCONTROL (1 << 19)
37#define WAKEUP_EN (1 << 24)
38#define WAKEUP_EVENT (1 << 25)
39
40/* Active pin states */
41#define PIN_OUTPUT 0
42#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
43#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
44#define PIN_INPUT INPUT_EN
45#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
46#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
47#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
48
49#endif
50
diff --git a/include/dt-bindings/pinctrl/nomadik.h b/include/dt-bindings/pinctrl/nomadik.h
new file mode 100644
index 000000000000..638fb321a1cb
--- /dev/null
+++ b/include/dt-bindings/pinctrl/nomadik.h
@@ -0,0 +1,36 @@
1/*
2 * nomadik.h
3 *
4 * Copyright (C) ST-Ericsson SA 2013
5 * Author: Gabriel Fernandez <gabriel.fernandez@st.com> for ST-Ericsson.
6 * License terms: GNU General Public License (GPL), version 2
7 */
8
9#define INPUT_NOPULL 0
10#define INPUT_PULLUP 1
11#define INPUT_PULLDOWN 2
12
13#define OUTPUT_LOW 0
14#define OUTPUT_HIGH 1
15#define DIR_OUTPUT 2
16
17#define SLPM_DISABLED 0
18#define SLPM_ENABLED 1
19
20#define SLPM_INPUT_NOPULL 0
21#define SLPM_INPUT_PULLUP 1
22#define SLPM_INPUT_PULLDOWN 2
23#define SLPM_DIR_INPUT 3
24
25#define SLPM_OUTPUT_LOW 0
26#define SLPM_OUTPUT_HIGH 1
27#define SLPM_DIR_OUTPUT 2
28
29#define SLPM_WAKEUP_DISABLE 0
30#define SLPM_WAKEUP_ENABLE 1
31
32#define GPIOMODE_DISABLED 0
33#define GPIOMODE_ENABLED 1
34
35#define SLPM_PDIS_DISABLED 0
36#define SLPM_PDIS_ENABLED 1
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
index edbd250809cb..bed35e36fd27 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -23,7 +23,7 @@
23#define PULL_UP (1 << 4) 23#define PULL_UP (1 << 4)
24#define ALTELECTRICALSEL (1 << 5) 24#define ALTELECTRICALSEL (1 << 5)
25 25
26/* 34xx specific mux bit defines */ 26/* omap3/4/5 specific mux bit defines */
27#define INPUT_EN (1 << 8) 27#define INPUT_EN (1 << 8)
28#define OFF_EN (1 << 9) 28#define OFF_EN (1 << 9)
29#define OFFOUT_EN (1 << 10) 29#define OFFOUT_EN (1 << 10)
@@ -31,8 +31,6 @@
31#define OFF_PULL_EN (1 << 12) 31#define OFF_PULL_EN (1 << 12)
32#define OFF_PULL_UP (1 << 13) 32#define OFF_PULL_UP (1 << 13)
33#define WAKEUP_EN (1 << 14) 33#define WAKEUP_EN (1 << 14)
34
35/* 44xx specific mux bit defines */
36#define WAKEUP_EVENT (1 << 15) 34#define WAKEUP_EVENT (1 << 15)
37 35
38/* Active pin states */ 36/* Active pin states */
diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h
new file mode 100644
index 000000000000..d69bc8af3292
--- /dev/null
+++ b/include/keys/big_key-type.h
@@ -0,0 +1,25 @@
1/* Big capacity key type.
2 *
3 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_BIG_KEY_TYPE_H
13#define _KEYS_BIG_KEY_TYPE_H
14
15#include <linux/key-type.h>
16
17extern struct key_type key_type_big_key;
18
19extern int big_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
20extern void big_key_revoke(struct key *key);
21extern void big_key_destroy(struct key *key);
22extern void big_key_describe(const struct key *big_key, struct seq_file *m);
23extern long big_key_read(const struct key *key, char __user *buffer, size_t buflen);
24
25#endif /* _KEYS_BIG_KEY_TYPE_H */
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
index cf49159b0e3a..fca5c62340a4 100644
--- a/include/keys/keyring-type.h
+++ b/include/keys/keyring-type.h
@@ -1,6 +1,6 @@
1/* Keyring key type 1/* Keyring key type
2 * 2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -13,19 +13,6 @@
13#define _KEYS_KEYRING_TYPE_H 13#define _KEYS_KEYRING_TYPE_H
14 14
15#include <linux/key.h> 15#include <linux/key.h>
16#include <linux/rcupdate.h> 16#include <linux/assoc_array.h>
17
18/*
19 * the keyring payload contains a list of the keys to which the keyring is
20 * subscribed
21 */
22struct keyring_list {
23 struct rcu_head rcu; /* RCU deletion hook */
24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key __rcu *keys[0];
28};
29
30 17
31#endif /* _KEYS_KEYRING_TYPE_H */ 18#endif /* _KEYS_KEYRING_TYPE_H */
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
new file mode 100644
index 000000000000..8dabc399bd1d
--- /dev/null
+++ b/include/keys/system_keyring.h
@@ -0,0 +1,23 @@
1/* System keyring containing trusted public keys.
2 *
3 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_SYSTEM_KEYRING_H
13#define _KEYS_SYSTEM_KEYRING_H
14
15#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
16
17#include <linux/key.h>
18
19extern struct key *system_trusted_keyring;
20
21#endif
22
23#endif /* _KEYS_SYSTEM_KEYRING_H */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a5db4aeefa36..d9099b15b472 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -44,6 +44,20 @@
44#include <acpi/acpi_numa.h> 44#include <acpi/acpi_numa.h>
45#include <asm/acpi.h> 45#include <asm/acpi.h>
46 46
47static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
48{
49 return adev ? adev->handle : NULL;
50}
51
52#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion)
53#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev)
54#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
55
56static inline const char *acpi_dev_name(struct acpi_device *adev)
57{
58 return dev_name(&adev->dev);
59}
60
47enum acpi_irq_model_id { 61enum acpi_irq_model_id {
48 ACPI_IRQ_MODEL_PIC = 0, 62 ACPI_IRQ_MODEL_PIC = 0,
49 ACPI_IRQ_MODEL_IOAPIC, 63 ACPI_IRQ_MODEL_IOAPIC,
@@ -116,7 +130,7 @@ void acpi_numa_arch_fixup(void);
116 130
117#ifdef CONFIG_ACPI_HOTPLUG_CPU 131#ifdef CONFIG_ACPI_HOTPLUG_CPU
118/* Arch dependent functions for cpu hotplug support */ 132/* Arch dependent functions for cpu hotplug support */
119int acpi_map_lsapic(acpi_handle handle, int *pcpu); 133int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu);
120int acpi_unmap_lsapic(int cpu); 134int acpi_unmap_lsapic(int cpu);
121#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 135#endif /* CONFIG_ACPI_HOTPLUG_CPU */
122 136
@@ -294,58 +308,52 @@ void __init acpi_nvs_nosave_s3(void);
294#endif /* CONFIG_PM_SLEEP */ 308#endif /* CONFIG_PM_SLEEP */
295 309
296struct acpi_osc_context { 310struct acpi_osc_context {
297 char *uuid_str; /* uuid string */ 311 char *uuid_str; /* UUID string */
298 int rev; 312 int rev;
299 struct acpi_buffer cap; /* arg2/arg3 */ 313 struct acpi_buffer cap; /* list of DWORD capabilities */
300 struct acpi_buffer ret; /* free by caller if success */ 314 struct acpi_buffer ret; /* free by caller if success */
301}; 315};
302 316
303#define OSC_QUERY_TYPE 0 317acpi_status acpi_str_to_uuid(char *str, u8 *uuid);
304#define OSC_SUPPORT_TYPE 1
305#define OSC_CONTROL_TYPE 2
306
307/* _OSC DW0 Definition */
308#define OSC_QUERY_ENABLE 1
309#define OSC_REQUEST_ERROR 2
310#define OSC_INVALID_UUID_ERROR 4
311#define OSC_INVALID_REVISION_ERROR 8
312#define OSC_CAPABILITIES_MASK_ERROR 16
313
314acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); 318acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
315 319
316/* platform-wide _OSC bits */ 320/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
317#define OSC_SB_PAD_SUPPORT 1 321#define OSC_QUERY_DWORD 0 /* DWORD 1 */
318#define OSC_SB_PPC_OST_SUPPORT 2 322#define OSC_SUPPORT_DWORD 1 /* DWORD 2 */
319#define OSC_SB_PR3_SUPPORT 4 323#define OSC_CONTROL_DWORD 2 /* DWORD 3 */
320#define OSC_SB_HOTPLUG_OST_SUPPORT 8 324
321#define OSC_SB_APEI_SUPPORT 16 325/* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */
326#define OSC_QUERY_ENABLE 0x00000001 /* input */
327#define OSC_REQUEST_ERROR 0x00000002 /* return */
328#define OSC_INVALID_UUID_ERROR 0x00000004 /* return */
329#define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */
330#define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */
331
332/* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */
333#define OSC_SB_PAD_SUPPORT 0x00000001
334#define OSC_SB_PPC_OST_SUPPORT 0x00000002
335#define OSC_SB_PR3_SUPPORT 0x00000004
336#define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008
337#define OSC_SB_APEI_SUPPORT 0x00000010
338#define OSC_SB_CPC_SUPPORT 0x00000020
322 339
323extern bool osc_sb_apei_support_acked; 340extern bool osc_sb_apei_support_acked;
324 341
325/* PCI defined _OSC bits */ 342/* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
326/* _OSC DW1 Definition (OS Support Fields) */ 343#define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001
327#define OSC_EXT_PCI_CONFIG_SUPPORT 1 344#define OSC_PCI_ASPM_SUPPORT 0x00000002
328#define OSC_ACTIVE_STATE_PWR_SUPPORT 2 345#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
329#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 346#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
330#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 347#define OSC_PCI_MSI_SUPPORT 0x00000010
331#define OSC_MSI_SUPPORT 16 348#define OSC_PCI_SUPPORT_MASKS 0x0000001f
332#define OSC_PCI_SUPPORT_MASKS 0x1f 349
333 350/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
334/* _OSC DW1 Definition (OS Control Fields) */ 351#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
335#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 352#define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002
336#define OSC_SHPC_NATIVE_HP_CONTROL 2 353#define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004
337#define OSC_PCI_EXPRESS_PME_CONTROL 4 354#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
338#define OSC_PCI_EXPRESS_AER_CONTROL 8 355#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
339#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 356#define OSC_PCI_CONTROL_MASKS 0x0000001f
340
341#define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
342 OSC_SHPC_NATIVE_HP_CONTROL | \
343 OSC_PCI_EXPRESS_PME_CONTROL | \
344 OSC_PCI_EXPRESS_AER_CONTROL | \
345 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
346
347#define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
348 OSC_SHPC_NATIVE_HP_CONTROL)
349 357
350extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 358extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
351 u32 *mask, u32 req); 359 u32 *mask, u32 req);
@@ -407,6 +415,15 @@ static inline bool acpi_driver_match_device(struct device *dev,
407 415
408#define acpi_disabled 1 416#define acpi_disabled 1
409 417
418#define ACPI_COMPANION(dev) (NULL)
419#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
420#define ACPI_HANDLE(dev) (NULL)
421
422static inline const char *acpi_dev_name(struct acpi_device *adev)
423{
424 return NULL;
425}
426
410static inline void acpi_early_init(void) { } 427static inline void acpi_early_init(void) { }
411 428
412static inline int early_acpi_boot_init(void) 429static inline int early_acpi_boot_init(void)
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
index 4c120a1e0ca3..d875bc3dba3c 100644
--- a/include/linux/acpi_gpio.h
+++ b/include/linux/acpi_gpio.h
@@ -2,36 +2,35 @@
2#define _LINUX_ACPI_GPIO_H_ 2#define _LINUX_ACPI_GPIO_H_
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h>
5#include <linux/errno.h> 6#include <linux/errno.h>
6#include <linux/gpio.h> 7#include <linux/gpio.h>
8#include <linux/gpio/consumer.h>
7 9
8/** 10/**
9 * struct acpi_gpio_info - ACPI GPIO specific information 11 * struct acpi_gpio_info - ACPI GPIO specific information
10 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo 12 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
13 * @active_low: in case of @gpioint, the pin is active low
11 */ 14 */
12struct acpi_gpio_info { 15struct acpi_gpio_info {
13 bool gpioint; 16 bool gpioint;
17 bool active_low;
14}; 18};
15 19
16#ifdef CONFIG_GPIO_ACPI 20#ifdef CONFIG_GPIO_ACPI
17 21
18int acpi_get_gpio(char *path, int pin); 22struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
19int acpi_get_gpio_by_index(struct device *dev, int index, 23 struct acpi_gpio_info *info);
20 struct acpi_gpio_info *info);
21void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); 24void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
22void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); 25void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
23 26
24#else /* CONFIG_GPIO_ACPI */ 27#else /* CONFIG_GPIO_ACPI */
25 28
26static inline int acpi_get_gpio(char *path, int pin) 29static inline struct gpio_desc *
30acpi_get_gpiod_by_index(struct device *dev, int index,
31 struct acpi_gpio_info *info)
27{ 32{
28 return -ENODEV; 33 return ERR_PTR(-ENOSYS);
29}
30
31static inline int acpi_get_gpio_by_index(struct device *dev, int index,
32 struct acpi_gpio_info *info)
33{
34 return -ENODEV;
35} 34}
36 35
37static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } 36static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
@@ -39,4 +38,14 @@ static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
39 38
40#endif /* CONFIG_GPIO_ACPI */ 39#endif /* CONFIG_GPIO_ACPI */
41 40
41static inline int acpi_get_gpio_by_index(struct device *dev, int index,
42 struct acpi_gpio_info *info)
43{
44 struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
45
46 if (IS_ERR(desc))
47 return PTR_ERR(desc);
48 return desc_to_gpio(desc);
49}
50
42#endif /* _LINUX_ACPI_GPIO_H_ */ 51#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 1bdf965339f9..d9c92daa3944 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -27,15 +27,13 @@ struct kiocb;
27 */ 27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL)) 28#define KIOCB_CANCELLED ((void *) (~0ULL))
29 29
30typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *); 30typedef int (kiocb_cancel_fn)(struct kiocb *);
31 31
32struct kiocb { 32struct kiocb {
33 atomic_t ki_users;
34
35 struct file *ki_filp; 33 struct file *ki_filp;
36 struct kioctx *ki_ctx; /* NULL for sync ops */ 34 struct kioctx *ki_ctx; /* NULL for sync ops */
37 kiocb_cancel_fn *ki_cancel; 35 kiocb_cancel_fn *ki_cancel;
38 void (*ki_dtor)(struct kiocb *); 36 void *private;
39 37
40 union { 38 union {
41 void __user *user; 39 void __user *user;
@@ -44,17 +42,7 @@ struct kiocb {
44 42
45 __u64 ki_user_data; /* user's data for completion */ 43 __u64 ki_user_data; /* user's data for completion */
46 loff_t ki_pos; 44 loff_t ki_pos;
47 45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
48 void *private;
49 /* State that we remember to be able to restart/retry */
50 unsigned short ki_opcode;
51 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
52 char __user *ki_buf; /* remaining iocb->aio_buf */
53 size_t ki_left; /* remaining bytes */
54 struct iovec ki_inline_vec; /* inline vector */
55 struct iovec *ki_iovec;
56 unsigned long ki_nr_segs;
57 unsigned long ki_cur_seg;
58 46
59 struct list_head ki_list; /* the aio core uses this 47 struct list_head ki_list; /* the aio core uses this
60 * for cancellation */ 48 * for cancellation */
@@ -74,7 +62,6 @@ static inline bool is_sync_kiocb(struct kiocb *kiocb)
74static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) 62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
75{ 63{
76 *kiocb = (struct kiocb) { 64 *kiocb = (struct kiocb) {
77 .ki_users = ATOMIC_INIT(1),
78 .ki_ctx = NULL, 65 .ki_ctx = NULL,
79 .ki_filp = filp, 66 .ki_filp = filp,
80 .ki_obj.tsk = current, 67 .ki_obj.tsk = current,
@@ -84,7 +71,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
84/* prototypes */ 71/* prototypes */
85#ifdef CONFIG_AIO 72#ifdef CONFIG_AIO
86extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
87extern void aio_put_req(struct kiocb *iocb);
88extern void aio_complete(struct kiocb *iocb, long res, long res2); 74extern void aio_complete(struct kiocb *iocb, long res, long res2);
89struct mm_struct; 75struct mm_struct;
90extern void exit_aio(struct mm_struct *mm); 76extern void exit_aio(struct mm_struct *mm);
@@ -93,7 +79,6 @@ extern long do_io_submit(aio_context_t ctx_id, long nr,
93void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
94#else 80#else
95static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
96static inline void aio_put_req(struct kiocb *iocb) { }
97static inline void aio_complete(struct kiocb *iocb, long res, long res2) { } 82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
98struct mm_struct; 83struct mm_struct;
99static inline void exit_aio(struct mm_struct *mm) { } 84static inline void exit_aio(struct mm_struct *mm) { }
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 43ec7e247a80..63b5eff0a80f 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -21,7 +21,7 @@
21#include <linux/resource.h> 21#include <linux/resource.h>
22#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
23 23
24#define AMBA_NR_IRQS 2 24#define AMBA_NR_IRQS 9
25#define AMBA_CID 0xb105f00d 25#define AMBA_CID 0xb105f00d
26 26
27struct clk; 27struct clk;
@@ -30,7 +30,6 @@ struct amba_device {
30 struct device dev; 30 struct device dev;
31 struct resource res; 31 struct resource res;
32 struct clk *pclk; 32 struct clk *pclk;
33 u64 dma_mask;
34 unsigned int periphid; 33 unsigned int periphid;
35 unsigned int irq[AMBA_NR_IRQS]; 34 unsigned int irq[AMBA_NR_IRQS];
36}; 35};
@@ -131,7 +130,6 @@ struct amba_device name##_device = { \
131struct amba_device name##_device = { \ 130struct amba_device name##_device = { \
132 .dev = __AMBA_DEV(busid, data, ~0ULL), \ 131 .dev = __AMBA_DEV(busid, data, ~0ULL), \
133 .res = DEFINE_RES_MEM(base, SZ_4K), \ 132 .res = DEFINE_RES_MEM(base, SZ_4K), \
134 .dma_mask = ~0ULL, \
135 .irq = irqs, \ 133 .irq = irqs, \
136 .periphid = id, \ 134 .periphid = id, \
137} 135}
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h
index 3e7b62fbefbd..91b84a7f0539 100644
--- a/include/linux/amba/pl080.h
+++ b/include/linux/amba/pl080.h
@@ -87,6 +87,7 @@
87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12) 87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12)
88#define PL080_CONTROL_SB_SIZE_SHIFT (12) 88#define PL080_CONTROL_SB_SIZE_SHIFT (12)
89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0) 89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0)
90#define PL080S_CONTROL_TRANSFER_SIZE_MASK (0x1ffffff << 0)
90#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0) 91#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0)
91 92
92#define PL080_BSIZE_1 (0x0) 93#define PL080_BSIZE_1 (0x0)
diff --git a/include/linux/assoc_array.h b/include/linux/assoc_array.h
new file mode 100644
index 000000000000..a89df3be1686
--- /dev/null
+++ b/include/linux/assoc_array.h
@@ -0,0 +1,92 @@
1/* Generic associative array implementation.
2 *
3 * See Documentation/assoc_array.txt for information.
4 *
5 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _LINUX_ASSOC_ARRAY_H
15#define _LINUX_ASSOC_ARRAY_H
16
17#ifdef CONFIG_ASSOCIATIVE_ARRAY
18
19#include <linux/types.h>
20
21#define ASSOC_ARRAY_KEY_CHUNK_SIZE BITS_PER_LONG /* Key data retrieved in chunks of this size */
22
23/*
24 * Generic associative array.
25 */
26struct assoc_array {
27 struct assoc_array_ptr *root; /* The node at the root of the tree */
28 unsigned long nr_leaves_on_tree;
29};
30
31/*
32 * Operations on objects and index keys for use by array manipulation routines.
33 */
34struct assoc_array_ops {
35 /* Method to get a chunk of an index key from caller-supplied data */
36 unsigned long (*get_key_chunk)(const void *index_key, int level);
37
38 /* Method to get a piece of an object's index key */
39 unsigned long (*get_object_key_chunk)(const void *object, int level);
40
41 /* Is this the object we're looking for? */
42 bool (*compare_object)(const void *object, const void *index_key);
43
44 /* How different is an object from an index key, to a bit position in
45 * their keys? (or -1 if they're the same)
46 */
47 int (*diff_objects)(const void *object, const void *index_key);
48
49 /* Method to free an object. */
50 void (*free_object)(void *object);
51};
52
53/*
54 * Access and manipulation functions.
55 */
56struct assoc_array_edit;
57
58static inline void assoc_array_init(struct assoc_array *array)
59{
60 array->root = NULL;
61 array->nr_leaves_on_tree = 0;
62}
63
64extern int assoc_array_iterate(const struct assoc_array *array,
65 int (*iterator)(const void *object,
66 void *iterator_data),
67 void *iterator_data);
68extern void *assoc_array_find(const struct assoc_array *array,
69 const struct assoc_array_ops *ops,
70 const void *index_key);
71extern void assoc_array_destroy(struct assoc_array *array,
72 const struct assoc_array_ops *ops);
73extern struct assoc_array_edit *assoc_array_insert(struct assoc_array *array,
74 const struct assoc_array_ops *ops,
75 const void *index_key,
76 void *object);
77extern void assoc_array_insert_set_object(struct assoc_array_edit *edit,
78 void *object);
79extern struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
80 const struct assoc_array_ops *ops,
81 const void *index_key);
82extern struct assoc_array_edit *assoc_array_clear(struct assoc_array *array,
83 const struct assoc_array_ops *ops);
84extern void assoc_array_apply_edit(struct assoc_array_edit *edit);
85extern void assoc_array_cancel_edit(struct assoc_array_edit *edit);
86extern int assoc_array_gc(struct assoc_array *array,
87 const struct assoc_array_ops *ops,
88 bool (*iterator)(void *object, void *iterator_data),
89 void *iterator_data);
90
91#endif /* CONFIG_ASSOCIATIVE_ARRAY */
92#endif /* _LINUX_ASSOC_ARRAY_H */
diff --git a/include/linux/assoc_array_priv.h b/include/linux/assoc_array_priv.h
new file mode 100644
index 000000000000..711275e6681c
--- /dev/null
+++ b/include/linux/assoc_array_priv.h
@@ -0,0 +1,182 @@
1/* Private definitions for the generic associative array implementation.
2 *
3 * See Documentation/assoc_array.txt for information.
4 *
5 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _LINUX_ASSOC_ARRAY_PRIV_H
15#define _LINUX_ASSOC_ARRAY_PRIV_H
16
17#ifdef CONFIG_ASSOCIATIVE_ARRAY
18
19#include <linux/assoc_array.h>
20
21#define ASSOC_ARRAY_FAN_OUT 16 /* Number of slots per node */
22#define ASSOC_ARRAY_FAN_MASK (ASSOC_ARRAY_FAN_OUT - 1)
23#define ASSOC_ARRAY_LEVEL_STEP (ilog2(ASSOC_ARRAY_FAN_OUT))
24#define ASSOC_ARRAY_LEVEL_STEP_MASK (ASSOC_ARRAY_LEVEL_STEP - 1)
25#define ASSOC_ARRAY_KEY_CHUNK_MASK (ASSOC_ARRAY_KEY_CHUNK_SIZE - 1)
26#define ASSOC_ARRAY_KEY_CHUNK_SHIFT (ilog2(BITS_PER_LONG))
27
28/*
29 * Undefined type representing a pointer with type information in the bottom
30 * two bits.
31 */
32struct assoc_array_ptr;
33
34/*
35 * An N-way node in the tree.
36 *
37 * Each slot contains one of four things:
38 *
39 * (1) Nothing (NULL).
40 *
41 * (2) A leaf object (pointer types 0).
42 *
43 * (3) A next-level node (pointer type 1, subtype 0).
44 *
45 * (4) A shortcut (pointer type 1, subtype 1).
46 *
47 * The tree is optimised for search-by-ID, but permits reasonable iteration
48 * also.
49 *
50 * The tree is navigated by constructing an index key consisting of an array of
51 * segments, where each segment is ilog2(ASSOC_ARRAY_FAN_OUT) bits in size.
52 *
53 * The segments correspond to levels of the tree (the first segment is used at
54 * level 0, the second at level 1, etc.).
55 */
56struct assoc_array_node {
57 struct assoc_array_ptr *back_pointer;
58 u8 parent_slot;
59 struct assoc_array_ptr *slots[ASSOC_ARRAY_FAN_OUT];
60 unsigned long nr_leaves_on_branch;
61};
62
63/*
64 * A shortcut through the index space out to where a collection of nodes/leaves
65 * with the same IDs live.
66 */
67struct assoc_array_shortcut {
68 struct assoc_array_ptr *back_pointer;
69 int parent_slot;
70 int skip_to_level;
71 struct assoc_array_ptr *next_node;
72 unsigned long index_key[];
73};
74
75/*
76 * Preallocation cache.
77 */
78struct assoc_array_edit {
79 struct rcu_head rcu;
80 struct assoc_array *array;
81 const struct assoc_array_ops *ops;
82 const struct assoc_array_ops *ops_for_excised_subtree;
83 struct assoc_array_ptr *leaf;
84 struct assoc_array_ptr **leaf_p;
85 struct assoc_array_ptr *dead_leaf;
86 struct assoc_array_ptr *new_meta[3];
87 struct assoc_array_ptr *excised_meta[1];
88 struct assoc_array_ptr *excised_subtree;
89 struct assoc_array_ptr **set_backpointers[ASSOC_ARRAY_FAN_OUT];
90 struct assoc_array_ptr *set_backpointers_to;
91 struct assoc_array_node *adjust_count_on;
92 long adjust_count_by;
93 struct {
94 struct assoc_array_ptr **ptr;
95 struct assoc_array_ptr *to;
96 } set[2];
97 struct {
98 u8 *p;
99 u8 to;
100 } set_parent_slot[1];
101 u8 segment_cache[ASSOC_ARRAY_FAN_OUT + 1];
102};
103
104/*
105 * Internal tree member pointers are marked in the bottom one or two bits to
106 * indicate what type they are so that we don't have to look behind every
107 * pointer to see what it points to.
108 *
109 * We provide functions to test type annotations and to create and translate
110 * the annotated pointers.
111 */
112#define ASSOC_ARRAY_PTR_TYPE_MASK 0x1UL
113#define ASSOC_ARRAY_PTR_LEAF_TYPE 0x0UL /* Points to leaf (or nowhere) */
114#define ASSOC_ARRAY_PTR_META_TYPE 0x1UL /* Points to node or shortcut */
115#define ASSOC_ARRAY_PTR_SUBTYPE_MASK 0x2UL
116#define ASSOC_ARRAY_PTR_NODE_SUBTYPE 0x0UL
117#define ASSOC_ARRAY_PTR_SHORTCUT_SUBTYPE 0x2UL
118
119static inline bool assoc_array_ptr_is_meta(const struct assoc_array_ptr *x)
120{
121 return (unsigned long)x & ASSOC_ARRAY_PTR_TYPE_MASK;
122}
123static inline bool assoc_array_ptr_is_leaf(const struct assoc_array_ptr *x)
124{
125 return !assoc_array_ptr_is_meta(x);
126}
127static inline bool assoc_array_ptr_is_shortcut(const struct assoc_array_ptr *x)
128{
129 return (unsigned long)x & ASSOC_ARRAY_PTR_SUBTYPE_MASK;
130}
131static inline bool assoc_array_ptr_is_node(const struct assoc_array_ptr *x)
132{
133 return !assoc_array_ptr_is_shortcut(x);
134}
135
136static inline void *assoc_array_ptr_to_leaf(const struct assoc_array_ptr *x)
137{
138 return (void *)((unsigned long)x & ~ASSOC_ARRAY_PTR_TYPE_MASK);
139}
140
141static inline
142unsigned long __assoc_array_ptr_to_meta(const struct assoc_array_ptr *x)
143{
144 return (unsigned long)x &
145 ~(ASSOC_ARRAY_PTR_SUBTYPE_MASK | ASSOC_ARRAY_PTR_TYPE_MASK);
146}
147static inline
148struct assoc_array_node *assoc_array_ptr_to_node(const struct assoc_array_ptr *x)
149{
150 return (struct assoc_array_node *)__assoc_array_ptr_to_meta(x);
151}
152static inline
153struct assoc_array_shortcut *assoc_array_ptr_to_shortcut(const struct assoc_array_ptr *x)
154{
155 return (struct assoc_array_shortcut *)__assoc_array_ptr_to_meta(x);
156}
157
158static inline
159struct assoc_array_ptr *__assoc_array_x_to_ptr(const void *p, unsigned long t)
160{
161 return (struct assoc_array_ptr *)((unsigned long)p | t);
162}
163static inline
164struct assoc_array_ptr *assoc_array_leaf_to_ptr(const void *p)
165{
166 return __assoc_array_x_to_ptr(p, ASSOC_ARRAY_PTR_LEAF_TYPE);
167}
168static inline
169struct assoc_array_ptr *assoc_array_node_to_ptr(const struct assoc_array_node *p)
170{
171 return __assoc_array_x_to_ptr(
172 p, ASSOC_ARRAY_PTR_META_TYPE | ASSOC_ARRAY_PTR_NODE_SUBTYPE);
173}
174static inline
175struct assoc_array_ptr *assoc_array_shortcut_to_ptr(const struct assoc_array_shortcut *p)
176{
177 return __assoc_array_x_to_ptr(
178 p, ASSOC_ARRAY_PTR_META_TYPE | ASSOC_ARRAY_PTR_SHORTCUT_SUBTYPE);
179}
180
181#endif /* CONFIG_ASSOCIATIVE_ARRAY */
182#endif /* _LINUX_ASSOC_ARRAY_PRIV_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index bf4c69ca76df..f2f4d8da97c0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -219,6 +219,7 @@ enum {
219 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */ 219 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
220 ATA_CMD_EDD = 0x90, /* execute device diagnostic */ 220 ATA_CMD_EDD = 0x90, /* execute device diagnostic */
221 ATA_CMD_DOWNLOAD_MICRO = 0x92, 221 ATA_CMD_DOWNLOAD_MICRO = 0x92,
222 ATA_CMD_DOWNLOAD_MICRO_DMA = 0x93,
222 ATA_CMD_NOP = 0x00, 223 ATA_CMD_NOP = 0x00,
223 ATA_CMD_FLUSH = 0xE7, 224 ATA_CMD_FLUSH = 0xE7,
224 ATA_CMD_FLUSH_EXT = 0xEA, 225 ATA_CMD_FLUSH_EXT = 0xEA,
@@ -268,12 +269,15 @@ enum {
268 ATA_CMD_WRITE_LOG_EXT = 0x3F, 269 ATA_CMD_WRITE_LOG_EXT = 0x3F,
269 ATA_CMD_READ_LOG_DMA_EXT = 0x47, 270 ATA_CMD_READ_LOG_DMA_EXT = 0x47,
270 ATA_CMD_WRITE_LOG_DMA_EXT = 0x57, 271 ATA_CMD_WRITE_LOG_DMA_EXT = 0x57,
272 ATA_CMD_TRUSTED_NONDATA = 0x5B,
271 ATA_CMD_TRUSTED_RCV = 0x5C, 273 ATA_CMD_TRUSTED_RCV = 0x5C,
272 ATA_CMD_TRUSTED_RCV_DMA = 0x5D, 274 ATA_CMD_TRUSTED_RCV_DMA = 0x5D,
273 ATA_CMD_TRUSTED_SND = 0x5E, 275 ATA_CMD_TRUSTED_SND = 0x5E,
274 ATA_CMD_TRUSTED_SND_DMA = 0x5F, 276 ATA_CMD_TRUSTED_SND_DMA = 0x5F,
275 ATA_CMD_PMP_READ = 0xE4, 277 ATA_CMD_PMP_READ = 0xE4,
278 ATA_CMD_PMP_READ_DMA = 0xE9,
276 ATA_CMD_PMP_WRITE = 0xE8, 279 ATA_CMD_PMP_WRITE = 0xE8,
280 ATA_CMD_PMP_WRITE_DMA = 0xEB,
277 ATA_CMD_CONF_OVERLAY = 0xB1, 281 ATA_CMD_CONF_OVERLAY = 0xB1,
278 ATA_CMD_SEC_SET_PASS = 0xF1, 282 ATA_CMD_SEC_SET_PASS = 0xF1,
279 ATA_CMD_SEC_UNLOCK = 0xF2, 283 ATA_CMD_SEC_UNLOCK = 0xF2,
@@ -292,6 +296,9 @@ enum {
292 ATA_CMD_CFA_TRANS_SECT = 0x87, 296 ATA_CMD_CFA_TRANS_SECT = 0x87,
293 ATA_CMD_CFA_ERASE = 0xC0, 297 ATA_CMD_CFA_ERASE = 0xC0,
294 ATA_CMD_CFA_WRITE_MULT_NE = 0xCD, 298 ATA_CMD_CFA_WRITE_MULT_NE = 0xCD,
299 ATA_CMD_REQ_SENSE_DATA = 0x0B,
300 ATA_CMD_SANITIZE_DEVICE = 0xB4,
301
295 /* marked obsolete in the ATA/ATAPI-7 spec */ 302 /* marked obsolete in the ATA/ATAPI-7 spec */
296 ATA_CMD_RESTORE = 0x10, 303 ATA_CMD_RESTORE = 0x10,
297 304
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index be201ca2990c..00beddf6be20 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -125,5 +125,6 @@
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */ 127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128#define ATMEL_US_VERSION 0xfc /* Ip Version */
128 129
129#endif 130#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 729a4d165bcc..a40641954c29 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -73,6 +73,8 @@ struct audit_field {
73 void *lsm_rule; 73 void *lsm_rule;
74}; 74};
75 75
76extern int is_audit_feature_set(int which);
77
76extern int __init audit_register_class(int class, unsigned *list); 78extern int __init audit_register_class(int class, unsigned *list);
77extern int audit_classify_syscall(int abi, unsigned syscall); 79extern int audit_classify_syscall(int abi, unsigned syscall);
78extern int audit_classify_arch(int arch); 80extern int audit_classify_arch(int arch);
@@ -207,7 +209,7 @@ static inline int audit_get_sessionid(struct task_struct *tsk)
207 209
208extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 210extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
209extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); 211extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
210extern int __audit_bprm(struct linux_binprm *bprm); 212extern void __audit_bprm(struct linux_binprm *bprm);
211extern int __audit_socketcall(int nargs, unsigned long *args); 213extern int __audit_socketcall(int nargs, unsigned long *args);
212extern int __audit_sockaddr(int len, void *addr); 214extern int __audit_sockaddr(int len, void *addr);
213extern void __audit_fd_pair(int fd1, int fd2); 215extern void __audit_fd_pair(int fd1, int fd2);
@@ -236,11 +238,10 @@ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid
236 if (unlikely(!audit_dummy_context())) 238 if (unlikely(!audit_dummy_context()))
237 __audit_ipc_set_perm(qbytes, uid, gid, mode); 239 __audit_ipc_set_perm(qbytes, uid, gid, mode);
238} 240}
239static inline int audit_bprm(struct linux_binprm *bprm) 241static inline void audit_bprm(struct linux_binprm *bprm)
240{ 242{
241 if (unlikely(!audit_dummy_context())) 243 if (unlikely(!audit_dummy_context()))
242 return __audit_bprm(bprm); 244 __audit_bprm(bprm);
243 return 0;
244} 245}
245static inline int audit_socketcall(int nargs, unsigned long *args) 246static inline int audit_socketcall(int nargs, unsigned long *args)
246{ 247{
@@ -367,10 +368,8 @@ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
367static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, 368static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
368 gid_t gid, umode_t mode) 369 gid_t gid, umode_t mode)
369{ } 370{ }
370static inline int audit_bprm(struct linux_binprm *bprm) 371static inline void audit_bprm(struct linux_binprm *bprm)
371{ 372{ }
372 return 0;
373}
374static inline int audit_socketcall(int nargs, unsigned long *args) 373static inline int audit_socketcall(int nargs, unsigned long *args)
375{ 374{
376 return 0; 375 return 0;
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index c3881553f7d1..24819001f5c8 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -109,7 +109,7 @@ struct backing_dev_info {
109#endif 109#endif
110}; 110};
111 111
112int bdi_init(struct backing_dev_info *bdi); 112int __must_check bdi_init(struct backing_dev_info *bdi);
113void bdi_destroy(struct backing_dev_info *bdi); 113void bdi_destroy(struct backing_dev_info *bdi);
114 114
115__printf(3, 4) 115__printf(3, 4)
@@ -117,7 +117,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
117 const char *fmt, ...); 117 const char *fmt, ...);
118int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 118int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
119void bdi_unregister(struct backing_dev_info *bdi); 119void bdi_unregister(struct backing_dev_info *bdi);
120int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 120int __must_check bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
121void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, 121void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
122 enum wb_reason reason); 122 enum wb_reason reason);
123void bdi_start_background_writeback(struct backing_dev_info *bdi); 123void bdi_start_background_writeback(struct backing_dev_info *bdi);
@@ -243,6 +243,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
243 * BDI_CAP_EXEC_MAP: Can be mapped for execution 243 * BDI_CAP_EXEC_MAP: Can be mapped for execution
244 * 244 *
245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed. 245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed.
246 *
247 * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
246 */ 248 */
247#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 249#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
248#define BDI_CAP_NO_WRITEBACK 0x00000002 250#define BDI_CAP_NO_WRITEBACK 0x00000002
@@ -254,6 +256,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
254#define BDI_CAP_NO_ACCT_WB 0x00000080 256#define BDI_CAP_NO_ACCT_WB 0x00000080
255#define BDI_CAP_SWAP_BACKED 0x00000100 257#define BDI_CAP_SWAP_BACKED 0x00000100
256#define BDI_CAP_STABLE_WRITES 0x00000200 258#define BDI_CAP_STABLE_WRITES 0x00000200
259#define BDI_CAP_STRICTLIMIT 0x00000400
257 260
258#define BDI_CAP_VMFLAGS \ 261#define BDI_CAP_VMFLAGS \
259 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 262 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 53b77949c79d..5f9cd963213d 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -100,6 +100,9 @@ struct backlight_device {
100 /* The framebuffer notifier block */ 100 /* The framebuffer notifier block */
101 struct notifier_block fb_notif; 101 struct notifier_block fb_notif;
102 102
103 /* list entry of all registered backlight devices */
104 struct list_head entry;
105
103 struct device dev; 106 struct device dev;
104}; 107};
105 108
@@ -123,6 +126,7 @@ extern void devm_backlight_device_unregister(struct device *dev,
123 struct backlight_device *bd); 126 struct backlight_device *bd);
124extern void backlight_force_update(struct backlight_device *bd, 127extern void backlight_force_update(struct backlight_device *bd,
125 enum backlight_update_reason reason); 128 enum backlight_update_reason reason);
129extern bool backlight_device_registered(enum backlight_type type);
126 130
127#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 131#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
128 132
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index f7f1d7169b11..089743ade734 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -159,6 +159,26 @@ static inline bool balloon_page_movable(struct page *page)
159} 159}
160 160
161/* 161/*
162 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */
171static inline bool isolated_balloon_page(struct page *page)
172{
173 /* Already isolated balloon pages, by default, have a raised refcount */
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179}
180
181/*
162 * balloon_page_insert - insert a page into the balloon's page list and make 182 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly. 183 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page' 184 * @page : page to be assigned as a 'balloon page'
@@ -243,6 +263,11 @@ static inline bool balloon_page_movable(struct page *page)
243 return false; 263 return false;
244} 264}
245 265
266static inline bool isolated_balloon_page(struct page *page)
267{
268 return false;
269}
270
246static inline bool balloon_page_isolate(struct page *page) 271static inline bool balloon_page_isolate(struct page *page)
247{ 272{
248 return false; 273 return false;
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index d66033f418c9..0333e605ea0d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -242,6 +242,7 @@ extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
242 struct bcma_device *core, bool enable); 242 struct bcma_device *core, bool enable);
243extern void bcma_core_pci_up(struct bcma_bus *bus); 243extern void bcma_core_pci_up(struct bcma_bus *bus);
244extern void bcma_core_pci_down(struct bcma_bus *bus); 244extern void bcma_core_pci_down(struct bcma_bus *bus);
245extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
245 246
246extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 247extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
247extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 248extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 70cf138690e9..fd8bf3219ef7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -31,7 +31,7 @@ struct linux_binprm {
31#ifdef __alpha__ 31#ifdef __alpha__
32 unsigned int taso:1; 32 unsigned int taso:1;
33#endif 33#endif
34 unsigned int recursion_depth; 34 unsigned int recursion_depth; /* only for search_binary_handler() */
35 struct file * file; 35 struct file * file;
36 struct cred *cred; /* new credentials */ 36 struct cred *cred; /* new credentials */
37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
@@ -56,11 +56,12 @@ struct linux_binprm {
56 56
57/* Function parameter for binfmt->coredump */ 57/* Function parameter for binfmt->coredump */
58struct coredump_params { 58struct coredump_params {
59 siginfo_t *siginfo; 59 const siginfo_t *siginfo;
60 struct pt_regs *regs; 60 struct pt_regs *regs;
61 struct file *file; 61 struct file *file;
62 unsigned long limit; 62 unsigned long limit;
63 unsigned long mm_flags; 63 unsigned long mm_flags;
64 loff_t written;
64}; 65};
65 66
66/* 67/*
@@ -99,9 +100,6 @@ extern void setup_new_exec(struct linux_binprm * bprm);
99extern void would_dump(struct linux_binprm *, struct file *); 100extern void would_dump(struct linux_binprm *, struct file *);
100 101
101extern int suid_dumpable; 102extern int suid_dumpable;
102#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
103#define SUID_DUMP_USER 1 /* Dump as user of process */
104#define SUID_DUMP_ROOT 2 /* Dump as root */
105 103
106/* Stack area protections */ 104/* Stack area protections */
107#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ 105#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ec48bac5b039..060ff695085c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -218,6 +218,7 @@ struct bio_pair {
218}; 218};
219extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); 219extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
220extern void bio_pair_release(struct bio_pair *dbio); 220extern void bio_pair_release(struct bio_pair *dbio);
221extern void bio_trim(struct bio *bio, int offset, int size);
221 222
222extern struct bio_set *bioset_create(unsigned int, unsigned int); 223extern struct bio_set *bioset_create(unsigned int, unsigned int);
223extern void bioset_free(struct bio_set *); 224extern void bioset_free(struct bio_set *);
@@ -419,6 +420,8 @@ static inline void bio_list_init(struct bio_list *bl)
419 bl->head = bl->tail = NULL; 420 bl->head = bl->tail = NULL;
420} 421}
421 422
423#define BIO_EMPTY_LIST { NULL, NULL }
424
422#define bio_list_for_each(bio, bl) \ 425#define bio_list_for_each(bio, bl) \
423 for (bio = (bl)->head; bio; bio = bio->bi_next) 426 for (bio = (bl)->head; bio; bio = bio->bi_next)
424 427
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3b6b82108b9..abc9ca778456 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -4,12 +4,23 @@
4 4
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6#define BIT(nr) (1UL << (nr)) 6#define BIT(nr) (1UL << (nr))
7#define BIT_ULL(nr) (1ULL << (nr))
7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) 8#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 9#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
10#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG))
11#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
9#define BITS_PER_BYTE 8 12#define BITS_PER_BYTE 8
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 13#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 14#endif
12 15
16/*
17 * Create a contiguous bitmask starting at bit position @l and ending at
18 * position @h. For example
19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
20 */
21#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
22#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
23
13extern unsigned int __sw_hweight8(unsigned int w); 24extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w); 25extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w); 26extern unsigned int __sw_hweight32(unsigned int w);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
new file mode 100644
index 000000000000..ab0e9b2025b3
--- /dev/null
+++ b/include/linux/blk-mq.h
@@ -0,0 +1,183 @@
1#ifndef BLK_MQ_H
2#define BLK_MQ_H
3
4#include <linux/blkdev.h>
5
6struct blk_mq_tags;
7
8struct blk_mq_cpu_notifier {
9 struct list_head list;
10 void *data;
11 void (*notify)(void *data, unsigned long action, unsigned int cpu);
12};
13
14struct blk_mq_hw_ctx {
15 struct {
16 spinlock_t lock;
17 struct list_head dispatch;
18 } ____cacheline_aligned_in_smp;
19
20 unsigned long state; /* BLK_MQ_S_* flags */
21 struct delayed_work delayed_work;
22
23 unsigned long flags; /* BLK_MQ_F_* flags */
24
25 struct request_queue *queue;
26 unsigned int queue_num;
27
28 void *driver_data;
29
30 unsigned int nr_ctx;
31 struct blk_mq_ctx **ctxs;
32 unsigned int nr_ctx_map;
33 unsigned long *ctx_map;
34
35 struct request **rqs;
36 struct list_head page_list;
37 struct blk_mq_tags *tags;
38
39 unsigned long queued;
40 unsigned long run;
41#define BLK_MQ_MAX_DISPATCH_ORDER 10
42 unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER];
43
44 unsigned int queue_depth;
45 unsigned int numa_node;
46 unsigned int cmd_size; /* per-request extra data */
47
48 struct blk_mq_cpu_notifier cpu_notifier;
49 struct kobject kobj;
50};
51
52struct blk_mq_reg {
53 struct blk_mq_ops *ops;
54 unsigned int nr_hw_queues;
55 unsigned int queue_depth;
56 unsigned int reserved_tags;
57 unsigned int cmd_size; /* per-request extra data */
58 int numa_node;
59 unsigned int timeout;
60 unsigned int flags; /* BLK_MQ_F_* */
61};
62
63typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *);
64typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
65typedef struct blk_mq_hw_ctx *(alloc_hctx_fn)(struct blk_mq_reg *,unsigned int);
66typedef void (free_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
67typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
68typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
69
70struct blk_mq_ops {
71 /*
72 * Queue request
73 */
74 queue_rq_fn *queue_rq;
75
76 /*
77 * Map to specific hardware queue
78 */
79 map_queue_fn *map_queue;
80
81 /*
82 * Called on request timeout
83 */
84 rq_timed_out_fn *timeout;
85
86 /*
87 * Override for hctx allocations (should probably go)
88 */
89 alloc_hctx_fn *alloc_hctx;
90 free_hctx_fn *free_hctx;
91
92 /*
93 * Called when the block layer side of a hardware queue has been
94 * set up, allowing the driver to allocate/init matching structures.
95 * Ditto for exit/teardown.
96 */
97 init_hctx_fn *init_hctx;
98 exit_hctx_fn *exit_hctx;
99};
100
101enum {
102 BLK_MQ_RQ_QUEUE_OK = 0, /* queued fine */
103 BLK_MQ_RQ_QUEUE_BUSY = 1, /* requeue IO for later */
104 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */
105
106 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
107 BLK_MQ_F_SHOULD_SORT = 1 << 1,
108 BLK_MQ_F_SHOULD_IPI = 1 << 2,
109
110 BLK_MQ_S_STOPPED = 1 << 0,
111
112 BLK_MQ_MAX_DEPTH = 2048,
113};
114
115struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *);
116void blk_mq_free_queue(struct request_queue *);
117int blk_mq_register_disk(struct gendisk *);
118void blk_mq_unregister_disk(struct gendisk *);
119void blk_mq_init_commands(struct request_queue *, void (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data);
120
121void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
122
123void blk_mq_insert_request(struct request_queue *, struct request *, bool);
124void blk_mq_run_queues(struct request_queue *q, bool async);
125void blk_mq_free_request(struct request *rq);
126bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
127struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp, bool reserved);
128struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, gfp_t gfp);
129struct request *blk_mq_rq_from_tag(struct request_queue *q, unsigned int tag);
130
131struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
132struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_reg *, unsigned int);
133void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *, unsigned int);
134
135void blk_mq_end_io(struct request *rq, int error);
136
137void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
138void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
139void blk_mq_stop_hw_queues(struct request_queue *q);
140void blk_mq_start_stopped_hw_queues(struct request_queue *q);
141
142/*
143 * Driver command data is immediately after the request. So subtract request
144 * size to get back to the original request.
145 */
146static inline struct request *blk_mq_rq_from_pdu(void *pdu)
147{
148 return pdu - sizeof(struct request);
149}
150static inline void *blk_mq_rq_to_pdu(struct request *rq)
151{
152 return (void *) rq + sizeof(*rq);
153}
154
155static inline struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx,
156 unsigned int tag)
157{
158 return hctx->rqs[tag];
159}
160
161#define queue_for_each_hw_ctx(q, hctx, i) \
162 for ((i) = 0, hctx = (q)->queue_hw_ctx[0]; \
163 (i) < (q)->nr_hw_queues; (i)++, hctx = (q)->queue_hw_ctx[i])
164
165#define queue_for_each_ctx(q, ctx, i) \
166 for ((i) = 0, ctx = per_cpu_ptr((q)->queue_ctx, 0); \
167 (i) < (q)->nr_queues; (i)++, ctx = per_cpu_ptr(q->queue_ctx, (i)))
168
169#define hctx_for_each_ctx(hctx, ctx, i) \
170 for ((i) = 0, ctx = (hctx)->ctxs[0]; \
171 (i) < (hctx)->nr_ctx; (i)++, ctx = (hctx)->ctxs[(i)])
172
173#define blk_ctx_sum(q, sum) \
174({ \
175 struct blk_mq_ctx *__x; \
176 unsigned int __ret = 0, __i; \
177 \
178 queue_for_each_ctx((q), __x, __i) \
179 __ret += sum; \
180 __ret; \
181})
182
183#endif
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index fa1abeb45b76..238ef0ed62f8 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -178,19 +178,20 @@ enum rq_flag_bits {
178 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 178 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
179 __REQ_KERNEL, /* direct IO to kernel pages */ 179 __REQ_KERNEL, /* direct IO to kernel pages */
180 __REQ_PM, /* runtime pm request */ 180 __REQ_PM, /* runtime pm request */
181 __REQ_END, /* last of chain of requests */
181 __REQ_NR_BITS, /* stops here */ 182 __REQ_NR_BITS, /* stops here */
182}; 183};
183 184
184#define REQ_WRITE (1 << __REQ_WRITE) 185#define REQ_WRITE (1ULL << __REQ_WRITE)
185#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) 186#define REQ_FAILFAST_DEV (1ULL << __REQ_FAILFAST_DEV)
186#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) 187#define REQ_FAILFAST_TRANSPORT (1ULL << __REQ_FAILFAST_TRANSPORT)
187#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) 188#define REQ_FAILFAST_DRIVER (1ULL << __REQ_FAILFAST_DRIVER)
188#define REQ_SYNC (1 << __REQ_SYNC) 189#define REQ_SYNC (1ULL << __REQ_SYNC)
189#define REQ_META (1 << __REQ_META) 190#define REQ_META (1ULL << __REQ_META)
190#define REQ_PRIO (1 << __REQ_PRIO) 191#define REQ_PRIO (1ULL << __REQ_PRIO)
191#define REQ_DISCARD (1 << __REQ_DISCARD) 192#define REQ_DISCARD (1ULL << __REQ_DISCARD)
192#define REQ_WRITE_SAME (1 << __REQ_WRITE_SAME) 193#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
193#define REQ_NOIDLE (1 << __REQ_NOIDLE) 194#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
194 195
195#define REQ_FAILFAST_MASK \ 196#define REQ_FAILFAST_MASK \
196 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 197 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
@@ -206,28 +207,29 @@ enum rq_flag_bits {
206#define REQ_NOMERGE_FLAGS \ 207#define REQ_NOMERGE_FLAGS \
207 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) 208 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA)
208 209
209#define REQ_RAHEAD (1 << __REQ_RAHEAD) 210#define REQ_RAHEAD (1ULL << __REQ_RAHEAD)
210#define REQ_THROTTLED (1 << __REQ_THROTTLED) 211#define REQ_THROTTLED (1ULL << __REQ_THROTTLED)
211 212
212#define REQ_SORTED (1 << __REQ_SORTED) 213#define REQ_SORTED (1ULL << __REQ_SORTED)
213#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 214#define REQ_SOFTBARRIER (1ULL << __REQ_SOFTBARRIER)
214#define REQ_FUA (1 << __REQ_FUA) 215#define REQ_FUA (1ULL << __REQ_FUA)
215#define REQ_NOMERGE (1 << __REQ_NOMERGE) 216#define REQ_NOMERGE (1ULL << __REQ_NOMERGE)
216#define REQ_STARTED (1 << __REQ_STARTED) 217#define REQ_STARTED (1ULL << __REQ_STARTED)
217#define REQ_DONTPREP (1 << __REQ_DONTPREP) 218#define REQ_DONTPREP (1ULL << __REQ_DONTPREP)
218#define REQ_QUEUED (1 << __REQ_QUEUED) 219#define REQ_QUEUED (1ULL << __REQ_QUEUED)
219#define REQ_ELVPRIV (1 << __REQ_ELVPRIV) 220#define REQ_ELVPRIV (1ULL << __REQ_ELVPRIV)
220#define REQ_FAILED (1 << __REQ_FAILED) 221#define REQ_FAILED (1ULL << __REQ_FAILED)
221#define REQ_QUIET (1 << __REQ_QUIET) 222#define REQ_QUIET (1ULL << __REQ_QUIET)
222#define REQ_PREEMPT (1 << __REQ_PREEMPT) 223#define REQ_PREEMPT (1ULL << __REQ_PREEMPT)
223#define REQ_ALLOCED (1 << __REQ_ALLOCED) 224#define REQ_ALLOCED (1ULL << __REQ_ALLOCED)
224#define REQ_COPY_USER (1 << __REQ_COPY_USER) 225#define REQ_COPY_USER (1ULL << __REQ_COPY_USER)
225#define REQ_FLUSH (1 << __REQ_FLUSH) 226#define REQ_FLUSH (1ULL << __REQ_FLUSH)
226#define REQ_FLUSH_SEQ (1 << __REQ_FLUSH_SEQ) 227#define REQ_FLUSH_SEQ (1ULL << __REQ_FLUSH_SEQ)
227#define REQ_IO_STAT (1 << __REQ_IO_STAT) 228#define REQ_IO_STAT (1ULL << __REQ_IO_STAT)
228#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 229#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE)
229#define REQ_SECURE (1 << __REQ_SECURE) 230#define REQ_SECURE (1ULL << __REQ_SECURE)
230#define REQ_KERNEL (1 << __REQ_KERNEL) 231#define REQ_KERNEL (1ULL << __REQ_KERNEL)
231#define REQ_PM (1 << __REQ_PM) 232#define REQ_PM (1ULL << __REQ_PM)
233#define REQ_END (1ULL << __REQ_END)
232 234
233#endif /* __LINUX_BLK_TYPES_H */ 235#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a451b49..1b135d49b279 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -8,6 +8,7 @@
8#include <linux/major.h> 8#include <linux/major.h>
9#include <linux/genhd.h> 9#include <linux/genhd.h>
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/llist.h>
11#include <linux/timer.h> 12#include <linux/timer.h>
12#include <linux/workqueue.h> 13#include <linux/workqueue.h>
13#include <linux/pagemap.h> 14#include <linux/pagemap.h>
@@ -94,12 +95,19 @@ enum rq_cmd_type_bits {
94 * as well! 95 * as well!
95 */ 96 */
96struct request { 97struct request {
97 struct list_head queuelist; 98 union {
98 struct call_single_data csd; 99 struct list_head queuelist;
100 struct llist_node ll_list;
101 };
102 union {
103 struct call_single_data csd;
104 struct work_struct mq_flush_data;
105 };
99 106
100 struct request_queue *q; 107 struct request_queue *q;
108 struct blk_mq_ctx *mq_ctx;
101 109
102 unsigned int cmd_flags; 110 u64 cmd_flags;
103 enum rq_cmd_type_bits cmd_type; 111 enum rq_cmd_type_bits cmd_type;
104 unsigned long atomic_flags; 112 unsigned long atomic_flags;
105 113
@@ -160,8 +168,6 @@ struct request {
160 168
161 unsigned short ioprio; 169 unsigned short ioprio;
162 170
163 int ref_count;
164
165 void *special; /* opaque pointer available for LLD use */ 171 void *special; /* opaque pointer available for LLD use */
166 char *buffer; /* kaddr of the current segment if available */ 172 char *buffer; /* kaddr of the current segment if available */
167 173
@@ -215,6 +221,8 @@ struct request_pm_state
215 221
216#include <linux/elevator.h> 222#include <linux/elevator.h>
217 223
224struct blk_queue_ctx;
225
218typedef void (request_fn_proc) (struct request_queue *q); 226typedef void (request_fn_proc) (struct request_queue *q);
219typedef void (make_request_fn) (struct request_queue *q, struct bio *bio); 227typedef void (make_request_fn) (struct request_queue *q, struct bio *bio);
220typedef int (prep_rq_fn) (struct request_queue *, struct request *); 228typedef int (prep_rq_fn) (struct request_queue *, struct request *);
@@ -313,6 +321,18 @@ struct request_queue {
313 dma_drain_needed_fn *dma_drain_needed; 321 dma_drain_needed_fn *dma_drain_needed;
314 lld_busy_fn *lld_busy_fn; 322 lld_busy_fn *lld_busy_fn;
315 323
324 struct blk_mq_ops *mq_ops;
325
326 unsigned int *mq_map;
327
328 /* sw queues */
329 struct blk_mq_ctx *queue_ctx;
330 unsigned int nr_queues;
331
332 /* hw dispatch queues */
333 struct blk_mq_hw_ctx **queue_hw_ctx;
334 unsigned int nr_hw_queues;
335
316 /* 336 /*
317 * Dispatch queue sorting 337 * Dispatch queue sorting
318 */ 338 */
@@ -361,6 +381,11 @@ struct request_queue {
361 */ 381 */
362 struct kobject kobj; 382 struct kobject kobj;
363 383
384 /*
385 * mq queue kobject
386 */
387 struct kobject mq_kobj;
388
364#ifdef CONFIG_PM_RUNTIME 389#ifdef CONFIG_PM_RUNTIME
365 struct device *dev; 390 struct device *dev;
366 int rpm_status; 391 int rpm_status;
@@ -425,7 +450,13 @@ struct request_queue {
425 unsigned long flush_pending_since; 450 unsigned long flush_pending_since;
426 struct list_head flush_queue[2]; 451 struct list_head flush_queue[2];
427 struct list_head flush_data_in_flight; 452 struct list_head flush_data_in_flight;
428 struct request flush_rq; 453 union {
454 struct request flush_rq;
455 struct {
456 spinlock_t mq_flush_lock;
457 struct work_struct mq_flush_work;
458 };
459 };
429 460
430 struct mutex sysfs_lock; 461 struct mutex sysfs_lock;
431 462
@@ -437,14 +468,14 @@ struct request_queue {
437 struct bsg_class_device bsg_dev; 468 struct bsg_class_device bsg_dev;
438#endif 469#endif
439 470
440#ifdef CONFIG_BLK_CGROUP
441 struct list_head all_q_node;
442#endif
443#ifdef CONFIG_BLK_DEV_THROTTLING 471#ifdef CONFIG_BLK_DEV_THROTTLING
444 /* Throttle data */ 472 /* Throttle data */
445 struct throtl_data *td; 473 struct throtl_data *td;
446#endif 474#endif
447 struct rcu_head rcu_head; 475 struct rcu_head rcu_head;
476 wait_queue_head_t mq_freeze_wq;
477 struct percpu_counter mq_usage_counter;
478 struct list_head all_q_node;
448}; 479};
449 480
450#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 481#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -467,12 +498,16 @@ struct request_queue {
467#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ 498#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
468#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 499#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
469#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ 500#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
501#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */
470 502
471#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 503#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
472 (1 << QUEUE_FLAG_STACKABLE) | \ 504 (1 << QUEUE_FLAG_STACKABLE) | \
473 (1 << QUEUE_FLAG_SAME_COMP) | \ 505 (1 << QUEUE_FLAG_SAME_COMP) | \
474 (1 << QUEUE_FLAG_ADD_RANDOM)) 506 (1 << QUEUE_FLAG_ADD_RANDOM))
475 507
508#define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
509 (1 << QUEUE_FLAG_SAME_COMP))
510
476static inline void queue_lockdep_assert_held(struct request_queue *q) 511static inline void queue_lockdep_assert_held(struct request_queue *q)
477{ 512{
478 if (q->queue_lock) 513 if (q->queue_lock)
@@ -539,6 +574,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
539#define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) 574#define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)
540#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) 575#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
541#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) 576#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags)
577#define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags)
542#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 578#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
543#define blk_queue_noxmerges(q) \ 579#define blk_queue_noxmerges(q) \
544 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 580 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
@@ -570,7 +606,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
570 606
571#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 607#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
572 608
573#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 609#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0)
574 610
575static inline unsigned int blk_queue_cluster(struct request_queue *q) 611static inline unsigned int blk_queue_cluster(struct request_queue *q)
576{ 612{
@@ -862,6 +898,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862 return blk_queue_get_max_sectors(q, rq->cmd_flags); 898 return blk_queue_get_max_sectors(q, rq->cmd_flags);
863} 899}
864 900
901static inline unsigned int blk_rq_count_bios(struct request *rq)
902{
903 unsigned int nr_bios = 0;
904 struct bio *bio;
905
906 __rq_for_each_bio(bio, rq)
907 nr_bios++;
908
909 return nr_bios;
910}
911
865/* 912/*
866 * Request issue related functions. 913 * Request issue related functions.
867 */ 914 */
@@ -1002,6 +1049,7 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
1002struct blk_plug { 1049struct blk_plug {
1003 unsigned long magic; /* detect uninitialized use-cases */ 1050 unsigned long magic; /* detect uninitialized use-cases */
1004 struct list_head list; /* requests */ 1051 struct list_head list; /* requests */
1052 struct list_head mq_list; /* blk-mq requests */
1005 struct list_head cb_list; /* md requires an unplug callback */ 1053 struct list_head cb_list; /* md requires an unplug callback */
1006}; 1054};
1007#define BLK_MAX_REQUEST_COUNT 16 1055#define BLK_MAX_REQUEST_COUNT 16
@@ -1039,7 +1087,10 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1039{ 1087{
1040 struct blk_plug *plug = tsk->plug; 1088 struct blk_plug *plug = tsk->plug;
1041 1089
1042 return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); 1090 return plug &&
1091 (!list_empty(&plug->list) ||
1092 !list_empty(&plug->mq_list) ||
1093 !list_empty(&plug->cb_list));
1043} 1094}
1044 1095
1045/* 1096/*
@@ -1314,6 +1365,7 @@ static inline void put_dev_sector(Sector p)
1314 1365
1315struct work_struct; 1366struct work_struct;
1316int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1367int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1368int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
1317 1369
1318#ifdef CONFIG_BLK_CGROUP 1370#ifdef CONFIG_BLK_CGROUP
1319/* 1371/*
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7c2e030e72f1..afc1343df3c7 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -5,6 +5,7 @@
5#include <linux/relay.h> 5#include <linux/relay.h>
6#include <linux/compat.h> 6#include <linux/compat.h>
7#include <uapi/linux/blktrace_api.h> 7#include <uapi/linux/blktrace_api.h>
8#include <linux/list.h>
8 9
9#if defined(CONFIG_BLK_DEV_IO_TRACE) 10#if defined(CONFIG_BLK_DEV_IO_TRACE)
10 11
@@ -23,6 +24,7 @@ struct blk_trace {
23 struct dentry *dir; 24 struct dentry *dir;
24 struct dentry *dropped_file; 25 struct dentry *dropped_file;
25 struct dentry *msg_file; 26 struct dentry *msg_file;
27 struct list_head running_list;
26 atomic_t dropped; 28 atomic_t dropped;
27}; 29};
28 30
@@ -87,7 +89,7 @@ static inline int blk_trace_init_sysfs(struct device *dev)
87#ifdef CONFIG_COMPAT 89#ifdef CONFIG_COMPAT
88 90
89struct compat_blk_user_trace_setup { 91struct compat_blk_user_trace_setup {
90 char name[32]; 92 char name[BLKTRACE_BDEV_SIZE];
91 u16 act_mask; 93 u16 act_mask;
92 u32 buf_size; 94 u32 buf_size;
93 u32 buf_nr; 95 u32 buf_nr;
diff --git a/include/linux/capability.h b/include/linux/capability.h
index d9a4f7f40f32..a6ee1f9a5018 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -210,7 +210,6 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
210 struct user_namespace *ns, int cap); 210 struct user_namespace *ns, int cap);
211extern bool capable(int cap); 211extern bool capable(int cap);
212extern bool ns_capable(struct user_namespace *ns, int cap); 212extern bool ns_capable(struct user_namespace *ns, int cap);
213extern bool nsown_capable(int cap);
214extern bool inode_capable(const struct inode *inode, int cap); 213extern bool inode_capable(const struct inode *inode, int cap);
215extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
216 215
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index ce6df39f60ff..8f47625a0661 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -335,6 +335,8 @@ extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
335 struct ceph_osd_request *req); 335 struct ceph_osd_request *req);
336extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 336extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
337 337
338extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc);
339
338extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, 340extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
339 struct ceph_vino vino, 341 struct ceph_vino vino,
340 struct ceph_file_layout *layout, 342 struct ceph_file_layout *layout,
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 3561d305b1e0..39c1d9469677 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -612,11 +612,6 @@ struct cgroup_subsys {
612 int subsys_id; 612 int subsys_id;
613 int disabled; 613 int disabled;
614 int early_init; 614 int early_init;
615 /*
616 * True if this subsys uses ID. ID is not available before cgroup_init()
617 * (not available in early_init time.)
618 */
619 bool use_id;
620 615
621 /* 616 /*
622 * If %false, this subsystem is properly hierarchical - 617 * If %false, this subsystem is properly hierarchical -
@@ -642,9 +637,6 @@ struct cgroup_subsys {
642 */ 637 */
643 struct cgroupfs_root *root; 638 struct cgroupfs_root *root;
644 struct list_head sibling; 639 struct list_head sibling;
645 /* used when use_id == true */
646 struct idr idr;
647 spinlock_t id_lock;
648 640
649 /* list of cftype_sets */ 641 /* list of cftype_sets */
650 struct list_head cftsets; 642 struct list_head cftsets;
@@ -875,35 +867,6 @@ int css_scan_tasks(struct cgroup_subsys_state *css,
875int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 867int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
876int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 868int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
877 869
878/*
879 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
880 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
881 * CSS ID is assigned at cgroup allocation (create) automatically
882 * and removed when subsys calls free_css_id() function. This is because
883 * the lifetime of cgroup_subsys_state is subsys's matter.
884 *
885 * Looking up and scanning function should be called under rcu_read_lock().
886 * Taking cgroup_mutex is not necessary for following calls.
887 * But the css returned by this routine can be "not populated yet" or "being
888 * destroyed". The caller should check css and cgroup's status.
889 */
890
891/*
892 * Typically Called at ->destroy(), or somewhere the subsys frees
893 * cgroup_subsys_state.
894 */
895void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
896
897/* Find a cgroup_subsys_state which has given ID */
898
899struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
900
901/* Returns true if root is ancestor of cg */
902bool css_is_ancestor(struct cgroup_subsys_state *cg,
903 const struct cgroup_subsys_state *root);
904
905/* Get id and depth of css */
906unsigned short css_id(struct cgroup_subsys_state *css);
907struct cgroup_subsys_state *css_from_dir(struct dentry *dentry, 870struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
908 struct cgroup_subsys *ss); 871 struct cgroup_subsys *ss);
909 872
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index dd7adff76e81..8138c94409f3 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -33,8 +33,11 @@ struct clk {
33 const char **parent_names; 33 const char **parent_names;
34 struct clk **parents; 34 struct clk **parents;
35 u8 num_parents; 35 u8 num_parents;
36 u8 new_parent_index;
36 unsigned long rate; 37 unsigned long rate;
37 unsigned long new_rate; 38 unsigned long new_rate;
39 struct clk *new_parent;
40 struct clk *new_child;
38 unsigned long flags; 41 unsigned long flags;
39 unsigned int enable_count; 42 unsigned int enable_count;
40 unsigned int prepare_count; 43 unsigned int prepare_count;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1ec14a732176..7e59253b8603 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -12,6 +12,7 @@
12#define __LINUX_CLK_PROVIDER_H 12#define __LINUX_CLK_PROVIDER_H
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h>
15 16
16#ifdef CONFIG_COMMON_CLK 17#ifdef CONFIG_COMMON_CLK
17 18
@@ -27,6 +28,7 @@
27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ 28#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
28#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ 29#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
29#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ 30#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
31#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
30 32
31struct clk_hw; 33struct clk_hw;
32 34
@@ -79,6 +81,10 @@ struct clk_hw;
79 * @round_rate: Given a target rate as input, returns the closest rate actually 81 * @round_rate: Given a target rate as input, returns the closest rate actually
80 * supported by the clock. 82 * supported by the clock.
81 * 83 *
84 * @determine_rate: Given a target rate as input, returns the closest rate
85 * actually supported by the clock, and optionally the parent clock
86 * that should be used to provide the clock rate.
87 *
82 * @get_parent: Queries the hardware to determine the parent of a clock. The 88 * @get_parent: Queries the hardware to determine the parent of a clock. The
83 * return value is a u8 which specifies the index corresponding to 89 * return value is a u8 which specifies the index corresponding to
84 * the parent clock. This index can be applied to either the 90 * the parent clock. This index can be applied to either the
@@ -126,6 +132,9 @@ struct clk_ops {
126 unsigned long parent_rate); 132 unsigned long parent_rate);
127 long (*round_rate)(struct clk_hw *hw, unsigned long, 133 long (*round_rate)(struct clk_hw *hw, unsigned long,
128 unsigned long *); 134 unsigned long *);
135 long (*determine_rate)(struct clk_hw *hw, unsigned long rate,
136 unsigned long *best_parent_rate,
137 struct clk **best_parent_clk);
129 int (*set_parent)(struct clk_hw *hw, u8 index); 138 int (*set_parent)(struct clk_hw *hw, u8 index);
130 u8 (*get_parent)(struct clk_hw *hw); 139 u8 (*get_parent)(struct clk_hw *hw);
131 int (*set_rate)(struct clk_hw *hw, unsigned long, 140 int (*set_rate)(struct clk_hw *hw, unsigned long,
@@ -327,8 +336,10 @@ struct clk_mux {
327#define CLK_MUX_INDEX_ONE BIT(0) 336#define CLK_MUX_INDEX_ONE BIT(0)
328#define CLK_MUX_INDEX_BIT BIT(1) 337#define CLK_MUX_INDEX_BIT BIT(1)
329#define CLK_MUX_HIWORD_MASK BIT(2) 338#define CLK_MUX_HIWORD_MASK BIT(2)
339#define CLK_MUX_READ_ONLY BIT(3) /* mux setting cannot be changed */
330 340
331extern const struct clk_ops clk_mux_ops; 341extern const struct clk_ops clk_mux_ops;
342extern const struct clk_ops clk_mux_ro_ops;
332 343
333struct clk *clk_register_mux(struct device *dev, const char *name, 344struct clk *clk_register_mux(struct device *dev, const char *name,
334 const char **parent_names, u8 num_parents, unsigned long flags, 345 const char **parent_names, u8 num_parents, unsigned long flags,
@@ -418,6 +429,7 @@ const char *__clk_get_name(struct clk *clk);
418struct clk_hw *__clk_get_hw(struct clk *clk); 429struct clk_hw *__clk_get_hw(struct clk *clk);
419u8 __clk_get_num_parents(struct clk *clk); 430u8 __clk_get_num_parents(struct clk *clk);
420struct clk *__clk_get_parent(struct clk *clk); 431struct clk *__clk_get_parent(struct clk *clk);
432struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
421unsigned int __clk_get_enable_count(struct clk *clk); 433unsigned int __clk_get_enable_count(struct clk *clk);
422unsigned int __clk_get_prepare_count(struct clk *clk); 434unsigned int __clk_get_prepare_count(struct clk *clk);
423unsigned long __clk_get_rate(struct clk *clk); 435unsigned long __clk_get_rate(struct clk *clk);
@@ -425,6 +437,9 @@ unsigned long __clk_get_flags(struct clk *clk);
425bool __clk_is_prepared(struct clk *clk); 437bool __clk_is_prepared(struct clk *clk);
426bool __clk_is_enabled(struct clk *clk); 438bool __clk_is_enabled(struct clk *clk);
427struct clk *__clk_lookup(const char *name); 439struct clk *__clk_lookup(const char *name);
440long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
441 unsigned long *best_parent_rate,
442 struct clk **best_parent_p);
428 443
429/* 444/*
430 * FIXME clock api without lock protection 445 * FIXME clock api without lock protection
@@ -457,6 +472,7 @@ void of_clk_del_provider(struct device_node *np);
457struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 472struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
458 void *data); 473 void *data);
459struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 474struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
475int of_clk_get_parent_count(struct device_node *np);
460const char *of_clk_get_parent_name(struct device_node *np, int index); 476const char *of_clk_get_parent_name(struct device_node *np, int index);
461 477
462void of_clk_init(const struct of_device_id *matches); 478void of_clk_init(const struct of_device_id *matches);
@@ -490,5 +506,21 @@ static inline const char *of_clk_get_parent_name(struct device_node *np,
490#define of_clk_init(matches) \ 506#define of_clk_init(matches) \
491 { while (0); } 507 { while (0); }
492#endif /* CONFIG_OF */ 508#endif /* CONFIG_OF */
509
510/*
511 * wrap access to peripherals in accessor routines
512 * for improved portability across platforms
513 */
514
515static inline u32 clk_readl(u32 __iomem *reg)
516{
517 return readl(reg);
518}
519
520static inline void clk_writel(u32 val, u32 __iomem *reg)
521{
522 writel(val, reg);
523}
524
493#endif /* CONFIG_COMMON_CLK */ 525#endif /* CONFIG_COMMON_CLK */
494#endif /* CLK_PROVIDER_H */ 526#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h
index 90c30dc3efc7..5138a90e018c 100644
--- a/include/linux/clk/mxs.h
+++ b/include/linux/clk/mxs.h
@@ -9,8 +9,6 @@
9#ifndef __LINUX_CLK_MXS_H 9#ifndef __LINUX_CLK_MXS_H
10#define __LINUX_CLK_MXS_H 10#define __LINUX_CLK_MXS_H
11 11
12int mx23_clocks_init(void);
13int mx28_clocks_init(void);
14int mxs_saif_clkmux_select(unsigned int clkmux); 12int mxs_saif_clkmux_select(unsigned int clkmux);
15 13
16#endif 14#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 0857922e8ad0..493aa021c7a9 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -60,6 +60,7 @@ enum clock_event_mode {
60 * Core shall set the interrupt affinity dynamically in broadcast mode 60 * Core shall set the interrupt affinity dynamically in broadcast mode
61 */ 61 */
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040
63 64
64/** 65/**
65 * struct clock_event_device - clock event device descriptor 66 * struct clock_event_device - clock event device descriptor
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index dbbf8aa7731b..67301a405712 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -292,6 +292,8 @@ extern void clocksource_resume(void);
292extern struct clocksource * __init __weak clocksource_default_clock(void); 292extern struct clocksource * __init __weak clocksource_default_clock(void);
293extern void clocksource_mark_unstable(struct clocksource *cs); 293extern void clocksource_mark_unstable(struct clocksource *cs);
294 294
295extern u64
296clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask);
295extern void 297extern void
296clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 298clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
297 299
diff --git a/include/linux/cmdline-parser.h b/include/linux/cmdline-parser.h
new file mode 100644
index 000000000000..a0f9280421ec
--- /dev/null
+++ b/include/linux/cmdline-parser.h
@@ -0,0 +1,45 @@
1/*
2 * Parsing command line, get the partitions information.
3 *
4 * Written by Cai Zhiyong <caizhiyong@huawei.com>
5 *
6 */
7#ifndef CMDLINEPARSEH
8#define CMDLINEPARSEH
9
10#include <linux/blkdev.h>
11#include <linux/fs.h>
12#include <linux/slab.h>
13
14/* partition flags */
15#define PF_RDONLY 0x01 /* Device is read only */
16#define PF_POWERUP_LOCK 0x02 /* Always locked after reset */
17
18struct cmdline_subpart {
19 char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
20 sector_t from;
21 sector_t size;
22 int flags;
23 struct cmdline_subpart *next_subpart;
24};
25
26struct cmdline_parts {
27 char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */
28 unsigned int nr_subparts;
29 struct cmdline_subpart *subpart;
30 struct cmdline_parts *next_parts;
31};
32
33void cmdline_parts_free(struct cmdline_parts **parts);
34
35int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
36
37struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
38 const char *bdev);
39
40void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
41 int slot,
42 int (*add_part)(int, struct cmdline_subpart *, void *),
43 void *param);
44
45#endif /* CMDLINEPARSEH */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ec1aee4aec9c..eb8a49d75ab3 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -41,13 +41,14 @@
41 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 41 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
42 42
43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
45 __attribute__((alias(__stringify(compat_SyS##name)))); \
45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 46 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
47 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ 48 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
47 { \ 49 { \
48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ 50 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
49 } \ 51 } \
50 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
51 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 52 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
52 53
53#ifndef compat_user_stack_pointer 54#ifndef compat_user_stack_pointer
@@ -361,7 +362,7 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
361long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 362long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
362 unsigned long bitmap_size); 363 unsigned long bitmap_size);
363int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from); 364int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
364int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); 365int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from);
365int get_compat_sigevent(struct sigevent *event, 366int get_compat_sigevent(struct sigevent *event,
366 const struct compat_sigevent __user *u_event); 367 const struct compat_sigevent __user *u_event);
367long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, 368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 842de225055f..ded429966c1f 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -65,6 +65,21 @@
65#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
66#endif 66#endif
67 67
68/*
69 * GCC 'asm goto' miscompiles certain code sequences:
70 *
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 *
76 * (asm goto is automatically volatile - the naming reflects this.)
77 */
78#if GCC_VERSION <= 40801
79# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
80#else
81# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
82#endif
68 83
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 84#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if GCC_VERSION >= 40400 85#if GCC_VERSION >= 40400
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index 973ce10c40b6..dc1bd3dcf11f 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -28,8 +28,6 @@
28 28
29#endif 29#endif
30 30
31#define uninitialized_var(x) x
32
33#ifndef __HAVE_BUILTIN_BSWAP16__ 31#ifndef __HAVE_BUILTIN_BSWAP16__
34/* icc has this, but it's called _bswap16 */ 32/* icc has this, but it's called _bswap16 */
35#define __HAVE_BUILTIN_BSWAP16__ 33#define __HAVE_BUILTIN_BSWAP16__
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 3cd574d5b19e..5d5aaae3af43 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -5,7 +5,7 @@
5 * (C) Copyright 2001 Linus Torvalds 5 * (C) Copyright 2001 Linus Torvalds
6 * 6 *
7 * Atomic wait-for-completion handler data structures. 7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched/core.c for details. 8 * See kernel/sched/completion.c for details.
9 */ 9 */
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
@@ -19,8 +19,8 @@
19 * 19 *
20 * See also: complete(), wait_for_completion() (and friends _timeout, 20 * See also: complete(), wait_for_completion() (and friends _timeout,
21 * _interruptible, _interruptible_timeout, and _killable), init_completion(), 21 * _interruptible, _interruptible_timeout, and _killable), init_completion(),
22 * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and 22 * reinit_completion(), and macros DECLARE_COMPLETION(),
23 * INIT_COMPLETION(). 23 * DECLARE_COMPLETION_ONSTACK().
24 */ 24 */
25struct completion { 25struct completion {
26 unsigned int done; 26 unsigned int done;
@@ -65,7 +65,7 @@ struct completion {
65 65
66/** 66/**
67 * init_completion - Initialize a dynamically allocated completion 67 * init_completion - Initialize a dynamically allocated completion
68 * @x: completion structure that is to be initialized 68 * @x: pointer to completion structure that is to be initialized
69 * 69 *
70 * This inline function will initialize a dynamically created completion 70 * This inline function will initialize a dynamically created completion
71 * structure. 71 * structure.
@@ -76,6 +76,18 @@ static inline void init_completion(struct completion *x)
76 init_waitqueue_head(&x->wait); 76 init_waitqueue_head(&x->wait);
77} 77}
78 78
79/**
80 * reinit_completion - reinitialize a completion structure
81 * @x: pointer to completion structure that is to be reinitialized
82 *
83 * This inline function should be used to reinitialize a completion structure so it can
84 * be reused. This is especially important after complete_all() is used.
85 */
86static inline void reinit_completion(struct completion *x)
87{
88 x->done = 0;
89}
90
79extern void wait_for_completion(struct completion *); 91extern void wait_for_completion(struct completion *);
80extern void wait_for_completion_io(struct completion *); 92extern void wait_for_completion_io(struct completion *);
81extern int wait_for_completion_interruptible(struct completion *x); 93extern int wait_for_completion_interruptible(struct completion *x);
@@ -94,14 +106,4 @@ extern bool completion_done(struct completion *x);
94extern void complete(struct completion *); 106extern void complete(struct completion *);
95extern void complete_all(struct completion *); 107extern void complete_all(struct completion *);
96 108
97/**
98 * INIT_COMPLETION - reinitialize a completion structure
99 * @x: completion structure to be reinitialized
100 *
101 * This macro should be used to reinitialize a completion structure so it can
102 * be reused. This is especially important after complete_all() is used.
103 */
104#define INIT_COMPLETION(x) ((x).done = 0)
105
106
107#endif 109#endif
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index a98f1ca60407..d016a121a8c4 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -10,12 +10,14 @@
10 * These are the only things you should do on a core-file: use only these 10 * These are the only things you should do on a core-file: use only these
11 * functions to write out all the necessary info. 11 * functions to write out all the necessary info.
12 */ 12 */
13extern int dump_write(struct file *file, const void *addr, int nr); 13struct coredump_params;
14extern int dump_seek(struct file *file, loff_t off); 14extern int dump_skip(struct coredump_params *cprm, size_t nr);
15extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
16extern int dump_align(struct coredump_params *cprm, int align);
15#ifdef CONFIG_COREDUMP 17#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo); 18extern void do_coredump(const siginfo_t *siginfo);
17#else 19#else
18static inline void do_coredump(siginfo_t *siginfo) {} 20static inline void do_coredump(const siginfo_t *siginfo) {}
19#endif 21#endif
20 22
21#endif /* _LINUX_COREDUMP_H */ 23#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cper.h b/include/linux/cper.h
index c23049496531..2fc0ec3d89cc 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -218,8 +218,8 @@ enum {
218#define CPER_PROC_VALID_IP 0x1000 218#define CPER_PROC_VALID_IP 0x1000
219 219
220#define CPER_MEM_VALID_ERROR_STATUS 0x0001 220#define CPER_MEM_VALID_ERROR_STATUS 0x0001
221#define CPER_MEM_VALID_PHYSICAL_ADDRESS 0x0002 221#define CPER_MEM_VALID_PA 0x0002
222#define CPER_MEM_VALID_PHYSICAL_ADDRESS_MASK 0x0004 222#define CPER_MEM_VALID_PA_MASK 0x0004
223#define CPER_MEM_VALID_NODE 0x0008 223#define CPER_MEM_VALID_NODE 0x0008
224#define CPER_MEM_VALID_CARD 0x0010 224#define CPER_MEM_VALID_CARD 0x0010
225#define CPER_MEM_VALID_MODULE 0x0020 225#define CPER_MEM_VALID_MODULE 0x0020
@@ -232,6 +232,9 @@ enum {
232#define CPER_MEM_VALID_RESPONDER_ID 0x1000 232#define CPER_MEM_VALID_RESPONDER_ID 0x1000
233#define CPER_MEM_VALID_TARGET_ID 0x2000 233#define CPER_MEM_VALID_TARGET_ID 0x2000
234#define CPER_MEM_VALID_ERROR_TYPE 0x4000 234#define CPER_MEM_VALID_ERROR_TYPE 0x4000
235#define CPER_MEM_VALID_RANK_NUMBER 0x8000
236#define CPER_MEM_VALID_CARD_HANDLE 0x10000
237#define CPER_MEM_VALID_MODULE_HANDLE 0x20000
235 238
236#define CPER_PCIE_VALID_PORT_TYPE 0x0001 239#define CPER_PCIE_VALID_PORT_TYPE 0x0001
237#define CPER_PCIE_VALID_VERSION 0x0002 240#define CPER_PCIE_VALID_VERSION 0x0002
@@ -347,6 +350,10 @@ struct cper_sec_mem_err {
347 __u64 responder_id; 350 __u64 responder_id;
348 __u64 target_id; 351 __u64 target_id;
349 __u8 error_type; 352 __u8 error_type;
353 __u8 reserved;
354 __u16 rank;
355 __u16 mem_array_handle; /* card handle in UEFI 2.4 */
356 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */
350}; 357};
351 358
352struct cper_sec_pcie { 359struct cper_sec_pcie {
@@ -389,6 +396,6 @@ struct cper_sec_pcie {
389 396
390u64 cper_next_record_id(void); 397u64 cper_next_record_id(void);
391void cper_print_bits(const char *prefix, unsigned int bits, 398void cper_print_bits(const char *prefix, unsigned int bits,
392 const char *strs[], unsigned int strs_size); 399 const char * const strs[], unsigned int strs_size);
393 400
394#endif 401#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 801ff9e73679..03e235ad1bba 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -18,6 +18,7 @@
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19 19
20struct device; 20struct device;
21struct device_node;
21 22
22struct cpu { 23struct cpu {
23 int node_id; /* The node which contains the CPU */ 24 int node_id; /* The node which contains the CPU */
@@ -29,6 +30,8 @@ extern int register_cpu(struct cpu *cpu, int num);
29extern struct device *get_cpu_device(unsigned cpu); 30extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu); 31extern bool cpu_is_hotpluggable(unsigned cpu);
31extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id); 32extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
33extern bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
34 int cpu, unsigned int *thread);
32 35
33extern int cpu_add_dev_attr(struct device_attribute *attr); 36extern int cpu_add_dev_attr(struct device_attribute *attr);
34extern void cpu_remove_dev_attr(struct device_attribute *attr); 37extern void cpu_remove_dev_attr(struct device_attribute *attr);
@@ -185,19 +188,6 @@ extern void cpu_hotplug_enable(void);
185void clear_tasks_mm_cpumask(int cpu); 188void clear_tasks_mm_cpumask(int cpu);
186int cpu_down(unsigned int cpu); 189int cpu_down(unsigned int cpu);
187 190
188#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
189extern void cpu_hotplug_driver_lock(void);
190extern void cpu_hotplug_driver_unlock(void);
191#else
192static inline void cpu_hotplug_driver_lock(void)
193{
194}
195
196static inline void cpu_hotplug_driver_unlock(void)
197{
198}
199#endif
200
201#else /* CONFIG_HOTPLUG_CPU */ 191#else /* CONFIG_HOTPLUG_CPU */
202 192
203static inline void cpu_hotplug_begin(void) {} 193static inline void cpu_hotplug_begin(void) {}
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index 1739510d8994..bdd18caa6c94 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -52,8 +52,6 @@ static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
52 return rmap->obj[rmap->near[cpu].index]; 52 return rmap->obj[rmap->near[cpu].index];
53} 53}
54 54
55#ifdef CONFIG_GENERIC_HARDIRQS
56
57/** 55/**
58 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs 56 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
59 * @size: Number of objects to be mapped 57 * @size: Number of objects to be mapped
@@ -68,5 +66,4 @@ extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
68 66
69extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq); 67extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
70 68
71#endif
72#endif /* __LINUX_CPU_RMAP_H */ 69#endif /* __LINUX_CPU_RMAP_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index d568f3975eeb..dc196bbcf227 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -85,7 +85,20 @@ struct cpufreq_policy {
85 struct list_head policy_list; 85 struct list_head policy_list;
86 struct kobject kobj; 86 struct kobject kobj;
87 struct completion kobj_unregister; 87 struct completion kobj_unregister;
88 int transition_ongoing; /* Tracks transition status */ 88
89 /*
90 * The rules for this semaphore:
91 * - Any routine that wants to read from the policy structure will
92 * do a down_read on this semaphore.
93 * - Any routine that will write to the policy structure and/or may take away
94 * the policy altogether (eg. CPU hotplug), will hold this lock in write
95 * mode before doing so.
96 *
97 * Additional rules:
98 * - Lock should not be held across
99 * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
100 */
101 struct rw_semaphore rwsem;
89}; 102};
90 103
91/* Only for ACPI */ 104/* Only for ACPI */
@@ -94,8 +107,16 @@ struct cpufreq_policy {
94#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 107#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
95#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 108#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
96 109
110#ifdef CONFIG_CPU_FREQ
97struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 111struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
98void cpufreq_cpu_put(struct cpufreq_policy *policy); 112void cpufreq_cpu_put(struct cpufreq_policy *policy);
113#else
114static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
115{
116 return NULL;
117}
118static inline void cpufreq_cpu_put(struct cpufreq_policy *policy) { }
119#endif
99 120
100static inline bool policy_is_shared(struct cpufreq_policy *policy) 121static inline bool policy_is_shared(struct cpufreq_policy *policy)
101{ 122{
@@ -181,13 +202,6 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
181struct cpufreq_driver { 202struct cpufreq_driver {
182 char name[CPUFREQ_NAME_LEN]; 203 char name[CPUFREQ_NAME_LEN];
183 u8 flags; 204 u8 flags;
184 /*
185 * This should be set by platforms having multiple clock-domains, i.e.
186 * supporting multiple policies. With this sysfs directories of governor
187 * would be created in cpu/cpu<num>/cpufreq/ directory and so they can
188 * use the same governor with different tunables for different clusters.
189 */
190 bool have_governor_per_policy;
191 205
192 /* needed by all drivers */ 206 /* needed by all drivers */
193 int (*init) (struct cpufreq_policy *policy); 207 int (*init) (struct cpufreq_policy *policy);
@@ -195,9 +209,11 @@ struct cpufreq_driver {
195 209
196 /* define one out of two */ 210 /* define one out of two */
197 int (*setpolicy) (struct cpufreq_policy *policy); 211 int (*setpolicy) (struct cpufreq_policy *policy);
198 int (*target) (struct cpufreq_policy *policy, 212 int (*target) (struct cpufreq_policy *policy, /* Deprecated */
199 unsigned int target_freq, 213 unsigned int target_freq,
200 unsigned int relation); 214 unsigned int relation);
215 int (*target_index) (struct cpufreq_policy *policy,
216 unsigned int index);
201 217
202 /* should be defined, if possible */ 218 /* should be defined, if possible */
203 unsigned int (*get) (unsigned int cpu); 219 unsigned int (*get) (unsigned int cpu);
@@ -212,13 +228,29 @@ struct cpufreq_driver {
212}; 228};
213 229
214/* flags */ 230/* flags */
215#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 231#define CPUFREQ_STICKY (1 << 0) /* driver isn't removed even if
216 * all ->init() calls failed */ 232 all ->init() calls failed */
217#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 233#define CPUFREQ_CONST_LOOPS (1 << 1) /* loops_per_jiffy or other
218 * "constants" aren't affected by 234 kernel "constants" aren't
219 * frequency transitions */ 235 affected by frequency
220#define CPUFREQ_PM_NO_WARN 0x04 /* don't warn on suspend/resume speed 236 transitions */
221 * mismatches */ 237#define CPUFREQ_PM_NO_WARN (1 << 2) /* don't warn on suspend/resume
238 speed mismatches */
239
240/*
241 * This should be set by platforms having multiple clock-domains, i.e.
242 * supporting multiple policies. With this sysfs directories of governor would
243 * be created in cpu/cpu<num>/cpufreq/ directory and so they can use the same
244 * governor with different tunables for different clusters.
245 */
246#define CPUFREQ_HAVE_GOVERNOR_PER_POLICY (1 << 3)
247
248/*
249 * Driver will do POSTCHANGE notifications from outside of their ->target()
250 * routine and so must set cpufreq_driver->flags with this flag, so that core
251 * can handle them specially.
252 */
253#define CPUFREQ_ASYNC_NOTIFICATION (1 << 4)
222 254
223int cpufreq_register_driver(struct cpufreq_driver *driver_data); 255int cpufreq_register_driver(struct cpufreq_driver *driver_data);
224int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 256int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
@@ -241,6 +273,13 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
241 return; 273 return;
242} 274}
243 275
276static inline void
277cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
278{
279 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
280 policy->cpuinfo.max_freq);
281}
282
244/********************************************************************* 283/*********************************************************************
245 * CPUFREQ NOTIFIER INTERFACE * 284 * CPUFREQ NOTIFIER INTERFACE *
246 *********************************************************************/ 285 *********************************************************************/
@@ -393,6 +432,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
393 432
394int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, 433int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
395 struct cpufreq_frequency_table *table); 434 struct cpufreq_frequency_table *table);
435int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy);
396 436
397int cpufreq_frequency_table_target(struct cpufreq_policy *policy, 437int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
398 struct cpufreq_frequency_table *table, 438 struct cpufreq_frequency_table *table,
@@ -408,8 +448,20 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
408 448
409/* the following are really really optional */ 449/* the following are really really optional */
410extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 450extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
451extern struct freq_attr *cpufreq_generic_attr[];
411void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 452void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
412 unsigned int cpu); 453 unsigned int cpu);
413void cpufreq_frequency_table_put_attr(unsigned int cpu); 454void cpufreq_frequency_table_put_attr(unsigned int cpu);
455int cpufreq_table_validate_and_show(struct cpufreq_policy *policy,
456 struct cpufreq_frequency_table *table);
457
458int cpufreq_generic_init(struct cpufreq_policy *policy,
459 struct cpufreq_frequency_table *table,
460 unsigned int transition_latency);
461static inline int cpufreq_generic_exit(struct cpufreq_policy *policy)
462{
463 cpufreq_frequency_table_put_attr(policy->cpu);
464 return 0;
465}
414 466
415#endif /* _LINUX_CPUFREQ_H */ 467#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 781addc66f03..50fcbb0ac4e7 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -114,7 +114,7 @@ struct cpuidle_driver {
114 int safe_state_index; 114 int safe_state_index;
115 115
116 /* the driver handles the cpus in cpumask */ 116 /* the driver handles the cpus in cpumask */
117 struct cpumask *cpumask; 117 struct cpumask *cpumask;
118}; 118};
119 119
120#ifdef CONFIG_CPU_IDLE 120#ifdef CONFIG_CPU_IDLE
@@ -195,16 +195,10 @@ struct cpuidle_governor {
195}; 195};
196 196
197#ifdef CONFIG_CPU_IDLE 197#ifdef CONFIG_CPU_IDLE
198
199extern int cpuidle_register_governor(struct cpuidle_governor *gov); 198extern int cpuidle_register_governor(struct cpuidle_governor *gov);
200extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
201
202#else 199#else
203
204static inline int cpuidle_register_governor(struct cpuidle_governor *gov) 200static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
205{return 0;} 201{return 0;}
206static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { }
207
208#endif 202#endif
209 203
210#ifdef CONFIG_ARCH_HAS_CPU_RELAX 204#ifdef CONFIG_ARCH_HAS_CPU_RELAX
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index cc1b01cf2035..3fe661fe96d1 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -110,10 +110,14 @@ static inline bool put_mems_allowed(unsigned int seq)
110 110
111static inline void set_mems_allowed(nodemask_t nodemask) 111static inline void set_mems_allowed(nodemask_t nodemask)
112{ 112{
113 unsigned long flags;
114
113 task_lock(current); 115 task_lock(current);
116 local_irq_save(flags);
114 write_seqcount_begin(&current->mems_allowed_seq); 117 write_seqcount_begin(&current->mems_allowed_seq);
115 current->mems_allowed = nodemask; 118 current->mems_allowed = nodemask;
116 write_seqcount_end(&current->mems_allowed_seq); 119 write_seqcount_end(&current->mems_allowed_seq);
120 local_irq_restore(flags);
117 task_unlock(current); 121 task_unlock(current);
118} 122}
119 123
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 37e4f8da7cdf..fe68a5a98583 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -12,6 +12,15 @@
12extern unsigned long long elfcorehdr_addr; 12extern unsigned long long elfcorehdr_addr;
13extern unsigned long long elfcorehdr_size; 13extern unsigned long long elfcorehdr_size;
14 14
15extern int __weak elfcorehdr_alloc(unsigned long long *addr,
16 unsigned long long *size);
17extern void __weak elfcorehdr_free(unsigned long long addr);
18extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos);
19extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
20extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
21 unsigned long from, unsigned long pfn,
22 unsigned long size, pgprot_t prot);
23
15extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 24extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
16 unsigned long, int); 25 unsigned long, int);
17 26
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index a9c96d865ee7..b3cb71f0d3b0 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1
8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
6__u16 crc_t10dif(unsigned char const *, size_t); 10__u16 crc_t10dif(unsigned char const *, size_t);
7 11
8#endif 12#endif
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 68267b64bb98..7d275c4fc011 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,8 +11,48 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14/**
15 * crc32_le_combine - Combine two crc32 check values into one. For two
16 * sequences of bytes, seq1 and seq2 with lengths len1
17 * and len2, crc32_le() check values were calculated
18 * for each, crc1 and crc2.
19 *
20 * @crc1: crc32 of the first block
21 * @crc2: crc32 of the second block
22 * @len2: length of the second block
23 *
24 * Return: The crc32_le() check value of seq1 and seq2 concatenated,
25 * requiring only crc1, crc2, and len2. Note: If seq_full denotes
26 * the concatenated memory area of seq1 with seq2, and crc_full
27 * the crc32_le() value of seq_full, then crc_full ==
28 * crc32_le_combine(crc1, crc2, len2) when crc_full was seeded
29 * with the same initializer as crc1, and crc2 seed was 0. See
30 * also crc32_combine_test().
31 */
32extern u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2);
33
14extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); 34extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
15 35
36/**
37 * __crc32c_le_combine - Combine two crc32c check values into one. For two
38 * sequences of bytes, seq1 and seq2 with lengths len1
39 * and len2, __crc32c_le() check values were calculated
40 * for each, crc1 and crc2.
41 *
42 * @crc1: crc32c of the first block
43 * @crc2: crc32c of the second block
44 * @len2: length of the second block
45 *
46 * Return: The __crc32c_le() check value of seq1 and seq2 concatenated,
47 * requiring only crc1, crc2, and len2. Note: If seq_full denotes
48 * the concatenated memory area of seq1 with seq2, and crc_full
49 * the __crc32c_le() value of seq_full, then crc_full ==
50 * __crc32c_le_combine(crc1, crc2, len2) when crc_full was
51 * seeded with the same initializer as crc1, and crc2 seed
52 * was 0. See also crc32c_combine_test().
53 */
54extern u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2);
55
16#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 56#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
17 57
18/* 58/*
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 9169b91ea2d2..bf72e9ac6de0 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -29,8 +29,10 @@ struct vfsmount;
29/* The hash is always the low bits of hash_len */ 29/* The hash is always the low bits of hash_len */
30#ifdef __LITTLE_ENDIAN 30#ifdef __LITTLE_ENDIAN
31 #define HASH_LEN_DECLARE u32 hash; u32 len; 31 #define HASH_LEN_DECLARE u32 hash; u32 len;
32 #define bytemask_from_count(cnt) (~(~0ul << (cnt)*8))
32#else 33#else
33 #define HASH_LEN_DECLARE u32 len; u32 hash; 34 #define HASH_LEN_DECLARE u32 len; u32 hash;
35 #define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8))
34#endif 36#endif
35 37
36/* 38/*
@@ -55,11 +57,11 @@ struct qstr {
55#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) 57#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
56 58
57struct dentry_stat_t { 59struct dentry_stat_t {
58 int nr_dentry; 60 long nr_dentry;
59 int nr_unused; 61 long nr_unused;
60 int age_limit; /* age in seconds */ 62 long age_limit; /* age in seconds */
61 int want_pages; /* pages requested by system */ 63 long want_pages; /* pages requested by system */
62 int dummy[2]; 64 long dummy[2];
63}; 65};
64extern struct dentry_stat_t dentry_stat; 66extern struct dentry_stat_t dentry_stat;
65 67
@@ -169,13 +171,13 @@ struct dentry_operations {
169 */ 171 */
170 172
171/* d_flags entries */ 173/* d_flags entries */
172#define DCACHE_OP_HASH 0x0001 174#define DCACHE_OP_HASH 0x00000001
173#define DCACHE_OP_COMPARE 0x0002 175#define DCACHE_OP_COMPARE 0x00000002
174#define DCACHE_OP_REVALIDATE 0x0004 176#define DCACHE_OP_REVALIDATE 0x00000004
175#define DCACHE_OP_DELETE 0x0008 177#define DCACHE_OP_DELETE 0x00000008
176#define DCACHE_OP_PRUNE 0x0010 178#define DCACHE_OP_PRUNE 0x00000010
177 179
178#define DCACHE_DISCONNECTED 0x0020 180#define DCACHE_DISCONNECTED 0x00000020
179 /* This dentry is possibly not currently connected to the dcache tree, in 181 /* This dentry is possibly not currently connected to the dcache tree, in
180 * which case its parent will either be itself, or will have this flag as 182 * which case its parent will either be itself, or will have this flag as
181 * well. nfsd will not use a dentry with this bit set, but will first 183 * well. nfsd will not use a dentry with this bit set, but will first
@@ -186,33 +188,42 @@ struct dentry_operations {
186 * dentry into place and return that dentry rather than the passed one, 188 * dentry into place and return that dentry rather than the passed one,
187 * typically using d_splice_alias. */ 189 * typically using d_splice_alias. */
188 190
189#define DCACHE_REFERENCED 0x0040 /* Recently used, don't discard. */ 191#define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */
190#define DCACHE_RCUACCESS 0x0080 /* Entry has ever been RCU-visible */ 192#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */
191 193
192#define DCACHE_CANT_MOUNT 0x0100 194#define DCACHE_CANT_MOUNT 0x00000100
193#define DCACHE_GENOCIDE 0x0200 195#define DCACHE_GENOCIDE 0x00000200
194#define DCACHE_SHRINK_LIST 0x0400 196#define DCACHE_SHRINK_LIST 0x00000400
195 197
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800 198#define DCACHE_OP_WEAK_REVALIDATE 0x00000800
197 199
198#define DCACHE_NFSFS_RENAMED 0x1000 200#define DCACHE_NFSFS_RENAMED 0x00001000
199 /* this dentry has been "silly renamed" and has to be deleted on the last 201 /* this dentry has been "silly renamed" and has to be deleted on the last
200 * dput() */ 202 * dput() */
201#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */ 203#define DCACHE_COOKIE 0x00002000 /* For use by dcookie subsystem */
202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000 204#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x00004000
203 /* Parent inode is watched by some fsnotify listener */ 205 /* Parent inode is watched by some fsnotify listener */
204 206
205#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 207#define DCACHE_DENTRY_KILLED 0x00008000
206#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 208
207#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 209#define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */
210#define DCACHE_NEED_AUTOMOUNT 0x00020000 /* handle automount on this dir */
211#define DCACHE_MANAGE_TRANSIT 0x00040000 /* manage transit from this dirent */
208#define DCACHE_MANAGED_DENTRY \ 212#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 213 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 214
211#define DCACHE_DENTRY_KILLED 0x100000 215#define DCACHE_LRU_LIST 0x00080000
216
217#define DCACHE_ENTRY_TYPE 0x00700000
218#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry */
219#define DCACHE_DIRECTORY_TYPE 0x00100000 /* Normal directory */
220#define DCACHE_AUTODIR_TYPE 0x00200000 /* Lookupless directory (presumed automount) */
221#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
222#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
212 223
213extern seqlock_t rename_lock; 224extern seqlock_t rename_lock;
214 225
215static inline int dname_external(struct dentry *dentry) 226static inline int dname_external(const struct dentry *dentry)
216{ 227{
217 return dentry->d_name.name != dentry->d_iname; 228 return dentry->d_name.name != dentry->d_iname;
218} 229}
@@ -223,6 +234,7 @@ static inline int dname_external(struct dentry *dentry)
223extern void d_instantiate(struct dentry *, struct inode *); 234extern void d_instantiate(struct dentry *, struct inode *);
224extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 235extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
225extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 236extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
237extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
226extern void __d_drop(struct dentry *dentry); 238extern void __d_drop(struct dentry *dentry);
227extern void d_drop(struct dentry *dentry); 239extern void d_drop(struct dentry *dentry);
228extern void d_delete(struct dentry *); 240extern void d_delete(struct dentry *);
@@ -253,6 +265,7 @@ extern void d_prune_aliases(struct inode *);
253 265
254/* test whether we have any submounts in a subdir tree */ 266/* test whether we have any submounts in a subdir tree */
255extern int have_submounts(struct dentry *); 267extern int have_submounts(struct dentry *);
268extern int check_submounts_and_drop(struct dentry *);
256 269
257/* 270/*
258 * This adds the entry to the hash queues. 271 * This adds the entry to the hash queues.
@@ -357,17 +370,17 @@ extern struct dentry *dget_parent(struct dentry *dentry);
357 * Returns true if the dentry passed is not currently hashed. 370 * Returns true if the dentry passed is not currently hashed.
358 */ 371 */
359 372
360static inline int d_unhashed(struct dentry *dentry) 373static inline int d_unhashed(const struct dentry *dentry)
361{ 374{
362 return hlist_bl_unhashed(&dentry->d_hash); 375 return hlist_bl_unhashed(&dentry->d_hash);
363} 376}
364 377
365static inline int d_unlinked(struct dentry *dentry) 378static inline int d_unlinked(const struct dentry *dentry)
366{ 379{
367 return d_unhashed(dentry) && !IS_ROOT(dentry); 380 return d_unhashed(dentry) && !IS_ROOT(dentry);
368} 381}
369 382
370static inline int cant_mount(struct dentry *dentry) 383static inline int cant_mount(const struct dentry *dentry)
371{ 384{
372 return (dentry->d_flags & DCACHE_CANT_MOUNT); 385 return (dentry->d_flags & DCACHE_CANT_MOUNT);
373} 386}
@@ -381,16 +394,75 @@ static inline void dont_mount(struct dentry *dentry)
381 394
382extern void dput(struct dentry *); 395extern void dput(struct dentry *);
383 396
384static inline bool d_managed(struct dentry *dentry) 397static inline bool d_managed(const struct dentry *dentry)
385{ 398{
386 return dentry->d_flags & DCACHE_MANAGED_DENTRY; 399 return dentry->d_flags & DCACHE_MANAGED_DENTRY;
387} 400}
388 401
389static inline bool d_mountpoint(struct dentry *dentry) 402static inline bool d_mountpoint(const struct dentry *dentry)
390{ 403{
391 return dentry->d_flags & DCACHE_MOUNTED; 404 return dentry->d_flags & DCACHE_MOUNTED;
392} 405}
393 406
407/*
408 * Directory cache entry type accessor functions.
409 */
410static inline void __d_set_type(struct dentry *dentry, unsigned type)
411{
412 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
413}
414
415static inline void __d_clear_type(struct dentry *dentry)
416{
417 __d_set_type(dentry, DCACHE_MISS_TYPE);
418}
419
420static inline void d_set_type(struct dentry *dentry, unsigned type)
421{
422 spin_lock(&dentry->d_lock);
423 __d_set_type(dentry, type);
424 spin_unlock(&dentry->d_lock);
425}
426
427static inline unsigned __d_entry_type(const struct dentry *dentry)
428{
429 return dentry->d_flags & DCACHE_ENTRY_TYPE;
430}
431
432static inline bool d_is_directory(const struct dentry *dentry)
433{
434 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
435}
436
437static inline bool d_is_autodir(const struct dentry *dentry)
438{
439 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
440}
441
442static inline bool d_is_symlink(const struct dentry *dentry)
443{
444 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
445}
446
447static inline bool d_is_file(const struct dentry *dentry)
448{
449 return __d_entry_type(dentry) == DCACHE_FILE_TYPE;
450}
451
452static inline bool d_is_negative(const struct dentry *dentry)
453{
454 return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
455}
456
457static inline bool d_is_positive(const struct dentry *dentry)
458{
459 return !d_is_negative(dentry);
460}
461
394extern int sysctl_vfs_cache_pressure; 462extern int sysctl_vfs_cache_pressure;
395 463
464static inline unsigned long vfs_pressure_ratio(unsigned long val)
465{
466 return mult_frac(val, sysctl_vfs_cache_pressure, 100);
467}
396#endif /* __LINUX_DCACHE_H */ 468#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 263489d0788d..4d0b4d1aa132 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -206,6 +206,12 @@ static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mod
206 return ERR_PTR(-ENODEV); 206 return ERR_PTR(-ENODEV);
207} 207}
208 208
209static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
210 struct dentry *parent, atomic_t *value)
211{
212 return ERR_PTR(-ENODEV);
213}
214
209static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, 215static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
210 struct dentry *parent, 216 struct dentry *parent,
211 u32 *value) 217 u32 *value)
@@ -227,6 +233,12 @@ static inline struct dentry *debugfs_create_regset32(const char *name,
227 return ERR_PTR(-ENODEV); 233 return ERR_PTR(-ENODEV);
228} 234}
229 235
236static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
237 int nregs, void __iomem *base, char *prefix)
238{
239 return 0;
240}
241
230static inline bool debugfs_initialized(void) 242static inline bool debugfs_initialized(void)
231{ 243{
232 return false; 244 return false;
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 32acc0090ce6..d48dc00232a4 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -15,7 +15,7 @@
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/opp.h> 18#include <linux/pm_opp.h>
19 19
20#define DEVFREQ_NAME_LEN 16 20#define DEVFREQ_NAME_LEN 16
21 21
@@ -187,7 +187,7 @@ extern int devfreq_suspend_device(struct devfreq *devfreq);
187extern int devfreq_resume_device(struct devfreq *devfreq); 187extern int devfreq_resume_device(struct devfreq *devfreq);
188 188
189/* Helper functions for devfreq user device driver with OPP. */ 189/* Helper functions for devfreq user device driver with OPP. */
190extern struct opp *devfreq_recommended_opp(struct device *dev, 190extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
191 unsigned long *freq, u32 flags); 191 unsigned long *freq, u32 flags);
192extern int devfreq_register_opp_notifier(struct device *dev, 192extern int devfreq_register_opp_notifier(struct device *dev,
193 struct devfreq *devfreq); 193 struct devfreq *devfreq);
@@ -238,7 +238,7 @@ static inline int devfreq_resume_device(struct devfreq *devfreq)
238 return 0; 238 return 0;
239} 239}
240 240
241static inline struct opp *devfreq_recommended_opp(struct device *dev, 241static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
242 unsigned long *freq, u32 flags) 242 unsigned long *freq, u32 flags)
243{ 243{
244 return ERR_PTR(-EINVAL); 244 return ERR_PTR(-EINVAL);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index e151d4c9298d..ed419c62dde1 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/bio.h> 11#include <linux/bio.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/math64.h>
13#include <linux/ratelimit.h> 14#include <linux/ratelimit.h>
14 15
15struct dm_dev; 16struct dm_dev;
@@ -405,13 +406,14 @@ int dm_noflush_suspending(struct dm_target *ti);
405union map_info *dm_get_mapinfo(struct bio *bio); 406union map_info *dm_get_mapinfo(struct bio *bio);
406union map_info *dm_get_rq_mapinfo(struct request *rq); 407union map_info *dm_get_rq_mapinfo(struct request *rq);
407 408
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
410
408/* 411/*
409 * Geometry functions. 412 * Geometry functions.
410 */ 413 */
411int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo); 414int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
412int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); 415int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
413 416
414
415/*----------------------------------------------------------------- 417/*-----------------------------------------------------------------
416 * Functions for manipulating device-mapper tables. 418 * Functions for manipulating device-mapper tables.
417 *---------------------------------------------------------------*/ 419 *---------------------------------------------------------------*/
@@ -550,6 +552,14 @@ extern struct ratelimit_state dm_ratelimit_state;
550#define DM_MAPIO_REMAPPED 1 552#define DM_MAPIO_REMAPPED 1
551#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE 553#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
552 554
555#define dm_sector_div64(x, y)( \
556{ \
557 u64 _res; \
558 (x) = div64_u64_rem(x, y, &_res); \
559 _res; \
560} \
561)
562
553/* 563/*
554 * Ceiling(n / sz) 564 * Ceiling(n / sz)
555 */ 565 */
diff --git a/include/linux/device.h b/include/linux/device.h
index f46646e49235..952b01033c32 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -26,6 +26,7 @@
26#include <linux/atomic.h> 26#include <linux/atomic.h>
27#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
28#include <linux/uidgid.h> 28#include <linux/uidgid.h>
29#include <linux/gfp.h>
29#include <asm/device.h> 30#include <asm/device.h>
30 31
31struct device; 32struct device;
@@ -63,9 +64,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
63 * @name: The name of the bus. 64 * @name: The name of the bus.
64 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 65 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
65 * @dev_root: Default device to use as the parent. 66 * @dev_root: Default device to use as the parent.
66 * @bus_attrs: Default attributes of the bus.
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus. 68 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus. 69 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus. 70 * @drv_groups: Default attributes of the device drivers on the bus.
@@ -106,9 +105,7 @@ struct bus_type {
106 const char *name; 105 const char *name;
107 const char *dev_name; 106 const char *dev_name;
108 struct device *dev_root; 107 struct device *dev_root;
109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
110 struct device_attribute *dev_attrs; /* use dev_groups instead */ 108 struct device_attribute *dev_attrs; /* use dev_groups instead */
111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups; 109 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups; 110 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups; 111 const struct attribute_group **drv_groups;
@@ -329,8 +326,6 @@ int subsys_virtual_register(struct bus_type *subsys,
329 * @owner: The module owner. 326 * @owner: The module owner.
330 * @class_attrs: Default attributes of this class. 327 * @class_attrs: Default attributes of this class.
331 * @dev_groups: Default attributes of the devices that belong to the class. 328 * @dev_groups: Default attributes of the devices that belong to the class.
332 * @dev_attrs: Default attributes of the devices belong to the class.
333 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
334 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 329 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
335 * @dev_uevent: Called when a device is added, removed from this class, or a 330 * @dev_uevent: Called when a device is added, removed from this class, or a
336 * few other things that generate uevents to add the environment 331 * few other things that generate uevents to add the environment
@@ -358,9 +353,7 @@ struct class {
358 struct module *owner; 353 struct module *owner;
359 354
360 struct class_attribute *class_attrs; 355 struct class_attribute *class_attrs;
361 struct device_attribute *dev_attrs; /* use dev_groups instead */
362 const struct attribute_group **dev_groups; 356 const struct attribute_group **dev_groups;
363 struct bin_attribute *dev_bin_attrs;
364 struct kobject *dev_kobj; 357 struct kobject *dev_kobj;
365 358
366 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 359 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -427,8 +420,6 @@ struct class_attribute {
427 char *buf); 420 char *buf);
428 ssize_t (*store)(struct class *class, struct class_attribute *attr, 421 ssize_t (*store)(struct class *class, struct class_attribute *attr,
429 const char *buf, size_t count); 422 const char *buf, size_t count);
430 const void *(*namespace)(struct class *class,
431 const struct class_attribute *attr);
432}; 423};
433 424
434#define CLASS_ATTR(_name, _mode, _show, _store) \ 425#define CLASS_ATTR(_name, _mode, _show, _store) \
@@ -438,10 +429,24 @@ struct class_attribute {
438#define CLASS_ATTR_RO(_name) \ 429#define CLASS_ATTR_RO(_name) \
439 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 430 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
440 431
441extern int __must_check class_create_file(struct class *class, 432extern int __must_check class_create_file_ns(struct class *class,
442 const struct class_attribute *attr); 433 const struct class_attribute *attr,
443extern void class_remove_file(struct class *class, 434 const void *ns);
444 const struct class_attribute *attr); 435extern void class_remove_file_ns(struct class *class,
436 const struct class_attribute *attr,
437 const void *ns);
438
439static inline int __must_check class_create_file(struct class *class,
440 const struct class_attribute *attr)
441{
442 return class_create_file_ns(class, attr, NULL);
443}
444
445static inline void class_remove_file(struct class *class,
446 const struct class_attribute *attr)
447{
448 return class_remove_file_ns(class, attr, NULL);
449}
445 450
446/* Simple class attribute that is just a static string */ 451/* Simple class attribute that is just a static string */
447struct class_attribute_string { 452struct class_attribute_string {
@@ -602,8 +607,24 @@ extern void devres_close_group(struct device *dev, void *id);
602extern void devres_remove_group(struct device *dev, void *id); 607extern void devres_remove_group(struct device *dev, void *id);
603extern int devres_release_group(struct device *dev, void *id); 608extern int devres_release_group(struct device *dev, void *id);
604 609
605/* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */ 610/* managed devm_k.alloc/kfree for device drivers */
606extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 611extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
615}
616static inline void *devm_kmalloc_array(struct device *dev,
617 size_t n, size_t size, gfp_t flags)
618{
619 if (size != 0 && n > SIZE_MAX / size)
620 return NULL;
621 return devm_kmalloc(dev, n * size, flags);
622}
623static inline void *devm_kcalloc(struct device *dev,
624 size_t n, size_t size, gfp_t flags)
625{
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627}
607extern void devm_kfree(struct device *dev, void *p); 628extern void devm_kfree(struct device *dev, void *p);
608 629
609void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
@@ -623,9 +644,11 @@ struct device_dma_parameters {
623 unsigned long segment_boundary_mask; 644 unsigned long segment_boundary_mask;
624}; 645};
625 646
647struct acpi_device;
648
626struct acpi_dev_node { 649struct acpi_dev_node {
627#ifdef CONFIG_ACPI 650#ifdef CONFIG_ACPI
628 void *handle; 651 struct acpi_device *companion;
629#endif 652#endif
630}; 653};
631 654
@@ -737,7 +760,7 @@ struct device {
737 760
738 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 761 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
739 override */ 762 override */
740#ifdef CONFIG_CMA 763#ifdef CONFIG_DMA_CMA
741 struct cma *cma_area; /* contiguous memory area for dma 764 struct cma *cma_area; /* contiguous memory area for dma
742 allocations */ 765 allocations */
743#endif 766#endif
@@ -769,14 +792,6 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
769 return container_of(kobj, struct device, kobj); 792 return container_of(kobj, struct device, kobj);
770} 793}
771 794
772#ifdef CONFIG_ACPI
773#define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
774#define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_)
775#else
776#define ACPI_HANDLE(dev) (NULL)
777#define ACPI_HANDLE_SET(dev, _handle_) do { } while (0)
778#endif
779
780/* Get the wakeup routines, which depend on struct device */ 795/* Get the wakeup routines, which depend on struct device */
781#include <linux/pm_wakeup.h> 796#include <linux/pm_wakeup.h>
782 797
@@ -1149,16 +1164,15 @@ do { \
1149#endif 1164#endif
1150 1165
1151/* 1166/*
1152 * dev_WARN*() acts like dev_printk(), but with the key difference 1167 * dev_WARN*() acts like dev_printk(), but with the key difference of
1153 * of using a WARN/WARN_ON to get the message out, including the 1168 * using WARN/WARN_ONCE to include file/line information and a backtrace.
1154 * file/line information and a backtrace.
1155 */ 1169 */
1156#define dev_WARN(dev, format, arg...) \ 1170#define dev_WARN(dev, format, arg...) \
1157 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); 1171 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
1158 1172
1159#define dev_WARN_ONCE(dev, condition, format, arg...) \ 1173#define dev_WARN_ONCE(dev, condition, format, arg...) \
1160 WARN_ONCE(condition, "Device %s\n" format, \ 1174 WARN_ONCE(condition, "%s %s: " format, \
1161 dev_driver_string(dev), ## arg) 1175 dev_driver_string(dev), dev_name(dev), ## arg)
1162 1176
1163/* Create alias, so I can be autoloaded. */ 1177/* Create alias, so I can be autoloaded. */
1164#define MODULE_ALIAS_CHARDEV(major,minor) \ 1178#define MODULE_ALIAS_CHARDEV(major,minor) \
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 00141d3325fe..3b28f937d959 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -67,9 +67,53 @@ struct device;
67 67
68extern struct cma *dma_contiguous_default_area; 68extern struct cma *dma_contiguous_default_area;
69 69
70static inline struct cma *dev_get_cma_area(struct device *dev)
71{
72 if (dev && dev->cma_area)
73 return dev->cma_area;
74 return dma_contiguous_default_area;
75}
76
77static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
78{
79 if (dev)
80 dev->cma_area = cma;
81}
82
83static inline void dma_contiguous_set_default(struct cma *cma)
84{
85 dma_contiguous_default_area = cma;
86}
87
70void dma_contiguous_reserve(phys_addr_t addr_limit); 88void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, phys_addr_t size, 89
72 phys_addr_t base, phys_addr_t limit); 90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
91 phys_addr_t limit, struct cma **res_cma);
92
93/**
94 * dma_declare_contiguous() - reserve area for contiguous memory handling
95 * for particular device
96 * @dev: Pointer to device structure.
97 * @size: Size of the reserved memory.
98 * @base: Start address of the reserved memory (optional, 0 for any).
99 * @limit: End address of the reserved memory (optional, 0 for any).
100 *
101 * This function reserves memory for specified device. It should be
102 * called by board specific code when early allocator (memblock or bootmem)
103 * is still activate.
104 */
105
106static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
107 phys_addr_t base, phys_addr_t limit)
108{
109 struct cma *cma;
110 int ret;
111 ret = dma_contiguous_reserve_area(size, base, limit, &cma);
112 if (ret == 0)
113 dev_set_cma_area(dev, cma);
114
115 return ret;
116}
73 117
74struct page *dma_alloc_from_contiguous(struct device *dev, int count, 118struct page *dma_alloc_from_contiguous(struct device *dev, int count,
75 unsigned int order); 119 unsigned int order);
@@ -80,8 +124,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
80 124
81#define MAX_CMA_AREAS (0) 125#define MAX_CMA_AREAS (0)
82 126
127static inline struct cma *dev_get_cma_area(struct device *dev)
128{
129 return NULL;
130}
131
132static inline void dev_set_cma_area(struct device *dev, struct cma *cma) { }
133
134static inline void dma_contiguous_set_default(struct cma *cma) { }
135
83static inline void dma_contiguous_reserve(phys_addr_t limit) { } 136static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84 137
138static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
139 phys_addr_t limit, struct cma **res_cma) {
140 return -ENOSYS;
141}
142
85static inline 143static inline
86int dma_declare_contiguous(struct device *dev, phys_addr_t size, 144int dma_declare_contiguous(struct device *dev, phys_addr_t size,
87 phys_addr_t base, phys_addr_t limit) 145 phys_addr_t base, phys_addr_t limit)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 3a8d0a2af607..fd4aee29ad10 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -97,6 +97,30 @@ static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
97} 97}
98#endif 98#endif
99 99
100/*
101 * Set both the DMA mask and the coherent DMA mask to the same thing.
102 * Note that we don't check the return value from dma_set_coherent_mask()
103 * as the DMA API guarantees that the coherent DMA mask can be set to
104 * the same or smaller than the streaming DMA mask.
105 */
106static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask)
107{
108 int rc = dma_set_mask(dev, mask);
109 if (rc == 0)
110 dma_set_coherent_mask(dev, mask);
111 return rc;
112}
113
114/*
115 * Similar to the above, except it deals with the case where the device
116 * does not have dev->dma_mask appropriately setup.
117 */
118static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
119{
120 dev->dma_mask = &dev->coherent_dma_mask;
121 return dma_set_mask_and_coherent(dev, mask);
122}
123
100extern u64 dma_get_required_mask(struct device *dev); 124extern u64 dma_get_required_mask(struct device *dev);
101 125
102static inline unsigned int dma_get_max_seg_size(struct device *dev) 126static inline unsigned int dma_get_max_seg_size(struct device *dev)
@@ -129,6 +153,13 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
129 return -EIO; 153 return -EIO;
130} 154}
131 155
156#ifndef dma_max_pfn
157static inline unsigned long dma_max_pfn(struct device *dev)
158{
159 return *dev->dma_mask >> PAGE_SHIFT;
160}
161#endif
162
132static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 163static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
133 dma_addr_t *dma_handle, gfp_t flag) 164 dma_addr_t *dma_handle, gfp_t flag)
134{ 165{
diff --git a/include/linux/dma/mmp-pdma.h b/include/linux/dma/mmp-pdma.h
new file mode 100644
index 000000000000..2dc9b2bc18fc
--- /dev/null
+++ b/include/linux/dma/mmp-pdma.h
@@ -0,0 +1,15 @@
1#ifndef _MMP_PDMA_H_
2#define _MMP_PDMA_H_
3
4struct dma_chan;
5
6#ifdef CONFIG_MMP_PDMA
7bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param);
8#else
9static inline bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
10{
11 return false;
12}
13#endif
14
15#endif /* _MMP_PDMA_H_ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index cb286b1acdb6..41cf0c399288 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -38,17 +38,20 @@ typedef s32 dma_cookie_t;
38#define DMA_MIN_COOKIE 1 38#define DMA_MIN_COOKIE 1
39#define DMA_MAX_COOKIE INT_MAX 39#define DMA_MAX_COOKIE INT_MAX
40 40
41#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) 41static inline int dma_submit_error(dma_cookie_t cookie)
42{
43 return cookie < 0 ? cookie : 0;
44}
42 45
43/** 46/**
44 * enum dma_status - DMA transaction status 47 * enum dma_status - DMA transaction status
45 * @DMA_SUCCESS: transaction completed successfully 48 * @DMA_COMPLETE: transaction completed
46 * @DMA_IN_PROGRESS: transaction not yet processed 49 * @DMA_IN_PROGRESS: transaction not yet processed
47 * @DMA_PAUSED: transaction is paused 50 * @DMA_PAUSED: transaction is paused
48 * @DMA_ERROR: transaction failed 51 * @DMA_ERROR: transaction failed
49 */ 52 */
50enum dma_status { 53enum dma_status {
51 DMA_SUCCESS, 54 DMA_COMPLETE,
52 DMA_IN_PROGRESS, 55 DMA_IN_PROGRESS,
53 DMA_PAUSED, 56 DMA_PAUSED,
54 DMA_ERROR, 57 DMA_ERROR,
@@ -168,12 +171,6 @@ struct dma_interleaved_template {
168 * @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client 171 * @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client
169 * acknowledges receipt, i.e. has has a chance to establish any dependency 172 * acknowledges receipt, i.e. has has a chance to establish any dependency
170 * chains 173 * chains
171 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
172 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
173 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
174 * (if not set, do the source dma-unmapping as page)
175 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
176 * (if not set, do the destination dma-unmapping as page)
177 * @DMA_PREP_PQ_DISABLE_P - prevent generation of P while generating Q 174 * @DMA_PREP_PQ_DISABLE_P - prevent generation of P while generating Q
178 * @DMA_PREP_PQ_DISABLE_Q - prevent generation of Q while generating P 175 * @DMA_PREP_PQ_DISABLE_Q - prevent generation of Q while generating P
179 * @DMA_PREP_CONTINUE - indicate to a driver that it is reusing buffers as 176 * @DMA_PREP_CONTINUE - indicate to a driver that it is reusing buffers as
@@ -185,14 +182,10 @@ struct dma_interleaved_template {
185enum dma_ctrl_flags { 182enum dma_ctrl_flags {
186 DMA_PREP_INTERRUPT = (1 << 0), 183 DMA_PREP_INTERRUPT = (1 << 0),
187 DMA_CTRL_ACK = (1 << 1), 184 DMA_CTRL_ACK = (1 << 1),
188 DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2), 185 DMA_PREP_PQ_DISABLE_P = (1 << 2),
189 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), 186 DMA_PREP_PQ_DISABLE_Q = (1 << 3),
190 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4), 187 DMA_PREP_CONTINUE = (1 << 4),
191 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5), 188 DMA_PREP_FENCE = (1 << 5),
192 DMA_PREP_PQ_DISABLE_P = (1 << 6),
193 DMA_PREP_PQ_DISABLE_Q = (1 << 7),
194 DMA_PREP_CONTINUE = (1 << 8),
195 DMA_PREP_FENCE = (1 << 9),
196}; 189};
197 190
198/** 191/**
@@ -370,6 +363,25 @@ struct dma_slave_config {
370 unsigned int slave_id; 363 unsigned int slave_id;
371}; 364};
372 365
366/* struct dma_slave_caps - expose capabilities of a slave channel only
367 *
368 * @src_addr_widths: bit mask of src addr widths the channel supports
369 * @dstn_addr_widths: bit mask of dstn addr widths the channel supports
370 * @directions: bit mask of slave direction the channel supported
371 * since the enum dma_transfer_direction is not defined as bits for each
372 * type of direction, the dma controller should fill (1 << <TYPE>) and same
373 * should be checked by controller as well
374 * @cmd_pause: true, if pause and thereby resume is supported
375 * @cmd_terminate: true, if terminate cmd is supported
376 */
377struct dma_slave_caps {
378 u32 src_addr_widths;
379 u32 dstn_addr_widths;
380 u32 directions;
381 bool cmd_pause;
382 bool cmd_terminate;
383};
384
373static inline const char *dma_chan_name(struct dma_chan *chan) 385static inline const char *dma_chan_name(struct dma_chan *chan)
374{ 386{
375 return dev_name(&chan->dev->device); 387 return dev_name(&chan->dev->device);
@@ -391,6 +403,17 @@ void dma_chan_cleanup(struct kref *kref);
391typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param); 403typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
392 404
393typedef void (*dma_async_tx_callback)(void *dma_async_param); 405typedef void (*dma_async_tx_callback)(void *dma_async_param);
406
407struct dmaengine_unmap_data {
408 u8 to_cnt;
409 u8 from_cnt;
410 u8 bidi_cnt;
411 struct device *dev;
412 struct kref kref;
413 size_t len;
414 dma_addr_t addr[0];
415};
416
394/** 417/**
395 * struct dma_async_tx_descriptor - async transaction descriptor 418 * struct dma_async_tx_descriptor - async transaction descriptor
396 * ---dma generic offload fields--- 419 * ---dma generic offload fields---
@@ -416,6 +439,7 @@ struct dma_async_tx_descriptor {
416 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 439 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
417 dma_async_tx_callback callback; 440 dma_async_tx_callback callback;
418 void *callback_param; 441 void *callback_param;
442 struct dmaengine_unmap_data *unmap;
419#ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH 443#ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
420 struct dma_async_tx_descriptor *next; 444 struct dma_async_tx_descriptor *next;
421 struct dma_async_tx_descriptor *parent; 445 struct dma_async_tx_descriptor *parent;
@@ -423,6 +447,40 @@ struct dma_async_tx_descriptor {
423#endif 447#endif
424}; 448};
425 449
450#ifdef CONFIG_DMA_ENGINE
451static inline void dma_set_unmap(struct dma_async_tx_descriptor *tx,
452 struct dmaengine_unmap_data *unmap)
453{
454 kref_get(&unmap->kref);
455 tx->unmap = unmap;
456}
457
458struct dmaengine_unmap_data *
459dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags);
460void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap);
461#else
462static inline void dma_set_unmap(struct dma_async_tx_descriptor *tx,
463 struct dmaengine_unmap_data *unmap)
464{
465}
466static inline struct dmaengine_unmap_data *
467dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags)
468{
469 return NULL;
470}
471static inline void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap)
472{
473}
474#endif
475
476static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)
477{
478 if (tx->unmap) {
479 dmaengine_unmap_put(tx->unmap);
480 tx->unmap = NULL;
481 }
482}
483
426#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH 484#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
427static inline void txd_lock(struct dma_async_tx_descriptor *txd) 485static inline void txd_lock(struct dma_async_tx_descriptor *txd)
428{ 486{
@@ -532,6 +590,7 @@ struct dma_tx_state {
532 * struct with auxiliary transfer status information, otherwise the call 590 * struct with auxiliary transfer status information, otherwise the call
533 * will just return a simple status code 591 * will just return a simple status code
534 * @device_issue_pending: push pending transactions to hardware 592 * @device_issue_pending: push pending transactions to hardware
593 * @device_slave_caps: return the slave channel capabilities
535 */ 594 */
536struct dma_device { 595struct dma_device {
537 596
@@ -597,6 +656,7 @@ struct dma_device {
597 dma_cookie_t cookie, 656 dma_cookie_t cookie,
598 struct dma_tx_state *txstate); 657 struct dma_tx_state *txstate);
599 void (*device_issue_pending)(struct dma_chan *chan); 658 void (*device_issue_pending)(struct dma_chan *chan);
659 int (*device_slave_caps)(struct dma_chan *chan, struct dma_slave_caps *caps);
600}; 660};
601 661
602static inline int dmaengine_device_control(struct dma_chan *chan, 662static inline int dmaengine_device_control(struct dma_chan *chan,
@@ -670,6 +730,21 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
670 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 730 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
671} 731}
672 732
733static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
734{
735 if (!chan || !caps)
736 return -EINVAL;
737
738 /* check if the channel supports slave transactions */
739 if (!test_bit(DMA_SLAVE, chan->device->cap_mask.bits))
740 return -ENXIO;
741
742 if (chan->device->device_slave_caps)
743 return chan->device->device_slave_caps(chan, caps);
744
745 return -ENXIO;
746}
747
673static inline int dmaengine_terminate_all(struct dma_chan *chan) 748static inline int dmaengine_terminate_all(struct dma_chan *chan)
674{ 749{
675 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); 750 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
@@ -940,10 +1015,10 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
940{ 1015{
941 if (last_complete <= last_used) { 1016 if (last_complete <= last_used) {
942 if ((cookie <= last_complete) || (cookie > last_used)) 1017 if ((cookie <= last_complete) || (cookie > last_used))
943 return DMA_SUCCESS; 1018 return DMA_COMPLETE;
944 } else { 1019 } else {
945 if ((cookie <= last_complete) && (cookie > last_used)) 1020 if ((cookie <= last_complete) && (cookie > last_used))
946 return DMA_SUCCESS; 1021 return DMA_COMPLETE;
947 } 1022 }
948 return DMA_IN_PROGRESS; 1023 return DMA_IN_PROGRESS;
949} 1024}
@@ -958,8 +1033,9 @@ dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used,
958 } 1033 }
959} 1034}
960 1035
961enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
962#ifdef CONFIG_DMA_ENGINE 1036#ifdef CONFIG_DMA_ENGINE
1037struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
1038enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
963enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 1039enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
964void dma_issue_pending_all(void); 1040void dma_issue_pending_all(void);
965struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, 1041struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
@@ -967,9 +1043,17 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
967struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); 1043struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
968void dma_release_channel(struct dma_chan *chan); 1044void dma_release_channel(struct dma_chan *chan);
969#else 1045#else
1046static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
1047{
1048 return NULL;
1049}
1050static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
1051{
1052 return DMA_COMPLETE;
1053}
970static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 1054static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
971{ 1055{
972 return DMA_SUCCESS; 1056 return DMA_COMPLETE;
973} 1057}
974static inline void dma_issue_pending_all(void) 1058static inline void dma_issue_pending_all(void)
975{ 1059{
@@ -994,7 +1078,7 @@ static inline void dma_release_channel(struct dma_chan *chan)
994int dma_async_device_register(struct dma_device *device); 1078int dma_async_device_register(struct dma_device *device);
995void dma_async_device_unregister(struct dma_device *device); 1079void dma_async_device_unregister(struct dma_device *device);
996void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1080void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
997struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 1081struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
998struct dma_chan *net_dma_find_channel(void); 1082struct dma_chan *net_dma_find_channel(void);
999#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1083#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1000#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ 1084#define dma_request_slave_channel_compat(mask, x, y, dev, name) \
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b6eb7a05d58e..f820f0a336c9 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -99,6 +99,7 @@ extern const char * dmi_get_system_info(int field);
99extern const struct dmi_device * dmi_find_device(int type, const char *name, 99extern const struct dmi_device * dmi_find_device(int type, const char *name,
100 const struct dmi_device *from); 100 const struct dmi_device *from);
101extern void dmi_scan_machine(void); 101extern void dmi_scan_machine(void);
102extern void dmi_memdev_walk(void);
102extern void dmi_set_dump_stack_arch_desc(void); 103extern void dmi_set_dump_stack_arch_desc(void);
103extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); 104extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
104extern int dmi_name_in_vendors(const char *str); 105extern int dmi_name_in_vendors(const char *str);
@@ -107,6 +108,7 @@ extern int dmi_available;
107extern int dmi_walk(void (*decode)(const struct dmi_header *, void *), 108extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
108 void *private_data); 109 void *private_data);
109extern bool dmi_match(enum dmi_field f, const char *str); 110extern bool dmi_match(enum dmi_field f, const char *str);
111extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
110 112
111#else 113#else
112 114
@@ -115,6 +117,7 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
115static inline const struct dmi_device * dmi_find_device(int type, const char *name, 117static inline const struct dmi_device * dmi_find_device(int type, const char *name,
116 const struct dmi_device *from) { return NULL; } 118 const struct dmi_device *from) { return NULL; }
117static inline void dmi_scan_machine(void) { return; } 119static inline void dmi_scan_machine(void) { return; }
120static inline void dmi_memdev_walk(void) { }
118static inline void dmi_set_dump_stack_arch_desc(void) { } 121static inline void dmi_set_dump_stack_arch_desc(void) { }
119static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) 122static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
120{ 123{
@@ -133,6 +136,8 @@ static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
133 void *private_data) { return -1; } 136 void *private_data) { return -1; }
134static inline bool dmi_match(enum dmi_field f, const char *str) 137static inline bool dmi_match(enum dmi_field f, const char *str)
135 { return false; } 138 { return false; }
139static inline void dmi_memdev_name(u16 handle, const char **bank,
140 const char **device) { }
136static inline const struct dmi_system_id * 141static inline const struct dmi_system_id *
137 dmi_first_match(const struct dmi_system_id *list) { return NULL; } 142 dmi_first_match(const struct dmi_system_id *list) { return NULL; }
138 143
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 5c6d7fbaf89e..dbdffe8d4469 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -51,7 +51,7 @@ static inline void opstate_init(void)
51#define EDAC_MC_LABEL_LEN 31 51#define EDAC_MC_LABEL_LEN 31
52 52
53/* Maximum size of the location string */ 53/* Maximum size of the location string */
54#define LOCATION_SIZE 80 54#define LOCATION_SIZE 256
55 55
56/* Defines the maximum number of labels that can be reported */ 56/* Defines the maximum number of labels that can be reported */
57#define EDAC_MAX_LABELS 8 57#define EDAC_MAX_LABELS 8
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 5f8f176154f7..11ce6784a196 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -39,6 +39,8 @@
39typedef unsigned long efi_status_t; 39typedef unsigned long efi_status_t;
40typedef u8 efi_bool_t; 40typedef u8 efi_bool_t;
41typedef u16 efi_char16_t; /* UNICODE character */ 41typedef u16 efi_char16_t; /* UNICODE character */
42typedef u64 efi_physical_addr_t;
43typedef void *efi_handle_t;
42 44
43 45
44typedef struct { 46typedef struct {
@@ -96,6 +98,7 @@ typedef struct {
96#define EFI_MEMORY_DESCRIPTOR_VERSION 1 98#define EFI_MEMORY_DESCRIPTOR_VERSION 1
97 99
98#define EFI_PAGE_SHIFT 12 100#define EFI_PAGE_SHIFT 12
101#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
99 102
100typedef struct { 103typedef struct {
101 u32 type; 104 u32 type;
@@ -157,11 +160,13 @@ typedef struct {
157 efi_table_hdr_t hdr; 160 efi_table_hdr_t hdr;
158 void *raise_tpl; 161 void *raise_tpl;
159 void *restore_tpl; 162 void *restore_tpl;
160 void *allocate_pages; 163 efi_status_t (*allocate_pages)(int, int, unsigned long,
161 void *free_pages; 164 efi_physical_addr_t *);
162 void *get_memory_map; 165 efi_status_t (*free_pages)(efi_physical_addr_t, unsigned long);
163 void *allocate_pool; 166 efi_status_t (*get_memory_map)(unsigned long *, void *, unsigned long *,
164 void *free_pool; 167 unsigned long *, u32 *);
168 efi_status_t (*allocate_pool)(int, unsigned long, void **);
169 efi_status_t (*free_pool)(void *);
165 void *create_event; 170 void *create_event;
166 void *set_timer; 171 void *set_timer;
167 void *wait_for_event; 172 void *wait_for_event;
@@ -171,7 +176,7 @@ typedef struct {
171 void *install_protocol_interface; 176 void *install_protocol_interface;
172 void *reinstall_protocol_interface; 177 void *reinstall_protocol_interface;
173 void *uninstall_protocol_interface; 178 void *uninstall_protocol_interface;
174 void *handle_protocol; 179 efi_status_t (*handle_protocol)(efi_handle_t, efi_guid_t *, void **);
175 void *__reserved; 180 void *__reserved;
176 void *register_protocol_notify; 181 void *register_protocol_notify;
177 void *locate_handle; 182 void *locate_handle;
@@ -181,7 +186,7 @@ typedef struct {
181 void *start_image; 186 void *start_image;
182 void *exit; 187 void *exit;
183 void *unload_image; 188 void *unload_image;
184 void *exit_boot_services; 189 efi_status_t (*exit_boot_services)(efi_handle_t, unsigned long);
185 void *get_next_monotonic_count; 190 void *get_next_monotonic_count;
186 void *stall; 191 void *stall;
187 void *set_watchdog_timer; 192 void *set_watchdog_timer;
@@ -404,6 +409,12 @@ typedef struct {
404 unsigned long table; 409 unsigned long table;
405} efi_config_table_t; 410} efi_config_table_t;
406 411
412typedef struct {
413 efi_guid_t guid;
414 const char *name;
415 unsigned long *ptr;
416} efi_config_table_type_t;
417
407#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) 418#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
408 419
409#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30)) 420#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
@@ -488,10 +499,6 @@ typedef struct {
488 unsigned long unload; 499 unsigned long unload;
489} efi_loaded_image_t; 500} efi_loaded_image_t;
490 501
491typedef struct {
492 u64 revision;
493 void *open_volume;
494} efi_file_io_interface_t;
495 502
496typedef struct { 503typedef struct {
497 u64 size; 504 u64 size;
@@ -504,20 +511,30 @@ typedef struct {
504 efi_char16_t filename[1]; 511 efi_char16_t filename[1];
505} efi_file_info_t; 512} efi_file_info_t;
506 513
507typedef struct { 514typedef struct _efi_file_handle {
508 u64 revision; 515 u64 revision;
509 void *open; 516 efi_status_t (*open)(struct _efi_file_handle *,
510 void *close; 517 struct _efi_file_handle **,
518 efi_char16_t *, u64, u64);
519 efi_status_t (*close)(struct _efi_file_handle *);
511 void *delete; 520 void *delete;
512 void *read; 521 efi_status_t (*read)(struct _efi_file_handle *, unsigned long *,
522 void *);
513 void *write; 523 void *write;
514 void *get_position; 524 void *get_position;
515 void *set_position; 525 void *set_position;
516 void *get_info; 526 efi_status_t (*get_info)(struct _efi_file_handle *, efi_guid_t *,
527 unsigned long *, void *);
517 void *set_info; 528 void *set_info;
518 void *flush; 529 void *flush;
519} efi_file_handle_t; 530} efi_file_handle_t;
520 531
532typedef struct _efi_file_io_interface {
533 u64 revision;
534 int (*open_volume)(struct _efi_file_io_interface *,
535 efi_file_handle_t **);
536} efi_file_io_interface_t;
537
521#define EFI_FILE_MODE_READ 0x0000000000000001 538#define EFI_FILE_MODE_READ 0x0000000000000001
522#define EFI_FILE_MODE_WRITE 0x0000000000000002 539#define EFI_FILE_MODE_WRITE 0x0000000000000002
523#define EFI_FILE_MODE_CREATE 0x8000000000000000 540#define EFI_FILE_MODE_CREATE 0x8000000000000000
@@ -552,6 +569,7 @@ extern struct efi {
552 efi_get_next_high_mono_count_t *get_next_high_mono_count; 569 efi_get_next_high_mono_count_t *get_next_high_mono_count;
553 efi_reset_system_t *reset_system; 570 efi_reset_system_t *reset_system;
554 efi_set_virtual_address_map_t *set_virtual_address_map; 571 efi_set_virtual_address_map_t *set_virtual_address_map;
572 struct efi_memory_map *memmap;
555} efi; 573} efi;
556 574
557static inline int 575static inline int
@@ -587,6 +605,7 @@ static inline efi_status_t efi_query_variable_store(u32 attributes, unsigned lon
587} 605}
588#endif 606#endif
589extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); 607extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
608extern int efi_config_init(efi_config_table_type_t *arch_tables);
590extern u64 efi_get_iobase (void); 609extern u64 efi_get_iobase (void);
591extern u32 efi_mem_type (unsigned long phys_addr); 610extern u32 efi_mem_type (unsigned long phys_addr);
592extern u64 efi_mem_attributes (unsigned long phys_addr); 611extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -782,6 +801,15 @@ struct efivar_entry {
782 struct efi_variable var; 801 struct efi_variable var;
783 struct list_head list; 802 struct list_head list;
784 struct kobject kobj; 803 struct kobject kobj;
804 bool scanning;
805 bool deleting;
806};
807
808
809struct efi_simple_text_output_protocol {
810 void *reset;
811 efi_status_t (*output_string)(void *, void *);
812 void *test_string;
785}; 813};
786 814
787extern struct list_head efivar_sysfs_list; 815extern struct list_head efivar_sysfs_list;
@@ -840,6 +868,8 @@ void efivar_run_worker(void);
840#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) 868#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
841int efivars_sysfs_init(void); 869int efivars_sysfs_init(void);
842 870
871#define EFIVARS_DATA_SIZE_MAX 1024
872
843#endif /* CONFIG_EFI_VARS */ 873#endif /* CONFIG_EFI_VARS */
844 874
845#endif /* _LINUX_EFI_H */ 875#endif /* _LINUX_EFI_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 40a3c0e01b2b..67a5fa7830c4 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -39,13 +39,13 @@ extern Elf64_Dyn _DYNAMIC [];
39 39
40/* Optional callbacks to write extra ELF notes. */ 40/* Optional callbacks to write extra ELF notes. */
41struct file; 41struct file;
42struct coredump_params;
42 43
43#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 44#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
44static inline int elf_coredump_extra_notes_size(void) { return 0; } 45static inline int elf_coredump_extra_notes_size(void) { return 0; }
45static inline int elf_coredump_extra_notes_write(struct file *file, 46static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
46 loff_t *foffset) { return 0; }
47#else 47#else
48extern int elf_coredump_extra_notes_size(void); 48extern int elf_coredump_extra_notes_size(void);
49extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); 49extern int elf_coredump_extra_notes_write(struct coredump_params *cprm);
50#endif 50#endif
51#endif /* _LINUX_ELF_H */ 51#endif /* _LINUX_ELF_H */
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index cdd3d13efce7..698d51a0eea3 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -6,6 +6,8 @@
6#include <asm/elf.h> 6#include <asm/elf.h>
7#include <uapi/linux/elfcore.h> 7#include <uapi/linux/elfcore.h>
8 8
9struct coredump_params;
10
9static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) 11static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
10{ 12{
11#ifdef ELF_CORE_COPY_REGS 13#ifdef ELF_CORE_COPY_REGS
@@ -63,10 +65,9 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse
63 */ 65 */
64extern Elf_Half elf_core_extra_phdrs(void); 66extern Elf_Half elf_core_extra_phdrs(void);
65extern int 67extern int
66elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, 68elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
67 unsigned long limit);
68extern int 69extern int
69elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); 70elf_core_write_extra_data(struct coredump_params *cprm);
70extern size_t elf_core_extra_data_size(void); 71extern size_t elf_core_extra_data_size(void);
71 72
72#endif /* _LINUX_ELFCORE_H */ 73#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index d8b512496e50..fc4a9aa7dd82 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -28,27 +28,24 @@
28#include <asm/unaligned.h> 28#include <asm/unaligned.h>
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 31__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern const struct header_ops eth_header_ops; 32extern const struct header_ops eth_header_ops;
33 33
34extern int eth_header(struct sk_buff *skb, struct net_device *dev, 34int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
35 unsigned short type, 35 const void *daddr, const void *saddr, unsigned len);
36 const void *daddr, const void *saddr, unsigned len); 36int eth_rebuild_header(struct sk_buff *skb);
37extern int eth_rebuild_header(struct sk_buff *skb); 37int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
38extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 38int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
39extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 39 __be16 type);
40extern void eth_header_cache_update(struct hh_cache *hh, 40void eth_header_cache_update(struct hh_cache *hh, const struct net_device *dev,
41 const struct net_device *dev, 41 const unsigned char *haddr);
42 const unsigned char *haddr); 42int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
43extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p); 43void eth_commit_mac_addr_change(struct net_device *dev, void *p);
44extern void eth_commit_mac_addr_change(struct net_device *dev, void *p); 44int eth_mac_addr(struct net_device *dev, void *p);
45extern int eth_mac_addr(struct net_device *dev, void *p); 45int eth_change_mtu(struct net_device *dev, int new_mtu);
46extern int eth_change_mtu(struct net_device *dev, int new_mtu); 46int eth_validate_addr(struct net_device *dev);
47extern int eth_validate_addr(struct net_device *dev); 47
48 48struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
49
50
51extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
52 unsigned int rxqs); 49 unsigned int rxqs);
53#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 50#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
54#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) 51#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index cf5d2af61b81..ff0b981f078e 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -9,7 +9,6 @@
9#define _LINUX_EVENTFD_H 9#define _LINUX_EVENTFD_H
10 10
11#include <linux/fcntl.h> 11#include <linux/fcntl.h>
12#include <linux/file.h>
13#include <linux/wait.h> 12#include <linux/wait.h>
14 13
15/* 14/*
@@ -26,6 +25,8 @@
26#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) 25#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
27#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) 26#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
28 27
28struct file;
29
29#ifdef CONFIG_EVENTFD 30#ifdef CONFIG_EVENTFD
30 31
31struct file *eventfd_file_create(unsigned int count, int flags); 32struct file *eventfd_file_create(unsigned int count, int flags);
diff --git a/include/linux/export.h b/include/linux/export.h
index 412cd509effe..3f2793d51899 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -43,7 +43,7 @@ extern struct module __this_module;
43/* Mark the CRC weak since genksyms apparently decides not to 43/* Mark the CRC weak since genksyms apparently decides not to
44 * generate a checksums for some symbols */ 44 * generate a checksums for some symbols */
45#define __CRC_SYMBOL(sym, sec) \ 45#define __CRC_SYMBOL(sym, sec) \
46 extern void *__crc_##sym __attribute__((weak)); \ 46 extern __visible void *__crc_##sym __attribute__((weak)); \
47 static const unsigned long __kcrctab_##sym \ 47 static const unsigned long __kcrctab_##sym \
48 __used \ 48 __used \
49 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \ 49 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
@@ -59,7 +59,7 @@ extern struct module __this_module;
59 static const char __kstrtab_##sym[] \ 59 static const char __kstrtab_##sym[] \
60 __attribute__((section("__ksymtab_strings"), aligned(1))) \ 60 __attribute__((section("__ksymtab_strings"), aligned(1))) \
61 = VMLINUX_SYMBOL_STR(sym); \ 61 = VMLINUX_SYMBOL_STR(sym); \
62 static const struct kernel_symbol __ksymtab_##sym \ 62 __visible const struct kernel_symbol __ksymtab_##sym \
63 __used \ 63 __used \
64 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ 64 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
65 = { (unsigned long)&sym, __kstrtab_##sym } 65 = { (unsigned long)&sym, __kstrtab_##sym }
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index fcb51c88319f..21c59af1150b 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -51,10 +51,10 @@
51enum extcon_cable_name { 51enum extcon_cable_name {
52 EXTCON_USB = 0, 52 EXTCON_USB = 0,
53 EXTCON_USB_HOST, 53 EXTCON_USB_HOST,
54 EXTCON_TA, /* Travel Adaptor */ 54 EXTCON_TA, /* Travel Adaptor */
55 EXTCON_FAST_CHARGER, 55 EXTCON_FAST_CHARGER,
56 EXTCON_SLOW_CHARGER, 56 EXTCON_SLOW_CHARGER,
57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */ 57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
58 EXTCON_HDMI, 58 EXTCON_HDMI,
59 EXTCON_MHL, 59 EXTCON_MHL,
60 EXTCON_DVI, 60 EXTCON_DVI,
@@ -76,8 +76,8 @@ struct extcon_cable;
76 76
77/** 77/**
78 * struct extcon_dev - An extcon device represents one external connector. 78 * struct extcon_dev - An extcon device represents one external connector.
79 * @name: The name of this extcon device. Parent device name is used 79 * @name: The name of this extcon device. Parent device name is
80 * if NULL. 80 * used if NULL.
81 * @supported_cable: Array of supported cable names ending with NULL. 81 * @supported_cable: Array of supported cable names ending with NULL.
82 * If supported_cable is NULL, cable name related APIs 82 * If supported_cable is NULL, cable name related APIs
83 * are disabled. 83 * are disabled.
@@ -89,21 +89,21 @@ struct extcon_cable;
89 * be attached simulataneously. {0x7, 0} is equivalent to 89 * be attached simulataneously. {0x7, 0} is equivalent to
90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
91 * can be no simultaneous connections. 91 * can be no simultaneous connections.
92 * @print_name: An optional callback to override the method to print the 92 * @print_name: An optional callback to override the method to print the
93 * name of the extcon device. 93 * name of the extcon device.
94 * @print_state: An optional callback to override the method to print the 94 * @print_state: An optional callback to override the method to print the
95 * status of the extcon device. 95 * status of the extcon device.
96 * @dev: Device of this extcon. Do not provide at register-time. 96 * @dev: Device of this extcon.
97 * @state: Attach/detach state of this extcon. Do not provide at 97 * @state: Attach/detach state of this extcon. Do not provide at
98 * register-time 98 * register-time.
99 * @nh: Notifier for the state change events from this extcon 99 * @nh: Notifier for the state change events from this extcon
100 * @entry: To support list of extcon devices so that users can search 100 * @entry: To support list of extcon devices so that users can search
101 * for extcon devices based on the extcon name. 101 * for extcon devices based on the extcon name.
102 * @lock: 102 * @lock:
103 * @max_supported: Internal value to store the number of cables. 103 * @max_supported: Internal value to store the number of cables.
104 * @extcon_dev_type: Device_type struct to provide attribute_groups 104 * @extcon_dev_type: Device_type struct to provide attribute_groups
105 * customized for each extcon device. 105 * customized for each extcon device.
106 * @cables: Sysfs subdirectories. Each represents one cable. 106 * @cables: Sysfs subdirectories. Each represents one cable.
107 * 107 *
108 * In most cases, users only need to provide "User initializing data" of 108 * In most cases, users only need to provide "User initializing data" of
109 * this struct when registering an extcon. In some exceptional cases, 109 * this struct when registering an extcon. In some exceptional cases,
@@ -111,26 +111,27 @@ struct extcon_cable;
111 * are overwritten by register function. 111 * are overwritten by register function.
112 */ 112 */
113struct extcon_dev { 113struct extcon_dev {
114 /* --- Optional user initializing data --- */ 114 /* Optional user initializing data */
115 const char *name; 115 const char *name;
116 const char **supported_cable; 116 const char **supported_cable;
117 const u32 *mutually_exclusive; 117 const u32 *mutually_exclusive;
118 118
119 /* --- Optional callbacks to override class functions --- */ 119 /* Optional callbacks to override class functions */
120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf); 120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf); 121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
122 122
123 /* --- Internal data. Please do not set. --- */ 123 /* Internal data. Please do not set. */
124 struct device *dev; 124 struct device dev;
125 u32 state;
126 struct raw_notifier_head nh; 125 struct raw_notifier_head nh;
127 struct list_head entry; 126 struct list_head entry;
128 spinlock_t lock; /* could be called by irq handler */
129 int max_supported; 127 int max_supported;
128 spinlock_t lock; /* could be called by irq handler */
129 u32 state;
130 130
131 /* /sys/class/extcon/.../cable.n/... */ 131 /* /sys/class/extcon/.../cable.n/... */
132 struct device_type extcon_dev_type; 132 struct device_type extcon_dev_type;
133 struct extcon_cable *cables; 133 struct extcon_cable *cables;
134
134 /* /sys/class/extcon/.../mutually_exclusive/... */ 135 /* /sys/class/extcon/.../mutually_exclusive/... */
135 struct attribute_group attr_g_muex; 136 struct attribute_group attr_g_muex;
136 struct attribute **attrs_muex; 137 struct attribute **attrs_muex;
@@ -138,13 +139,13 @@ struct extcon_dev {
138}; 139};
139 140
140/** 141/**
141 * struct extcon_cable - An internal data for each cable of extcon device. 142 * struct extcon_cable - An internal data for each cable of extcon device.
142 * @edev: The extcon device 143 * @edev: The extcon device
143 * @cable_index: Index of this cable in the edev 144 * @cable_index: Index of this cable in the edev
144 * @attr_g: Attribute group for the cable 145 * @attr_g: Attribute group for the cable
145 * @attr_name: "name" sysfs entry 146 * @attr_name: "name" sysfs entry
146 * @attr_state: "state" sysfs entry 147 * @attr_state: "state" sysfs entry
147 * @attrs: Array pointing to attr_name and attr_state for attr_g 148 * @attrs: Array pointing to attr_name and attr_state for attr_g
148 */ 149 */
149struct extcon_cable { 150struct extcon_cable {
150 struct extcon_dev *edev; 151 struct extcon_dev *edev;
@@ -159,11 +160,13 @@ struct extcon_cable {
159 160
160/** 161/**
161 * struct extcon_specific_cable_nb - An internal data for 162 * struct extcon_specific_cable_nb - An internal data for
162 * extcon_register_interest(). 163 * extcon_register_interest().
163 * @internal_nb: a notifier block bridging extcon notifier and cable notifier. 164 * @internal_nb: A notifier block bridging extcon notifier
164 * @user_nb: user provided notifier block for events from a specific cable. 165 * and cable notifier.
166 * @user_nb: user provided notifier block for events from
167 * a specific cable.
165 * @cable_index: the target cable. 168 * @cable_index: the target cable.
166 * @edev: the target extcon device. 169 * @edev: the target extcon device.
167 * @previous_value: the saved previous event value. 170 * @previous_value: the saved previous event value.
168 */ 171 */
169struct extcon_specific_cable_nb { 172struct extcon_specific_cable_nb {
@@ -180,7 +183,7 @@ struct extcon_specific_cable_nb {
180 * Following APIs are for notifiers or configurations. 183 * Following APIs are for notifiers or configurations.
181 * Notifiers are the external port and connection devices. 184 * Notifiers are the external port and connection devices.
182 */ 185 */
183extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev); 186extern int extcon_dev_register(struct extcon_dev *edev);
184extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
185extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
186 189
@@ -238,8 +241,7 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
238extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
239 struct notifier_block *nb); 242 struct notifier_block *nb);
240#else /* CONFIG_EXTCON */ 243#else /* CONFIG_EXTCON */
241static inline int extcon_dev_register(struct extcon_dev *edev, 244static inline int extcon_dev_register(struct extcon_dev *edev)
242 struct device *dev)
243{ 245{
244 return 0; 246 return 0;
245} 247}
diff --git a/include/linux/extcon/extcon-adc-jack.h b/include/linux/extcon/extcon-adc-jack.h
index 20e9eef25d4c..9ca958c4e94c 100644
--- a/include/linux/extcon/extcon-adc-jack.h
+++ b/include/linux/extcon/extcon-adc-jack.h
@@ -20,10 +20,10 @@
20 20
21/** 21/**
22 * struct adc_jack_cond - condition to use an extcon state 22 * struct adc_jack_cond - condition to use an extcon state
23 * @state - the corresponding extcon state (if 0, this struct denotes 23 * @state: the corresponding extcon state (if 0, this struct
24 * the last adc_jack_cond element among the array) 24 * denotes the last adc_jack_cond element among the array)
25 * @min_adc - min adc value for this condition 25 * @min_adc: min adc value for this condition
26 * @max_adc - max adc value for this condition 26 * @max_adc: max adc value for this condition
27 * 27 *
28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means 28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means
29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and 29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and
@@ -33,34 +33,34 @@
33 * because when no adc_jack_cond is met, state = 0 is automatically chosen. 33 * because when no adc_jack_cond is met, state = 0 is automatically chosen.
34 */ 34 */
35struct adc_jack_cond { 35struct adc_jack_cond {
36 u32 state; /* extcon state value. 0 if invalid */ 36 u32 state; /* extcon state value. 0 if invalid */
37 u32 min_adc; 37 u32 min_adc;
38 u32 max_adc; 38 u32 max_adc;
39}; 39};
40 40
41/** 41/**
42 * struct adc_jack_pdata - platform data for adc jack device. 42 * struct adc_jack_pdata - platform data for adc jack device.
43 * @name - name of the extcon device. If null, "adc-jack" is used. 43 * @name: name of the extcon device. If null, "adc-jack" is used.
44 * @consumer_channel - Unique name to identify the channel on the consumer 44 * @consumer_channel: Unique name to identify the channel on the consumer
45 * side. This typically describes the channels used within 45 * side. This typically describes the channels used within
46 * the consumer. E.g. 'battery_voltage' 46 * the consumer. E.g. 'battery_voltage'
47 * @cable_names - array of cable names ending with null. 47 * @cable_names: array of cable names ending with null.
48 * @adc_contitions - array of struct adc_jack_cond conditions ending 48 * @adc_contitions: array of struct adc_jack_cond conditions ending
49 * with .state = 0 entry. This describes how to decode 49 * with .state = 0 entry. This describes how to decode
50 * adc values into extcon state. 50 * adc values into extcon state.
51 * @irq_flags - irq flags used for the @irq 51 * @irq_flags: irq flags used for the @irq
52 * @handling_delay_ms - in some devices, we need to read ADC value some 52 * @handling_delay_ms: in some devices, we need to read ADC value some
53 * milli-seconds after the interrupt occurs. You may 53 * milli-seconds after the interrupt occurs. You may
54 * describe such delays with @handling_delay_ms, which 54 * describe such delays with @handling_delay_ms, which
55 * is rounded-off by jiffies. 55 * is rounded-off by jiffies.
56 */ 56 */
57struct adc_jack_pdata { 57struct adc_jack_pdata {
58 const char *name; 58 const char *name;
59 const char *consumer_channel; 59 const char *consumer_channel;
60 /* 60
61 * The last entry should be NULL 61 /* The last entry should be NULL */
62 */
63 const char **cable_names; 62 const char **cable_names;
63
64 /* The last entry's state should be 0 */ 64 /* The last entry's state should be 0 */
65 struct adc_jack_cond *adc_conditions; 65 struct adc_jack_cond *adc_conditions;
66 66
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 2d8307f7d67d..4195810f87fe 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -25,14 +25,17 @@
25 25
26/** 26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. 27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device. 28 * @name: The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO. 29 * @gpio: Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms. 30 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). 31 * If true, low state of gpio means active.
32 * @state_on print_state is overriden with state_on if attached. If Null, 32 * If false, high state of gpio means active.
33 * default method of extcon class is used. 33 * @debounce: Debounce time for GPIO IRQ in ms.
34 * @state_off print_state is overriden with state_on if detached. If Null, 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * default method of extcon class is used. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached.
38 * If NUll, default method of extcon class is used.
36 * 39 *
37 * Note that in order for state_on or state_off to be valid, both state_on 40 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL, 41 * and state_off should be not NULL. If at least one of them is NULL,
@@ -41,6 +44,7 @@
41struct gpio_extcon_platform_data { 44struct gpio_extcon_platform_data {
42 const char *name; 45 const char *name;
43 unsigned gpio; 46 unsigned gpio;
47 bool gpio_active_low;
44 unsigned long debounce; 48 unsigned long debounce;
45 unsigned long irq_flags; 49 unsigned long irq_flags;
46 50
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ffac70aab3e9..70c4836e4a9f 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -792,4 +792,16 @@ extern int fb_find_mode(struct fb_var_screeninfo *var,
792 const struct fb_videomode *default_mode, 792 const struct fb_videomode *default_mode,
793 unsigned int default_bpp); 793 unsigned int default_bpp);
794 794
795/* Convenience logging macros */
796#define fb_err(fb_info, fmt, ...) \
797 pr_err("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
798#define fb_notice(info, fmt, ...) \
799 pr_notice("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
800#define fb_warn(fb_info, fmt, ...) \
801 pr_warn("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
802#define fb_info(fb_info, fmt, ...) \
803 pr_info("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
804#define fb_dbg(fb_info, fmt, ...) \
805 pr_debug("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
806
795#endif /* _LINUX_FB_H */ 807#endif /* _LINUX_FB_H */
diff --git a/include/linux/fcdevice.h b/include/linux/fcdevice.h
index e460ef831984..5009fa16b5d8 100644
--- a/include/linux/fcdevice.h
+++ b/include/linux/fcdevice.h
@@ -27,7 +27,7 @@
27#include <linux/if_fc.h> 27#include <linux/if_fc.h>
28 28
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30extern struct net_device *alloc_fcdev(int sizeof_priv); 30struct net_device *alloc_fcdev(int sizeof_priv);
31#endif 31#endif
32 32
33#endif /* _LINUX_FCDEVICE_H */ 33#endif /* _LINUX_FCDEVICE_H */
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index 155bafd9e886..9a79f0106da1 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -25,10 +25,9 @@
25#include <linux/if_fddi.h> 25#include <linux/if_fddi.h>
26 26
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev);
29 struct net_device *dev); 29int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu); 30struct net_device *alloc_fddidev(int sizeof_priv);
31extern struct net_device *alloc_fddidev(int sizeof_priv);
32#endif 31#endif
33 32
34#endif /* _LINUX_FDDIDEVICE_H */ 33#endif /* _LINUX_FDDIDEVICE_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a6ac84871d6d..ff4e40cd45b1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/workqueue.h>
9#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
10 11
11#ifdef CONFIG_COMPAT 12#ifdef CONFIG_COMPAT
@@ -25,15 +26,19 @@ struct sk_filter
25{ 26{
26 atomic_t refcnt; 27 atomic_t refcnt;
27 unsigned int len; /* Number of filter blocks */ 28 unsigned int len; /* Number of filter blocks */
29 struct rcu_head rcu;
28 unsigned int (*bpf_func)(const struct sk_buff *skb, 30 unsigned int (*bpf_func)(const struct sk_buff *skb,
29 const struct sock_filter *filter); 31 const struct sock_filter *filter);
30 struct rcu_head rcu; 32 union {
31 struct sock_filter insns[0]; 33 struct sock_filter insns[0];
34 struct work_struct work;
35 };
32}; 36};
33 37
34static inline unsigned int sk_filter_len(const struct sk_filter *fp) 38static inline unsigned int sk_filter_size(unsigned int proglen)
35{ 39{
36 return fp->len * sizeof(struct sock_filter) + sizeof(*fp); 40 return max(sizeof(struct sk_filter),
41 offsetof(struct sk_filter, insns[proglen]));
37} 42}
38 43
39extern int sk_filter(struct sock *sk, struct sk_buff *skb); 44extern int sk_filter(struct sock *sk, struct sk_buff *skb);
@@ -67,11 +72,13 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
67} 72}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
69#else 74#else
75#include <linux/slab.h>
70static inline void bpf_jit_compile(struct sk_filter *fp) 76static inline void bpf_jit_compile(struct sk_filter *fp)
71{ 77{
72} 78}
73static inline void bpf_jit_free(struct sk_filter *fp) 79static inline void bpf_jit_free(struct sk_filter *fp)
74{ 80{
81 kfree(fp);
75} 82}
76#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) 83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
77#endif 84#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3b4cd8296e41..121f11f001c0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,7 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/list_lru.h>
13#include <linux/llist.h> 14#include <linux/llist.h>
14#include <linux/radix-tree.h> 15#include <linux/radix-tree.h>
15#include <linux/rbtree.h> 16#include <linux/rbtree.h>
@@ -622,10 +623,13 @@ static inline int inode_unhashed(struct inode *inode)
622 * 0: the object of the current VFS operation 623 * 0: the object of the current VFS operation
623 * 1: parent 624 * 1: parent
624 * 2: child/target 625 * 2: child/target
625 * 3: quota file 626 * 3: xattr
627 * 4: second non-directory
628 * The last is for certain operations (such as rename) which lock two
629 * non-directories at once.
626 * 630 *
627 * The locking order between these classes is 631 * The locking order between these classes is
628 * parent -> child -> normal -> xattr -> quota 632 * parent -> child -> normal -> xattr -> second non-directory
629 */ 633 */
630enum inode_i_mutex_lock_class 634enum inode_i_mutex_lock_class
631{ 635{
@@ -633,9 +637,12 @@ enum inode_i_mutex_lock_class
633 I_MUTEX_PARENT, 637 I_MUTEX_PARENT,
634 I_MUTEX_CHILD, 638 I_MUTEX_CHILD,
635 I_MUTEX_XATTR, 639 I_MUTEX_XATTR,
636 I_MUTEX_QUOTA 640 I_MUTEX_NONDIR2
637}; 641};
638 642
643void lock_two_nondirectories(struct inode *, struct inode*);
644void unlock_two_nondirectories(struct inode *, struct inode*);
645
639/* 646/*
640 * NOTE: in a 32bit arch with a preemptable kernel and 647 * NOTE: in a 32bit arch with a preemptable kernel and
641 * an UP compile the i_size_read/write must be atomic 648 * an UP compile the i_size_read/write must be atomic
@@ -763,12 +770,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
763#define FILE_MNT_WRITE_RELEASED 2 770#define FILE_MNT_WRITE_RELEASED 2
764 771
765struct file { 772struct file {
766 /*
767 * fu_list becomes invalid after file_free is called and queued via
768 * fu_rcuhead for RCU freeing
769 */
770 union { 773 union {
771 struct list_head fu_list;
772 struct llist_node fu_llist; 774 struct llist_node fu_llist;
773 struct rcu_head fu_rcuhead; 775 struct rcu_head fu_rcuhead;
774 } f_u; 776 } f_u;
@@ -782,9 +784,6 @@ struct file {
782 * Must not be taken from IRQ context. 784 * Must not be taken from IRQ context.
783 */ 785 */
784 spinlock_t f_lock; 786 spinlock_t f_lock;
785#ifdef CONFIG_SMP
786 int f_sb_list_cpu;
787#endif
788 atomic_long_t f_count; 787 atomic_long_t f_count;
789 unsigned int f_flags; 788 unsigned int f_flags;
790 fmode_t f_mode; 789 fmode_t f_mode;
@@ -881,6 +880,7 @@ static inline int file_check_writeable(struct file *filp)
881 880
882#define FL_POSIX 1 881#define FL_POSIX 1
883#define FL_FLOCK 2 882#define FL_FLOCK 2
883#define FL_DELEG 4 /* NFSv4 delegation */
884#define FL_ACCESS 8 /* not trying to lock, just looking */ 884#define FL_ACCESS 8 /* not trying to lock, just looking */
885#define FL_EXISTS 16 /* when unlocking, test for existence */ 885#define FL_EXISTS 16 /* when unlocking, test for existence */
886#define FL_LEASE 32 /* lease held on this file */ 886#define FL_LEASE 32 /* lease held on this file */
@@ -1022,7 +1022,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1024extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 1024extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
1025extern int __break_lease(struct inode *inode, unsigned int flags); 1025extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
1026extern void lease_get_mtime(struct inode *, struct timespec *time); 1026extern void lease_get_mtime(struct inode *, struct timespec *time);
1027extern int generic_setlease(struct file *, long, struct file_lock **); 1027extern int generic_setlease(struct file *, long, struct file_lock **);
1028extern int vfs_setlease(struct file *, long, struct file_lock **); 1028extern int vfs_setlease(struct file *, long, struct file_lock **);
@@ -1131,7 +1131,7 @@ static inline int flock_lock_file_wait(struct file *filp,
1131 return -ENOLCK; 1131 return -ENOLCK;
1132} 1132}
1133 1133
1134static inline int __break_lease(struct inode *inode, unsigned int mode) 1134static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
1135{ 1135{
1136 return 0; 1136 return 0;
1137} 1137}
@@ -1263,21 +1263,7 @@ struct super_block {
1263 1263
1264 struct list_head s_inodes; /* all inodes */ 1264 struct list_head s_inodes; /* all inodes */
1265 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ 1265 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
1266#ifdef CONFIG_SMP
1267 struct list_head __percpu *s_files;
1268#else
1269 struct list_head s_files;
1270#endif
1271 struct list_head s_mounts; /* list of mounts; _not_ for fs use */ 1266 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1272 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1273 struct list_head s_dentry_lru; /* unused dentry lru */
1274 int s_nr_dentry_unused; /* # of dentry on lru */
1275
1276 /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */
1277 spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp;
1278 struct list_head s_inode_lru; /* unused inode lru */
1279 int s_nr_inodes_unused; /* # of inodes on lru */
1280
1281 struct block_device *s_bdev; 1267 struct block_device *s_bdev;
1282 struct backing_dev_info *s_bdi; 1268 struct backing_dev_info *s_bdi;
1283 struct mtd_info *s_mtd; 1269 struct mtd_info *s_mtd;
@@ -1331,11 +1317,15 @@ struct super_block {
1331 1317
1332 /* AIO completions deferred from interrupt context */ 1318 /* AIO completions deferred from interrupt context */
1333 struct workqueue_struct *s_dio_done_wq; 1319 struct workqueue_struct *s_dio_done_wq;
1334};
1335 1320
1336/* superblock cache pruning functions */ 1321 /*
1337extern void prune_icache_sb(struct super_block *sb, int nr_to_scan); 1322 * Keep the lru lists last in the structure so they always sit on their
1338extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan); 1323 * own individual cachelines.
1324 */
1325 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1326 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1327 struct rcu_head rcu;
1328};
1339 1329
1340extern struct timespec current_fs_time(struct super_block *sb); 1330extern struct timespec current_fs_time(struct super_block *sb);
1341 1331
@@ -1463,10 +1453,10 @@ extern int vfs_create(struct inode *, struct dentry *, umode_t, bool);
1463extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); 1453extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1464extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); 1454extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1465extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1455extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1466extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1456extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);
1467extern int vfs_rmdir(struct inode *, struct dentry *); 1457extern int vfs_rmdir(struct inode *, struct dentry *);
1468extern int vfs_unlink(struct inode *, struct dentry *); 1458extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1469extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 1459extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **);
1470 1460
1471/* 1461/*
1472 * VFS dentry helper functions. 1462 * VFS dentry helper functions.
@@ -1629,8 +1619,8 @@ struct super_operations {
1629 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1619 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1630#endif 1620#endif
1631 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1621 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1632 int (*nr_cached_objects)(struct super_block *); 1622 long (*nr_cached_objects)(struct super_block *, int);
1633 void (*free_cached_objects)(struct super_block *, int); 1623 long (*free_cached_objects)(struct super_block *, long, int);
1634}; 1624};
1635 1625
1636/* 1626/*
@@ -1880,6 +1870,17 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1880 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1870 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
1881#define fops_put(fops) \ 1871#define fops_put(fops) \
1882 do { if (fops) module_put((fops)->owner); } while(0) 1872 do { if (fops) module_put((fops)->owner); } while(0)
1873/*
1874 * This one is to be used *ONLY* from ->open() instances.
1875 * fops must be non-NULL, pinned down *and* module dependencies
1876 * should be sufficient to pin the caller down as well.
1877 */
1878#define replace_fops(f, fops) \
1879 do { \
1880 struct file *__file = (f); \
1881 fops_put(__file->f_op); \
1882 BUG_ON(!(__file->f_op = (fops))); \
1883 } while(0)
1883 1884
1884extern int register_filesystem(struct file_system_type *); 1885extern int register_filesystem(struct file_system_type *);
1885extern int unregister_filesystem(struct file_system_type *); 1886extern int unregister_filesystem(struct file_system_type *);
@@ -1900,9 +1901,13 @@ extern int vfs_ustat(dev_t, struct kstatfs *);
1900extern int freeze_super(struct super_block *super); 1901extern int freeze_super(struct super_block *super);
1901extern int thaw_super(struct super_block *super); 1902extern int thaw_super(struct super_block *super);
1902extern bool our_mnt(struct vfsmount *mnt); 1903extern bool our_mnt(struct vfsmount *mnt);
1904extern bool fs_fully_visible(struct file_system_type *);
1903 1905
1904extern int current_umask(void); 1906extern int current_umask(void);
1905 1907
1908extern void ihold(struct inode * inode);
1909extern void iput(struct inode *);
1910
1906/* /sys/fs */ 1911/* /sys/fs */
1907extern struct kobject *fs_kobj; 1912extern struct kobject *fs_kobj;
1908 1913
@@ -1959,9 +1964,39 @@ static inline int locks_verify_truncate(struct inode *inode,
1959static inline int break_lease(struct inode *inode, unsigned int mode) 1964static inline int break_lease(struct inode *inode, unsigned int mode)
1960{ 1965{
1961 if (inode->i_flock) 1966 if (inode->i_flock)
1962 return __break_lease(inode, mode); 1967 return __break_lease(inode, mode, FL_LEASE);
1963 return 0; 1968 return 0;
1964} 1969}
1970
1971static inline int break_deleg(struct inode *inode, unsigned int mode)
1972{
1973 if (inode->i_flock)
1974 return __break_lease(inode, mode, FL_DELEG);
1975 return 0;
1976}
1977
1978static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
1979{
1980 int ret;
1981
1982 ret = break_deleg(inode, O_WRONLY|O_NONBLOCK);
1983 if (ret == -EWOULDBLOCK && delegated_inode) {
1984 *delegated_inode = inode;
1985 ihold(inode);
1986 }
1987 return ret;
1988}
1989
1990static inline int break_deleg_wait(struct inode **delegated_inode)
1991{
1992 int ret;
1993
1994 ret = break_deleg(*delegated_inode, O_WRONLY);
1995 iput(*delegated_inode);
1996 *delegated_inode = NULL;
1997 return ret;
1998}
1999
1965#else /* !CONFIG_FILE_LOCKING */ 2000#else /* !CONFIG_FILE_LOCKING */
1966static inline int locks_mandatory_locked(struct inode *inode) 2001static inline int locks_mandatory_locked(struct inode *inode)
1967{ 2002{
@@ -2001,6 +2036,22 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
2001 return 0; 2036 return 0;
2002} 2037}
2003 2038
2039static inline int break_deleg(struct inode *inode, unsigned int mode)
2040{
2041 return 0;
2042}
2043
2044static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
2045{
2046 return 0;
2047}
2048
2049static inline int break_deleg_wait(struct inode **delegated_inode)
2050{
2051 BUG();
2052 return 0;
2053}
2054
2004#endif /* CONFIG_FILE_LOCKING */ 2055#endif /* CONFIG_FILE_LOCKING */
2005 2056
2006/* fs/open.c */ 2057/* fs/open.c */
@@ -2073,6 +2124,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
2073extern void emergency_thaw_all(void); 2124extern void emergency_thaw_all(void);
2074extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2125extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
2075extern int fsync_bdev(struct block_device *); 2126extern int fsync_bdev(struct block_device *);
2127extern int sb_is_blkdev_sb(struct super_block *sb);
2076#else 2128#else
2077static inline void bd_forget(struct inode *inode) {} 2129static inline void bd_forget(struct inode *inode) {}
2078static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2130static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -2092,6 +2144,11 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2092static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg) 2144static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
2093{ 2145{
2094} 2146}
2147
2148static inline int sb_is_blkdev_sb(struct super_block *sb)
2149{
2150 return 0;
2151}
2095#endif 2152#endif
2096extern int sync_filesystem(struct super_block *); 2153extern int sync_filesystem(struct super_block *);
2097extern const struct file_operations def_blk_fops; 2154extern const struct file_operations def_blk_fops;
@@ -2221,7 +2278,7 @@ extern void emergency_remount(void);
2221#ifdef CONFIG_BLOCK 2278#ifdef CONFIG_BLOCK
2222extern sector_t bmap(struct inode *, sector_t); 2279extern sector_t bmap(struct inode *, sector_t);
2223#endif 2280#endif
2224extern int notify_change(struct dentry *, struct iattr *); 2281extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2225extern int inode_permission(struct inode *, int); 2282extern int inode_permission(struct inode *, int);
2226extern int generic_permission(struct inode *, int); 2283extern int generic_permission(struct inode *, int);
2227 2284
@@ -2290,6 +2347,11 @@ static inline void allow_write_access(struct file *file)
2290 if (file) 2347 if (file)
2291 atomic_inc(&file_inode(file)->i_writecount); 2348 atomic_inc(&file_inode(file)->i_writecount);
2292} 2349}
2350static inline bool inode_is_open_for_write(const struct inode *inode)
2351{
2352 return atomic_read(&inode->i_writecount) > 0;
2353}
2354
2293#ifdef CONFIG_IMA 2355#ifdef CONFIG_IMA
2294static inline void i_readcount_dec(struct inode *inode) 2356static inline void i_readcount_dec(struct inode *inode)
2295{ 2357{
@@ -2330,8 +2392,6 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2330extern int inode_init_always(struct super_block *, struct inode *); 2392extern int inode_init_always(struct super_block *, struct inode *);
2331extern void inode_init_once(struct inode *); 2393extern void inode_init_once(struct inode *);
2332extern void address_space_init_once(struct address_space *mapping); 2394extern void address_space_init_once(struct address_space *mapping);
2333extern void ihold(struct inode * inode);
2334extern void iput(struct inode *);
2335extern struct inode * igrab(struct inode *); 2395extern struct inode * igrab(struct inode *);
2336extern ino_t iunique(struct super_block *, ino_t); 2396extern ino_t iunique(struct super_block *, ino_t);
2337extern int inode_needs_sync(struct inode *inode); 2397extern int inode_needs_sync(struct inode *inode);
@@ -2493,7 +2553,6 @@ extern const struct file_operations generic_ro_fops;
2493#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 2553#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2494 2554
2495extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 2555extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
2496extern int vfs_follow_link(struct nameidata *, const char *);
2497extern int page_readlink(struct dentry *, char __user *, int); 2556extern int page_readlink(struct dentry *, char __user *, int);
2498extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2557extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2499extern void page_put_link(struct dentry *, struct nameidata *, void *); 2558extern void page_put_link(struct dentry *, struct nameidata *, void *);
@@ -2501,8 +2560,10 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
2501 int nofs); 2560 int nofs);
2502extern int page_symlink(struct inode *inode, const char *symname, int len); 2561extern int page_symlink(struct inode *inode, const char *symname, int len);
2503extern const struct inode_operations page_symlink_inode_operations; 2562extern const struct inode_operations page_symlink_inode_operations;
2563extern void kfree_put_link(struct dentry *, struct nameidata *, void *);
2504extern int generic_readlink(struct dentry *, char __user *, int); 2564extern int generic_readlink(struct dentry *, char __user *, int);
2505extern void generic_fillattr(struct inode *, struct kstat *); 2565extern void generic_fillattr(struct inode *, struct kstat *);
2566int vfs_getattr_nosec(struct path *path, struct kstat *stat);
2506extern int vfs_getattr(struct path *, struct kstat *); 2567extern int vfs_getattr(struct path *, struct kstat *);
2507void __inode_add_bytes(struct inode *inode, loff_t bytes); 2568void __inode_add_bytes(struct inode *inode, loff_t bytes);
2508void inode_add_bytes(struct inode *inode, loff_t bytes); 2569void inode_add_bytes(struct inode *inode, loff_t bytes);
@@ -2561,6 +2622,9 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
2561extern int simple_write_end(struct file *file, struct address_space *mapping, 2622extern int simple_write_end(struct file *file, struct address_space *mapping,
2562 loff_t pos, unsigned len, unsigned copied, 2623 loff_t pos, unsigned len, unsigned copied,
2563 struct page *page, void *fsdata); 2624 struct page *page, void *fsdata);
2625extern int always_delete_dentry(const struct dentry *);
2626extern struct inode *alloc_anon_inode(struct super_block *);
2627extern const struct dentry_operations simple_dentry_operations;
2564 2628
2565extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2629extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
2566extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 2630extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 2b93a9a5a1e6..0efc3e62843a 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -39,17 +39,6 @@ static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
39 spin_unlock(&fs->lock); 39 spin_unlock(&fs->lock);
40} 40}
41 41
42static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
43 struct path *pwd)
44{
45 spin_lock(&fs->lock);
46 *root = fs->root;
47 path_get(root);
48 *pwd = fs->pwd;
49 path_get(pwd);
50 spin_unlock(&fs->lock);
51}
52
53extern bool current_chrooted(void); 42extern bool current_chrooted(void);
54 43
55#endif /* _LINUX_FS_STRUCT_H */ 44#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index a9ff9a36b86d..771484993ca7 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -251,6 +251,10 @@ struct fscache_cache_ops {
251 /* unpin an object in the cache */ 251 /* unpin an object in the cache */
252 void (*unpin_object)(struct fscache_object *object); 252 void (*unpin_object)(struct fscache_object *object);
253 253
254 /* check the consistency between the backing cache and the FS-Cache
255 * cookie */
256 bool (*check_consistency)(struct fscache_operation *op);
257
254 /* store the updated auxiliary data on an object */ 258 /* store the updated auxiliary data on an object */
255 void (*update_object)(struct fscache_object *object); 259 void (*update_object)(struct fscache_object *object);
256 260
@@ -304,36 +308,6 @@ struct fscache_cache_ops {
304 void (*dissociate_pages)(struct fscache_cache *cache); 308 void (*dissociate_pages)(struct fscache_cache *cache);
305}; 309};
306 310
307/*
308 * data file or index object cookie
309 * - a file will only appear in one cache
310 * - a request to cache a file may or may not be honoured, subject to
311 * constraints such as disk space
312 * - indices are created on disk just-in-time
313 */
314struct fscache_cookie {
315 atomic_t usage; /* number of users of this cookie */
316 atomic_t n_children; /* number of children of this cookie */
317 atomic_t n_active; /* number of active users of netfs ptrs */
318 spinlock_t lock;
319 spinlock_t stores_lock; /* lock on page store tree */
320 struct hlist_head backing_objects; /* object(s) backing this file/index */
321 const struct fscache_cookie_def *def; /* definition */
322 struct fscache_cookie *parent; /* parent of this entry */
323 void *netfs_data; /* back pointer to netfs */
324 struct radix_tree_root stores; /* pages to be stored on this cookie */
325#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
326#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
327
328 unsigned long flags;
329#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
330#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
331#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
332#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
333#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
334#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
335};
336
337extern struct fscache_cookie fscache_fsdef_index; 311extern struct fscache_cookie fscache_fsdef_index;
338 312
339/* 313/*
@@ -396,6 +370,7 @@ struct fscache_object {
396#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */ 370#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
397#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ 371#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
398#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ 372#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
373#define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */
399 374
400 struct list_head cache_link; /* link in cache->object_list */ 375 struct list_head cache_link; /* link in cache->object_list */
401 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 376 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -507,6 +482,11 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
507 op->end_io_func(page, op->context, error); 482 op->end_io_func(page, op->context, error);
508} 483}
509 484
485static inline void __fscache_use_cookie(struct fscache_cookie *cookie)
486{
487 atomic_inc(&cookie->n_active);
488}
489
510/** 490/**
511 * fscache_use_cookie - Request usage of cookie attached to an object 491 * fscache_use_cookie - Request usage of cookie attached to an object
512 * @object: Object description 492 * @object: Object description
@@ -520,6 +500,16 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
520 return atomic_inc_not_zero(&cookie->n_active) != 0; 500 return atomic_inc_not_zero(&cookie->n_active) != 0;
521} 501}
522 502
503static inline bool __fscache_unuse_cookie(struct fscache_cookie *cookie)
504{
505 return atomic_dec_and_test(&cookie->n_active);
506}
507
508static inline void __fscache_wake_unused_cookie(struct fscache_cookie *cookie)
509{
510 wake_up_atomic_t(&cookie->n_active);
511}
512
523/** 513/**
524 * fscache_unuse_cookie - Cease usage of cookie attached to an object 514 * fscache_unuse_cookie - Cease usage of cookie attached to an object
525 * @object: Object description 515 * @object: Object description
@@ -530,8 +520,8 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
530static inline void fscache_unuse_cookie(struct fscache_object *object) 520static inline void fscache_unuse_cookie(struct fscache_object *object)
531{ 521{
532 struct fscache_cookie *cookie = object->cookie; 522 struct fscache_cookie *cookie = object->cookie;
533 if (atomic_dec_and_test(&cookie->n_active)) 523 if (__fscache_unuse_cookie(cookie))
534 wake_up_atomic_t(&cookie->n_active); 524 __fscache_wake_unused_cookie(cookie);
535} 525}
536 526
537/* 527/*
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 7a086235da4b..115bb81912cc 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -167,6 +167,42 @@ struct fscache_netfs {
167}; 167};
168 168
169/* 169/*
170 * data file or index object cookie
171 * - a file will only appear in one cache
172 * - a request to cache a file may or may not be honoured, subject to
173 * constraints such as disk space
174 * - indices are created on disk just-in-time
175 */
176struct fscache_cookie {
177 atomic_t usage; /* number of users of this cookie */
178 atomic_t n_children; /* number of children of this cookie */
179 atomic_t n_active; /* number of active users of netfs ptrs */
180 spinlock_t lock;
181 spinlock_t stores_lock; /* lock on page store tree */
182 struct hlist_head backing_objects; /* object(s) backing this file/index */
183 const struct fscache_cookie_def *def; /* definition */
184 struct fscache_cookie *parent; /* parent of this entry */
185 void *netfs_data; /* back pointer to netfs */
186 struct radix_tree_root stores; /* pages to be stored on this cookie */
187#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
188#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
189
190 unsigned long flags;
191#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
192#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
193#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
194#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
195#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
196#define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */
197#define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */
198};
199
200static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie)
201{
202 return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
203}
204
205/*
170 * slow-path functions for when there is actually caching available, and the 206 * slow-path functions for when there is actually caching available, and the
171 * netfs does actually have a valid token 207 * netfs does actually have a valid token
172 * - these are not to be called directly 208 * - these are not to be called directly
@@ -181,8 +217,9 @@ extern void __fscache_release_cache_tag(struct fscache_cache_tag *);
181extern struct fscache_cookie *__fscache_acquire_cookie( 217extern struct fscache_cookie *__fscache_acquire_cookie(
182 struct fscache_cookie *, 218 struct fscache_cookie *,
183 const struct fscache_cookie_def *, 219 const struct fscache_cookie_def *,
184 void *); 220 void *, bool);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 221extern void __fscache_relinquish_cookie(struct fscache_cookie *, bool);
222extern int __fscache_check_consistency(struct fscache_cookie *);
186extern void __fscache_update_cookie(struct fscache_cookie *); 223extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *); 224extern int __fscache_attr_changed(struct fscache_cookie *);
188extern void __fscache_invalidate(struct fscache_cookie *); 225extern void __fscache_invalidate(struct fscache_cookie *);
@@ -208,6 +245,11 @@ extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
208 gfp_t); 245 gfp_t);
209extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *, 246extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
210 struct inode *); 247 struct inode *);
248extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
249 struct list_head *pages);
250extern void __fscache_disable_cookie(struct fscache_cookie *, bool);
251extern void __fscache_enable_cookie(struct fscache_cookie *,
252 bool (*)(void *), void *);
211 253
212/** 254/**
213 * fscache_register_netfs - Register a filesystem as desiring caching services 255 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -286,6 +328,7 @@ void fscache_release_cache_tag(struct fscache_cache_tag *tag)
286 * @def: A description of the cache object, including callback operations 328 * @def: A description of the cache object, including callback operations
287 * @netfs_data: An arbitrary piece of data to be kept in the cookie to 329 * @netfs_data: An arbitrary piece of data to be kept in the cookie to
288 * represent the cache object to the netfs 330 * represent the cache object to the netfs
331 * @enable: Whether or not to enable a data cookie immediately
289 * 332 *
290 * This function is used to inform FS-Cache about part of an index hierarchy 333 * This function is used to inform FS-Cache about part of an index hierarchy
291 * that can be used to locate files. This is done by requesting a cookie for 334 * that can be used to locate files. This is done by requesting a cookie for
@@ -298,10 +341,12 @@ static inline
298struct fscache_cookie *fscache_acquire_cookie( 341struct fscache_cookie *fscache_acquire_cookie(
299 struct fscache_cookie *parent, 342 struct fscache_cookie *parent,
300 const struct fscache_cookie_def *def, 343 const struct fscache_cookie_def *def,
301 void *netfs_data) 344 void *netfs_data,
345 bool enable)
302{ 346{
303 if (fscache_cookie_valid(parent)) 347 if (fscache_cookie_valid(parent) && fscache_cookie_enabled(parent))
304 return __fscache_acquire_cookie(parent, def, netfs_data); 348 return __fscache_acquire_cookie(parent, def, netfs_data,
349 enable);
305 else 350 else
306 return NULL; 351 return NULL;
307} 352}
@@ -319,13 +364,32 @@ struct fscache_cookie *fscache_acquire_cookie(
319 * description. 364 * description.
320 */ 365 */
321static inline 366static inline
322void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) 367void fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
323{ 368{
324 if (fscache_cookie_valid(cookie)) 369 if (fscache_cookie_valid(cookie))
325 __fscache_relinquish_cookie(cookie, retire); 370 __fscache_relinquish_cookie(cookie, retire);
326} 371}
327 372
328/** 373/**
374 * fscache_check_consistency - Request that if the cache is updated
375 * @cookie: The cookie representing the cache object
376 *
377 * Request an consistency check from fscache, which passes the request
378 * to the backing cache.
379 *
380 * Returns 0 if consistent and -ESTALE if inconsistent. May also
381 * return -ENOMEM and -ERESTARTSYS.
382 */
383static inline
384int fscache_check_consistency(struct fscache_cookie *cookie)
385{
386 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
387 return __fscache_check_consistency(cookie);
388 else
389 return 0;
390}
391
392/**
329 * fscache_update_cookie - Request that a cache object be updated 393 * fscache_update_cookie - Request that a cache object be updated
330 * @cookie: The cookie representing the cache object 394 * @cookie: The cookie representing the cache object
331 * 395 *
@@ -338,7 +402,7 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
338static inline 402static inline
339void fscache_update_cookie(struct fscache_cookie *cookie) 403void fscache_update_cookie(struct fscache_cookie *cookie)
340{ 404{
341 if (fscache_cookie_valid(cookie)) 405 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
342 __fscache_update_cookie(cookie); 406 __fscache_update_cookie(cookie);
343} 407}
344 408
@@ -385,7 +449,7 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
385static inline 449static inline
386int fscache_attr_changed(struct fscache_cookie *cookie) 450int fscache_attr_changed(struct fscache_cookie *cookie)
387{ 451{
388 if (fscache_cookie_valid(cookie)) 452 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
389 return __fscache_attr_changed(cookie); 453 return __fscache_attr_changed(cookie);
390 else 454 else
391 return -ENOBUFS; 455 return -ENOBUFS;
@@ -407,7 +471,7 @@ int fscache_attr_changed(struct fscache_cookie *cookie)
407static inline 471static inline
408void fscache_invalidate(struct fscache_cookie *cookie) 472void fscache_invalidate(struct fscache_cookie *cookie)
409{ 473{
410 if (fscache_cookie_valid(cookie)) 474 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
411 __fscache_invalidate(cookie); 475 __fscache_invalidate(cookie);
412} 476}
413 477
@@ -481,7 +545,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
481 void *context, 545 void *context,
482 gfp_t gfp) 546 gfp_t gfp)
483{ 547{
484 if (fscache_cookie_valid(cookie)) 548 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
485 return __fscache_read_or_alloc_page(cookie, page, end_io_func, 549 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
486 context, gfp); 550 context, gfp);
487 else 551 else
@@ -532,7 +596,7 @@ int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
532 void *context, 596 void *context,
533 gfp_t gfp) 597 gfp_t gfp)
534{ 598{
535 if (fscache_cookie_valid(cookie)) 599 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
536 return __fscache_read_or_alloc_pages(cookie, mapping, pages, 600 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
537 nr_pages, end_io_func, 601 nr_pages, end_io_func,
538 context, gfp); 602 context, gfp);
@@ -563,13 +627,33 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
563 struct page *page, 627 struct page *page,
564 gfp_t gfp) 628 gfp_t gfp)
565{ 629{
566 if (fscache_cookie_valid(cookie)) 630 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
567 return __fscache_alloc_page(cookie, page, gfp); 631 return __fscache_alloc_page(cookie, page, gfp);
568 else 632 else
569 return -ENOBUFS; 633 return -ENOBUFS;
570} 634}
571 635
572/** 636/**
637 * fscache_readpages_cancel - Cancel read/alloc on pages
638 * @cookie: The cookie representing the inode's cache object.
639 * @pages: The netfs pages that we canceled write on in readpages()
640 *
641 * Uncache/unreserve the pages reserved earlier in readpages() via
642 * fscache_readpages_or_alloc() and similar. In most successful caches in
643 * readpages() this doesn't do anything. In cases when the underlying netfs's
644 * readahead failed we need to clean up the pagelist (unmark and uncache).
645 *
646 * This function may sleep as it may have to clean up disk state.
647 */
648static inline
649void fscache_readpages_cancel(struct fscache_cookie *cookie,
650 struct list_head *pages)
651{
652 if (fscache_cookie_valid(cookie))
653 __fscache_readpages_cancel(cookie, pages);
654}
655
656/**
573 * fscache_write_page - Request storage of a page in the cache 657 * fscache_write_page - Request storage of a page in the cache
574 * @cookie: The cookie representing the cache object 658 * @cookie: The cookie representing the cache object
575 * @page: The netfs page to store 659 * @page: The netfs page to store
@@ -592,7 +676,7 @@ int fscache_write_page(struct fscache_cookie *cookie,
592 struct page *page, 676 struct page *page,
593 gfp_t gfp) 677 gfp_t gfp)
594{ 678{
595 if (fscache_cookie_valid(cookie)) 679 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
596 return __fscache_write_page(cookie, page, gfp); 680 return __fscache_write_page(cookie, page, gfp);
597 else 681 else
598 return -ENOBUFS; 682 return -ENOBUFS;
@@ -702,4 +786,47 @@ void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
702 __fscache_uncache_all_inode_pages(cookie, inode); 786 __fscache_uncache_all_inode_pages(cookie, inode);
703} 787}
704 788
789/**
790 * fscache_disable_cookie - Disable a cookie
791 * @cookie: The cookie representing the cache object
792 * @invalidate: Invalidate the backing object
793 *
794 * Disable a cookie from accepting further alloc, read, write, invalidate,
795 * update or acquire operations. Outstanding operations can still be waited
796 * upon and pages can still be uncached and the cookie relinquished.
797 *
798 * This will not return until all outstanding operations have completed.
799 *
800 * If @invalidate is set, then the backing object will be invalidated and
801 * detached, otherwise it will just be detached.
802 */
803static inline
804void fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate)
805{
806 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
807 __fscache_disable_cookie(cookie, invalidate);
808}
809
810/**
811 * fscache_enable_cookie - Reenable a cookie
812 * @cookie: The cookie representing the cache object
813 * @can_enable: A function to permit enablement once lock is held
814 * @data: Data for can_enable()
815 *
816 * Reenable a previously disabled cookie, allowing it to accept further alloc,
817 * read, write, invalidate, update or acquire operations. An attempt will be
818 * made to immediately reattach the cookie to a backing object.
819 *
820 * The can_enable() function is called (if not NULL) once the enablement lock
821 * is held to rule on whether enablement is still permitted to go ahead.
822 */
823static inline
824void fscache_enable_cookie(struct fscache_cookie *cookie,
825 bool (*can_enable)(void *data),
826 void *data)
827{
828 if (fscache_cookie_valid(cookie) && !fscache_cookie_enabled(cookie))
829 __fscache_enable_cookie(cookie, can_enable, data);
830}
831
705#endif /* _LINUX_FSCACHE_H */ 832#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
deleted file mode 100644
index 55d870238399..000000000000
--- a/include/linux/fsl/mxs-dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_MXS_DMA_H__
10#define __MACH_MXS_DMA_H__
11
12#include <linux/dmaengine.h>
13
14struct mxs_dma_data {
15 int chan_irq;
16};
17
18extern int mxs_dma_is_apbh(struct dma_chan *chan);
19extern int mxs_dma_is_apbx(struct dma_chan *chan);
20#endif /* __MACH_MXS_DMA_H__ */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9f15c0064c50..31ea4b428360 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -533,11 +533,11 @@ static inline int ftrace_force_update(void) { return 0; }
533static inline void ftrace_disable_daemon(void) { } 533static inline void ftrace_disable_daemon(void) { }
534static inline void ftrace_enable_daemon(void) { } 534static inline void ftrace_enable_daemon(void) { }
535static inline void ftrace_release_mod(struct module *mod) {} 535static inline void ftrace_release_mod(struct module *mod) {}
536static inline int register_ftrace_command(struct ftrace_func_command *cmd) 536static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
537{ 537{
538 return -EINVAL; 538 return -EINVAL;
539} 539}
540static inline int unregister_ftrace_command(char *cmd_name) 540static inline __init int unregister_ftrace_command(char *cmd_name)
541{ 541{
542 return -EINVAL; 542 return -EINVAL;
543} 543}
@@ -721,6 +721,7 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
721extern char __irqentry_text_start[]; 721extern char __irqentry_text_start[];
722extern char __irqentry_text_end[]; 722extern char __irqentry_text_end[];
723 723
724#define FTRACE_NOTRACE_DEPTH 65536
724#define FTRACE_RETFUNC_DEPTH 50 725#define FTRACE_RETFUNC_DEPTH 50
725#define FTRACE_RETSTACK_ALLOC_SIZE 32 726#define FTRACE_RETSTACK_ALLOC_SIZE 32
726extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 727extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5eaa746735ff..8c9b7a1c4138 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -202,6 +202,7 @@ enum {
202 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 202 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
203 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 203 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
204 TRACE_EVENT_FL_WAS_ENABLED_BIT, 204 TRACE_EVENT_FL_WAS_ENABLED_BIT,
205 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
205}; 206};
206 207
207/* 208/*
@@ -213,6 +214,7 @@ enum {
213 * WAS_ENABLED - Set and stays set when an event was ever enabled 214 * WAS_ENABLED - Set and stays set when an event was ever enabled
214 * (used for module unloading, if a module event is enabled, 215 * (used for module unloading, if a module event is enabled,
215 * it is best to clear the buffers that used it). 216 * it is best to clear the buffers that used it).
217 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
216 */ 218 */
217enum { 219enum {
218 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 220 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -220,6 +222,7 @@ enum {
220 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 222 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
221 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 223 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
222 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 224 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
225 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
223}; 226};
224 227
225struct ftrace_event_call { 228struct ftrace_event_call {
@@ -238,12 +241,16 @@ struct ftrace_event_call {
238 * bit 2: failed to apply filter 241 * bit 2: failed to apply filter
239 * bit 3: ftrace internal event (do not enable) 242 * bit 3: ftrace internal event (do not enable)
240 * bit 4: Event was enabled by module 243 * bit 4: Event was enabled by module
244 * bit 5: use call filter rather than file filter
241 */ 245 */
242 int flags; /* static flags of different events */ 246 int flags; /* static flags of different events */
243 247
244#ifdef CONFIG_PERF_EVENTS 248#ifdef CONFIG_PERF_EVENTS
245 int perf_refcount; 249 int perf_refcount;
246 struct hlist_head __percpu *perf_events; 250 struct hlist_head __percpu *perf_events;
251
252 int (*perf_perm)(struct ftrace_event_call *,
253 struct perf_event *);
247#endif 254#endif
248}; 255};
249 256
@@ -253,6 +260,8 @@ struct ftrace_subsystem_dir;
253enum { 260enum {
254 FTRACE_EVENT_FL_ENABLED_BIT, 261 FTRACE_EVENT_FL_ENABLED_BIT,
255 FTRACE_EVENT_FL_RECORDED_CMD_BIT, 262 FTRACE_EVENT_FL_RECORDED_CMD_BIT,
263 FTRACE_EVENT_FL_FILTERED_BIT,
264 FTRACE_EVENT_FL_NO_SET_FILTER_BIT,
256 FTRACE_EVENT_FL_SOFT_MODE_BIT, 265 FTRACE_EVENT_FL_SOFT_MODE_BIT,
257 FTRACE_EVENT_FL_SOFT_DISABLED_BIT, 266 FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
258}; 267};
@@ -261,6 +270,8 @@ enum {
261 * Ftrace event file flags: 270 * Ftrace event file flags:
262 * ENABLED - The event is enabled 271 * ENABLED - The event is enabled
263 * RECORDED_CMD - The comms should be recorded at sched_switch 272 * RECORDED_CMD - The comms should be recorded at sched_switch
273 * FILTERED - The event has a filter attached
274 * NO_SET_FILTER - Set when filter has error and is to be ignored
264 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED 275 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED
265 * SOFT_DISABLED - When set, do not trace the event (even though its 276 * SOFT_DISABLED - When set, do not trace the event (even though its
266 * tracepoint may be enabled) 277 * tracepoint may be enabled)
@@ -268,6 +279,8 @@ enum {
268enum { 279enum {
269 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT), 280 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
270 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT), 281 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
282 FTRACE_EVENT_FL_FILTERED = (1 << FTRACE_EVENT_FL_FILTERED_BIT),
283 FTRACE_EVENT_FL_NO_SET_FILTER = (1 << FTRACE_EVENT_FL_NO_SET_FILTER_BIT),
271 FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT), 284 FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
272 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT), 285 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
273}; 286};
@@ -275,6 +288,7 @@ enum {
275struct ftrace_event_file { 288struct ftrace_event_file {
276 struct list_head list; 289 struct list_head list;
277 struct ftrace_event_call *event_call; 290 struct ftrace_event_call *event_call;
291 struct event_filter *filter;
278 struct dentry *dir; 292 struct dentry *dir;
279 struct trace_array *tr; 293 struct trace_array *tr;
280 struct ftrace_subsystem_dir *system; 294 struct ftrace_subsystem_dir *system;
@@ -306,16 +320,33 @@ struct ftrace_event_file {
306 } \ 320 } \
307 early_initcall(trace_init_flags_##name); 321 early_initcall(trace_init_flags_##name);
308 322
323#define __TRACE_EVENT_PERF_PERM(name, expr...) \
324 static int perf_perm_##name(struct ftrace_event_call *tp_event, \
325 struct perf_event *p_event) \
326 { \
327 return ({ expr; }); \
328 } \
329 static int __init trace_init_perf_perm_##name(void) \
330 { \
331 event_##name.perf_perm = &perf_perm_##name; \
332 return 0; \
333 } \
334 early_initcall(trace_init_perf_perm_##name);
335
309#define PERF_MAX_TRACE_SIZE 2048 336#define PERF_MAX_TRACE_SIZE 2048
310 337
311#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 338#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
312 339
313extern void destroy_preds(struct ftrace_event_call *call); 340extern void destroy_preds(struct ftrace_event_file *file);
341extern void destroy_call_preds(struct ftrace_event_call *call);
314extern int filter_match_preds(struct event_filter *filter, void *rec); 342extern int filter_match_preds(struct event_filter *filter, void *rec);
315extern int filter_current_check_discard(struct ring_buffer *buffer, 343
316 struct ftrace_event_call *call, 344extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
317 void *rec, 345 struct ring_buffer *buffer,
318 struct ring_buffer_event *event); 346 struct ring_buffer_event *event);
347extern int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
348 struct ring_buffer *buffer,
349 struct ring_buffer_event *event);
319 350
320enum { 351enum {
321 FILTER_OTHER = 0, 352 FILTER_OTHER = 0,
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 661d374aeb2d..1eda33d7cb10 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -66,8 +66,8 @@ struct gen_pool_chunk {
66 struct list_head next_chunk; /* next chunk in pool */ 66 struct list_head next_chunk; /* next chunk in pool */
67 atomic_t avail; 67 atomic_t avail;
68 phys_addr_t phys_addr; /* physical starting address of memory chunk */ 68 phys_addr_t phys_addr; /* physical starting address of memory chunk */
69 unsigned long start_addr; /* starting address of memory chunk */ 69 unsigned long start_addr; /* start address of memory chunk */
70 unsigned long end_addr; /* ending address of memory chunk */ 70 unsigned long end_addr; /* end address of memory chunk (inclusive) */
71 unsigned long bits[0]; /* bitmap for allocating memory chunk */ 71 unsigned long bits[0]; /* bitmap for allocating memory chunk */
72}; 72};
73 73
@@ -94,6 +94,8 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
94} 94}
95extern void gen_pool_destroy(struct gen_pool *); 95extern void gen_pool_destroy(struct gen_pool *);
96extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); 96extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
97extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size,
98 dma_addr_t *dma);
97extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); 99extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
98extern void gen_pool_for_each_chunk(struct gen_pool *, 100extern void gen_pool_for_each_chunk(struct gen_pool *,
99 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); 101 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *);
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index 023bc346b877..c0894dd8827b 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -273,49 +273,40 @@ static struct genl_family ZZZ_genl_family __read_mostly = {
273 * Magic: define multicast groups 273 * Magic: define multicast groups
274 * Magic: define multicast group registration helper 274 * Magic: define multicast group registration helper
275 */ 275 */
276#define ZZZ_genl_mcgrps CONCAT_(GENL_MAGIC_FAMILY, _genl_mcgrps)
277static const struct genl_multicast_group ZZZ_genl_mcgrps[] = {
278#undef GENL_mc_group
279#define GENL_mc_group(group) { .name = #group, },
280#include GENL_MAGIC_INCLUDE_FILE
281};
282
283enum CONCAT_(GENL_MAGIC_FAMILY, group_ids) {
284#undef GENL_mc_group
285#define GENL_mc_group(group) CONCAT_(GENL_MAGIC_FAMILY, _group_ ## group),
286#include GENL_MAGIC_INCLUDE_FILE
287};
288
276#undef GENL_mc_group 289#undef GENL_mc_group
277#define GENL_mc_group(group) \ 290#define GENL_mc_group(group) \
278static struct genl_multicast_group \
279CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group) __read_mostly = { \
280 .name = #group, \
281}; \
282static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \ 291static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \
283 struct sk_buff *skb, gfp_t flags) \ 292 struct sk_buff *skb, gfp_t flags) \
284{ \ 293{ \
285 unsigned int group_id = \ 294 unsigned int group_id = \
286 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id; \ 295 CONCAT_(GENL_MAGIC_FAMILY, _group_ ## group); \
287 if (!group_id) \ 296 return genlmsg_multicast(&ZZZ_genl_family, skb, 0, \
288 return -EINVAL; \ 297 group_id, flags); \
289 return genlmsg_multicast(skb, 0, group_id, flags); \
290} 298}
291 299
292#include GENL_MAGIC_INCLUDE_FILE 300#include GENL_MAGIC_INCLUDE_FILE
293 301
294int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
295{
296 int err = genl_register_family_with_ops(&ZZZ_genl_family,
297 ZZZ_genl_ops, ARRAY_SIZE(ZZZ_genl_ops));
298 if (err)
299 return err;
300#undef GENL_mc_group
301#define GENL_mc_group(group) \
302 err = genl_register_mc_group(&ZZZ_genl_family, \
303 &CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group)); \
304 if (err) \
305 goto fail; \
306 else \
307 pr_info("%s: mcg %s: %u\n", #group, \
308 __stringify(GENL_MAGIC_FAMILY), \
309 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id);
310
311#include GENL_MAGIC_INCLUDE_FILE
312
313#undef GENL_mc_group 302#undef GENL_mc_group
314#define GENL_mc_group(group) 303#define GENL_mc_group(group)
315 return 0; 304
316fail: 305int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
317 genl_unregister_family(&ZZZ_genl_family); 306{
318 return err; 307 return genl_register_family_with_ops_groups(&ZZZ_genl_family, \
308 ZZZ_genl_ops, \
309 ZZZ_genl_mcgrps);
319} 310}
320 311
321void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void) 312void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 552e3f46e4a3..13dfd24d01ab 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -16,14 +16,17 @@
16#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 16#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
17#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 17#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
18 18
19/* Gpio pin is active-low */
20#define GPIOF_ACTIVE_LOW (1 << 2)
21
19/* Gpio pin is open drain */ 22/* Gpio pin is open drain */
20#define GPIOF_OPEN_DRAIN (1 << 2) 23#define GPIOF_OPEN_DRAIN (1 << 3)
21 24
22/* Gpio pin is open source */ 25/* Gpio pin is open source */
23#define GPIOF_OPEN_SOURCE (1 << 3) 26#define GPIOF_OPEN_SOURCE (1 << 4)
24 27
25#define GPIOF_EXPORT (1 << 4) 28#define GPIOF_EXPORT (1 << 5)
26#define GPIOF_EXPORT_CHANGEABLE (1 << 5) 29#define GPIOF_EXPORT_CHANGEABLE (1 << 6)
27#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) 30#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
28#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) 31#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
29 32
@@ -74,12 +77,22 @@ static inline int irq_to_gpio(unsigned int irq)
74 77
75#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ 78#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
76 79
80/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
81
82struct device;
83
84int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
85int devm_gpio_request_one(struct device *dev, unsigned gpio,
86 unsigned long flags, const char *label);
87void devm_gpio_free(struct device *dev, unsigned int gpio);
88
77#else /* ! CONFIG_GPIOLIB */ 89#else /* ! CONFIG_GPIOLIB */
78 90
79#include <linux/kernel.h> 91#include <linux/kernel.h>
80#include <linux/types.h> 92#include <linux/types.h>
81#include <linux/errno.h> 93#include <linux/errno.h>
82#include <linux/bug.h> 94#include <linux/bug.h>
95#include <linux/pinctrl/pinctrl.h>
83 96
84struct device; 97struct device;
85struct gpio_chip; 98struct gpio_chip;
@@ -204,6 +217,18 @@ static inline int gpio_to_irq(unsigned gpio)
204 return -EINVAL; 217 return -EINVAL;
205} 218}
206 219
220static inline int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
221{
222 WARN_ON(1);
223 return -EINVAL;
224}
225
226static inline void gpio_unlock_as_irq(struct gpio_chip *chip,
227 unsigned int offset)
228{
229 WARN_ON(1);
230}
231
207static inline int irq_to_gpio(unsigned irq) 232static inline int irq_to_gpio(unsigned irq)
208{ 233{
209 /* irq can never have been returned from gpio_to_irq() */ 234 /* irq can never have been returned from gpio_to_irq() */
@@ -220,20 +245,40 @@ gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
220 return -EINVAL; 245 return -EINVAL;
221} 246}
222 247
248static inline int
249gpiochip_add_pingroup_range(struct gpio_chip *chip,
250 struct pinctrl_dev *pctldev,
251 unsigned int gpio_offset, const char *pin_group)
252{
253 WARN_ON(1);
254 return -EINVAL;
255}
256
223static inline void 257static inline void
224gpiochip_remove_pin_ranges(struct gpio_chip *chip) 258gpiochip_remove_pin_ranges(struct gpio_chip *chip)
225{ 259{
226 WARN_ON(1); 260 WARN_ON(1);
227} 261}
228 262
229#endif /* ! CONFIG_GPIOLIB */ 263static inline int devm_gpio_request(struct device *dev, unsigned gpio,
264 const char *label)
265{
266 WARN_ON(1);
267 return -EINVAL;
268}
230 269
231struct device; 270static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
271 unsigned long flags, const char *label)
272{
273 WARN_ON(1);
274 return -EINVAL;
275}
232 276
233/* bindings for managed devices that want to request gpios */ 277static inline void devm_gpio_free(struct device *dev, unsigned int gpio)
234int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); 278{
235int devm_gpio_request_one(struct device *dev, unsigned gpio, 279 WARN_ON(1);
236 unsigned long flags, const char *label); 280}
237void devm_gpio_free(struct device *dev, unsigned int gpio); 281
282#endif /* ! CONFIG_GPIOLIB */
238 283
239#endif /* __LINUX_GPIO_H */ 284#endif /* __LINUX_GPIO_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
new file mode 100644
index 000000000000..4d34dbbbad4d
--- /dev/null
+++ b/include/linux/gpio/consumer.h
@@ -0,0 +1,253 @@
1#ifndef __LINUX_GPIO_CONSUMER_H
2#define __LINUX_GPIO_CONSUMER_H
3
4#include <linux/err.h>
5#include <linux/kernel.h>
6
7#ifdef CONFIG_GPIOLIB
8
9struct device;
10struct gpio_chip;
11
12/**
13 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
14 * preferable to the old integer-based handles.
15 *
16 * Contrary to integers, a pointer to a gpio_desc is guaranteed to be valid
17 * until the GPIO is released.
18 */
19struct gpio_desc;
20
21/* Acquire and dispose GPIOs */
22struct gpio_desc *__must_check gpiod_get(struct device *dev,
23 const char *con_id);
24struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
25 const char *con_id,
26 unsigned int idx);
27void gpiod_put(struct gpio_desc *desc);
28
29struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
30 const char *con_id);
31struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
32 const char *con_id,
33 unsigned int idx);
34void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
35
36int gpiod_get_direction(const struct gpio_desc *desc);
37int gpiod_direction_input(struct gpio_desc *desc);
38int gpiod_direction_output(struct gpio_desc *desc, int value);
39
40/* Value get/set from non-sleeping context */
41int gpiod_get_value(const struct gpio_desc *desc);
42void gpiod_set_value(struct gpio_desc *desc, int value);
43int gpiod_get_raw_value(const struct gpio_desc *desc);
44void gpiod_set_raw_value(struct gpio_desc *desc, int value);
45
46/* Value get/set from sleeping context */
47int gpiod_get_value_cansleep(const struct gpio_desc *desc);
48void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);
49int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc);
50void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);
51
52int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
53
54int gpiod_is_active_low(const struct gpio_desc *desc);
55int gpiod_cansleep(const struct gpio_desc *desc);
56
57int gpiod_to_irq(const struct gpio_desc *desc);
58
59/* Convert between the old gpio_ and new gpiod_ interfaces */
60struct gpio_desc *gpio_to_desc(unsigned gpio);
61int desc_to_gpio(const struct gpio_desc *desc);
62struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
63
64#else /* CONFIG_GPIOLIB */
65
66static inline struct gpio_desc *__must_check gpiod_get(struct device *dev,
67 const char *con_id)
68{
69 return ERR_PTR(-ENOSYS);
70}
71static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
72 const char *con_id,
73 unsigned int idx)
74{
75 return ERR_PTR(-ENOSYS);
76}
77static inline void gpiod_put(struct gpio_desc *desc)
78{
79 might_sleep();
80
81 /* GPIO can never have been requested */
82 WARN_ON(1);
83}
84
85static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
86 const char *con_id)
87{
88 return ERR_PTR(-ENOSYS);
89}
90static inline
91struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
92 const char *con_id,
93 unsigned int idx)
94{
95 return ERR_PTR(-ENOSYS);
96}
97static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
98{
99 might_sleep();
100
101 /* GPIO can never have been requested */
102 WARN_ON(1);
103}
104
105
106static inline int gpiod_get_direction(const struct gpio_desc *desc)
107{
108 /* GPIO can never have been requested */
109 WARN_ON(1);
110 return -ENOSYS;
111}
112static inline int gpiod_direction_input(struct gpio_desc *desc)
113{
114 /* GPIO can never have been requested */
115 WARN_ON(1);
116 return -ENOSYS;
117}
118static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
119{
120 /* GPIO can never have been requested */
121 WARN_ON(1);
122 return -ENOSYS;
123}
124
125
126static inline int gpiod_get_value(const struct gpio_desc *desc)
127{
128 /* GPIO can never have been requested */
129 WARN_ON(1);
130 return 0;
131}
132static inline void gpiod_set_value(struct gpio_desc *desc, int value)
133{
134 /* GPIO can never have been requested */
135 WARN_ON(1);
136}
137static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
138{
139 /* GPIO can never have been requested */
140 WARN_ON(1);
141 return 0;
142}
143static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
144{
145 /* GPIO can never have been requested */
146 WARN_ON(1);
147}
148
149static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
150{
151 /* GPIO can never have been requested */
152 WARN_ON(1);
153 return 0;
154}
155static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
156{
157 /* GPIO can never have been requested */
158 WARN_ON(1);
159}
160static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
161{
162 /* GPIO can never have been requested */
163 WARN_ON(1);
164 return 0;
165}
166static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
167 int value)
168{
169 /* GPIO can never have been requested */
170 WARN_ON(1);
171}
172
173static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
174{
175 /* GPIO can never have been requested */
176 WARN_ON(1);
177 return -ENOSYS;
178}
179
180static inline int gpiod_is_active_low(const struct gpio_desc *desc)
181{
182 /* GPIO can never have been requested */
183 WARN_ON(1);
184 return 0;
185}
186static inline int gpiod_cansleep(const struct gpio_desc *desc)
187{
188 /* GPIO can never have been requested */
189 WARN_ON(1);
190 return 0;
191}
192
193static inline int gpiod_to_irq(const struct gpio_desc *desc)
194{
195 /* GPIO can never have been requested */
196 WARN_ON(1);
197 return -EINVAL;
198}
199
200static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
201{
202 return ERR_PTR(-EINVAL);
203}
204static inline int desc_to_gpio(const struct gpio_desc *desc)
205{
206 /* GPIO can never have been requested */
207 WARN_ON(1);
208 return -EINVAL;
209}
210static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
211{
212 /* GPIO can never have been requested */
213 WARN_ON(1);
214 return ERR_PTR(-ENODEV);
215}
216
217
218#endif /* CONFIG_GPIOLIB */
219
220#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
221
222int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
223int gpiod_export_link(struct device *dev, const char *name,
224 struct gpio_desc *desc);
225int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
226void gpiod_unexport(struct gpio_desc *desc);
227
228#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
229
230static inline int gpiod_export(struct gpio_desc *desc,
231 bool direction_may_change)
232{
233 return -ENOSYS;
234}
235
236static inline int gpiod_export_link(struct device *dev, const char *name,
237 struct gpio_desc *desc)
238{
239 return -ENOSYS;
240}
241
242static inline int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value)
243{
244 return -ENOSYS;
245}
246
247static inline void gpiod_unexport(struct gpio_desc *desc)
248{
249}
250
251#endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
252
253#endif
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
new file mode 100644
index 000000000000..3ea2cf6b0e6c
--- /dev/null
+++ b/include/linux/gpio/driver.h
@@ -0,0 +1,194 @@
1#ifndef __LINUX_GPIO_DRIVER_H
2#define __LINUX_GPIO_DRIVER_H
3
4#include <linux/types.h>
5#include <linux/module.h>
6
7struct device;
8struct gpio_desc;
9struct of_phandle_args;
10struct device_node;
11struct seq_file;
12
13/**
14 * struct gpio_chip - abstract a GPIO controller
15 * @label: for diagnostics
16 * @dev: optional device providing the GPIOs
17 * @owner: helps prevent removal of modules exporting active GPIOs
18 * @list: links gpio_chips together for traversal
19 * @request: optional hook for chip-specific activation, such as
20 * enabling module power and clock; may sleep
21 * @free: optional hook for chip-specific deactivation, such as
22 * disabling module power and clock; may sleep
23 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
24 * (same as GPIOF_DIR_XXX), or negative error
25 * @direction_input: configures signal "offset" as input, or returns error
26 * @direction_output: configures signal "offset" as output, or returns error
27 * @get: returns value for signal "offset"; for output signals this
28 * returns either the value actually sensed, or zero
29 * @set: assigns output value for signal "offset"
30 * @set_debounce: optional hook for setting debounce time for specified gpio in
31 * interrupt triggered gpio chips
32 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
33 * implementation may not sleep
34 * @dbg_show: optional routine to show contents in debugfs; default code
35 * will be used when this is omitted, but custom code can show extra
36 * state (such as pullup/pulldown configuration).
37 * @base: identifies the first GPIO number handled by this chip; or, if
38 * negative during registration, requests dynamic ID allocation.
39 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
40 * handled is (base + ngpio - 1).
41 * @desc: array of ngpio descriptors. Private.
42 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
43 * must while accessing GPIO expander chips over I2C or SPI
44 * @names: if set, must be an array of strings to use as alternative
45 * names for the GPIOs in this chip. Any entry in the array
46 * may be NULL if there is no alias for the GPIO, however the
47 * array must be @ngpio entries long. A name can include a single printk
48 * format specifier for an unsigned int. It is substituted by the actual
49 * number of the gpio.
50 *
51 * A gpio_chip can help platforms abstract various sources of GPIOs so
52 * they can all be accessed through a common programing interface.
53 * Example sources would be SOC controllers, FPGAs, multifunction
54 * chips, dedicated GPIO expanders, and so on.
55 *
56 * Each chip controls a number of signals, identified in method calls
57 * by "offset" values in the range 0..(@ngpio - 1). When those signals
58 * are referenced through calls like gpio_get_value(gpio), the offset
59 * is calculated by subtracting @base from the gpio number.
60 */
61struct gpio_chip {
62 const char *label;
63 struct device *dev;
64 struct module *owner;
65 struct list_head list;
66
67 int (*request)(struct gpio_chip *chip,
68 unsigned offset);
69 void (*free)(struct gpio_chip *chip,
70 unsigned offset);
71 int (*get_direction)(struct gpio_chip *chip,
72 unsigned offset);
73 int (*direction_input)(struct gpio_chip *chip,
74 unsigned offset);
75 int (*direction_output)(struct gpio_chip *chip,
76 unsigned offset, int value);
77 int (*get)(struct gpio_chip *chip,
78 unsigned offset);
79 void (*set)(struct gpio_chip *chip,
80 unsigned offset, int value);
81 int (*set_debounce)(struct gpio_chip *chip,
82 unsigned offset,
83 unsigned debounce);
84
85 int (*to_irq)(struct gpio_chip *chip,
86 unsigned offset);
87
88 void (*dbg_show)(struct seq_file *s,
89 struct gpio_chip *chip);
90 int base;
91 u16 ngpio;
92 struct gpio_desc *desc;
93 const char *const *names;
94 unsigned can_sleep:1;
95 unsigned exported:1;
96
97#if defined(CONFIG_OF_GPIO)
98 /*
99 * If CONFIG_OF is enabled, then all GPIO controllers described in the
100 * device tree automatically may have an OF translation
101 */
102 struct device_node *of_node;
103 int of_gpio_n_cells;
104 int (*of_xlate)(struct gpio_chip *gc,
105 const struct of_phandle_args *gpiospec, u32 *flags);
106#endif
107#ifdef CONFIG_PINCTRL
108 /*
109 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
110 * describe the actual pin range which they serve in an SoC. This
111 * information would be used by pinctrl subsystem to configure
112 * corresponding pins for gpio usage.
113 */
114 struct list_head pin_ranges;
115#endif
116};
117
118extern const char *gpiochip_is_requested(struct gpio_chip *chip,
119 unsigned offset);
120
121/* add/remove chips */
122extern int gpiochip_add(struct gpio_chip *chip);
123extern int __must_check gpiochip_remove(struct gpio_chip *chip);
124extern struct gpio_chip *gpiochip_find(void *data,
125 int (*match)(struct gpio_chip *chip, void *data));
126
127/* lock/unlock as IRQ */
128int gpiod_lock_as_irq(struct gpio_desc *desc);
129void gpiod_unlock_as_irq(struct gpio_desc *desc);
130
131enum gpio_lookup_flags {
132 GPIO_ACTIVE_HIGH = (0 << 0),
133 GPIO_ACTIVE_LOW = (1 << 0),
134 GPIO_OPEN_DRAIN = (1 << 1),
135 GPIO_OPEN_SOURCE = (1 << 2),
136};
137
138/**
139 * Lookup table for associating GPIOs to specific devices and functions using
140 * platform data.
141 */
142struct gpiod_lookup {
143 struct list_head list;
144 /*
145 * name of the chip the GPIO belongs to
146 */
147 const char *chip_label;
148 /*
149 * hardware number (i.e. relative to the chip) of the GPIO
150 */
151 u16 chip_hwnum;
152 /*
153 * name of device that can claim this GPIO
154 */
155 const char *dev_id;
156 /*
157 * name of the GPIO from the device's point of view
158 */
159 const char *con_id;
160 /*
161 * index of the GPIO in case several GPIOs share the same name
162 */
163 unsigned int idx;
164 /*
165 * mask of GPIO_* values
166 */
167 enum gpio_lookup_flags flags;
168};
169
170/*
171 * Simple definition of a single GPIO under a con_id
172 */
173#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _dev_id, _con_id, _flags) \
174 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, 0, _flags)
175
176/*
177 * Use this macro if you need to have several GPIOs under the same con_id.
178 * Each GPIO needs to use a different index and can be accessed using
179 * gpiod_get_index()
180 */
181#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, _idx, \
182 _flags) \
183{ \
184 .chip_label = _chip_label, \
185 .chip_hwnum = _chip_hwnum, \
186 .dev_id = _dev_id, \
187 .con_id = _con_id, \
188 .idx = _idx, \
189 .flags = _flags, \
190}
191
192void gpiod_add_table(struct gpiod_lookup *table, size_t size);
193
194#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index ccfe17c5c8da..d9cf963ac832 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -7,11 +7,7 @@
7#include <linux/vtime.h> 7#include <linux/vtime.h>
8 8
9 9
10#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
11extern void synchronize_irq(unsigned int irq); 10extern void synchronize_irq(unsigned int irq);
12#else
13# define synchronize_irq(irq) barrier()
14#endif
15 11
16#if defined(CONFIG_TINY_RCU) 12#if defined(CONFIG_TINY_RCU)
17 13
@@ -37,7 +33,7 @@ extern void rcu_nmi_exit(void);
37#define __irq_enter() \ 33#define __irq_enter() \
38 do { \ 34 do { \
39 account_irq_enter_time(current); \ 35 account_irq_enter_time(current); \
40 add_preempt_count(HARDIRQ_OFFSET); \ 36 preempt_count_add(HARDIRQ_OFFSET); \
41 trace_hardirq_enter(); \ 37 trace_hardirq_enter(); \
42 } while (0) 38 } while (0)
43 39
@@ -53,7 +49,7 @@ extern void irq_enter(void);
53 do { \ 49 do { \
54 trace_hardirq_exit(); \ 50 trace_hardirq_exit(); \
55 account_irq_exit_time(current); \ 51 account_irq_exit_time(current); \
56 sub_preempt_count(HARDIRQ_OFFSET); \ 52 preempt_count_sub(HARDIRQ_OFFSET); \
57 } while (0) 53 } while (0)
58 54
59/* 55/*
@@ -66,7 +62,7 @@ extern void irq_exit(void);
66 lockdep_off(); \ 62 lockdep_off(); \
67 ftrace_nmi_enter(); \ 63 ftrace_nmi_enter(); \
68 BUG_ON(in_nmi()); \ 64 BUG_ON(in_nmi()); \
69 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 65 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
70 rcu_nmi_enter(); \ 66 rcu_nmi_enter(); \
71 trace_hardirq_enter(); \ 67 trace_hardirq_enter(); \
72 } while (0) 68 } while (0)
@@ -76,7 +72,7 @@ extern void irq_exit(void);
76 trace_hardirq_exit(); \ 72 trace_hardirq_exit(); \
77 rcu_nmi_exit(); \ 73 rcu_nmi_exit(); \
78 BUG_ON(!in_nmi()); \ 74 BUG_ON(!in_nmi()); \
79 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 75 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
80 ftrace_nmi_exit(); \ 76 ftrace_nmi_exit(); \
81 lockdep_on(); \ 77 lockdep_on(); \
82 } while (0) 78 } while (0)
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index a9df51f5d54c..519b6e2d769e 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -174,6 +174,21 @@ static inline void hash_del_rcu(struct hlist_node *node)
174 member) 174 member)
175 175
176/** 176/**
177 * hash_for_each_possible_rcu_notrace - iterate over all possible objects hashing
178 * to the same bucket in an rcu enabled hashtable in a rcu enabled hashtable
179 * @name: hashtable to iterate
180 * @obj: the type * to use as a loop cursor for each entry
181 * @member: the name of the hlist_node within the struct
182 * @key: the key of the objects to iterate over
183 *
184 * This is the same as hash_for_each_possible_rcu() except that it does
185 * not do any RCU debugging or tracing.
186 */
187#define hash_for_each_possible_rcu_notrace(name, obj, member, key) \
188 hlist_for_each_entry_rcu_notrace(obj, \
189 &name[hash_min(key, HASH_BITS(name))], member)
190
191/**
177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 192 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
178 * same bucket safe against removals 193 * same bucket safe against removals
179 * @name: hashtable to iterate 194 * @name: hashtable to iterate
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 32ba45158d39..b914ca3f57ba 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -21,6 +21,8 @@
21 21
22#include <linux/hid.h> 22#include <linux/hid.h>
23#include <linux/hid-sensor-ids.h> 23#include <linux/hid-sensor-ids.h>
24#include <linux/iio/iio.h>
25#include <linux/iio/trigger.h>
24 26
25/** 27/**
26 * struct hid_sensor_hub_attribute_info - Attribute info 28 * struct hid_sensor_hub_attribute_info - Attribute info
@@ -40,6 +42,8 @@ struct hid_sensor_hub_attribute_info {
40 s32 units; 42 s32 units;
41 s32 unit_expo; 43 s32 unit_expo;
42 s32 size; 44 s32 size;
45 s32 logical_minimum;
46 s32 logical_maximum;
43}; 47};
44 48
45/** 49/**
@@ -47,11 +51,13 @@ struct hid_sensor_hub_attribute_info {
47 * @hdev: Stores the hid instance. 51 * @hdev: Stores the hid instance.
48 * @vendor_id: Vendor id of hub device. 52 * @vendor_id: Vendor id of hub device.
49 * @product_id: Product id of hub device. 53 * @product_id: Product id of hub device.
54 * @ref_cnt: Number of MFD clients have opened this device
50 */ 55 */
51struct hid_sensor_hub_device { 56struct hid_sensor_hub_device {
52 struct hid_device *hdev; 57 struct hid_device *hdev;
53 u32 vendor_id; 58 u32 vendor_id;
54 u32 product_id; 59 u32 product_id;
60 int ref_cnt;
55}; 61};
56 62
57/** 63/**
@@ -74,6 +80,22 @@ struct hid_sensor_hub_callbacks {
74 void *priv); 80 void *priv);
75}; 81};
76 82
83/**
84* sensor_hub_device_open() - Open hub device
85* @hsdev: Hub device instance.
86*
87* Used to open hid device for sensor hub.
88*/
89int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev);
90
91/**
92* sensor_hub_device_clode() - Close hub device
93* @hsdev: Hub device instance.
94*
95* Used to clode hid device for sensor hub.
96*/
97void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev);
98
77/* Registration functions */ 99/* Registration functions */
78 100
79/** 101/**
@@ -166,6 +188,7 @@ struct hid_sensor_common {
166 struct platform_device *pdev; 188 struct platform_device *pdev;
167 unsigned usage_id; 189 unsigned usage_id;
168 bool data_ready; 190 bool data_ready;
191 struct iio_trigger *trigger;
169 struct hid_sensor_hub_attribute_info poll; 192 struct hid_sensor_hub_attribute_info poll;
170 struct hid_sensor_hub_attribute_info report_state; 193 struct hid_sensor_hub_attribute_info report_state;
171 struct hid_sensor_hub_attribute_info power_state; 194 struct hid_sensor_hub_attribute_info power_state;
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 4f945d3ed49f..8323775ac21d 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -117,4 +117,16 @@
117#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316 117#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
118#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319 118#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
119 119
120/* Power state enumerations */
121#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00
122#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01
123#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02
124#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03
125#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04
126#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05
127
128/* Report State enumerations */
129#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00
130#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01
131
120#endif 132#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ee1ffc5e19c9..31b9d299ef6c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -756,6 +756,10 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
756struct hid_device *hid_allocate_device(void); 756struct hid_device *hid_allocate_device(void);
757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
759struct hid_report *hid_validate_values(struct hid_device *hid,
760 unsigned int type, unsigned int id,
761 unsigned int field_index,
762 unsigned int report_counts);
759int hid_open_report(struct hid_device *device); 763int hid_open_report(struct hid_device *device);
760int hid_check_keys_pressed(struct hid_device *hid); 764int hid_check_keys_pressed(struct hid_device *hid);
761int hid_connect(struct hid_device *hid, unsigned int connect_mask); 765int hid_connect(struct hid_device *hid, unsigned int connect_mask);
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index f148e4908410..8ec23fb0b412 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -31,11 +31,11 @@ struct hippi_cb {
31 __u32 ifield; 31 __u32 ifield;
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35extern int hippi_change_mtu(struct net_device *dev, int new_mtu); 35int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p); 36int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p); 37int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
38extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38struct net_device *alloc_hippi_dev(int sizeof_priv);
39#endif 39#endif
40 40
41#endif /* _LINUX_HIPPIDEVICE_H */ 41#endif /* _LINUX_HIPPIDEVICE_H */
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
new file mode 100644
index 000000000000..f5b9b87ac9a9
--- /dev/null
+++ b/include/linux/host1x.h
@@ -0,0 +1,284 @@
1/*
2 * Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __LINUX_HOST1X_H
20#define __LINUX_HOST1X_H
21
22#include <linux/device.h>
23#include <linux/types.h>
24
25enum host1x_class {
26 HOST1X_CLASS_HOST1X = 0x1,
27 HOST1X_CLASS_GR2D = 0x51,
28 HOST1X_CLASS_GR2D_SB = 0x52,
29 HOST1X_CLASS_GR3D = 0x60,
30};
31
32struct host1x_client;
33
34struct host1x_client_ops {
35 int (*init)(struct host1x_client *client);
36 int (*exit)(struct host1x_client *client);
37};
38
39struct host1x_client {
40 struct list_head list;
41 struct device *parent;
42 struct device *dev;
43
44 const struct host1x_client_ops *ops;
45
46 enum host1x_class class;
47 struct host1x_channel *channel;
48
49 struct host1x_syncpt **syncpts;
50 unsigned int num_syncpts;
51};
52
53/*
54 * host1x buffer objects
55 */
56
57struct host1x_bo;
58struct sg_table;
59
60struct host1x_bo_ops {
61 struct host1x_bo *(*get)(struct host1x_bo *bo);
62 void (*put)(struct host1x_bo *bo);
63 dma_addr_t (*pin)(struct host1x_bo *bo, struct sg_table **sgt);
64 void (*unpin)(struct host1x_bo *bo, struct sg_table *sgt);
65 void *(*mmap)(struct host1x_bo *bo);
66 void (*munmap)(struct host1x_bo *bo, void *addr);
67 void *(*kmap)(struct host1x_bo *bo, unsigned int pagenum);
68 void (*kunmap)(struct host1x_bo *bo, unsigned int pagenum, void *addr);
69};
70
71struct host1x_bo {
72 const struct host1x_bo_ops *ops;
73};
74
75static inline void host1x_bo_init(struct host1x_bo *bo,
76 const struct host1x_bo_ops *ops)
77{
78 bo->ops = ops;
79}
80
81static inline struct host1x_bo *host1x_bo_get(struct host1x_bo *bo)
82{
83 return bo->ops->get(bo);
84}
85
86static inline void host1x_bo_put(struct host1x_bo *bo)
87{
88 bo->ops->put(bo);
89}
90
91static inline dma_addr_t host1x_bo_pin(struct host1x_bo *bo,
92 struct sg_table **sgt)
93{
94 return bo->ops->pin(bo, sgt);
95}
96
97static inline void host1x_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt)
98{
99 bo->ops->unpin(bo, sgt);
100}
101
102static inline void *host1x_bo_mmap(struct host1x_bo *bo)
103{
104 return bo->ops->mmap(bo);
105}
106
107static inline void host1x_bo_munmap(struct host1x_bo *bo, void *addr)
108{
109 bo->ops->munmap(bo, addr);
110}
111
112static inline void *host1x_bo_kmap(struct host1x_bo *bo, unsigned int pagenum)
113{
114 return bo->ops->kmap(bo, pagenum);
115}
116
117static inline void host1x_bo_kunmap(struct host1x_bo *bo,
118 unsigned int pagenum, void *addr)
119{
120 bo->ops->kunmap(bo, pagenum, addr);
121}
122
123/*
124 * host1x syncpoints
125 */
126
127#define HOST1X_SYNCPT_CLIENT_MANAGED (1 << 0)
128#define HOST1X_SYNCPT_HAS_BASE (1 << 1)
129
130struct host1x_syncpt_base;
131struct host1x_syncpt;
132struct host1x;
133
134struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id);
135u32 host1x_syncpt_id(struct host1x_syncpt *sp);
136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
138int host1x_syncpt_incr(struct host1x_syncpt *sp);
139int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
140 u32 *value);
141struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
142 unsigned long flags);
143void host1x_syncpt_free(struct host1x_syncpt *sp);
144
145struct host1x_syncpt_base *host1x_syncpt_get_base(struct host1x_syncpt *sp);
146u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base);
147
148/*
149 * host1x channel
150 */
151
152struct host1x_channel;
153struct host1x_job;
154
155struct host1x_channel *host1x_channel_request(struct device *dev);
156void host1x_channel_free(struct host1x_channel *channel);
157struct host1x_channel *host1x_channel_get(struct host1x_channel *channel);
158void host1x_channel_put(struct host1x_channel *channel);
159int host1x_job_submit(struct host1x_job *job);
160
161/*
162 * host1x job
163 */
164
165struct host1x_reloc {
166 struct host1x_bo *cmdbuf;
167 u32 cmdbuf_offset;
168 struct host1x_bo *target;
169 u32 target_offset;
170 u32 shift;
171 u32 pad;
172};
173
174struct host1x_job {
175 /* When refcount goes to zero, job can be freed */
176 struct kref ref;
177
178 /* List entry */
179 struct list_head list;
180
181 /* Channel where job is submitted to */
182 struct host1x_channel *channel;
183
184 u32 client;
185
186 /* Gathers and their memory */
187 struct host1x_job_gather *gathers;
188 unsigned int num_gathers;
189
190 /* Wait checks to be processed at submit time */
191 struct host1x_waitchk *waitchk;
192 unsigned int num_waitchk;
193 u32 waitchk_mask;
194
195 /* Array of handles to be pinned & unpinned */
196 struct host1x_reloc *relocarray;
197 unsigned int num_relocs;
198 struct host1x_job_unpin_data *unpins;
199 unsigned int num_unpins;
200
201 dma_addr_t *addr_phys;
202 dma_addr_t *gather_addr_phys;
203 dma_addr_t *reloc_addr_phys;
204
205 /* Sync point id, number of increments and end related to the submit */
206 u32 syncpt_id;
207 u32 syncpt_incrs;
208 u32 syncpt_end;
209
210 /* Maximum time to wait for this job */
211 unsigned int timeout;
212
213 /* Index and number of slots used in the push buffer */
214 unsigned int first_get;
215 unsigned int num_slots;
216
217 /* Copy of gathers */
218 size_t gather_copy_size;
219 dma_addr_t gather_copy;
220 u8 *gather_copy_mapped;
221
222 /* Check if register is marked as an address reg */
223 int (*is_addr_reg)(struct device *dev, u32 reg, u32 class);
224
225 /* Request a SETCLASS to this class */
226 u32 class;
227
228 /* Add a channel wait for previous ops to complete */
229 bool serialize;
230};
231
232struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
233 u32 num_cmdbufs, u32 num_relocs,
234 u32 num_waitchks);
235void host1x_job_add_gather(struct host1x_job *job, struct host1x_bo *mem_id,
236 u32 words, u32 offset);
237struct host1x_job *host1x_job_get(struct host1x_job *job);
238void host1x_job_put(struct host1x_job *job);
239int host1x_job_pin(struct host1x_job *job, struct device *dev);
240void host1x_job_unpin(struct host1x_job *job);
241
242/*
243 * subdevice probe infrastructure
244 */
245
246struct host1x_device;
247
248struct host1x_driver {
249 const struct of_device_id *subdevs;
250 struct list_head list;
251 const char *name;
252
253 int (*probe)(struct host1x_device *device);
254 int (*remove)(struct host1x_device *device);
255};
256
257int host1x_driver_register(struct host1x_driver *driver);
258void host1x_driver_unregister(struct host1x_driver *driver);
259
260struct host1x_device {
261 struct host1x_driver *driver;
262 struct list_head list;
263 struct device dev;
264
265 struct mutex subdevs_lock;
266 struct list_head subdevs;
267 struct list_head active;
268
269 struct mutex clients_lock;
270 struct list_head clients;
271};
272
273static inline struct host1x_device *to_host1x_device(struct device *dev)
274{
275 return container_of(dev, struct host1x_device, dev);
276}
277
278int host1x_device_init(struct host1x_device *device);
279int host1x_device_exit(struct host1x_device *device);
280
281int host1x_client_register(struct host1x_client *client);
282int host1x_client_unregister(struct host1x_client *client);
283
284#endif
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b60de92e2edc..91672e2deec3 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -54,7 +54,8 @@ enum page_check_address_pmd_flag {
54extern pmd_t *page_check_address_pmd(struct page *page, 54extern pmd_t *page_check_address_pmd(struct page *page,
55 struct mm_struct *mm, 55 struct mm_struct *mm,
56 unsigned long address, 56 unsigned long address,
57 enum page_check_address_pmd_flag flag); 57 enum page_check_address_pmd_flag flag,
58 spinlock_t **ptl);
58 59
59#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) 60#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
60#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) 61#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
@@ -96,9 +97,6 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
96 pmd_t *dst_pmd, pmd_t *src_pmd, 97 pmd_t *dst_pmd, pmd_t *src_pmd,
97 struct vm_area_struct *vma, 98 struct vm_area_struct *vma,
98 unsigned long addr, unsigned long end); 99 unsigned long addr, unsigned long end);
99extern int handle_pte_fault(struct mm_struct *mm,
100 struct vm_area_struct *vma, unsigned long address,
101 pte_t *pte, pmd_t *pmd, unsigned int flags);
102extern int split_huge_page_to_list(struct page *page, struct list_head *list); 100extern int split_huge_page_to_list(struct page *page, struct list_head *list);
103static inline int split_huge_page(struct page *page) 101static inline int split_huge_page(struct page *page)
104{ 102{
@@ -132,15 +130,15 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma,
132 unsigned long start, 130 unsigned long start,
133 unsigned long end, 131 unsigned long end,
134 long adjust_next); 132 long adjust_next);
135extern int __pmd_trans_huge_lock(pmd_t *pmd, 133extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
136 struct vm_area_struct *vma); 134 spinlock_t **ptl);
137/* mmap_sem must be held on entry */ 135/* mmap_sem must be held on entry */
138static inline int pmd_trans_huge_lock(pmd_t *pmd, 136static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
139 struct vm_area_struct *vma) 137 spinlock_t **ptl)
140{ 138{
141 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 139 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem));
142 if (pmd_trans_huge(*pmd)) 140 if (pmd_trans_huge(*pmd))
143 return __pmd_trans_huge_lock(pmd, vma); 141 return __pmd_trans_huge_lock(pmd, vma, ptl);
144 else 142 else
145 return 0; 143 return 0;
146} 144}
@@ -218,8 +216,8 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
218 long adjust_next) 216 long adjust_next)
219{ 217{
220} 218}
221static inline int pmd_trans_huge_lock(pmd_t *pmd, 219static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
222 struct vm_area_struct *vma) 220 spinlock_t **ptl)
223{ 221{
224 return 0; 222 return 0;
225} 223}
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c2b1801a160b..bd7e98752222 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -31,6 +31,7 @@ struct hugepage_subpool *hugepage_new_subpool(long nr_blocks);
31void hugepage_put_subpool(struct hugepage_subpool *spool); 31void hugepage_put_subpool(struct hugepage_subpool *spool);
32 32
33int PageHuge(struct page *page); 33int PageHuge(struct page *page);
34int PageHeadHuge(struct page *page_head);
34 35
35void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 36void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
36int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 37int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -66,7 +67,9 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
66 vm_flags_t vm_flags); 67 vm_flags_t vm_flags);
67void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 68void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
68int dequeue_hwpoisoned_huge_page(struct page *page); 69int dequeue_hwpoisoned_huge_page(struct page *page);
69void copy_huge_page(struct page *dst, struct page *src); 70bool isolate_huge_page(struct page *page, struct list_head *list);
71void putback_active_hugepage(struct page *page);
72bool is_hugepage_active(struct page *page);
70 73
71#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 74#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
72pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); 75pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
@@ -101,6 +104,11 @@ static inline int PageHuge(struct page *page)
101 return 0; 104 return 0;
102} 105}
103 106
107static inline int PageHeadHuge(struct page *page_head)
108{
109 return 0;
110}
111
104static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 112static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
105{ 113{
106} 114}
@@ -134,9 +142,12 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
134 return 0; 142 return 0;
135} 143}
136 144
137static inline void copy_huge_page(struct page *dst, struct page *src) 145static inline bool isolate_huge_page(struct page *page, struct list_head *list)
138{ 146{
147 return false;
139} 148}
149#define putback_active_hugepage(p) do {} while (0)
150#define is_hugepage_active(x) false
140 151
141static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, 152static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
142 unsigned long address, unsigned long end, pgprot_t newprot) 153 unsigned long address, unsigned long end, pgprot_t newprot)
@@ -261,6 +272,8 @@ struct huge_bootmem_page {
261}; 272};
262 273
263struct page *alloc_huge_page_node(struct hstate *h, int nid); 274struct page *alloc_huge_page_node(struct hstate *h, int nid);
275struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
276 unsigned long addr, int avoid_reserve);
264 277
265/* arch callback */ 278/* arch callback */
266int __init alloc_bootmem_huge_page(struct hstate *h); 279int __init alloc_bootmem_huge_page(struct hstate *h);
@@ -371,14 +384,38 @@ static inline pgoff_t basepage_index(struct page *page)
371 return __basepage_index(page); 384 return __basepage_index(page);
372} 385}
373 386
387extern void dissolve_free_huge_pages(unsigned long start_pfn,
388 unsigned long end_pfn);
389int pmd_huge_support(void);
390/*
391 * Currently hugepage migration is enabled only for pmd-based hugepage.
392 * This function will be updated when hugepage migration is more widely
393 * supported.
394 */
395static inline int hugepage_migration_support(struct hstate *h)
396{
397 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
398}
399
400static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
401 struct mm_struct *mm, pte_t *pte)
402{
403 if (huge_page_size(h) == PMD_SIZE)
404 return pmd_lockptr(mm, (pmd_t *) pte);
405 VM_BUG_ON(huge_page_size(h) == PAGE_SIZE);
406 return &mm->page_table_lock;
407}
408
374#else /* CONFIG_HUGETLB_PAGE */ 409#else /* CONFIG_HUGETLB_PAGE */
375struct hstate {}; 410struct hstate {};
376#define alloc_huge_page_node(h, nid) NULL 411#define alloc_huge_page_node(h, nid) NULL
412#define alloc_huge_page_noerr(v, a, r) NULL
377#define alloc_bootmem_huge_page(h) NULL 413#define alloc_bootmem_huge_page(h) NULL
378#define hstate_file(f) NULL 414#define hstate_file(f) NULL
379#define hstate_sizelog(s) NULL 415#define hstate_sizelog(s) NULL
380#define hstate_vma(v) NULL 416#define hstate_vma(v) NULL
381#define hstate_inode(i) NULL 417#define hstate_inode(i) NULL
418#define page_hstate(page) NULL
382#define huge_page_size(h) PAGE_SIZE 419#define huge_page_size(h) PAGE_SIZE
383#define huge_page_mask(h) PAGE_MASK 420#define huge_page_mask(h) PAGE_MASK
384#define vma_kernel_pagesize(v) PAGE_SIZE 421#define vma_kernel_pagesize(v) PAGE_SIZE
@@ -396,6 +433,25 @@ static inline pgoff_t basepage_index(struct page *page)
396{ 433{
397 return page->index; 434 return page->index;
398} 435}
436#define dissolve_free_huge_pages(s, e) do {} while (0)
437#define pmd_huge_support() 0
438#define hugepage_migration_support(h) 0
439
440static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
441 struct mm_struct *mm, pte_t *pte)
442{
443 return &mm->page_table_lock;
444}
399#endif /* CONFIG_HUGETLB_PAGE */ 445#endif /* CONFIG_HUGETLB_PAGE */
400 446
447static inline spinlock_t *huge_pte_lock(struct hstate *h,
448 struct mm_struct *mm, pte_t *pte)
449{
450 spinlock_t *ptl;
451
452 ptl = huge_pte_lockptr(h, mm, pte);
453 spin_lock(ptl);
454 return ptl;
455}
456
401#endif /* _LINUX_HUGETLB_H */ 457#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index f346e4d5381c..da0a680e2f6d 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -38,7 +38,7 @@ static inline int vid_to_reg(int val, u8 vrm)
38 return ((val >= 1100) && (val <= 1850) ? 38 return ((val >= 1100) && (val <= 1850) ?
39 ((18499 - val * 10) / 25 + 5) / 10 : -1); 39 ((18499 - val * 10) / 25 + 5) / 10 : -1);
40 default: 40 default:
41 return -1; 41 return -EINVAL;
42 } 42 }
43} 43}
44 44
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index b2514f70d591..09354f6c1d63 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -15,9 +15,19 @@
15#define _HWMON_H_ 15#define _HWMON_H_
16 16
17struct device; 17struct device;
18struct attribute_group;
18 19
19struct device *hwmon_device_register(struct device *dev); 20struct device *hwmon_device_register(struct device *dev);
21struct device *
22hwmon_device_register_with_groups(struct device *dev, const char *name,
23 void *drvdata,
24 const struct attribute_group **groups);
25struct device *
26devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
27 void *drvdata,
28 const struct attribute_group **groups);
20 29
21void hwmon_device_unregister(struct device *dev); 30void hwmon_device_unregister(struct device *dev);
31void devm_hwmon_device_unregister(struct device *dev);
22 32
23#endif 33#endif
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a3b8b2e2d244..15da677478dd 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -30,10 +30,13 @@
30/* 30/*
31 * Framework version for util services. 31 * Framework version for util services.
32 */ 32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
33 37
34#define UTIL_FW_MAJOR 3 38#define UTIL_FW_MAJOR 3
35#define UTIL_FW_MINOR 0 39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
36#define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
37 40
38 41
39/* 42/*
@@ -429,15 +432,6 @@ struct hv_ring_buffer_info {
429 u32 ring_data_startoffset; 432 u32 ring_data_startoffset;
430}; 433};
431 434
432struct hv_ring_buffer_debug_info {
433 u32 current_interrupt_mask;
434 u32 current_read_index;
435 u32 current_write_index;
436 u32 bytes_avail_toread;
437 u32 bytes_avail_towrite;
438};
439
440
441/* 435/*
442 * 436 *
443 * hv_get_ringbuffer_availbytes() 437 * hv_get_ringbuffer_availbytes()
@@ -899,23 +893,6 @@ enum vmbus_channel_state {
899 CHANNEL_OPENED_STATE, 893 CHANNEL_OPENED_STATE,
900}; 894};
901 895
902struct vmbus_channel_debug_info {
903 u32 relid;
904 enum vmbus_channel_state state;
905 uuid_le interfacetype;
906 uuid_le interface_instance;
907 u32 monitorid;
908 u32 servermonitor_pending;
909 u32 servermonitor_latency;
910 u32 servermonitor_connectionid;
911 u32 clientmonitor_pending;
912 u32 clientmonitor_latency;
913 u32 clientmonitor_connectionid;
914
915 struct hv_ring_buffer_debug_info inbound;
916 struct hv_ring_buffer_debug_info outbound;
917};
918
919/* 896/*
920 * Represents each channel msg on the vmbus connection This is a 897 * Represents each channel msg on the vmbus connection This is a
921 * variable-size data structure depending on the msg type itself 898 * variable-size data structure depending on the msg type itself
@@ -1181,19 +1158,8 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
1181 u64 *requestid); 1158 u64 *requestid);
1182 1159
1183 1160
1184extern void vmbus_get_debug_info(struct vmbus_channel *channel,
1185 struct vmbus_channel_debug_info *debug);
1186
1187extern void vmbus_ontimer(unsigned long data); 1161extern void vmbus_ontimer(unsigned long data);
1188 1162
1189struct hv_dev_port_info {
1190 u32 int_mask;
1191 u32 read_idx;
1192 u32 write_idx;
1193 u32 bytes_avail_toread;
1194 u32 bytes_avail_towrite;
1195};
1196
1197/* Base driver object */ 1163/* Base driver object */
1198struct hv_driver { 1164struct hv_driver {
1199 const char *name; 1165 const char *name;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2ab11dc38077..eff50e062be8 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -205,7 +205,6 @@ struct i2c_driver {
205 * @name: Indicates the type of the device, usually a chip name that's 205 * @name: Indicates the type of the device, usually a chip name that's
206 * generic enough to hide second-sourcing and compatible revisions. 206 * generic enough to hide second-sourcing and compatible revisions.
207 * @adapter: manages the bus segment hosting this I2C device 207 * @adapter: manages the bus segment hosting this I2C device
208 * @driver: device's driver, hence pointer to access routines
209 * @dev: Driver model device node for the slave. 208 * @dev: Driver model device node for the slave.
210 * @irq: indicates the IRQ generated by this device (if any) 209 * @irq: indicates the IRQ generated by this device (if any)
211 * @detected: member of an i2c_driver.clients list or i2c-core's 210 * @detected: member of an i2c_driver.clients list or i2c-core's
@@ -222,7 +221,6 @@ struct i2c_client {
222 /* _LOWER_ 7 bits */ 221 /* _LOWER_ 7 bits */
223 char name[I2C_NAME_SIZE]; 222 char name[I2C_NAME_SIZE];
224 struct i2c_adapter *adapter; /* the adapter we sit on */ 223 struct i2c_adapter *adapter; /* the adapter we sit on */
225 struct i2c_driver *driver; /* and our access routines */
226 struct device dev; /* the device structure */ 224 struct device dev; /* the device structure */
227 int irq; /* irq issued by device */ 225 int irq; /* irq issued by device */
228 struct list_head detected; 226 struct list_head detected;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 81cbbdb96aae..673a3ce67f31 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -26,6 +26,7 @@
26#define __TWL_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/phy/phy.h>
29#include <linux/input/matrix_keypad.h> 30#include <linux/input/matrix_keypad.h>
30 31
31/* 32/*
@@ -615,6 +616,7 @@ enum twl4030_usb_mode {
615struct twl4030_usb_data { 616struct twl4030_usb_data {
616 enum twl4030_usb_mode usb_mode; 617 enum twl4030_usb_mode usb_mode;
617 unsigned long features; 618 unsigned long features;
619 struct phy_init_data *init_data;
618 620
619 int (*phy_init)(struct device *dev); 621 int (*phy_init)(struct device *dev);
620 int (*phy_exit)(struct device *dev); 622 int (*phy_exit)(struct device *dev);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index a986ff588944..0f9bafa17a02 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -31,6 +31,30 @@
31#define I8042_CMD_MUX_PFX 0x0090 31#define I8042_CMD_MUX_PFX 0x0090
32#define I8042_CMD_MUX_SEND 0x1090 32#define I8042_CMD_MUX_SEND 0x1090
33 33
34/*
35 * Status register bits.
36 */
37
38#define I8042_STR_PARITY 0x80
39#define I8042_STR_TIMEOUT 0x40
40#define I8042_STR_AUXDATA 0x20
41#define I8042_STR_KEYLOCK 0x10
42#define I8042_STR_CMDDAT 0x08
43#define I8042_STR_MUXERR 0x04
44#define I8042_STR_IBF 0x02
45#define I8042_STR_OBF 0x01
46
47/*
48 * Control register bits.
49 */
50
51#define I8042_CTR_KBDINT 0x01
52#define I8042_CTR_AUXINT 0x02
53#define I8042_CTR_IGNKEYLOCK 0x08
54#define I8042_CTR_KBDDIS 0x10
55#define I8042_CTR_AUXDIS 0x20
56#define I8042_CTR_XLATE 0x40
57
34struct serio; 58struct serio;
35 59
36#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE) 60#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b17974917dbf..46a14229a162 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1514,7 +1514,7 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1514 1514
1515char *ide_media_string(ide_drive_t *); 1515char *ide_media_string(ide_drive_t *);
1516 1516
1517extern struct device_attribute ide_dev_attrs[]; 1517extern const struct attribute_group *ide_dev_groups[];
1518extern struct bus_type ide_bus_type; 1518extern struct bus_type ide_bus_type;
1519extern struct class *ide_port_class; 1519extern struct class *ide_port_class;
1520 1520
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a5b598a79bec..8c3b26a21574 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -697,6 +697,18 @@ struct ieee80211_sec_chan_offs_ie {
697} __packed; 697} __packed;
698 698
699/** 699/**
700 * struct ieee80211_mesh_chansw_params_ie - mesh channel switch parameters IE
701 *
702 * This structure represents the "Mesh Channel Switch Paramters element"
703 */
704struct ieee80211_mesh_chansw_params_ie {
705 u8 mesh_ttl;
706 u8 mesh_flags;
707 __le16 mesh_reason;
708 __le16 mesh_pre_value;
709} __packed;
710
711/**
700 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE 712 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE
701 */ 713 */
702struct ieee80211_wide_bw_chansw_ie { 714struct ieee80211_wide_bw_chansw_ie {
@@ -751,6 +763,14 @@ enum mesh_config_capab_flags {
751}; 763};
752 764
753/** 765/**
766 * mesh channel switch parameters element's flag indicator
767 *
768 */
769#define WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT BIT(0)
770#define WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR BIT(1)
771#define WLAN_EID_CHAN_SWITCH_PARAM_REASON BIT(2)
772
773/**
754 * struct ieee80211_rann_ie 774 * struct ieee80211_rann_ie
755 * 775 *
756 * This structure refers to "Root Announcement information element" 776 * This structure refers to "Root Announcement information element"
@@ -1391,8 +1411,8 @@ struct ieee80211_vht_operation {
1391#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 1411#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
1392#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1412#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1393#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1413#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1394#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1414#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MAX 0x0000e000
1395#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000 1415#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00070000
1396#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1416#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1397#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1417#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1398#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1418#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index ddd33fd5904d..84ba5ac39e03 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -61,6 +61,7 @@ struct macvlan_dev {
61 struct hlist_node hlist; 61 struct hlist_node hlist;
62 struct macvlan_port *port; 62 struct macvlan_port *port;
63 struct net_device *lowerdev; 63 struct net_device *lowerdev;
64 void *fwd_priv;
64 struct macvlan_pcpu_stats __percpu *pcpu_stats; 65 struct macvlan_pcpu_stats __percpu *pcpu_stats;
65 66
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 67 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
@@ -118,4 +119,21 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
118extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, 119extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
119 struct net_device *dev); 120 struct net_device *dev);
120 121
122#if IS_ENABLED(CONFIG_MACVLAN)
123static inline struct net_device *
124macvlan_dev_real_dev(const struct net_device *dev)
125{
126 struct macvlan_dev *macvlan = netdev_priv(dev);
127
128 return macvlan->lowerdev;
129}
130#else
131static inline struct net_device *
132macvlan_dev_real_dev(const struct net_device *dev)
133{
134 BUG();
135 return NULL;
136}
137#endif
138
121#endif /* _LINUX_IF_MACVLAN_H */ 139#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 715c343f7c00..f252deb99454 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -89,6 +89,101 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
89extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 89extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
90extern u16 vlan_dev_vlan_id(const struct net_device *dev); 90extern u16 vlan_dev_vlan_id(const struct net_device *dev);
91 91
92/**
93 * struct vlan_priority_tci_mapping - vlan egress priority mappings
94 * @priority: skb priority
95 * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
96 * @next: pointer to next struct
97 */
98struct vlan_priority_tci_mapping {
99 u32 priority;
100 u16 vlan_qos;
101 struct vlan_priority_tci_mapping *next;
102};
103
104/**
105 * struct vlan_pcpu_stats - VLAN percpu rx/tx stats
106 * @rx_packets: number of received packets
107 * @rx_bytes: number of received bytes
108 * @rx_multicast: number of received multicast packets
109 * @tx_packets: number of transmitted packets
110 * @tx_bytes: number of transmitted bytes
111 * @syncp: synchronization point for 64bit counters
112 * @rx_errors: number of rx errors
113 * @tx_dropped: number of tx drops
114 */
115struct vlan_pcpu_stats {
116 u64 rx_packets;
117 u64 rx_bytes;
118 u64 rx_multicast;
119 u64 tx_packets;
120 u64 tx_bytes;
121 struct u64_stats_sync syncp;
122 u32 rx_errors;
123 u32 tx_dropped;
124};
125
126struct proc_dir_entry;
127struct netpoll;
128
129/**
130 * struct vlan_dev_priv - VLAN private device data
131 * @nr_ingress_mappings: number of ingress priority mappings
132 * @ingress_priority_map: ingress priority mappings
133 * @nr_egress_mappings: number of egress priority mappings
134 * @egress_priority_map: hash of egress priority mappings
135 * @vlan_proto: VLAN encapsulation protocol
136 * @vlan_id: VLAN identifier
137 * @flags: device flags
138 * @real_dev: underlying netdevice
139 * @real_dev_addr: address of underlying netdevice
140 * @dent: proc dir entry
141 * @vlan_pcpu_stats: ptr to percpu rx stats
142 */
143struct vlan_dev_priv {
144 unsigned int nr_ingress_mappings;
145 u32 ingress_priority_map[8];
146 unsigned int nr_egress_mappings;
147 struct vlan_priority_tci_mapping *egress_priority_map[16];
148
149 __be16 vlan_proto;
150 u16 vlan_id;
151 u16 flags;
152
153 struct net_device *real_dev;
154 unsigned char real_dev_addr[ETH_ALEN];
155
156 struct proc_dir_entry *dent;
157 struct vlan_pcpu_stats __percpu *vlan_pcpu_stats;
158#ifdef CONFIG_NET_POLL_CONTROLLER
159 struct netpoll *netpoll;
160#endif
161};
162
163static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
164{
165 return netdev_priv(dev);
166}
167
168static inline u16
169vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
170{
171 struct vlan_priority_tci_mapping *mp;
172
173 smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */
174
175 mp = vlan_dev_priv(dev)->egress_priority_map[(skprio & 0xF)];
176 while (mp) {
177 if (mp->priority == skprio) {
178 return mp->vlan_qos; /* This should already be shifted
179 * to mask correctly with the
180 * VLAN's TCI */
181 }
182 mp = mp->next;
183 }
184 return 0;
185}
186
92extern bool vlan_do_receive(struct sk_buff **skb); 187extern bool vlan_do_receive(struct sk_buff **skb);
93extern struct sk_buff *vlan_untag(struct sk_buff *skb); 188extern struct sk_buff *vlan_untag(struct sk_buff *skb);
94 189
@@ -121,6 +216,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
121 return 0; 216 return 0;
122} 217}
123 218
219static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
220 u32 skprio)
221{
222 return 0;
223}
224
124static inline bool vlan_do_receive(struct sk_buff **skb) 225static inline bool vlan_do_receive(struct sk_buff **skb)
125{ 226{
126 return false; 227 return false;
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 2bac0eb8948d..15607b45221a 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -11,6 +11,7 @@
11#define _IIO_BUFFER_GENERIC_H_ 11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h> 12#include <linux/sysfs.h>
13#include <linux/iio/iio.h> 13#include <linux/iio/iio.h>
14#include <linux/kref.h>
14 15
15#ifdef CONFIG_IIO_BUFFER 16#ifdef CONFIG_IIO_BUFFER
16 17
@@ -26,6 +27,8 @@ struct iio_buffer;
26 * @set_bytes_per_datum:set number of bytes per datum 27 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer 28 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer 29 * @set_length: set number of datums in buffer
30 * @release: called when the last reference to the buffer is dropped,
31 * should free all resources allocated by the buffer.
29 * 32 *
30 * The purpose of this structure is to make the buffer element 33 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require 34 * modular as event for a given driver, different usecases may require
@@ -36,7 +39,7 @@ struct iio_buffer;
36 * any of them not existing. 39 * any of them not existing.
37 **/ 40 **/
38struct iio_buffer_access_funcs { 41struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data); 42 int (*store_to)(struct iio_buffer *buffer, const void *data);
40 int (*read_first_n)(struct iio_buffer *buffer, 43 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n, 44 size_t n,
42 char __user *buf); 45 char __user *buf);
@@ -47,6 +50,8 @@ struct iio_buffer_access_funcs {
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); 50 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer); 51 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length); 52 int (*set_length)(struct iio_buffer *buffer, int length);
53
54 void (*release)(struct iio_buffer *buffer);
50}; 55};
51 56
52/** 57/**
@@ -67,6 +72,7 @@ struct iio_buffer_access_funcs {
67 * @demux_list: [INTERN] list of operations required to demux the scan. 72 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 73 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 * @buffer_list: [INTERN] entry in the devices list of current buffers. 74 * @buffer_list: [INTERN] entry in the devices list of current buffers.
75 * @ref: [INTERN] reference count of the buffer.
70 */ 76 */
71struct iio_buffer { 77struct iio_buffer {
72 int length; 78 int length;
@@ -81,8 +87,9 @@ struct iio_buffer {
81 bool stufftoread; 87 bool stufftoread;
82 const struct attribute_group *attrs; 88 const struct attribute_group *attrs;
83 struct list_head demux_list; 89 struct list_head demux_list;
84 unsigned char *demux_bounce; 90 void *demux_bounce;
85 struct list_head buffer_list; 91 struct list_head buffer_list;
92 struct kref ref;
86}; 93};
87 94
88/** 95/**
@@ -120,7 +127,32 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
120 * @indio_dev: iio_dev structure for device. 127 * @indio_dev: iio_dev structure for device.
121 * @data: Full scan. 128 * @data: Full scan.
122 */ 129 */
123int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data); 130int iio_push_to_buffers(struct iio_dev *indio_dev, const void *data);
131
132/*
133 * iio_push_to_buffers_with_timestamp() - push data and timestamp to buffers
134 * @indio_dev: iio_dev structure for device.
135 * @data: sample data
136 * @timestamp: timestamp for the sample data
137 *
138 * Pushes data to the IIO device's buffers. If timestamps are enabled for the
139 * device the function will store the supplied timestamp as the last element in
140 * the sample data buffer before pushing it to the device buffers. The sample
141 * data buffer needs to be large enough to hold the additional timestamp
142 * (usually the buffer should be indio->scan_bytes bytes large).
143 *
144 * Returns 0 on success, a negative error code otherwise.
145 */
146static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
147 void *data, int64_t timestamp)
148{
149 if (indio_dev->scan_timestamp) {
150 size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
151 ((int64_t *)data)[ts_offset] = timestamp;
152 }
153
154 return iio_push_to_buffers(indio_dev, data);
155}
124 156
125int iio_update_demux(struct iio_dev *indio_dev); 157int iio_update_demux(struct iio_dev *indio_dev);
126 158
@@ -174,11 +206,27 @@ ssize_t iio_buffer_show_enable(struct device *dev,
174 iio_buffer_show_enable, \ 206 iio_buffer_show_enable, \
175 iio_buffer_store_enable) 207 iio_buffer_store_enable)
176 208
177int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
178
179bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, 209bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
180 const unsigned long *mask); 210 const unsigned long *mask);
181 211
212struct iio_buffer *iio_buffer_get(struct iio_buffer *buffer);
213void iio_buffer_put(struct iio_buffer *buffer);
214
215/**
216 * iio_device_attach_buffer - Attach a buffer to a IIO device
217 * @indio_dev: The device the buffer should be attached to
218 * @buffer: The buffer to attach to the device
219 *
220 * This function attaches a buffer to a IIO device. The buffer stays attached to
221 * the device until the device is freed. The function should only be called at
222 * most once per device.
223 */
224static inline void iio_device_attach_buffer(struct iio_dev *indio_dev,
225 struct iio_buffer *buffer)
226{
227 indio_dev->buffer = iio_buffer_get(buffer);
228}
229
182#else /* CONFIG_IIO_BUFFER */ 230#else /* CONFIG_IIO_BUFFER */
183 231
184static inline int iio_buffer_register(struct iio_dev *indio_dev, 232static inline int iio_buffer_register(struct iio_dev *indio_dev,
@@ -191,6 +239,9 @@ static inline int iio_buffer_register(struct iio_dev *indio_dev,
191static inline void iio_buffer_unregister(struct iio_dev *indio_dev) 239static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
192{} 240{}
193 241
242static inline void iio_buffer_get(struct iio_buffer *buffer) {}
243static inline void iio_buffer_put(struct iio_buffer *buffer) {}
244
194#endif /* CONFIG_IIO_BUFFER */ 245#endif /* CONFIG_IIO_BUFFER */
195 246
196#endif /* _IIO_BUFFER_GENERIC_H_ */ 247#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e51f65480ea5..3c005eb3a0a4 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -16,6 +16,7 @@
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/regulator/consumer.h>
19 20
20#include <linux/platform_data/st_sensors_pdata.h> 21#include <linux/platform_data/st_sensors_pdata.h>
21 22
@@ -184,6 +185,7 @@ struct st_sensors {
184 u8 wai; 185 u8 wai;
185 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; 186 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
186 struct iio_chan_spec *ch; 187 struct iio_chan_spec *ch;
188 int num_ch;
187 struct st_sensor_odr odr; 189 struct st_sensor_odr odr;
188 struct st_sensor_power pw; 190 struct st_sensor_power pw;
189 struct st_sensor_axis enable_axis; 191 struct st_sensor_axis enable_axis;
@@ -200,6 +202,8 @@ struct st_sensors {
200 * @trig: The trigger in use by the core driver. 202 * @trig: The trigger in use by the core driver.
201 * @sensor: Pointer to the current sensor struct in use. 203 * @sensor: Pointer to the current sensor struct in use.
202 * @current_fullscale: Maximum range of measure by the sensor. 204 * @current_fullscale: Maximum range of measure by the sensor.
205 * @vdd: Pointer to sensor's Vdd power supply
206 * @vdd_io: Pointer to sensor's Vdd-IO power supply
203 * @enabled: Status of the sensor (false->off, true->on). 207 * @enabled: Status of the sensor (false->off, true->on).
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 208 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 209 * @buffer_data: Data used by buffer part.
@@ -215,6 +219,8 @@ struct st_sensor_data {
215 struct iio_trigger *trig; 219 struct iio_trigger *trig;
216 struct st_sensors *sensor; 220 struct st_sensors *sensor;
217 struct st_sensor_fullscale_avl *current_fullscale; 221 struct st_sensor_fullscale_avl *current_fullscale;
222 struct regulator *vdd;
223 struct regulator *vdd_io;
218 224
219 bool enabled; 225 bool enabled;
220 bool multiread_bit; 226 bool multiread_bit;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 833926c91aa8..2752b1fd12be 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -77,7 +77,7 @@ struct iio_cb_buffer;
77 * fail. 77 * fail.
78 */ 78 */
79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, 79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
80 int (*cb)(u8 *data, 80 int (*cb)(const void *data,
81 void *private), 81 void *private),
82 void *private); 82 void *private);
83/** 83/**
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 13ce220c7003..5dab2c41031f 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -26,20 +26,6 @@ struct iio_event_data {
26 26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) 27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/** 29/**
44 * IIO_EVENT_CODE() - create event identifier 30 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type. 31 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 2103cc32a5fb..256a90a1bea6 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -36,6 +36,14 @@ enum iio_chan_info_enum {
36 IIO_CHAN_INFO_PHASE, 36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN, 37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS, 38 IIO_CHAN_INFO_HYSTERESIS,
39 IIO_CHAN_INFO_INT_TIME,
40};
41
42enum iio_shared_by {
43 IIO_SEPARATE,
44 IIO_SHARED_BY_TYPE,
45 IIO_SHARED_BY_DIR,
46 IIO_SHARED_BY_ALL
39}; 47};
40 48
41enum iio_endian { 49enum iio_endian {
@@ -57,7 +65,7 @@ struct iio_dev;
57 */ 65 */
58struct iio_chan_spec_ext_info { 66struct iio_chan_spec_ext_info {
59 const char *name; 67 const char *name;
60 bool shared; 68 enum iio_shared_by shared;
61 ssize_t (*read)(struct iio_dev *, uintptr_t private, 69 ssize_t (*read)(struct iio_dev *, uintptr_t private,
62 struct iio_chan_spec const *, char *buf); 70 struct iio_chan_spec const *, char *buf);
63 ssize_t (*write)(struct iio_dev *, uintptr_t private, 71 ssize_t (*write)(struct iio_dev *, uintptr_t private,
@@ -125,12 +133,35 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
125#define IIO_ENUM_AVAILABLE(_name, _e) \ 133#define IIO_ENUM_AVAILABLE(_name, _e) \
126{ \ 134{ \
127 .name = (_name "_available"), \ 135 .name = (_name "_available"), \
128 .shared = true, \ 136 .shared = IIO_SHARED_BY_TYPE, \
129 .read = iio_enum_available_read, \ 137 .read = iio_enum_available_read, \
130 .private = (uintptr_t)(_e), \ 138 .private = (uintptr_t)(_e), \
131} 139}
132 140
133/** 141/**
142 * struct iio_event_spec - specification for a channel event
143 * @type: Type of the event
144 * @dir: Direction of the event
145 * @mask_separate: Bit mask of enum iio_event_info values. Attributes
146 * set in this mask will be registered per channel.
147 * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes
148 * set in this mask will be shared by channel type.
149 * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes
150 * set in this mask will be shared by channel type and
151 * direction.
152 * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes
153 * set in this mask will be shared by all channels.
154 */
155struct iio_event_spec {
156 enum iio_event_type type;
157 enum iio_event_direction dir;
158 unsigned long mask_separate;
159 unsigned long mask_shared_by_type;
160 unsigned long mask_shared_by_dir;
161 unsigned long mask_shared_by_all;
162};
163
164/**
134 * struct iio_chan_spec - specification of a single channel 165 * struct iio_chan_spec - specification of a single channel
135 * @type: What type of measurement is the channel making. 166 * @type: What type of measurement is the channel making.
136 * @channel: What number do we wish to assign the channel. 167 * @channel: What number do we wish to assign the channel.
@@ -146,13 +177,18 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
146 * shift: Shift right by this before masking out 177 * shift: Shift right by this before masking out
147 * realbits. 178 * realbits.
148 * endianness: little or big endian 179 * endianness: little or big endian
149 * @info_mask: What information is to be exported about this channel.
150 * This includes calibbias, scale etc.
151 * @info_mask_separate: What information is to be exported that is specific to 180 * @info_mask_separate: What information is to be exported that is specific to
152 * this channel. 181 * this channel.
153 * @info_mask_shared_by_type: What information is to be exported that is shared 182 * @info_mask_shared_by_type: What information is to be exported that is shared
154* by all channels of the same type. 183 * by all channels of the same type.
184 * @info_mask_shared_by_dir: What information is to be exported that is shared
185 * by all channels of the same direction.
186 * @info_mask_shared_by_all: What information is to be exported that is shared
187 * by all channels.
155 * @event_mask: What events can this channel produce. 188 * @event_mask: What events can this channel produce.
189 * @event_spec: Array of events which should be registered for this
190 * channel.
191 * @num_event_specs: Size of the event_spec array.
156 * @ext_info: Array of extended info attributes for this channel. 192 * @ext_info: Array of extended info attributes for this channel.
157 * The array is NULL terminated, the last element should 193 * The array is NULL terminated, the last element should
158 * have its name field set to NULL. 194 * have its name field set to NULL.
@@ -186,10 +222,13 @@ struct iio_chan_spec {
186 u8 shift; 222 u8 shift;
187 enum iio_endian endianness; 223 enum iio_endian endianness;
188 } scan_type; 224 } scan_type;
189 long info_mask;
190 long info_mask_separate; 225 long info_mask_separate;
191 long info_mask_shared_by_type; 226 long info_mask_shared_by_type;
227 long info_mask_shared_by_dir;
228 long info_mask_shared_by_all;
192 long event_mask; 229 long event_mask;
230 const struct iio_event_spec *event_spec;
231 unsigned int num_event_specs;
193 const struct iio_chan_spec_ext_info *ext_info; 232 const struct iio_chan_spec_ext_info *ext_info;
194 const char *extend_name; 233 const char *extend_name;
195 const char *datasheet_name; 234 const char *datasheet_name;
@@ -212,7 +251,9 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 251 enum iio_chan_info_enum type)
213{ 252{
214 return (chan->info_mask_separate & BIT(type)) | 253 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & BIT(type)); 254 (chan->info_mask_shared_by_type & BIT(type)) |
255 (chan->info_mask_shared_by_dir & BIT(type)) |
256 (chan->info_mask_shared_by_all & BIT(type));
216} 257}
217 258
218#define IIO_ST(si, rb, sb, sh) \ 259#define IIO_ST(si, rb, sb, sh) \
@@ -270,6 +311,12 @@ struct iio_dev;
270 * is event dependant. event_code specifies which event. 311 * is event dependant. event_code specifies which event.
271 * @write_event_value: write the value associated with the event. 312 * @write_event_value: write the value associated with the event.
272 * Meaning is event dependent. 313 * Meaning is event dependent.
314 * @read_event_config_new: find out if the event is enabled. New style interface.
315 * @write_event_config_new: set if the event is enabled. New style interface.
316 * @read_event_value_new: read a configuration value associated with the event.
317 * New style interface.
318 * @write_event_value_new: write a configuration value for the event. New style
319 * interface.
273 * @validate_trigger: function to validate the trigger when the 320 * @validate_trigger: function to validate the trigger when the
274 * current trigger gets changed. 321 * current trigger gets changed.
275 * @update_scan_mode: function to configure device and scan buffer when 322 * @update_scan_mode: function to configure device and scan buffer when
@@ -310,6 +357,30 @@ struct iio_info {
310 int (*write_event_value)(struct iio_dev *indio_dev, 357 int (*write_event_value)(struct iio_dev *indio_dev,
311 u64 event_code, 358 u64 event_code,
312 int val); 359 int val);
360
361 int (*read_event_config_new)(struct iio_dev *indio_dev,
362 const struct iio_chan_spec *chan,
363 enum iio_event_type type,
364 enum iio_event_direction dir);
365
366 int (*write_event_config_new)(struct iio_dev *indio_dev,
367 const struct iio_chan_spec *chan,
368 enum iio_event_type type,
369 enum iio_event_direction dir,
370 int state);
371
372 int (*read_event_value_new)(struct iio_dev *indio_dev,
373 const struct iio_chan_spec *chan,
374 enum iio_event_type type,
375 enum iio_event_direction dir,
376 enum iio_event_info info, int *val, int *val2);
377
378 int (*write_event_value_new)(struct iio_dev *indio_dev,
379 const struct iio_chan_spec *chan,
380 enum iio_event_type type,
381 enum iio_event_direction dir,
382 enum iio_event_info info, int val, int val2);
383
313 int (*validate_trigger)(struct iio_dev *indio_dev, 384 int (*validate_trigger)(struct iio_dev *indio_dev,
314 struct iio_trigger *trig); 385 struct iio_trigger *trig);
315 int (*update_scan_mode)(struct iio_dev *indio_dev, 386 int (*update_scan_mode)(struct iio_dev *indio_dev,
@@ -457,7 +528,7 @@ static inline void iio_device_put(struct iio_dev *indio_dev)
457{ 528{
458 if (indio_dev) 529 if (indio_dev)
459 put_device(&indio_dev->dev); 530 put_device(&indio_dev->dev);
460}; 531}
461 532
462/** 533/**
463 * dev_to_iio_dev() - Get IIO device struct from a device struct 534 * dev_to_iio_dev() - Get IIO device struct from a device struct
@@ -593,7 +664,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
593{ 664{
594 return indio_dev->currentmode 665 return indio_dev->currentmode
595 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); 666 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
596}; 667}
597 668
598/** 669/**
599 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry 670 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
@@ -603,12 +674,12 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
603static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 674static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
604{ 675{
605 return indio_dev->debugfs_dentry; 676 return indio_dev->debugfs_dentry;
606}; 677}
607#else 678#else
608static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 679static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
609{ 680{
610 return NULL; 681 return NULL;
611}; 682}
612#endif 683#endif
613 684
614int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, 685int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index 2958c960003a..8a1d18640ab9 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -100,6 +100,21 @@ struct iio_const_attr {
100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ 100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
101 IIO_CONST_ATTR(sampling_frequency_available, _string) 101 IIO_CONST_ATTR(sampling_frequency_available, _string)
102 102
103/**
104 * IIO_DEV_ATTR_INT_TIME_AVAIL - list available integration times
105 * @_show: output method for the attribute
106 **/
107#define IIO_DEV_ATTR_INT_TIME_AVAIL(_show) \
108 IIO_DEVICE_ATTR(integration_time_available, S_IRUGO, _show, NULL, 0)
109/**
110 * IIO_CONST_ATTR_INT_TIME_AVAIL - list available integration times
111 * @_string: frequency string for the attribute
112 *
113 * Constant version
114 **/
115#define IIO_CONST_ATTR_INT_TIME_AVAIL(_string) \
116 IIO_CONST_ATTR(integration_time_available, _string)
117
103#define IIO_DEV_ATTR_TEMP_RAW(_show) \ 118#define IIO_DEV_ATTR_TEMP_RAW(_show) \
104 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) 119 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
105 120
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 88bf0f0d27b4..4ac928ee31c5 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -54,6 +54,26 @@ enum iio_modifier {
54 IIO_MOD_LIGHT_BLUE, 54 IIO_MOD_LIGHT_BLUE,
55}; 55};
56 56
57enum iio_event_type {
58 IIO_EV_TYPE_THRESH,
59 IIO_EV_TYPE_MAG,
60 IIO_EV_TYPE_ROC,
61 IIO_EV_TYPE_THRESH_ADAPTIVE,
62 IIO_EV_TYPE_MAG_ADAPTIVE,
63};
64
65enum iio_event_info {
66 IIO_EV_INFO_ENABLE,
67 IIO_EV_INFO_VALUE,
68 IIO_EV_INFO_HYSTERESIS,
69};
70
71enum iio_event_direction {
72 IIO_EV_DIR_EITHER,
73 IIO_EV_DIR_RISING,
74 IIO_EV_DIR_FALLING,
75};
76
57#define IIO_VAL_INT 1 77#define IIO_VAL_INT 1
58#define IIO_VAL_INT_PLUS_MICRO 2 78#define IIO_VAL_INT_PLUS_MICRO 2
59#define IIO_VAL_INT_PLUS_NANO 3 79#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 79640e015a86..0d678aefe69d 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -147,25 +147,27 @@ struct in_ifaddr {
147 unsigned long ifa_tstamp; /* updated timestamp */ 147 unsigned long ifa_tstamp; /* updated timestamp */
148}; 148};
149 149
150extern int register_inetaddr_notifier(struct notifier_block *nb); 150int register_inetaddr_notifier(struct notifier_block *nb);
151extern int unregister_inetaddr_notifier(struct notifier_block *nb); 151int unregister_inetaddr_notifier(struct notifier_block *nb);
152 152
153extern void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, 153void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,
154 struct ipv4_devconf *devconf); 154 struct ipv4_devconf *devconf);
155 155
156extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); 156struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
157static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) 157static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
158{ 158{
159 return __ip_dev_find(net, addr, true); 159 return __ip_dev_find(net, addr, true);
160} 160}
161 161
162extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 162int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
163extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); 163int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
164extern void devinet_init(void); 164void devinet_init(void);
165extern struct in_device *inetdev_by_index(struct net *, int); 165struct in_device *inetdev_by_index(struct net *, int);
166extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 166__be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
167extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope); 167__be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local,
168extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); 168 int scope);
169struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
170 __be32 mask);
169 171
170static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) 172static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
171{ 173{
@@ -218,7 +220,7 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
218 return rtnl_dereference(dev->ip_ptr); 220 return rtnl_dereference(dev->ip_ptr);
219} 221}
220 222
221extern void in_dev_finish_destroy(struct in_device *idev); 223void in_dev_finish_destroy(struct in_device *idev);
222 224
223static inline void in_dev_put(struct in_device *idev) 225static inline void in_dev_put(struct in_device *idev)
224{ 226{
diff --git a/include/linux/init.h b/include/linux/init.h
index e73f2b708525..8e68a64bfe00 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -26,8 +26,8 @@
26 * extern int initialize_foobar_device(int, int, int) __init; 26 * extern int initialize_foobar_device(int, int, int) __init;
27 * 27 *
28 * For initialized data: 28 * For initialized data:
29 * You should insert __initdata between the variable name and equal 29 * You should insert __initdata or __initconst between the variable name
30 * sign followed by value, e.g.: 30 * and equal sign followed by value, e.g.:
31 * 31 *
32 * static int init_variable __initdata = 0; 32 * static int init_variable __initdata = 0;
33 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... }; 33 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
@@ -35,8 +35,6 @@
35 * Don't forget to initialize data not at file scope, i.e. within a function, 35 * Don't forget to initialize data not at file scope, i.e. within a function,
36 * as gcc otherwise puts the data into the bss section and not into the init 36 * as gcc otherwise puts the data into the bss section and not into the init
37 * section. 37 * section.
38 *
39 * Also note, that this data cannot be "const".
40 */ 38 */
41 39
42/* These are for everybody (although not all archs will actually 40/* These are for everybody (although not all archs will actually
@@ -153,6 +151,7 @@ extern unsigned int reset_devices;
153void setup_arch(char **); 151void setup_arch(char **);
154void prepare_namespace(void); 152void prepare_namespace(void);
155void __init load_default_modules(void); 153void __init load_default_modules(void);
154int __init init_rootfs(void);
156 155
157extern void (*late_time_init)(void); 156extern void (*late_time_init)(void);
158 157
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 5cd0f0949927..b0ed422e4e4a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -32,10 +32,10 @@ extern struct fs_struct init_fs;
32#endif 32#endif
33 33
34#ifdef CONFIG_CPUSETS 34#ifdef CONFIG_CPUSETS
35#define INIT_CPUSET_SEQ \ 35#define INIT_CPUSET_SEQ(tsk) \
36 .mems_allowed_seq = SEQCNT_ZERO, 36 .mems_allowed_seq = SEQCNT_ZERO(tsk.mems_allowed_seq),
37#else 37#else
38#define INIT_CPUSET_SEQ 38#define INIT_CPUSET_SEQ(tsk)
39#endif 39#endif
40 40
41#define INIT_SIGNALS(sig) { \ 41#define INIT_SIGNALS(sig) { \
@@ -220,7 +220,7 @@ extern struct task_group root_task_group;
220 INIT_FTRACE_GRAPH \ 220 INIT_FTRACE_GRAPH \
221 INIT_TRACE_RECURSION \ 221 INIT_TRACE_RECURSION \
222 INIT_TASK_RCU_PREEMPT(tsk) \ 222 INIT_TASK_RCU_PREEMPT(tsk) \
223 INIT_CPUSET_SEQ \ 223 INIT_CPUSET_SEQ(tsk) \
224 INIT_VTIME(tsk) \ 224 INIT_VTIME(tsk) \
225} 225}
226 226
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 78e2ada50cd5..d380c5e68008 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -55,7 +55,7 @@
55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ 55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */ 56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */
57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ 57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ 58#define DMAR_ICS_REG 0x9c /* Invalidation complete status register */
59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ 59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
60 60
61#define OFFSET_STRIDE (9) 61#define OFFSET_STRIDE (9)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5fa5afeeb759..db43b58a3355 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,14 +11,13 @@
11#include <linux/irqnr.h> 11#include <linux/irqnr.h>
12#include <linux/hardirq.h> 12#include <linux/hardirq.h>
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/smp.h>
15#include <linux/percpu.h>
16#include <linux/hrtimer.h> 14#include <linux/hrtimer.h>
17#include <linux/kref.h> 15#include <linux/kref.h>
18#include <linux/workqueue.h> 16#include <linux/workqueue.h>
19 17
20#include <linux/atomic.h> 18#include <linux/atomic.h>
21#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/irq.h>
22 21
23/* 22/*
24 * These correspond to the IORESOURCE_IRQ_* defines in 23 * These correspond to the IORESOURCE_IRQ_* defines in
@@ -120,7 +119,6 @@ struct irqaction {
120 119
121extern irqreturn_t no_action(int cpl, void *dev_id); 120extern irqreturn_t no_action(int cpl, void *dev_id);
122 121
123#ifdef CONFIG_GENERIC_HARDIRQS
124extern int __must_check 122extern int __must_check
125request_threaded_irq(unsigned int irq, irq_handler_t handler, 123request_threaded_irq(unsigned int irq, irq_handler_t handler,
126 irq_handler_t thread_fn, 124 irq_handler_t thread_fn,
@@ -140,40 +138,6 @@ request_any_context_irq(unsigned int irq, irq_handler_t handler,
140extern int __must_check 138extern int __must_check
141request_percpu_irq(unsigned int irq, irq_handler_t handler, 139request_percpu_irq(unsigned int irq, irq_handler_t handler,
142 const char *devname, void __percpu *percpu_dev_id); 140 const char *devname, void __percpu *percpu_dev_id);
143#else
144
145extern int __must_check
146request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
147 const char *name, void *dev);
148
149/*
150 * Special function to avoid ifdeffery in kernel/irq/devres.c which
151 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
152 * m68k). I really love these $@%#!* obvious Makefile references:
153 * ../../../kernel/irq/devres.o
154 */
155static inline int __must_check
156request_threaded_irq(unsigned int irq, irq_handler_t handler,
157 irq_handler_t thread_fn,
158 unsigned long flags, const char *name, void *dev)
159{
160 return request_irq(irq, handler, flags, name, dev);
161}
162
163static inline int __must_check
164request_any_context_irq(unsigned int irq, irq_handler_t handler,
165 unsigned long flags, const char *name, void *dev_id)
166{
167 return request_irq(irq, handler, flags, name, dev_id);
168}
169
170static inline int __must_check
171request_percpu_irq(unsigned int irq, irq_handler_t handler,
172 const char *devname, void __percpu *percpu_dev_id)
173{
174 return request_irq(irq, handler, 0, devname, percpu_dev_id);
175}
176#endif
177 141
178extern void free_irq(unsigned int, void *); 142extern void free_irq(unsigned int, void *);
179extern void free_percpu_irq(unsigned int, void __percpu *); 143extern void free_percpu_irq(unsigned int, void __percpu *);
@@ -221,7 +185,6 @@ extern void enable_irq(unsigned int irq);
221extern void enable_percpu_irq(unsigned int irq, unsigned int type); 185extern void enable_percpu_irq(unsigned int irq, unsigned int type);
222 186
223/* The following three functions are for the core kernel use only. */ 187/* The following three functions are for the core kernel use only. */
224#ifdef CONFIG_GENERIC_HARDIRQS
225extern void suspend_device_irqs(void); 188extern void suspend_device_irqs(void);
226extern void resume_device_irqs(void); 189extern void resume_device_irqs(void);
227#ifdef CONFIG_PM_SLEEP 190#ifdef CONFIG_PM_SLEEP
@@ -229,13 +192,8 @@ extern int check_wakeup_irqs(void);
229#else 192#else
230static inline int check_wakeup_irqs(void) { return 0; } 193static inline int check_wakeup_irqs(void) { return 0; }
231#endif 194#endif
232#else
233static inline void suspend_device_irqs(void) { };
234static inline void resume_device_irqs(void) { };
235static inline int check_wakeup_irqs(void) { return 0; }
236#endif
237 195
238#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 196#if defined(CONFIG_SMP)
239 197
240extern cpumask_var_t irq_default_affinity; 198extern cpumask_var_t irq_default_affinity;
241 199
@@ -287,9 +245,8 @@ static inline int irq_set_affinity_hint(unsigned int irq,
287{ 245{
288 return -EINVAL; 246 return -EINVAL;
289} 247}
290#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 248#endif /* CONFIG_SMP */
291 249
292#ifdef CONFIG_GENERIC_HARDIRQS
293/* 250/*
294 * Special lockdep variants of irq disabling/enabling. 251 * Special lockdep variants of irq disabling/enabling.
295 * These should be used for locking constructs that 252 * These should be used for locking constructs that
@@ -354,33 +311,6 @@ static inline int disable_irq_wake(unsigned int irq)
354 return irq_set_irq_wake(irq, 0); 311 return irq_set_irq_wake(irq, 0);
355} 312}
356 313
357#else /* !CONFIG_GENERIC_HARDIRQS */
358/*
359 * NOTE: non-genirq architectures, if they want to support the lock
360 * validator need to define the methods below in their asm/irq.h
361 * files, under an #ifdef CONFIG_LOCKDEP section.
362 */
363#ifndef CONFIG_LOCKDEP
364# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
365# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
366 disable_irq_nosync(irq)
367# define disable_irq_lockdep(irq) disable_irq(irq)
368# define enable_irq_lockdep(irq) enable_irq(irq)
369# define enable_irq_lockdep_irqrestore(irq, flags) \
370 enable_irq(irq)
371# endif
372
373static inline int enable_irq_wake(unsigned int irq)
374{
375 return 0;
376}
377
378static inline int disable_irq_wake(unsigned int irq)
379{
380 return 0;
381}
382#endif /* CONFIG_GENERIC_HARDIRQS */
383
384 314
385#ifdef CONFIG_IRQ_FORCED_THREADING 315#ifdef CONFIG_IRQ_FORCED_THREADING
386extern bool force_irqthreads; 316extern bool force_irqthreads;
@@ -443,6 +373,16 @@ struct softirq_action
443 373
444asmlinkage void do_softirq(void); 374asmlinkage void do_softirq(void);
445asmlinkage void __do_softirq(void); 375asmlinkage void __do_softirq(void);
376
377#ifdef __ARCH_HAS_DO_SOFTIRQ
378void do_softirq_own_stack(void);
379#else
380static inline void do_softirq_own_stack(void)
381{
382 __do_softirq();
383}
384#endif
385
446extern void open_softirq(int nr, void (*action)(struct softirq_action *)); 386extern void open_softirq(int nr, void (*action)(struct softirq_action *));
447extern void softirq_init(void); 387extern void softirq_init(void);
448extern void __raise_softirq_irqoff(unsigned int nr); 388extern void __raise_softirq_irqoff(unsigned int nr);
@@ -450,15 +390,6 @@ extern void __raise_softirq_irqoff(unsigned int nr);
450extern void raise_softirq_irqoff(unsigned int nr); 390extern void raise_softirq_irqoff(unsigned int nr);
451extern void raise_softirq(unsigned int nr); 391extern void raise_softirq(unsigned int nr);
452 392
453/* This is the worklist that queues up per-cpu softirq work.
454 *
455 * send_remote_sendirq() adds work to these lists, and
456 * the softirq handler itself dequeues from them. The queues
457 * are protected by disabling local cpu interrupts and they must
458 * only be accessed by the local cpu that they are for.
459 */
460DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
461
462DECLARE_PER_CPU(struct task_struct *, ksoftirqd); 393DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
463 394
464static inline struct task_struct *this_cpu_ksoftirqd(void) 395static inline struct task_struct *this_cpu_ksoftirqd(void)
@@ -466,17 +397,6 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
466 return this_cpu_read(ksoftirqd); 397 return this_cpu_read(ksoftirqd);
467} 398}
468 399
469/* Try to send a softirq to a remote cpu. If this cannot be done, the
470 * work will be queued to the local cpu.
471 */
472extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
473
474/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
475 * and compute the current cpu, passed in as 'this_cpu'.
476 */
477extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
478 int this_cpu, int softirq);
479
480/* Tasklets --- multithreaded analogue of BHs. 400/* Tasklets --- multithreaded analogue of BHs.
481 401
482 Main feature differing them of generic softirqs: tasklet 402 Main feature differing them of generic softirqs: tasklet
@@ -655,7 +575,7 @@ void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
655 * if more than one irq occurred. 575 * if more than one irq occurred.
656 */ 576 */
657 577
658#if defined(CONFIG_GENERIC_HARDIRQS) && !defined(CONFIG_GENERIC_IRQ_PROBE) 578#if !defined(CONFIG_GENERIC_IRQ_PROBE)
659static inline unsigned long probe_irq_on(void) 579static inline unsigned long probe_irq_on(void)
660{ 580{
661 return 0; 581 return 0;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3aeb7305e2f5..a444c790fa72 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -22,6 +22,7 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <trace/events/iommu.h>
25 26
26#define IOMMU_READ (1) 27#define IOMMU_READ (1)
27#define IOMMU_WRITE (2) 28#define IOMMU_WRITE (2)
@@ -58,10 +59,26 @@ struct iommu_domain {
58#define IOMMU_CAP_CACHE_COHERENCY 0x1 59#define IOMMU_CAP_CACHE_COHERENCY 0x1
59#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 60#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
60 61
62/*
63 * Following constraints are specifc to FSL_PAMUV1:
64 * -aperture must be power of 2, and naturally aligned
65 * -number of windows must be power of 2, and address space size
66 * of each window is determined by aperture size / # of windows
67 * -the actual size of the mapped region of a window must be power
68 * of 2 starting with 4KB and physical address must be naturally
69 * aligned.
70 * DOMAIN_ATTR_FSL_PAMUV1 corresponds to the above mentioned contraints.
71 * The caller can invoke iommu_domain_get_attr to check if the underlying
72 * iommu implementation supports these constraints.
73 */
74
61enum iommu_attr { 75enum iommu_attr {
62 DOMAIN_ATTR_GEOMETRY, 76 DOMAIN_ATTR_GEOMETRY,
63 DOMAIN_ATTR_PAGING, 77 DOMAIN_ATTR_PAGING,
64 DOMAIN_ATTR_WINDOWS, 78 DOMAIN_ATTR_WINDOWS,
79 DOMAIN_ATTR_FSL_PAMU_STASH,
80 DOMAIN_ATTR_FSL_PAMU_ENABLE,
81 DOMAIN_ATTR_FSL_PAMUV1,
65 DOMAIN_ATTR_MAX, 82 DOMAIN_ATTR_MAX,
66}; 83};
67 84
@@ -211,6 +228,7 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
211 ret = domain->handler(domain, dev, iova, flags, 228 ret = domain->handler(domain, dev, iova, flags,
212 domain->handler_token); 229 domain->handler_token);
213 230
231 trace_io_page_fault(dev, iova, flags);
214 return ret; 232 return ret;
215} 233}
216 234
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index c4d870b0d5e6..f6c82de12541 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -22,7 +22,7 @@ struct ipc_ids {
22 int in_use; 22 int in_use;
23 unsigned short seq; 23 unsigned short seq;
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rwsem;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id; 27 int next_id;
28}; 28};
@@ -34,9 +34,9 @@ struct ipc_namespace {
34 int sem_ctls[4]; 34 int sem_ctls[4];
35 int used_sems; 35 int used_sems;
36 36
37 int msg_ctlmax; 37 unsigned int msg_ctlmax;
38 int msg_ctlmnb; 38 unsigned int msg_ctlmnb;
39 int msg_ctlmni; 39 unsigned int msg_ctlmni;
40 atomic_t msg_bytes; 40 atomic_t msg_bytes;
41 atomic_t msg_hdrs; 41 atomic_t msg_hdrs;
42 int auto_msgmni; 42 int auto_msgmni;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 28ea38439313..c56c350324e4 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -4,6 +4,7 @@
4#include <uapi/linux/ipv6.h> 4#include <uapi/linux/ipv6.h>
5 5
6#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) 6#define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
7#define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
7/* 8/*
8 * This structure contains configuration options per IPv6 link. 9 * This structure contains configuration options per IPv6 link.
9 */ 10 */
@@ -21,13 +22,11 @@ struct ipv6_devconf {
21 __s32 force_mld_version; 22 __s32 force_mld_version;
22 __s32 mldv1_unsolicited_report_interval; 23 __s32 mldv1_unsolicited_report_interval;
23 __s32 mldv2_unsolicited_report_interval; 24 __s32 mldv2_unsolicited_report_interval;
24#ifdef CONFIG_IPV6_PRIVACY
25 __s32 use_tempaddr; 25 __s32 use_tempaddr;
26 __s32 temp_valid_lft; 26 __s32 temp_valid_lft;
27 __s32 temp_prefered_lft; 27 __s32 temp_prefered_lft;
28 __s32 regen_max_retry; 28 __s32 regen_max_retry;
29 __s32 max_desync_factor; 29 __s32 max_desync_factor;
30#endif
31 __s32 max_addresses; 30 __s32 max_addresses;
32 __s32 accept_ra_defrtr; 31 __s32 accept_ra_defrtr;
33 __s32 accept_ra_pinfo; 32 __s32 accept_ra_pinfo;
@@ -115,16 +114,8 @@ static inline int inet6_iif(const struct sk_buff *skb)
115 return IP6CB(skb)->iif; 114 return IP6CB(skb)->iif;
116} 115}
117 116
118struct inet6_request_sock {
119 struct in6_addr loc_addr;
120 struct in6_addr rmt_addr;
121 struct sk_buff *pktopts;
122 int iif;
123};
124
125struct tcp6_request_sock { 117struct tcp6_request_sock {
126 struct tcp_request_sock tcp6rsk_tcp; 118 struct tcp_request_sock tcp6rsk_tcp;
127 struct inet6_request_sock tcp6rsk_inet6;
128}; 119};
129 120
130struct ipv6_mc_socklist; 121struct ipv6_mc_socklist;
@@ -141,8 +132,6 @@ struct ipv6_fl_socklist;
141 */ 132 */
142struct ipv6_pinfo { 133struct ipv6_pinfo {
143 struct in6_addr saddr; 134 struct in6_addr saddr;
144 struct in6_addr rcv_saddr;
145 struct in6_addr daddr;
146 struct in6_pktinfo sticky_pktinfo; 135 struct in6_pktinfo sticky_pktinfo;
147 const struct in6_addr *daddr_cache; 136 const struct in6_addr *daddr_cache;
148#ifdef CONFIG_IPV6_SUBTREES 137#ifdef CONFIG_IPV6_SUBTREES
@@ -256,48 +245,22 @@ struct tcp6_sock {
256 245
257extern int inet6_sk_rebuild_header(struct sock *sk); 246extern int inet6_sk_rebuild_header(struct sock *sk);
258 247
259struct inet6_timewait_sock {
260 struct in6_addr tw_v6_daddr;
261 struct in6_addr tw_v6_rcv_saddr;
262};
263
264struct tcp6_timewait_sock { 248struct tcp6_timewait_sock {
265 struct tcp_timewait_sock tcp6tw_tcp; 249 struct tcp_timewait_sock tcp6tw_tcp;
266 struct inet6_timewait_sock tcp6tw_inet6;
267}; 250};
268 251
269static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
270{
271 return (struct inet6_timewait_sock *)(((u8 *)sk) +
272 inet_twsk(sk)->tw_ipv6_offset);
273}
274
275#if IS_ENABLED(CONFIG_IPV6) 252#if IS_ENABLED(CONFIG_IPV6)
276static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 253static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
277{ 254{
278 return inet_sk(__sk)->pinet6; 255 return inet_sk(__sk)->pinet6;
279} 256}
280 257
281static inline struct inet6_request_sock *
282 inet6_rsk(const struct request_sock *rsk)
283{
284 return (struct inet6_request_sock *)(((u8 *)rsk) +
285 inet_rsk(rsk)->inet6_rsk_offset);
286}
287
288static inline u32 inet6_rsk_offset(struct request_sock *rsk)
289{
290 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
291}
292
293static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) 258static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
294{ 259{
295 struct request_sock *req = reqsk_alloc(ops); 260 struct request_sock *req = reqsk_alloc(ops);
296 261
297 if (req != NULL) { 262 if (req)
298 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); 263 inet_rsk(req)->pktopts = NULL;
299 inet6_rsk(req)->pktopts = NULL;
300 }
301 264
302 return req; 265 return req;
303} 266}
@@ -321,21 +284,11 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
321#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 284#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
322#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 285#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
323 286
324static inline u16 inet6_tw_offset(const struct proto *prot) 287static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
325{ 288{
326 return prot->twsk_prot->twsk_obj_size - 289 if (sk->sk_family == AF_INET6)
327 sizeof(struct inet6_timewait_sock); 290 return &sk->sk_v6_rcv_saddr;
328} 291 return NULL;
329
330static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
331{
332 return likely(sk->sk_state != TCP_TIME_WAIT) ?
333 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
334}
335
336static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
337{
338 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
339} 292}
340 293
341static inline int inet_v6_ipv6only(const struct sock *sk) 294static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -363,28 +316,18 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
363 return NULL; 316 return NULL;
364} 317}
365 318
366#define __inet6_rcv_saddr(__sk) NULL
367#define inet6_rcv_saddr(__sk) NULL 319#define inet6_rcv_saddr(__sk) NULL
368#define tcp_twsk_ipv6only(__sk) 0 320#define tcp_twsk_ipv6only(__sk) 0
369#define inet_v6_ipv6only(__sk) 0 321#define inet_v6_ipv6only(__sk) 0
370#endif /* IS_ENABLED(CONFIG_IPV6) */ 322#endif /* IS_ENABLED(CONFIG_IPV6) */
371 323
372#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ 324#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
373 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 325 (((__sk)->sk_portpair == (__ports)) && \
374 ((__sk)->sk_family == AF_INET6) && \ 326 ((__sk)->sk_family == AF_INET6) && \
375 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 327 ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \
376 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 328 ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \
377 (!(__sk)->sk_bound_dev_if || \ 329 (!(__sk)->sk_bound_dev_if || \
378 ((__sk)->sk_bound_dev_if == (__dif))) && \ 330 ((__sk)->sk_bound_dev_if == (__dif))) && \
379 net_eq(sock_net(__sk), (__net))) 331 net_eq(sock_net(__sk), (__net)))
380 332
381#define INET6_TW_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
382 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
383 ((__sk)->sk_family == AF_INET6) && \
384 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr)) && \
385 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr)) && \
386 (!(__sk)->sk_bound_dev_if || \
387 ((__sk)->sk_bound_dev_if == (__dif))) && \
388 net_eq(sock_net(__sk), (__net)))
389
390#endif /* _IPV6_H */ 333#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f04d3ba335cb..7dc10036eff5 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -70,6 +70,9 @@ typedef void (*irq_preflow_handler_t)(struct irq_data *data);
70 * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context 70 * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context
71 * IRQ_NESTED_TRHEAD - Interrupt nests into another thread 71 * IRQ_NESTED_TRHEAD - Interrupt nests into another thread
72 * IRQ_PER_CPU_DEVID - Dev_id is a per-cpu variable 72 * IRQ_PER_CPU_DEVID - Dev_id is a per-cpu variable
73 * IRQ_IS_POLLED - Always polled by another interrupt. Exclude
74 * it from the spurious interrupt detection
75 * mechanism and from core side polling.
73 */ 76 */
74enum { 77enum {
75 IRQ_TYPE_NONE = 0x00000000, 78 IRQ_TYPE_NONE = 0x00000000,
@@ -94,12 +97,14 @@ enum {
94 IRQ_NESTED_THREAD = (1 << 15), 97 IRQ_NESTED_THREAD = (1 << 15),
95 IRQ_NOTHREAD = (1 << 16), 98 IRQ_NOTHREAD = (1 << 16),
96 IRQ_PER_CPU_DEVID = (1 << 17), 99 IRQ_PER_CPU_DEVID = (1 << 17),
100 IRQ_IS_POLLED = (1 << 18),
97}; 101};
98 102
99#define IRQF_MODIFY_MASK \ 103#define IRQF_MODIFY_MASK \
100 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ 104 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
101 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \ 105 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
102 IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID) 106 IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID | \
107 IRQ_IS_POLLED)
103 108
104#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) 109#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
105 110
@@ -382,8 +387,6 @@ extern void irq_cpu_online(void);
382extern void irq_cpu_offline(void); 387extern void irq_cpu_offline(void);
383extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); 388extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask);
384 389
385#ifdef CONFIG_GENERIC_HARDIRQS
386
387#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 390#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
388void irq_move_irq(struct irq_data *data); 391void irq_move_irq(struct irq_data *data);
389void irq_move_masked_irq(struct irq_data *data); 392void irq_move_masked_irq(struct irq_data *data);
@@ -802,11 +805,4 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
802static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 805static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
803#endif 806#endif
804 807
805#else /* !CONFIG_GENERIC_HARDIRQS */
806
807extern struct msi_desc *irq_get_msi_desc(unsigned int irq);
808extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
809
810#endif /* CONFIG_GENERIC_HARDIRQS */
811
812#endif /* _LINUX_IRQ_H */ 808#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 3e203eb23cc7..cac496b1e279 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -31,6 +31,8 @@
31#define GIC_DIST_TARGET 0x800 31#define GIC_DIST_TARGET 0x800
32#define GIC_DIST_CONFIG 0xc00 32#define GIC_DIST_CONFIG 0xc00
33#define GIC_DIST_SOFTINT 0xf00 33#define GIC_DIST_SOFTINT 0xf00
34#define GIC_DIST_SGI_PENDING_CLEAR 0xf10
35#define GIC_DIST_SGI_PENDING_SET 0xf20
34 36
35#define GICH_HCR 0x0 37#define GICH_HCR 0x0
36#define GICH_VTR 0x4 38#define GICH_VTR 0x4
@@ -66,6 +68,7 @@ extern struct irq_chip gic_arch_extn;
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 68void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *); 69 u32 offset, struct device_node *);
68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 70void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
71void gic_cpu_if_down(void);
69 72
70static inline void gic_init(unsigned int nr, int start, 73static inline void gic_init(unsigned int nr, int start,
71 void __iomem *dist , void __iomem *cpu) 74 void __iomem *dist , void __iomem *cpu)
@@ -73,6 +76,11 @@ static inline void gic_init(unsigned int nr, int start,
73 gic_init_bases(nr, start, dist, cpu, 0, NULL); 76 gic_init_bases(nr, start, dist, cpu, 0, NULL);
74} 77}
75 78
79void gic_send_sgi(unsigned int cpu_id, unsigned int irq);
80int gic_get_cpu_id(unsigned int cpu);
81void gic_migrate_target(unsigned int new_cpu_id);
82unsigned long gic_get_sgir_physaddr(void);
83
76#endif /* __ASSEMBLY */ 84#endif /* __ASSEMBLY */
77 85
78#endif 86#endif
diff --git a/include/linux/irqchip/mmp.h b/include/linux/irqchip/mmp.h
new file mode 100644
index 000000000000..c78a8921185d
--- /dev/null
+++ b/include/linux/irqchip/mmp.h
@@ -0,0 +1,6 @@
1#ifndef __IRQCHIP_MMP_H
2#define __IRQCHIP_MMP_H
3
4extern struct irq_chip icu_irq_chip;
5
6#endif /* __IRQCHIP_MMP_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 623325e2ff97..56fb646909dc 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -76,8 +76,6 @@ struct irq_desc {
76extern struct irq_desc irq_desc[NR_IRQS]; 76extern struct irq_desc irq_desc[NR_IRQS];
77#endif 77#endif
78 78
79#ifdef CONFIG_GENERIC_HARDIRQS
80
81static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) 79static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
82{ 80{
83 return &desc->irq_data; 81 return &desc->irq_data;
@@ -173,6 +171,5 @@ __irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
173 desc->preflow_handler = handler; 171 desc->preflow_handler = handler;
174} 172}
175#endif 173#endif
176#endif
177 174
178#endif 175#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 0a2dc46cdaf6..fdd5cc16c9c4 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -4,23 +4,6 @@
4#include <uapi/linux/irqnr.h> 4#include <uapi/linux/irqnr.h>
5 5
6 6
7#ifndef CONFIG_GENERIC_HARDIRQS
8#include <asm/irq.h>
9
10/*
11 * Wrappers for non-genirq architectures:
12 */
13#define nr_irqs NR_IRQS
14#define irq_to_desc(irq) (&irq_desc[irq])
15
16# define for_each_irq_desc(irq, desc) \
17 for (irq = 0; irq < nr_irqs; irq++)
18
19# define for_each_irq_desc_reverse(irq, desc) \
20 for (irq = nr_irqs - 1; irq >= 0; irq--)
21
22#else /* CONFIG_GENERIC_HARDIRQS */
23
24extern int nr_irqs; 7extern int nr_irqs;
25extern struct irq_desc *irq_to_desc(unsigned int irq); 8extern struct irq_desc *irq_to_desc(unsigned int irq);
26unsigned int irq_get_next_irq(unsigned int offset); 9unsigned int irq_get_next_irq(unsigned int offset);
@@ -50,8 +33,6 @@ unsigned int irq_get_next_irq(unsigned int offset);
50 for (irq = irq_get_next_irq(0); irq < nr_irqs; \ 33 for (irq = irq_get_next_irq(0); irq < nr_irqs; \
51 irq = irq_get_next_irq(irq + 1)) 34 irq = irq_get_next_irq(irq + 1))
52 35
53#endif /* CONFIG_GENERIC_HARDIRQS */
54
55#define for_each_irq_nr(irq) \ 36#define for_each_irq_nr(irq) \
56 for (irq = 0; irq < nr_irqs; irq++) 37 for (irq = 0; irq < nr_irqs; irq++)
57 38
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index 714ba08dc092..e374e369fb2f 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -14,6 +14,6 @@ enum irqreturn {
14}; 14};
15 15
16typedef enum irqreturn irqreturn_t; 16typedef enum irqreturn irqreturn_t;
17#define IRQ_RETVAL(x) ((x) != IRQ_NONE) 17#define IRQ_RETVAL(x) ((x) ? IRQ_HANDLED : IRQ_NONE)
18 18
19#endif 19#endif
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a5079072da66..39999775b922 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -48,6 +48,13 @@
48 48
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/compiler.h> 50#include <linux/compiler.h>
51#include <linux/bug.h>
52
53extern bool static_key_initialized;
54
55#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \
56 "%s used before call to jump_label_init", \
57 __func__)
51 58
52#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 59#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
53 60
@@ -128,29 +135,32 @@ struct static_key {
128 135
129static __always_inline void jump_label_init(void) 136static __always_inline void jump_label_init(void)
130{ 137{
138 static_key_initialized = true;
131} 139}
132 140
133static __always_inline bool static_key_false(struct static_key *key) 141static __always_inline bool static_key_false(struct static_key *key)
134{ 142{
135 if (unlikely(atomic_read(&key->enabled)) > 0) 143 if (unlikely(atomic_read(&key->enabled) > 0))
136 return true; 144 return true;
137 return false; 145 return false;
138} 146}
139 147
140static __always_inline bool static_key_true(struct static_key *key) 148static __always_inline bool static_key_true(struct static_key *key)
141{ 149{
142 if (likely(atomic_read(&key->enabled)) > 0) 150 if (likely(atomic_read(&key->enabled) > 0))
143 return true; 151 return true;
144 return false; 152 return false;
145} 153}
146 154
147static inline void static_key_slow_inc(struct static_key *key) 155static inline void static_key_slow_inc(struct static_key *key)
148{ 156{
157 STATIC_KEY_CHECK_USE();
149 atomic_inc(&key->enabled); 158 atomic_inc(&key->enabled);
150} 159}
151 160
152static inline void static_key_slow_dec(struct static_key *key) 161static inline void static_key_slow_dec(struct static_key *key)
153{ 162{
163 STATIC_KEY_CHECK_USE();
154 atomic_dec(&key->enabled); 164 atomic_dec(&key->enabled);
155} 165}
156 166
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h
index 113788389b3d..089f70f83e97 100644
--- a/include/linux/jump_label_ratelimit.h
+++ b/include/linux/jump_label_ratelimit.h
@@ -23,12 +23,14 @@ struct static_key_deferred {
23}; 23};
24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) 24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
25{ 25{
26 STATIC_KEY_CHECK_USE();
26 static_key_slow_dec(&key->key); 27 static_key_slow_dec(&key->key);
27} 28}
28static inline void 29static inline void
29jump_label_rate_limit(struct static_key_deferred *key, 30jump_label_rate_limit(struct static_key_deferred *key,
30 unsigned long rl) 31 unsigned long rl)
31{ 32{
33 STATIC_KEY_CHECK_USE();
32} 34}
33#endif /* HAVE_JUMP_LABEL */ 35#endif /* HAVE_JUMP_LABEL */
34#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ 36#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 7f6fe6e015bc..290db1269c4c 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -109,6 +109,7 @@ typedef enum {
109 KDB_REASON_RECURSE, /* Recursive entry to kdb; 109 KDB_REASON_RECURSE, /* Recursive entry to kdb;
110 * regs probably valid */ 110 * regs probably valid */
111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */ 111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
112 KDB_REASON_SYSTEM_NMI, /* In NMI due to SYSTEM cmd; regs valid */
112} kdb_reason_t; 113} kdb_reason_t;
113 114
114extern int kdb_trap_printk; 115extern int kdb_trap_printk;
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index 546eb6a76934..f65ce09784f1 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -15,5 +15,6 @@
15#define KPF_OWNER_PRIVATE 37 15#define KPF_OWNER_PRIVATE 37
16#define KPF_ARCH 38 16#define KPF_ARCH 38
17#define KPF_UNCACHED 39 17#define KPF_UNCACHED 39
18#define KPF_SOFTDIRTY 40
18 19
19#endif /* LINUX_KERNEL_PAGE_FLAGS_H */ 20#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 482ad2d84a32..ecb87544cc5d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -193,7 +193,8 @@ extern int _cond_resched(void);
193 (__x < 0) ? -__x : __x; \ 193 (__x < 0) ? -__x : __x; \
194 }) 194 })
195 195
196#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) 196#if defined(CONFIG_MMU) && \
197 (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP))
197void might_fault(void); 198void might_fault(void);
198#else 199#else
199static inline void might_fault(void) { } 200static inline void might_fault(void) { }
@@ -439,6 +440,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
439 return buf; 440 return buf;
440} 441}
441 442
443extern const char hex_asc_upper[];
444#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
445#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
446
447static inline char *hex_byte_pack_upper(char *buf, u8 byte)
448{
449 *buf++ = hex_asc_upper_hi(byte);
450 *buf++ = hex_asc_upper_lo(byte);
451 return buf;
452}
453
442static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) 454static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
443{ 455{
444 return hex_byte_pack(buf, byte); 456 return hex_byte_pack(buf, byte);
@@ -490,7 +502,6 @@ void tracing_snapshot_alloc(void);
490 502
491extern void tracing_start(void); 503extern void tracing_start(void);
492extern void tracing_stop(void); 504extern void tracing_stop(void);
493extern void ftrace_off_permanent(void);
494 505
495static inline __printf(1, 2) 506static inline __printf(1, 2)
496void ____trace_printk_check_format(const char *fmt, ...) 507void ____trace_printk_check_format(const char *fmt, ...)
@@ -628,7 +639,6 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
628#else 639#else
629static inline void tracing_start(void) { } 640static inline void tracing_start(void) { }
630static inline void tracing_stop(void) { } 641static inline void tracing_stop(void) { }
631static inline void ftrace_off_permanent(void) { }
632static inline void trace_dump_stack(int skip) { } 642static inline void trace_dump_stack(int skip) { }
633 643
634static inline void tracing_on(void) { } 644static inline void tracing_on(void) { }
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ed5f6ed6eb77..51c72be4a7c3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -36,9 +36,6 @@ struct kernel_cpustat {
36}; 36};
37 37
38struct kernel_stat { 38struct kernel_stat {
39#ifndef CONFIG_GENERIC_HARDIRQS
40 unsigned int irqs[NR_IRQS];
41#endif
42 unsigned long irqs_sum; 39 unsigned long irqs_sum;
43 unsigned int softirqs[NR_SOFTIRQS]; 40 unsigned int softirqs[NR_SOFTIRQS];
44}; 41};
@@ -54,22 +51,6 @@ DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
54 51
55extern unsigned long long nr_context_switches(void); 52extern unsigned long long nr_context_switches(void);
56 53
57#ifndef CONFIG_GENERIC_HARDIRQS
58
59struct irq_desc;
60
61static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
62 struct irq_desc *desc)
63{
64 __this_cpu_inc(kstat.irqs[irq]);
65 __this_cpu_inc(kstat.irqs_sum);
66}
67
68static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
69{
70 return kstat_cpu(cpu).irqs[irq];
71}
72#else
73#include <linux/irq.h> 54#include <linux/irq.h>
74extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 55extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
75 56
@@ -79,8 +60,6 @@ do { \
79 __this_cpu_inc(kstat.irqs_sum); \ 60 __this_cpu_inc(kstat.irqs_sum); \
80} while (0) 61} while (0)
81 62
82#endif
83
84static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) 63static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
85{ 64{
86 __this_cpu_inc(kstat.softirqs[irq]); 65 __this_cpu_inc(kstat.softirqs[irq]);
@@ -94,20 +73,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
94/* 73/*
95 * Number of interrupts per specific IRQ source, since bootup 74 * Number of interrupts per specific IRQ source, since bootup
96 */ 75 */
97#ifndef CONFIG_GENERIC_HARDIRQS
98static inline unsigned int kstat_irqs(unsigned int irq)
99{
100 unsigned int sum = 0;
101 int cpu;
102
103 for_each_possible_cpu(cpu)
104 sum += kstat_irqs_cpu(irq, cpu);
105
106 return sum;
107}
108#else
109extern unsigned int kstat_irqs(unsigned int irq); 76extern unsigned int kstat_irqs(unsigned int irq);
110#endif
111 77
112/* 78/*
113 * Number of interrupts per cpu, since bootup 79 * Number of interrupts per cpu, since bootup
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d78d28a733b1..5fd33dc1fe3a 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -198,6 +198,9 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
198extern size_t vmcoreinfo_size; 198extern size_t vmcoreinfo_size;
199extern size_t vmcoreinfo_max_size; 199extern size_t vmcoreinfo_max_size;
200 200
201/* flag to track if kexec reboot is in progress */
202extern bool kexec_in_progress;
203
201int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, 204int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
202 unsigned long long *crash_size, unsigned long long *crash_base); 205 unsigned long long *crash_size, unsigned long long *crash_base);
203int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, 206int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 518a53afb9ea..a74c3a84dfdd 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -45,6 +45,7 @@ struct key_preparsed_payload {
45 const void *data; /* Raw data */ 45 const void *data; /* Raw data */
46 size_t datalen; /* Raw datalen */ 46 size_t datalen; /* Raw datalen */
47 size_t quotalen; /* Quota length for proposed payload */ 47 size_t quotalen; /* Quota length for proposed payload */
48 bool trusted; /* True if key is trusted */
48}; 49};
49 50
50typedef int (*request_key_actor_t)(struct key_construction *key, 51typedef int (*request_key_actor_t)(struct key_construction *key,
@@ -63,6 +64,11 @@ struct key_type {
63 */ 64 */
64 size_t def_datalen; 65 size_t def_datalen;
65 66
67 /* Default key search algorithm. */
68 unsigned def_lookup_type;
69#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
70#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
71
66 /* vet a description */ 72 /* vet a description */
67 int (*vet_description)(const char *description); 73 int (*vet_description)(const char *description);
68 74
diff --git a/include/linux/key.h b/include/linux/key.h
index 4dfde1161c5e..80d677483e31 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -22,6 +22,7 @@
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/rwsem.h> 23#include <linux/rwsem.h>
24#include <linux/atomic.h> 24#include <linux/atomic.h>
25#include <linux/assoc_array.h>
25 26
26#ifdef __KERNEL__ 27#ifdef __KERNEL__
27#include <linux/uidgid.h> 28#include <linux/uidgid.h>
@@ -82,6 +83,12 @@ struct key_owner;
82struct keyring_list; 83struct keyring_list;
83struct keyring_name; 84struct keyring_name;
84 85
86struct keyring_index_key {
87 struct key_type *type;
88 const char *description;
89 size_t desc_len;
90};
91
85/*****************************************************************************/ 92/*****************************************************************************/
86/* 93/*
87 * key reference with possession attribute handling 94 * key reference with possession attribute handling
@@ -99,7 +106,7 @@ struct keyring_name;
99typedef struct __key_reference_with_attributes *key_ref_t; 106typedef struct __key_reference_with_attributes *key_ref_t;
100 107
101static inline key_ref_t make_key_ref(const struct key *key, 108static inline key_ref_t make_key_ref(const struct key *key,
102 unsigned long possession) 109 bool possession)
103{ 110{
104 return (key_ref_t) ((unsigned long) key | possession); 111 return (key_ref_t) ((unsigned long) key | possession);
105} 112}
@@ -109,7 +116,7 @@ static inline struct key *key_ref_to_ptr(const key_ref_t key_ref)
109 return (struct key *) ((unsigned long) key_ref & ~1UL); 116 return (struct key *) ((unsigned long) key_ref & ~1UL);
110} 117}
111 118
112static inline unsigned long is_key_possessed(const key_ref_t key_ref) 119static inline bool is_key_possessed(const key_ref_t key_ref)
113{ 120{
114 return (unsigned long) key_ref & 1UL; 121 return (unsigned long) key_ref & 1UL;
115} 122}
@@ -129,7 +136,6 @@ struct key {
129 struct list_head graveyard_link; 136 struct list_head graveyard_link;
130 struct rb_node serial_node; 137 struct rb_node serial_node;
131 }; 138 };
132 struct key_type *type; /* type of key */
133 struct rw_semaphore sem; /* change vs change sem */ 139 struct rw_semaphore sem; /* change vs change sem */
134 struct key_user *user; /* owner of this key */ 140 struct key_user *user; /* owner of this key */
135 void *security; /* security data for this key */ 141 void *security; /* security data for this key */
@@ -162,13 +168,21 @@ struct key {
162#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ 168#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
163#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ 169#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
164#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ 170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */
172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */
165 173
166 /* the description string 174 /* the key type and key description string
167 * - this is used to match a key against search criteria 175 * - the desc is used to match a key against search criteria
168 * - this should be a printable string 176 * - it should be a printable string
169 * - eg: for krb5 AFS, this might be "afs@REDHAT.COM" 177 * - eg: for krb5 AFS, this might be "afs@REDHAT.COM"
170 */ 178 */
171 char *description; 179 union {
180 struct keyring_index_key index_key;
181 struct {
182 struct key_type *type; /* type of key */
183 char *description;
184 };
185 };
172 186
173 /* type specific data 187 /* type specific data
174 * - this is used by the keyring type to index the name 188 * - this is used by the keyring type to index the name
@@ -185,11 +199,14 @@ struct key {
185 * whatever 199 * whatever
186 */ 200 */
187 union { 201 union {
188 unsigned long value; 202 union {
189 void __rcu *rcudata; 203 unsigned long value;
190 void *data; 204 void __rcu *rcudata;
191 struct keyring_list __rcu *subscriptions; 205 void *data;
192 } payload; 206 void *data2[2];
207 } payload;
208 struct assoc_array keys;
209 };
193}; 210};
194 211
195extern struct key *key_alloc(struct key_type *type, 212extern struct key *key_alloc(struct key_type *type,
@@ -203,18 +220,23 @@ extern struct key *key_alloc(struct key_type *type,
203#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */ 220#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
204#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */ 221#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
205#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 222#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
223#define KEY_ALLOC_TRUSTED 0x0004 /* Key should be flagged as trusted */
206 224
207extern void key_revoke(struct key *key); 225extern void key_revoke(struct key *key);
208extern void key_invalidate(struct key *key); 226extern void key_invalidate(struct key *key);
209extern void key_put(struct key *key); 227extern void key_put(struct key *key);
210 228
211static inline struct key *key_get(struct key *key) 229static inline struct key *__key_get(struct key *key)
212{ 230{
213 if (key) 231 atomic_inc(&key->usage);
214 atomic_inc(&key->usage);
215 return key; 232 return key;
216} 233}
217 234
235static inline struct key *key_get(struct key *key)
236{
237 return key ? __key_get(key) : key;
238}
239
218static inline void key_ref_put(key_ref_t key_ref) 240static inline void key_ref_put(key_ref_t key_ref)
219{ 241{
220 key_put(key_ref_to_ptr(key_ref)); 242 key_put(key_ref_to_ptr(key_ref));
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 10308c6a3d1c..552d51efb429 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * A generic kernel FIFO implementation 2 * A generic kernel FIFO implementation
3 * 3 *
4 * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net> 4 * Copyright (C) 2013 Stefani Seibold <stefani@seibold.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -67,9 +67,10 @@ struct __kfifo {
67 union { \ 67 union { \
68 struct __kfifo kfifo; \ 68 struct __kfifo kfifo; \
69 datatype *type; \ 69 datatype *type; \
70 const datatype *const_type; \
70 char (*rectype)[recsize]; \ 71 char (*rectype)[recsize]; \
71 ptrtype *ptr; \ 72 ptrtype *ptr; \
72 const ptrtype *ptr_const; \ 73 ptrtype const *ptr_const; \
73 } 74 }
74 75
75#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \ 76#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \
@@ -386,16 +387,12 @@ __kfifo_int_must_check_helper( \
386#define kfifo_put(fifo, val) \ 387#define kfifo_put(fifo, val) \
387({ \ 388({ \
388 typeof((fifo) + 1) __tmp = (fifo); \ 389 typeof((fifo) + 1) __tmp = (fifo); \
389 typeof((val) + 1) __val = (val); \ 390 typeof(*__tmp->const_type) __val = (val); \
390 unsigned int __ret; \ 391 unsigned int __ret; \
391 const size_t __recsize = sizeof(*__tmp->rectype); \ 392 size_t __recsize = sizeof(*__tmp->rectype); \
392 struct __kfifo *__kfifo = &__tmp->kfifo; \ 393 struct __kfifo *__kfifo = &__tmp->kfifo; \
393 if (0) { \
394 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
395 __dummy = (typeof(__val))NULL; \
396 } \
397 if (__recsize) \ 394 if (__recsize) \
398 __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \ 395 __ret = __kfifo_in_r(__kfifo, &__val, sizeof(__val), \
399 __recsize); \ 396 __recsize); \
400 else { \ 397 else { \
401 __ret = !kfifo_is_full(__tmp); \ 398 __ret = !kfifo_is_full(__tmp); \
@@ -404,7 +401,7 @@ __kfifo_int_must_check_helper( \
404 ((typeof(__tmp->type))__kfifo->data) : \ 401 ((typeof(__tmp->type))__kfifo->data) : \
405 (__tmp->buf) \ 402 (__tmp->buf) \
406 )[__kfifo->in & __tmp->kfifo.mask] = \ 403 )[__kfifo->in & __tmp->kfifo.mask] = \
407 *(typeof(__tmp->type))__val; \ 404 (typeof(*__tmp->type))__val; \
408 smp_wmb(); \ 405 smp_wmb(); \
409 __kfifo->in++; \ 406 __kfifo->in++; \
410 } \ 407 } \
@@ -415,7 +412,7 @@ __kfifo_int_must_check_helper( \
415/** 412/**
416 * kfifo_get - get data from the fifo 413 * kfifo_get - get data from the fifo
417 * @fifo: address of the fifo to be used 414 * @fifo: address of the fifo to be used
418 * @val: the var where to store the data to be added 415 * @val: address where to store the data
419 * 416 *
420 * This macro reads the data from the fifo. 417 * This macro reads the data from the fifo.
421 * It returns 0 if the fifo was empty. Otherwise it returns the number 418 * It returns 0 if the fifo was empty. Otherwise it returns the number
@@ -428,12 +425,10 @@ __kfifo_int_must_check_helper( \
428__kfifo_uint_must_check_helper( \ 425__kfifo_uint_must_check_helper( \
429({ \ 426({ \
430 typeof((fifo) + 1) __tmp = (fifo); \ 427 typeof((fifo) + 1) __tmp = (fifo); \
431 typeof((val) + 1) __val = (val); \ 428 typeof(__tmp->ptr) __val = (val); \
432 unsigned int __ret; \ 429 unsigned int __ret; \
433 const size_t __recsize = sizeof(*__tmp->rectype); \ 430 const size_t __recsize = sizeof(*__tmp->rectype); \
434 struct __kfifo *__kfifo = &__tmp->kfifo; \ 431 struct __kfifo *__kfifo = &__tmp->kfifo; \
435 if (0) \
436 __val = (typeof(__tmp->ptr))0; \
437 if (__recsize) \ 432 if (__recsize) \
438 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \ 433 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \
439 __recsize); \ 434 __recsize); \
@@ -456,7 +451,7 @@ __kfifo_uint_must_check_helper( \
456/** 451/**
457 * kfifo_peek - get data from the fifo without removing 452 * kfifo_peek - get data from the fifo without removing
458 * @fifo: address of the fifo to be used 453 * @fifo: address of the fifo to be used
459 * @val: the var where to store the data to be added 454 * @val: address where to store the data
460 * 455 *
461 * This reads the data from the fifo without removing it from the fifo. 456 * This reads the data from the fifo without removing it from the fifo.
462 * It returns 0 if the fifo was empty. Otherwise it returns the number 457 * It returns 0 if the fifo was empty. Otherwise it returns the number
@@ -469,12 +464,10 @@ __kfifo_uint_must_check_helper( \
469__kfifo_uint_must_check_helper( \ 464__kfifo_uint_must_check_helper( \
470({ \ 465({ \
471 typeof((fifo) + 1) __tmp = (fifo); \ 466 typeof((fifo) + 1) __tmp = (fifo); \
472 typeof((val) + 1) __val = (val); \ 467 typeof(__tmp->ptr) __val = (val); \
473 unsigned int __ret; \ 468 unsigned int __ret; \
474 const size_t __recsize = sizeof(*__tmp->rectype); \ 469 const size_t __recsize = sizeof(*__tmp->rectype); \
475 struct __kfifo *__kfifo = &__tmp->kfifo; \ 470 struct __kfifo *__kfifo = &__tmp->kfifo; \
476 if (0) \
477 __val = (typeof(__tmp->ptr))NULL; \
478 if (__recsize) \ 471 if (__recsize) \
479 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \ 472 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \
480 __recsize); \ 473 __recsize); \
@@ -508,14 +501,10 @@ __kfifo_uint_must_check_helper( \
508#define kfifo_in(fifo, buf, n) \ 501#define kfifo_in(fifo, buf, n) \
509({ \ 502({ \
510 typeof((fifo) + 1) __tmp = (fifo); \ 503 typeof((fifo) + 1) __tmp = (fifo); \
511 typeof((buf) + 1) __buf = (buf); \ 504 typeof(__tmp->ptr_const) __buf = (buf); \
512 unsigned long __n = (n); \ 505 unsigned long __n = (n); \
513 const size_t __recsize = sizeof(*__tmp->rectype); \ 506 const size_t __recsize = sizeof(*__tmp->rectype); \
514 struct __kfifo *__kfifo = &__tmp->kfifo; \ 507 struct __kfifo *__kfifo = &__tmp->kfifo; \
515 if (0) { \
516 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
517 __dummy = (typeof(__buf))NULL; \
518 } \
519 (__recsize) ?\ 508 (__recsize) ?\
520 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \ 509 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \
521 __kfifo_in(__kfifo, __buf, __n); \ 510 __kfifo_in(__kfifo, __buf, __n); \
@@ -561,14 +550,10 @@ __kfifo_uint_must_check_helper( \
561__kfifo_uint_must_check_helper( \ 550__kfifo_uint_must_check_helper( \
562({ \ 551({ \
563 typeof((fifo) + 1) __tmp = (fifo); \ 552 typeof((fifo) + 1) __tmp = (fifo); \
564 typeof((buf) + 1) __buf = (buf); \ 553 typeof(__tmp->ptr) __buf = (buf); \
565 unsigned long __n = (n); \ 554 unsigned long __n = (n); \
566 const size_t __recsize = sizeof(*__tmp->rectype); \ 555 const size_t __recsize = sizeof(*__tmp->rectype); \
567 struct __kfifo *__kfifo = &__tmp->kfifo; \ 556 struct __kfifo *__kfifo = &__tmp->kfifo; \
568 if (0) { \
569 typeof(__tmp->ptr) __dummy = NULL; \
570 __buf = __dummy; \
571 } \
572 (__recsize) ?\ 557 (__recsize) ?\
573 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \ 558 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \
574 __kfifo_out(__kfifo, __buf, __n); \ 559 __kfifo_out(__kfifo, __buf, __n); \
@@ -773,14 +758,10 @@ __kfifo_uint_must_check_helper( \
773__kfifo_uint_must_check_helper( \ 758__kfifo_uint_must_check_helper( \
774({ \ 759({ \
775 typeof((fifo) + 1) __tmp = (fifo); \ 760 typeof((fifo) + 1) __tmp = (fifo); \
776 typeof((buf) + 1) __buf = (buf); \ 761 typeof(__tmp->ptr) __buf = (buf); \
777 unsigned long __n = (n); \ 762 unsigned long __n = (n); \
778 const size_t __recsize = sizeof(*__tmp->rectype); \ 763 const size_t __recsize = sizeof(*__tmp->rectype); \
779 struct __kfifo *__kfifo = &__tmp->kfifo; \ 764 struct __kfifo *__kfifo = &__tmp->kfifo; \
780 if (0) { \
781 typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \
782 __buf = __dummy; \
783 } \
784 (__recsize) ? \ 765 (__recsize) ? \
785 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \ 766 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \
786 __kfifo_out_peek(__kfifo, __buf, __n); \ 767 __kfifo_out_peek(__kfifo, __buf, __n); \
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index c6e091bf39a5..dfb4f2ffdaa2 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -310,6 +310,7 @@ extern int
310kgdb_handle_exception(int ex_vector, int signo, int err_code, 310kgdb_handle_exception(int ex_vector, int signo, int err_code,
311 struct pt_regs *regs); 311 struct pt_regs *regs);
312extern int kgdb_nmicallback(int cpu, void *regs); 312extern int kgdb_nmicallback(int cpu, void *regs);
313extern int kgdb_nmicallin(int cpu, int trapnr, void *regs, atomic_t *snd_rdy);
313extern void gdbstub_exit(int status); 314extern void gdbstub_exit(int status);
314 315
315extern int kgdb_single_step; 316extern int kgdb_single_step;
diff --git a/include/linux/kobj_completion.h b/include/linux/kobj_completion.h
new file mode 100644
index 000000000000..a428f6436063
--- /dev/null
+++ b/include/linux/kobj_completion.h
@@ -0,0 +1,18 @@
1#ifndef _KOBJ_COMPLETION_H_
2#define _KOBJ_COMPLETION_H_
3
4#include <linux/kobject.h>
5#include <linux/completion.h>
6
7struct kobj_completion {
8 struct kobject kc_kobj;
9 struct completion kc_unregister;
10};
11
12#define kobj_to_kobj_completion(kobj) \
13 container_of(kobj, struct kobj_completion, kc_kobj)
14
15void kobj_completion_init(struct kobj_completion *kc, struct kobj_type *ktype);
16void kobj_completion_release(struct kobject *kobj);
17void kobj_completion_del_and_wait(struct kobj_completion *kc);
18#endif /* _KOBJ_COMPLETION_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index de6dcbcc6ef7..e7ba650086ce 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -107,6 +107,7 @@ extern int __must_check kobject_move(struct kobject *, struct kobject *);
107extern struct kobject *kobject_get(struct kobject *kobj); 107extern struct kobject *kobject_get(struct kobject *kobj);
108extern void kobject_put(struct kobject *kobj); 108extern void kobject_put(struct kobject *kobj);
109 109
110extern const void *kobject_namespace(struct kobject *kobj);
110extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 111extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
111 112
112struct kobj_type { 113struct kobj_type {
diff --git a/include/linux/kobject_ns.h b/include/linux/kobject_ns.h
index f66b065a8b5f..df32d2508290 100644
--- a/include/linux/kobject_ns.h
+++ b/include/linux/kobject_ns.h
@@ -39,6 +39,7 @@ enum kobj_ns_type {
39 */ 39 */
40struct kobj_ns_type_operations { 40struct kobj_ns_type_operations {
41 enum kobj_ns_type type; 41 enum kobj_ns_type type;
42 bool (*current_may_mount)(void);
42 void *(*grab_current_ns)(void); 43 void *(*grab_current_ns)(void);
43 const void *(*netlink_ns)(struct sock *sk); 44 const void *(*netlink_ns)(struct sock *sk);
44 const void *(*initial_ns)(void); 45 const void *(*initial_ns)(void);
@@ -50,6 +51,7 @@ int kobj_ns_type_registered(enum kobj_ns_type type);
50const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); 51const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
51const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); 52const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
52 53
54bool kobj_ns_current_may_mount(enum kobj_ns_type type);
53void *kobj_ns_grab_current(enum kobj_ns_type type); 55void *kobj_ns_grab_current(enum kobj_ns_type type);
54const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); 56const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
55const void *kobj_ns_initial(enum kobj_ns_type type); 57const void *kobj_ns_initial(enum kobj_ns_type type);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ca1d27a0d6a6..925eaf28fca9 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -264,10 +264,36 @@ extern void arch_arm_kprobe(struct kprobe *p);
264extern void arch_disarm_kprobe(struct kprobe *p); 264extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern kprobe_opcode_t *get_insn_slot(void);
268extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
269extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
270 268
269struct kprobe_insn_cache {
270 struct mutex mutex;
271 void *(*alloc)(void); /* allocate insn page */
272 void (*free)(void *); /* free insn page */
273 struct list_head pages; /* list of kprobe_insn_page */
274 size_t insn_size; /* size of instruction slot */
275 int nr_garbage;
276};
277
278extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
279extern void __free_insn_slot(struct kprobe_insn_cache *c,
280 kprobe_opcode_t *slot, int dirty);
281
282#define DEFINE_INSN_CACHE_OPS(__name) \
283extern struct kprobe_insn_cache kprobe_##__name##_slots; \
284 \
285static inline kprobe_opcode_t *get_##__name##_slot(void) \
286{ \
287 return __get_insn_slot(&kprobe_##__name##_slots); \
288} \
289 \
290static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\
291{ \
292 __free_insn_slot(&kprobe_##__name##_slots, slot, dirty); \
293} \
294
295DEFINE_INSN_CACHE_OPS(insn);
296
271#ifdef CONFIG_OPTPROBES 297#ifdef CONFIG_OPTPROBES
272/* 298/*
273 * Internal structure for direct jump optimized probe 299 * Internal structure for direct jump optimized probe
@@ -287,13 +313,13 @@ extern void arch_optimize_kprobes(struct list_head *oplist);
287extern void arch_unoptimize_kprobes(struct list_head *oplist, 313extern void arch_unoptimize_kprobes(struct list_head *oplist,
288 struct list_head *done_list); 314 struct list_head *done_list);
289extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); 315extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
290extern kprobe_opcode_t *get_optinsn_slot(void);
291extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
292extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, 316extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
293 unsigned long addr); 317 unsigned long addr);
294 318
295extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); 319extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
296 320
321DEFINE_INSN_CACHE_OPS(optinsn);
322
297#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
298extern int sysctl_kprobes_optimization; 324extern int sysctl_kprobes_optimization;
299extern int proc_kprobes_optimization_handler(struct ctl_table *table, 325extern int proc_kprobes_optimization_handler(struct ctl_table *table,
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ca645a01d37a..9523d2ad7535 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -142,7 +142,7 @@ struct kvm;
142struct kvm_vcpu; 142struct kvm_vcpu;
143extern struct kmem_cache *kvm_vcpu_cache; 143extern struct kmem_cache *kvm_vcpu_cache;
144 144
145extern raw_spinlock_t kvm_lock; 145extern spinlock_t kvm_lock;
146extern struct list_head vm_list; 146extern struct list_head vm_list;
147 147
148struct kvm_io_range { 148struct kvm_io_range {
@@ -189,8 +189,7 @@ struct kvm_async_pf {
189 gva_t gva; 189 gva_t gva;
190 unsigned long addr; 190 unsigned long addr;
191 struct kvm_arch_async_pf arch; 191 struct kvm_arch_async_pf arch;
192 struct page *page; 192 bool wakeup_all;
193 bool done;
194}; 193};
195 194
196void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu); 195void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu);
@@ -508,9 +507,10 @@ int kvm_set_memory_region(struct kvm *kvm,
508 struct kvm_userspace_memory_region *mem); 507 struct kvm_userspace_memory_region *mem);
509int __kvm_set_memory_region(struct kvm *kvm, 508int __kvm_set_memory_region(struct kvm *kvm,
510 struct kvm_userspace_memory_region *mem); 509 struct kvm_userspace_memory_region *mem);
511void kvm_arch_free_memslot(struct kvm_memory_slot *free, 510void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
512 struct kvm_memory_slot *dont); 511 struct kvm_memory_slot *dont);
513int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 512int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
513 unsigned long npages);
514void kvm_arch_memslots_updated(struct kvm *kvm); 514void kvm_arch_memslots_updated(struct kvm *kvm);
515int kvm_arch_prepare_memory_region(struct kvm *kvm, 515int kvm_arch_prepare_memory_region(struct kvm *kvm,
516 struct kvm_memory_slot *memslot, 516 struct kvm_memory_slot *memslot,
@@ -533,6 +533,7 @@ int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages,
533 533
534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
536unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
536unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 537unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
537void kvm_release_page_clean(struct page *page); 538void kvm_release_page_clean(struct page *page);
538void kvm_release_page_dirty(struct page *page); 539void kvm_release_page_dirty(struct page *page);
@@ -670,6 +671,25 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
670} 671}
671#endif 672#endif
672 673
674#ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA
675void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
676void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
677bool kvm_arch_has_noncoherent_dma(struct kvm *kvm);
678#else
679static inline void kvm_arch_register_noncoherent_dma(struct kvm *kvm)
680{
681}
682
683static inline void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm)
684{
685}
686
687static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
688{
689 return false;
690}
691#endif
692
673static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) 693static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
674{ 694{
675#ifdef __KVM_HAVE_ARCH_WQP 695#ifdef __KVM_HAVE_ARCH_WQP
@@ -746,9 +766,6 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
746int kvm_request_irq_source_id(struct kvm *kvm); 766int kvm_request_irq_source_id(struct kvm *kvm);
747void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 767void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
748 768
749/* For vcpu->arch.iommu_flags */
750#define KVM_IOMMU_CACHE_COHERENCY 0x1
751
752#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT 769#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
753int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 770int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
754void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 771void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
@@ -788,7 +805,7 @@ static inline void kvm_guest_enter(void)
788 805
789 /* KVM does not hold any references to rcu protected data when it 806 /* KVM does not hold any references to rcu protected data when it
790 * switches CPU into a guest mode. In fact switching to a guest mode 807 * switches CPU into a guest mode. In fact switching to a guest mode
791 * is very similar to exiting to userspase from rcu point of view. In 808 * is very similar to exiting to userspace from rcu point of view. In
792 * addition CPU may stay in a guest mode for quite a long time (up to 809 * addition CPU may stay in a guest mode for quite a long time (up to
793 * one time slice). Lets treat guest mode as quiescent state, just like 810 * one time slice). Lets treat guest mode as quiescent state, just like
794 * we do with user-mode execution. 811 * we do with user-mode execution.
@@ -841,13 +858,6 @@ static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
841 return gfn_to_memslot(kvm, gfn)->id; 858 return gfn_to_memslot(kvm, gfn)->id;
842} 859}
843 860
844static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
845{
846 /* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
847 return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
848 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
849}
850
851static inline gfn_t 861static inline gfn_t
852hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot) 862hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot)
853{ 863{
@@ -1065,6 +1075,7 @@ struct kvm_device *kvm_device_from_filp(struct file *filp);
1065 1075
1066extern struct kvm_device_ops kvm_mpic_ops; 1076extern struct kvm_device_ops kvm_mpic_ops;
1067extern struct kvm_device_ops kvm_xics_ops; 1077extern struct kvm_device_ops kvm_xics_ops;
1078extern struct kvm_device_ops kvm_vfio_ops;
1068 1079
1069#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1080#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1070 1081
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index 0d24e932db0b..96549abe8842 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -25,16 +25,6 @@
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/notifier.h> 26#include <linux/notifier.h>
27 27
28/* can make br locks by using local lock for read side, global lock for write */
29#define br_lock_init(name) lg_lock_init(name, #name)
30#define br_read_lock(name) lg_local_lock(name)
31#define br_read_unlock(name) lg_local_unlock(name)
32#define br_write_lock(name) lg_global_lock(name)
33#define br_write_unlock(name) lg_global_unlock(name)
34
35#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
36#define DEFINE_STATIC_BRLOCK(name) DEFINE_STATIC_LGLOCK(name)
37
38#ifdef CONFIG_DEBUG_LOCK_ALLOC 28#ifdef CONFIG_DEBUG_LOCK_ALLOC
39#define LOCKDEP_INIT_MAP lockdep_init_map 29#define LOCKDEP_INIT_MAP lockdep_init_map
40#else 30#else
diff --git a/include/linux/list.h b/include/linux/list.h
index f4d8a2f12a33..ef9594171062 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -362,6 +362,17 @@ static inline void list_splice_tail_init(struct list_head *list,
362 list_entry((ptr)->next, type, member) 362 list_entry((ptr)->next, type, member)
363 363
364/** 364/**
365 * list_last_entry - get the last element from a list
366 * @ptr: the list head to take the element from.
367 * @type: the type of the struct this is embedded in.
368 * @member: the name of the list_struct within the struct.
369 *
370 * Note, that list is expected to be not empty.
371 */
372#define list_last_entry(ptr, type, member) \
373 list_entry((ptr)->prev, type, member)
374
375/**
365 * list_first_entry_or_null - get the first element from a list 376 * list_first_entry_or_null - get the first element from a list
366 * @ptr: the list head to take the element from. 377 * @ptr: the list head to take the element from.
367 * @type: the type of the struct this is embedded in. 378 * @type: the type of the struct this is embedded in.
@@ -373,6 +384,22 @@ static inline void list_splice_tail_init(struct list_head *list,
373 (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) 384 (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
374 385
375/** 386/**
387 * list_next_entry - get the next element in list
388 * @pos: the type * to cursor
389 * @member: the name of the list_struct within the struct.
390 */
391#define list_next_entry(pos, member) \
392 list_entry((pos)->member.next, typeof(*(pos)), member)
393
394/**
395 * list_prev_entry - get the prev element in list
396 * @pos: the type * to cursor
397 * @member: the name of the list_struct within the struct.
398 */
399#define list_prev_entry(pos, member) \
400 list_entry((pos)->member.prev, typeof(*(pos)), member)
401
402/**
376 * list_for_each - iterate over a list 403 * list_for_each - iterate over a list
377 * @pos: the &struct list_head to use as a loop cursor. 404 * @pos: the &struct list_head to use as a loop cursor.
378 * @head: the head for your list. 405 * @head: the head for your list.
@@ -416,9 +443,9 @@ static inline void list_splice_tail_init(struct list_head *list,
416 * @member: the name of the list_struct within the struct. 443 * @member: the name of the list_struct within the struct.
417 */ 444 */
418#define list_for_each_entry(pos, head, member) \ 445#define list_for_each_entry(pos, head, member) \
419 for (pos = list_entry((head)->next, typeof(*pos), member); \ 446 for (pos = list_first_entry(head, typeof(*pos), member); \
420 &pos->member != (head); \ 447 &pos->member != (head); \
421 pos = list_entry(pos->member.next, typeof(*pos), member)) 448 pos = list_next_entry(pos, member))
422 449
423/** 450/**
424 * list_for_each_entry_reverse - iterate backwards over list of given type. 451 * list_for_each_entry_reverse - iterate backwards over list of given type.
@@ -427,9 +454,9 @@ static inline void list_splice_tail_init(struct list_head *list,
427 * @member: the name of the list_struct within the struct. 454 * @member: the name of the list_struct within the struct.
428 */ 455 */
429#define list_for_each_entry_reverse(pos, head, member) \ 456#define list_for_each_entry_reverse(pos, head, member) \
430 for (pos = list_entry((head)->prev, typeof(*pos), member); \ 457 for (pos = list_last_entry(head, typeof(*pos), member); \
431 &pos->member != (head); \ 458 &pos->member != (head); \
432 pos = list_entry(pos->member.prev, typeof(*pos), member)) 459 pos = list_prev_entry(pos, member))
433 460
434/** 461/**
435 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() 462 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
@@ -452,9 +479,9 @@ static inline void list_splice_tail_init(struct list_head *list,
452 * the current position. 479 * the current position.
453 */ 480 */
454#define list_for_each_entry_continue(pos, head, member) \ 481#define list_for_each_entry_continue(pos, head, member) \
455 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 482 for (pos = list_next_entry(pos, member); \
456 &pos->member != (head); \ 483 &pos->member != (head); \
457 pos = list_entry(pos->member.next, typeof(*pos), member)) 484 pos = list_next_entry(pos, member))
458 485
459/** 486/**
460 * list_for_each_entry_continue_reverse - iterate backwards from the given point 487 * list_for_each_entry_continue_reverse - iterate backwards from the given point
@@ -466,9 +493,9 @@ static inline void list_splice_tail_init(struct list_head *list,
466 * the current position. 493 * the current position.
467 */ 494 */
468#define list_for_each_entry_continue_reverse(pos, head, member) \ 495#define list_for_each_entry_continue_reverse(pos, head, member) \
469 for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ 496 for (pos = list_prev_entry(pos, member); \
470 &pos->member != (head); \ 497 &pos->member != (head); \
471 pos = list_entry(pos->member.prev, typeof(*pos), member)) 498 pos = list_prev_entry(pos, member))
472 499
473/** 500/**
474 * list_for_each_entry_from - iterate over list of given type from the current point 501 * list_for_each_entry_from - iterate over list of given type from the current point
@@ -479,8 +506,8 @@ static inline void list_splice_tail_init(struct list_head *list,
479 * Iterate over list of given type, continuing from current position. 506 * Iterate over list of given type, continuing from current position.
480 */ 507 */
481#define list_for_each_entry_from(pos, head, member) \ 508#define list_for_each_entry_from(pos, head, member) \
482 for (; &pos->member != (head); \ 509 for (; &pos->member != (head); \
483 pos = list_entry(pos->member.next, typeof(*pos), member)) 510 pos = list_next_entry(pos, member))
484 511
485/** 512/**
486 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 513 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
@@ -490,10 +517,10 @@ static inline void list_splice_tail_init(struct list_head *list,
490 * @member: the name of the list_struct within the struct. 517 * @member: the name of the list_struct within the struct.
491 */ 518 */
492#define list_for_each_entry_safe(pos, n, head, member) \ 519#define list_for_each_entry_safe(pos, n, head, member) \
493 for (pos = list_entry((head)->next, typeof(*pos), member), \ 520 for (pos = list_first_entry(head, typeof(*pos), member), \
494 n = list_entry(pos->member.next, typeof(*pos), member); \ 521 n = list_next_entry(pos, member); \
495 &pos->member != (head); \ 522 &pos->member != (head); \
496 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 523 pos = n, n = list_next_entry(n, member))
497 524
498/** 525/**
499 * list_for_each_entry_safe_continue - continue list iteration safe against removal 526 * list_for_each_entry_safe_continue - continue list iteration safe against removal
@@ -506,10 +533,10 @@ static inline void list_splice_tail_init(struct list_head *list,
506 * safe against removal of list entry. 533 * safe against removal of list entry.
507 */ 534 */
508#define list_for_each_entry_safe_continue(pos, n, head, member) \ 535#define list_for_each_entry_safe_continue(pos, n, head, member) \
509 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 536 for (pos = list_next_entry(pos, member), \
510 n = list_entry(pos->member.next, typeof(*pos), member); \ 537 n = list_next_entry(pos, member); \
511 &pos->member != (head); \ 538 &pos->member != (head); \
512 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 539 pos = n, n = list_next_entry(n, member))
513 540
514/** 541/**
515 * list_for_each_entry_safe_from - iterate over list from current point safe against removal 542 * list_for_each_entry_safe_from - iterate over list from current point safe against removal
@@ -522,9 +549,9 @@ static inline void list_splice_tail_init(struct list_head *list,
522 * removal of list entry. 549 * removal of list entry.
523 */ 550 */
524#define list_for_each_entry_safe_from(pos, n, head, member) \ 551#define list_for_each_entry_safe_from(pos, n, head, member) \
525 for (n = list_entry(pos->member.next, typeof(*pos), member); \ 552 for (n = list_next_entry(pos, member); \
526 &pos->member != (head); \ 553 &pos->member != (head); \
527 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 554 pos = n, n = list_next_entry(n, member))
528 555
529/** 556/**
530 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal 557 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
@@ -537,10 +564,10 @@ static inline void list_splice_tail_init(struct list_head *list,
537 * of list entry. 564 * of list entry.
538 */ 565 */
539#define list_for_each_entry_safe_reverse(pos, n, head, member) \ 566#define list_for_each_entry_safe_reverse(pos, n, head, member) \
540 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 567 for (pos = list_last_entry(head, typeof(*pos), member), \
541 n = list_entry(pos->member.prev, typeof(*pos), member); \ 568 n = list_prev_entry(pos, member); \
542 &pos->member != (head); \ 569 &pos->member != (head); \
543 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 570 pos = n, n = list_prev_entry(n, member))
544 571
545/** 572/**
546 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop 573 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
@@ -555,7 +582,7 @@ static inline void list_splice_tail_init(struct list_head *list,
555 * completing the current iteration of the loop body. 582 * completing the current iteration of the loop body.
556 */ 583 */
557#define list_safe_reset_next(pos, n, member) \ 584#define list_safe_reset_next(pos, n, member) \
558 n = list_entry(pos->member.next, typeof(*pos), member) 585 n = list_next_entry(pos, member)
559 586
560/* 587/*
561 * Double linked lists with a single pointer list head. 588 * Double linked lists with a single pointer list head.
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
new file mode 100644
index 000000000000..3ce541753c88
--- /dev/null
+++ b/include/linux/list_lru.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (c) 2013 Red Hat, Inc. and Parallels Inc. All rights reserved.
3 * Authors: David Chinner and Glauber Costa
4 *
5 * Generic LRU infrastructure
6 */
7#ifndef _LRU_LIST_H
8#define _LRU_LIST_H
9
10#include <linux/list.h>
11#include <linux/nodemask.h>
12
13/* list_lru_walk_cb has to always return one of those */
14enum lru_status {
15 LRU_REMOVED, /* item removed from list */
16 LRU_ROTATE, /* item referenced, give another pass */
17 LRU_SKIP, /* item cannot be locked, skip */
18 LRU_RETRY, /* item not freeable. May drop the lock
19 internally, but has to return locked. */
20};
21
22struct list_lru_node {
23 spinlock_t lock;
24 struct list_head list;
25 /* kept as signed so we can catch imbalance bugs */
26 long nr_items;
27} ____cacheline_aligned_in_smp;
28
29struct list_lru {
30 struct list_lru_node *node;
31 nodemask_t active_nodes;
32};
33
34void list_lru_destroy(struct list_lru *lru);
35int list_lru_init(struct list_lru *lru);
36
37/**
38 * list_lru_add: add an element to the lru list's tail
39 * @list_lru: the lru pointer
40 * @item: the item to be added.
41 *
42 * If the element is already part of a list, this function returns doing
43 * nothing. Therefore the caller does not need to keep state about whether or
44 * not the element already belongs in the list and is allowed to lazy update
45 * it. Note however that this is valid for *a* list, not *this* list. If
46 * the caller organize itself in a way that elements can be in more than
47 * one type of list, it is up to the caller to fully remove the item from
48 * the previous list (with list_lru_del() for instance) before moving it
49 * to @list_lru
50 *
51 * Return value: true if the list was updated, false otherwise
52 */
53bool list_lru_add(struct list_lru *lru, struct list_head *item);
54
55/**
56 * list_lru_del: delete an element to the lru list
57 * @list_lru: the lru pointer
58 * @item: the item to be deleted.
59 *
60 * This function works analogously as list_lru_add in terms of list
61 * manipulation. The comments about an element already pertaining to
62 * a list are also valid for list_lru_del.
63 *
64 * Return value: true if the list was updated, false otherwise
65 */
66bool list_lru_del(struct list_lru *lru, struct list_head *item);
67
68/**
69 * list_lru_count_node: return the number of objects currently held by @lru
70 * @lru: the lru pointer.
71 * @nid: the node id to count from.
72 *
73 * Always return a non-negative number, 0 for empty lists. There is no
74 * guarantee that the list is not updated while the count is being computed.
75 * Callers that want such a guarantee need to provide an outer lock.
76 */
77unsigned long list_lru_count_node(struct list_lru *lru, int nid);
78static inline unsigned long list_lru_count(struct list_lru *lru)
79{
80 long count = 0;
81 int nid;
82
83 for_each_node_mask(nid, lru->active_nodes)
84 count += list_lru_count_node(lru, nid);
85
86 return count;
87}
88
89typedef enum lru_status
90(*list_lru_walk_cb)(struct list_head *item, spinlock_t *lock, void *cb_arg);
91/**
92 * list_lru_walk_node: walk a list_lru, isolating and disposing freeable items.
93 * @lru: the lru pointer.
94 * @nid: the node id to scan from.
95 * @isolate: callback function that is resposible for deciding what to do with
96 * the item currently being scanned
97 * @cb_arg: opaque type that will be passed to @isolate
98 * @nr_to_walk: how many items to scan.
99 *
100 * This function will scan all elements in a particular list_lru, calling the
101 * @isolate callback for each of those items, along with the current list
102 * spinlock and a caller-provided opaque. The @isolate callback can choose to
103 * drop the lock internally, but *must* return with the lock held. The callback
104 * will return an enum lru_status telling the list_lru infrastructure what to
105 * do with the object being scanned.
106 *
107 * Please note that nr_to_walk does not mean how many objects will be freed,
108 * just how many objects will be scanned.
109 *
110 * Return value: the number of objects effectively removed from the LRU.
111 */
112unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
113 list_lru_walk_cb isolate, void *cb_arg,
114 unsigned long *nr_to_walk);
115
116static inline unsigned long
117list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
118 void *cb_arg, unsigned long nr_to_walk)
119{
120 long isolated = 0;
121 int nid;
122
123 for_each_node_mask(nid, lru->active_nodes) {
124 isolated += list_lru_walk_node(lru, nid, isolate,
125 cb_arg, &nr_to_walk);
126 if (nr_to_walk <= 0)
127 break;
128 }
129 return isolated;
130}
131#endif /* _LRU_LIST_H */
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 8828a78dec9a..fbf10a0bc095 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -195,4 +195,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
195 195
196extern struct llist_node *llist_del_first(struct llist_head *head); 196extern struct llist_node *llist_del_first(struct llist_head *head);
197 197
198struct llist_node *llist_reverse_order(struct llist_node *head);
199
198#endif /* LLIST_H */ 200#endif /* LLIST_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index cfc2f119779a..92b1bfc5da60 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -497,6 +497,10 @@ static inline void print_irqtrace_events(struct task_struct *curr)
497#define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i) 497#define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i)
498#define rwlock_release(l, n, i) lock_release(l, n, i) 498#define rwlock_release(l, n, i) lock_release(l, n, i)
499 499
500#define seqcount_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
501#define seqcount_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i)
502#define seqcount_release(l, n, i) lock_release(l, n, i)
503
500#define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) 504#define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
501#define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) 505#define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
502#define mutex_release(l, n, i) lock_release(l, n, i) 506#define mutex_release(l, n, i) lock_release(l, n, i)
@@ -504,11 +508,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
504#define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) 508#define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
505#define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) 509#define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
506#define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i) 510#define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i)
507# define rwsem_release(l, n, i) lock_release(l, n, i) 511#define rwsem_release(l, n, i) lock_release(l, n, i)
508 512
509#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) 513#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
510#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) 514#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
511# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 515#define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
512 516
513#ifdef CONFIG_PROVE_LOCKING 517#ifdef CONFIG_PROVE_LOCKING
514# define might_lock(lock) \ 518# define might_lock(lock) \
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index ca07b5028b01..c8929c3832db 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -15,10 +15,15 @@
15 */ 15 */
16 16
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <generated/bounds.h>
19
20#define USE_CMPXCHG_LOCKREF \
21 (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
22 IS_ENABLED(CONFIG_SMP) && !BLOATED_SPINLOCKS)
18 23
19struct lockref { 24struct lockref {
20 union { 25 union {
21#ifdef CONFIG_CMPXCHG_LOCKREF 26#if USE_CMPXCHG_LOCKREF
22 aligned_u64 lock_count; 27 aligned_u64 lock_count;
23#endif 28#endif
24 struct { 29 struct {
@@ -33,4 +38,13 @@ extern int lockref_get_not_zero(struct lockref *);
33extern int lockref_get_or_lock(struct lockref *); 38extern int lockref_get_or_lock(struct lockref *);
34extern int lockref_put_or_lock(struct lockref *); 39extern int lockref_put_or_lock(struct lockref *);
35 40
41extern void lockref_mark_dead(struct lockref *);
42extern int lockref_get_not_dead(struct lockref *);
43
44/* Must be called under spinlock for reliable results */
45static inline int __lockref_is_dead(const struct lockref *l)
46{
47 return ((int)l->count < 0);
48}
49
36#endif /* __LINUX_LOCKREF_H */ 50#endif /* __LINUX_LOCKREF_H */
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
index d21c13f10a64..4356686b0a39 100644
--- a/include/linux/lz4.h
+++ b/include/linux/lz4.h
@@ -67,8 +67,8 @@ int lz4hc_compress(const unsigned char *src, size_t src_len,
67 * note : Destination buffer must be already allocated. 67 * note : Destination buffer must be already allocated.
68 * slightly faster than lz4_decompress_unknownoutputsize() 68 * slightly faster than lz4_decompress_unknownoutputsize()
69 */ 69 */
70int lz4_decompress(const char *src, size_t *src_len, char *dest, 70int lz4_decompress(const unsigned char *src, size_t *src_len,
71 size_t actual_dest_len); 71 unsigned char *dest, size_t actual_dest_len);
72 72
73/* 73/*
74 * lz4_decompress_unknownoutputsize() 74 * lz4_decompress_unknownoutputsize()
@@ -82,6 +82,6 @@ int lz4_decompress(const char *src, size_t *src_len, char *dest,
82 * Error if return (< 0) 82 * Error if return (< 0)
83 * note : Destination buffer must be already allocated. 83 * note : Destination buffer must be already allocated.
84 */ 84 */
85int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, 85int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len,
86 char *dest, size_t *dest_len); 86 unsigned char *dest, size_t *dest_len);
87#endif 87#endif
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 2913b86eb12a..69ed5f5e9f6e 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -31,6 +31,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
31} 31}
32 32
33/** 33/**
34 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
35 */
36static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
37{
38 *remainder = dividend % divisor;
39 return dividend / divisor;
40}
41
42/**
34 * div64_u64 - unsigned 64bit divide with 64bit divisor 43 * div64_u64 - unsigned 64bit divide with 64bit divisor
35 */ 44 */
36static inline u64 div64_u64(u64 dividend, u64 divisor) 45static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -63,6 +72,10 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
63extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); 72extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
64#endif 73#endif
65 74
75#ifndef div64_u64_rem
76extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
77#endif
78
66#ifndef div64_u64 79#ifndef div64_u64
67extern u64 div64_u64(u64 dividend, u64 divisor); 80extern u64 div64_u64(u64 dividend, u64 divisor);
68#endif 81#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index dba482e31a13..345b8c53b897 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -11,6 +11,8 @@
11#ifndef __LINUX_MBUS_H 11#ifndef __LINUX_MBUS_H
12#define __LINUX_MBUS_H 12#define __LINUX_MBUS_H
13 13
14struct resource;
15
14struct mbus_dram_target_info 16struct mbus_dram_target_info
15{ 17{
16 /* 18 /*
@@ -59,14 +61,18 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
59} 61}
60#endif 62#endif
61 63
62int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, 64void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
63 size_t size, phys_addr_t remap, 65void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
64 unsigned int flags); 66int mvebu_mbus_add_window_remap_by_id(unsigned int target,
65int mvebu_mbus_add_window(const char *devname, phys_addr_t base, 67 unsigned int attribute,
66 size_t size); 68 phys_addr_t base, size_t size,
69 phys_addr_t remap);
70int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
71 phys_addr_t base, size_t size);
67int mvebu_mbus_del_window(phys_addr_t base, size_t size); 72int mvebu_mbus_del_window(phys_addr_t base, size_t size);
68int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, 73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
69 size_t mbus_size, phys_addr_t sdram_phys_base, 74 size_t mbus_size, phys_addr_t sdram_phys_base,
70 size_t sdram_size); 75 size_t sdram_size);
76int mvebu_mbus_dt_init(void);
71 77
72#endif /* __LINUX_MBUS_H */ 78#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f388203db7e8..77c60e52939d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -35,6 +35,7 @@ struct memblock_type {
35}; 35};
36 36
37struct memblock { 37struct memblock {
38 bool bottom_up; /* is bottom up direction? */
38 phys_addr_t current_limit; 39 phys_addr_t current_limit;
39 struct memblock_type memory; 40 struct memblock_type memory;
40 struct memblock_type reserved; 41 struct memblock_type reserved;
@@ -60,6 +61,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
60void memblock_trim_memory(phys_addr_t align); 61void memblock_trim_memory(phys_addr_t align);
61 62
62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
65 unsigned long *end_pfn);
63void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 66void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
64 unsigned long *out_end_pfn, int *out_nid); 67 unsigned long *out_end_pfn, int *out_nid);
65 68
@@ -146,6 +149,29 @@ phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
146 149
147phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); 150phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
148 151
152#ifdef CONFIG_MOVABLE_NODE
153/*
154 * Set the allocation direction to bottom-up or top-down.
155 */
156static inline void memblock_set_bottom_up(bool enable)
157{
158 memblock.bottom_up = enable;
159}
160
161/*
162 * Check if the allocation direction is bottom-up or not.
163 * if this is true, that said, memblock will allocate memory
164 * in bottom-up direction.
165 */
166static inline bool memblock_bottom_up(void)
167{
168 return memblock.bottom_up;
169}
170#else
171static inline void memblock_set_bottom_up(bool enable) {}
172static inline bool memblock_bottom_up(void) { return false; }
173#endif
174
149/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 175/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
150#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 176#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
151#define MEMBLOCK_ALLOC_ACCESSIBLE 0 177#define MEMBLOCK_ALLOC_ACCESSIBLE 0
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6c416092e324..b3e7a667e03c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -30,9 +30,21 @@ struct page;
30struct mm_struct; 30struct mm_struct;
31struct kmem_cache; 31struct kmem_cache;
32 32
33/* Stats that can be updated by kernel. */ 33/*
34enum mem_cgroup_page_stat_item { 34 * The corresponding mem_cgroup_stat_names is defined in mm/memcontrol.c,
35 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 35 * These two lists should keep in accord with each other.
36 */
37enum mem_cgroup_stat_index {
38 /*
39 * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss.
40 */
41 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */
42 MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */
43 MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */
44 MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */
45 MEM_CGROUP_STAT_WRITEBACK, /* # of pages under writeback */
46 MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */
47 MEM_CGROUP_STAT_NSTATS,
36}; 48};
37 49
38struct mem_cgroup_reclaim_cookie { 50struct mem_cgroup_reclaim_cookie {
@@ -125,6 +137,25 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
125extern void mem_cgroup_replace_page_cache(struct page *oldpage, 137extern void mem_cgroup_replace_page_cache(struct page *oldpage,
126 struct page *newpage); 138 struct page *newpage);
127 139
140static inline void mem_cgroup_oom_enable(void)
141{
142 WARN_ON(current->memcg_oom.may_oom);
143 current->memcg_oom.may_oom = 1;
144}
145
146static inline void mem_cgroup_oom_disable(void)
147{
148 WARN_ON(!current->memcg_oom.may_oom);
149 current->memcg_oom.may_oom = 0;
150}
151
152static inline bool task_in_memcg_oom(struct task_struct *p)
153{
154 return p->memcg_oom.memcg;
155}
156
157bool mem_cgroup_oom_synchronize(bool wait);
158
128#ifdef CONFIG_MEMCG_SWAP 159#ifdef CONFIG_MEMCG_SWAP
129extern int do_swap_account; 160extern int do_swap_account;
130#endif 161#endif
@@ -165,17 +196,17 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
165} 196}
166 197
167void mem_cgroup_update_page_stat(struct page *page, 198void mem_cgroup_update_page_stat(struct page *page,
168 enum mem_cgroup_page_stat_item idx, 199 enum mem_cgroup_stat_index idx,
169 int val); 200 int val);
170 201
171static inline void mem_cgroup_inc_page_stat(struct page *page, 202static inline void mem_cgroup_inc_page_stat(struct page *page,
172 enum mem_cgroup_page_stat_item idx) 203 enum mem_cgroup_stat_index idx)
173{ 204{
174 mem_cgroup_update_page_stat(page, idx, 1); 205 mem_cgroup_update_page_stat(page, idx, 1);
175} 206}
176 207
177static inline void mem_cgroup_dec_page_stat(struct page *page, 208static inline void mem_cgroup_dec_page_stat(struct page *page,
178 enum mem_cgroup_page_stat_item idx) 209 enum mem_cgroup_stat_index idx)
179{ 210{
180 mem_cgroup_update_page_stat(page, idx, -1); 211 mem_cgroup_update_page_stat(page, idx, -1);
181} 212}
@@ -348,13 +379,31 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
348{ 379{
349} 380}
350 381
382static inline void mem_cgroup_oom_enable(void)
383{
384}
385
386static inline void mem_cgroup_oom_disable(void)
387{
388}
389
390static inline bool task_in_memcg_oom(struct task_struct *p)
391{
392 return false;
393}
394
395static inline bool mem_cgroup_oom_synchronize(bool wait)
396{
397 return false;
398}
399
351static inline void mem_cgroup_inc_page_stat(struct page *page, 400static inline void mem_cgroup_inc_page_stat(struct page *page,
352 enum mem_cgroup_page_stat_item idx) 401 enum mem_cgroup_stat_index idx)
353{ 402{
354} 403}
355 404
356static inline void mem_cgroup_dec_page_stat(struct page *page, 405static inline void mem_cgroup_dec_page_stat(struct page *page,
357 enum mem_cgroup_page_stat_item idx) 406 enum mem_cgroup_stat_index idx)
358{ 407{
359} 408}
360 409
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index dd38e62b84d2..4ca3d951fe91 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -94,6 +94,8 @@ extern void __online_page_set_limits(struct page *page);
94extern void __online_page_increment_counters(struct page *page); 94extern void __online_page_increment_counters(struct page *page);
95extern void __online_page_free(struct page *page); 95extern void __online_page_free(struct page *page);
96 96
97extern int try_online_node(int nid);
98
97#ifdef CONFIG_MEMORY_HOTREMOVE 99#ifdef CONFIG_MEMORY_HOTREMOVE
98extern bool is_pageblock_removable_nolock(struct page *page); 100extern bool is_pageblock_removable_nolock(struct page *page);
99extern int arch_remove_memory(u64 start, u64 size); 101extern int arch_remove_memory(u64 start, u64 size);
@@ -225,6 +227,11 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
225{ 227{
226} 228}
227 229
230static inline int try_online_node(int nid)
231{
232 return 0;
233}
234
228static inline void lock_memory_hotplug(void) {} 235static inline void lock_memory_hotplug(void) {}
229static inline void unlock_memory_hotplug(void) {} 236static inline void unlock_memory_hotplug(void) {}
230 237
@@ -256,14 +263,12 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
256 263
257extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 264extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
258 void *arg, int (*func)(struct memory_block *, void *)); 265 void *arg, int (*func)(struct memory_block *, void *));
259extern int mem_online_node(int nid);
260extern int add_memory(int nid, u64 start, u64 size); 266extern int add_memory(int nid, u64 start, u64 size);
261extern int arch_add_memory(int nid, u64 start, u64 size); 267extern int arch_add_memory(int nid, u64 start, u64 size);
262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 268extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
263extern bool is_memblock_offlined(struct memory_block *mem); 269extern bool is_memblock_offlined(struct memory_block *mem);
264extern void remove_memory(int nid, u64 start, u64 size); 270extern void remove_memory(int nid, u64 start, u64 size);
265extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 271extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn);
266 int nr_pages);
267extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 272extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
268extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, 273extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
269 unsigned long pnum); 274 unsigned long pnum);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 0d7df39a5885..9fe426b30a41 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -91,7 +91,6 @@ static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
91} 91}
92 92
93#define vma_policy(vma) ((vma)->vm_policy) 93#define vma_policy(vma) ((vma)->vm_policy)
94#define vma_set_policy(vma, pol) ((vma)->vm_policy = (pol))
95 94
96static inline void mpol_get(struct mempolicy *pol) 95static inline void mpol_get(struct mempolicy *pol)
97{ 96{
@@ -126,6 +125,7 @@ struct shared_policy {
126 spinlock_t lock; 125 spinlock_t lock;
127}; 126};
128 127
128int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst);
129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
130int mpol_set_shared_policy(struct shared_policy *info, 130int mpol_set_shared_policy(struct shared_policy *info,
131 struct vm_area_struct *vma, 131 struct vm_area_struct *vma,
@@ -136,6 +136,7 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_vma_policy(struct task_struct *tsk,
138 struct vm_area_struct *vma, unsigned long addr); 138 struct vm_area_struct *vma, unsigned long addr);
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma);
139 140
140extern void numa_default_policy(void); 141extern void numa_default_policy(void);
141extern void numa_policy_init(void); 142extern void numa_policy_init(void);
@@ -168,12 +169,12 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
168extern int mpol_parse_str(char *str, struct mempolicy **mpol); 169extern int mpol_parse_str(char *str, struct mempolicy **mpol);
169#endif 170#endif
170 171
171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); 172extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
172 173
173/* Check if a vma is migratable */ 174/* Check if a vma is migratable */
174static inline int vma_migratable(struct vm_area_struct *vma) 175static inline int vma_migratable(struct vm_area_struct *vma)
175{ 176{
176 if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP)) 177 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
177 return 0; 178 return 0;
178 /* 179 /*
179 * Migration allocates pages in the highest zone. If we cannot 180 * Migration allocates pages in the highest zone. If we cannot
@@ -240,7 +241,12 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
240} 241}
241 242
242#define vma_policy(vma) NULL 243#define vma_policy(vma) NULL
243#define vma_set_policy(vma, pol) do {} while(0) 244
245static inline int
246vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
247{
248 return 0;
249}
244 250
245static inline void numa_policy_init(void) 251static inline void numa_policy_init(void)
246{ 252{
@@ -301,9 +307,8 @@ static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
301} 307}
302#endif 308#endif
303 309
304static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) 310static inline void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
305{ 311{
306 return 0;
307} 312}
308 313
309static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma, 314static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 4706d3d46e56..cb49417f8ba9 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -1908,7 +1908,7 @@
1908#define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */ 1908#define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */
1909#define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */ 1909#define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */
1910#define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */ 1910#define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */
1911#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ 1911#define ARIZONA_FLL2_SYNC_BW 0x0001 /* FLL2_SYNC_BW */
1912#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ 1912#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */
1913#define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */ 1913#define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */
1914#define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */ 1914#define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
new file mode 100644
index 000000000000..16bf8a0dcd97
--- /dev/null
+++ b/include/linux/mfd/as3722.h
@@ -0,0 +1,423 @@
1/*
2 * as3722 definitions
3 *
4 * Copyright (C) 2013 ams
5 * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
6 *
7 * Author: Florian Lobmaier <florian.lobmaier@ams.com>
8 * Author: Laxman Dewangan <ldewangan@nvidia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __LINUX_MFD_AS3722_H__
27#define __LINUX_MFD_AS3722_H__
28
29#include <linux/regmap.h>
30
31/* AS3722 registers */
32#define AS3722_SD0_VOLTAGE_REG 0x00
33#define AS3722_SD1_VOLTAGE_REG 0x01
34#define AS3722_SD2_VOLTAGE_REG 0x02
35#define AS3722_SD3_VOLTAGE_REG 0x03
36#define AS3722_SD4_VOLTAGE_REG 0x04
37#define AS3722_SD5_VOLTAGE_REG 0x05
38#define AS3722_SD6_VOLTAGE_REG 0x06
39#define AS3722_GPIO0_CONTROL_REG 0x08
40#define AS3722_GPIO1_CONTROL_REG 0x09
41#define AS3722_GPIO2_CONTROL_REG 0x0A
42#define AS3722_GPIO3_CONTROL_REG 0x0B
43#define AS3722_GPIO4_CONTROL_REG 0x0C
44#define AS3722_GPIO5_CONTROL_REG 0x0D
45#define AS3722_GPIO6_CONTROL_REG 0x0E
46#define AS3722_GPIO7_CONTROL_REG 0x0F
47#define AS3722_LDO0_VOLTAGE_REG 0x10
48#define AS3722_LDO1_VOLTAGE_REG 0x11
49#define AS3722_LDO2_VOLTAGE_REG 0x12
50#define AS3722_LDO3_VOLTAGE_REG 0x13
51#define AS3722_LDO4_VOLTAGE_REG 0x14
52#define AS3722_LDO5_VOLTAGE_REG 0x15
53#define AS3722_LDO6_VOLTAGE_REG 0x16
54#define AS3722_LDO7_VOLTAGE_REG 0x17
55#define AS3722_LDO9_VOLTAGE_REG 0x19
56#define AS3722_LDO10_VOLTAGE_REG 0x1A
57#define AS3722_LDO11_VOLTAGE_REG 0x1B
58#define AS3722_GPIO_DEB1_REG 0x1E
59#define AS3722_GPIO_DEB2_REG 0x1F
60#define AS3722_GPIO_SIGNAL_OUT_REG 0x20
61#define AS3722_GPIO_SIGNAL_IN_REG 0x21
62#define AS3722_REG_SEQU_MOD1_REG 0x22
63#define AS3722_REG_SEQU_MOD2_REG 0x23
64#define AS3722_REG_SEQU_MOD3_REG 0x24
65#define AS3722_SD_PHSW_CTRL_REG 0x27
66#define AS3722_SD_PHSW_STATUS 0x28
67#define AS3722_SD0_CONTROL_REG 0x29
68#define AS3722_SD1_CONTROL_REG 0x2A
69#define AS3722_SDmph_CONTROL_REG 0x2B
70#define AS3722_SD23_CONTROL_REG 0x2C
71#define AS3722_SD4_CONTROL_REG 0x2D
72#define AS3722_SD5_CONTROL_REG 0x2E
73#define AS3722_SD6_CONTROL_REG 0x2F
74#define AS3722_SD_DVM_REG 0x30
75#define AS3722_RESET_REASON_REG 0x31
76#define AS3722_BATTERY_VOLTAGE_MONITOR_REG 0x32
77#define AS3722_STARTUP_CONTROL_REG 0x33
78#define AS3722_RESET_TIMER_REG 0x34
79#define AS3722_REFERENCE_CONTROL_REG 0x35
80#define AS3722_RESET_CONTROL_REG 0x36
81#define AS3722_OVER_TEMP_CONTROL_REG 0x37
82#define AS3722_WATCHDOG_CONTROL_REG 0x38
83#define AS3722_REG_STANDBY_MOD1_REG 0x39
84#define AS3722_REG_STANDBY_MOD2_REG 0x3A
85#define AS3722_REG_STANDBY_MOD3_REG 0x3B
86#define AS3722_ENABLE_CTRL1_REG 0x3C
87#define AS3722_ENABLE_CTRL2_REG 0x3D
88#define AS3722_ENABLE_CTRL3_REG 0x3E
89#define AS3722_ENABLE_CTRL4_REG 0x3F
90#define AS3722_ENABLE_CTRL5_REG 0x40
91#define AS3722_PWM_CONTROL_L_REG 0x41
92#define AS3722_PWM_CONTROL_H_REG 0x42
93#define AS3722_WATCHDOG_TIMER_REG 0x46
94#define AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG 0x48
95#define AS3722_IOVOLTAGE_REG 0x49
96#define AS3722_BATTERY_VOLTAGE_MONITOR2_REG 0x4A
97#define AS3722_SD_CONTROL_REG 0x4D
98#define AS3722_LDOCONTROL0_REG 0x4E
99#define AS3722_LDOCONTROL1_REG 0x4F
100#define AS3722_SD0_PROTECT_REG 0x50
101#define AS3722_SD6_PROTECT_REG 0x51
102#define AS3722_PWM_VCONTROL1_REG 0x52
103#define AS3722_PWM_VCONTROL2_REG 0x53
104#define AS3722_PWM_VCONTROL3_REG 0x54
105#define AS3722_PWM_VCONTROL4_REG 0x55
106#define AS3722_BB_CHARGER_REG 0x57
107#define AS3722_CTRL_SEQU1_REG 0x58
108#define AS3722_CTRL_SEQU2_REG 0x59
109#define AS3722_OVCURRENT_REG 0x5A
110#define AS3722_OVCURRENT_DEB_REG 0x5B
111#define AS3722_SDLV_DEB_REG 0x5C
112#define AS3722_OC_PG_CTRL_REG 0x5D
113#define AS3722_OC_PG_CTRL2_REG 0x5E
114#define AS3722_CTRL_STATUS 0x5F
115#define AS3722_RTC_CONTROL_REG 0x60
116#define AS3722_RTC_SECOND_REG 0x61
117#define AS3722_RTC_MINUTE_REG 0x62
118#define AS3722_RTC_HOUR_REG 0x63
119#define AS3722_RTC_DAY_REG 0x64
120#define AS3722_RTC_MONTH_REG 0x65
121#define AS3722_RTC_YEAR_REG 0x66
122#define AS3722_RTC_ALARM_SECOND_REG 0x67
123#define AS3722_RTC_ALARM_MINUTE_REG 0x68
124#define AS3722_RTC_ALARM_HOUR_REG 0x69
125#define AS3722_RTC_ALARM_DAY_REG 0x6A
126#define AS3722_RTC_ALARM_MONTH_REG 0x6B
127#define AS3722_RTC_ALARM_YEAR_REG 0x6C
128#define AS3722_SRAM_REG 0x6D
129#define AS3722_RTC_ACCESS_REG 0x6F
130#define AS3722_RTC_STATUS_REG 0x73
131#define AS3722_INTERRUPT_MASK1_REG 0x74
132#define AS3722_INTERRUPT_MASK2_REG 0x75
133#define AS3722_INTERRUPT_MASK3_REG 0x76
134#define AS3722_INTERRUPT_MASK4_REG 0x77
135#define AS3722_INTERRUPT_STATUS1_REG 0x78
136#define AS3722_INTERRUPT_STATUS2_REG 0x79
137#define AS3722_INTERRUPT_STATUS3_REG 0x7A
138#define AS3722_INTERRUPT_STATUS4_REG 0x7B
139#define AS3722_TEMP_STATUS_REG 0x7D
140#define AS3722_ADC0_CONTROL_REG 0x80
141#define AS3722_ADC1_CONTROL_REG 0x81
142#define AS3722_ADC0_MSB_RESULT_REG 0x82
143#define AS3722_ADC0_LSB_RESULT_REG 0x83
144#define AS3722_ADC1_MSB_RESULT_REG 0x84
145#define AS3722_ADC1_LSB_RESULT_REG 0x85
146#define AS3722_ADC1_THRESHOLD_HI_MSB_REG 0x86
147#define AS3722_ADC1_THRESHOLD_HI_LSB_REG 0x87
148#define AS3722_ADC1_THRESHOLD_LO_MSB_REG 0x88
149#define AS3722_ADC1_THRESHOLD_LO_LSB_REG 0x89
150#define AS3722_ADC_CONFIGURATION_REG 0x8A
151#define AS3722_ASIC_ID1_REG 0x90
152#define AS3722_ASIC_ID2_REG 0x91
153#define AS3722_LOCK_REG 0x9E
154#define AS3722_MAX_REGISTER 0xF4
155
156#define AS3722_SD0_EXT_ENABLE_MASK 0x03
157#define AS3722_SD1_EXT_ENABLE_MASK 0x0C
158#define AS3722_SD2_EXT_ENABLE_MASK 0x30
159#define AS3722_SD3_EXT_ENABLE_MASK 0xC0
160#define AS3722_SD4_EXT_ENABLE_MASK 0x03
161#define AS3722_SD5_EXT_ENABLE_MASK 0x0C
162#define AS3722_SD6_EXT_ENABLE_MASK 0x30
163#define AS3722_LDO0_EXT_ENABLE_MASK 0x03
164#define AS3722_LDO1_EXT_ENABLE_MASK 0x0C
165#define AS3722_LDO2_EXT_ENABLE_MASK 0x30
166#define AS3722_LDO3_EXT_ENABLE_MASK 0xC0
167#define AS3722_LDO4_EXT_ENABLE_MASK 0x03
168#define AS3722_LDO5_EXT_ENABLE_MASK 0x0C
169#define AS3722_LDO6_EXT_ENABLE_MASK 0x30
170#define AS3722_LDO7_EXT_ENABLE_MASK 0xC0
171#define AS3722_LDO9_EXT_ENABLE_MASK 0x0C
172#define AS3722_LDO10_EXT_ENABLE_MASK 0x30
173#define AS3722_LDO11_EXT_ENABLE_MASK 0xC0
174
175#define AS3722_OVCURRENT_SD0_ALARM_MASK 0x07
176#define AS3722_OVCURRENT_SD0_ALARM_SHIFT 0x01
177#define AS3722_OVCURRENT_SD0_TRIP_MASK 0x18
178#define AS3722_OVCURRENT_SD0_TRIP_SHIFT 0x03
179#define AS3722_OVCURRENT_SD1_TRIP_MASK 0x60
180#define AS3722_OVCURRENT_SD1_TRIP_SHIFT 0x05
181
182#define AS3722_OVCURRENT_SD6_ALARM_MASK 0x07
183#define AS3722_OVCURRENT_SD6_ALARM_SHIFT 0x01
184#define AS3722_OVCURRENT_SD6_TRIP_MASK 0x18
185#define AS3722_OVCURRENT_SD6_TRIP_SHIFT 0x03
186
187/* AS3722 register bits and bit masks */
188#define AS3722_LDO_ILIMIT_MASK BIT(7)
189#define AS3722_LDO_ILIMIT_BIT BIT(7)
190#define AS3722_LDO0_VSEL_MASK 0x1F
191#define AS3722_LDO0_VSEL_MIN 0x01
192#define AS3722_LDO0_VSEL_MAX 0x12
193#define AS3722_LDO0_NUM_VOLT 0x12
194#define AS3722_LDO3_VSEL_MASK 0x3F
195#define AS3722_LDO3_VSEL_MIN 0x01
196#define AS3722_LDO3_VSEL_MAX 0x2D
197#define AS3722_LDO3_NUM_VOLT 0x2D
198#define AS3722_LDO_VSEL_MASK 0x7F
199#define AS3722_LDO_VSEL_MIN 0x01
200#define AS3722_LDO_VSEL_MAX 0x7F
201#define AS3722_LDO_VSEL_DNU_MIN 0x25
202#define AS3722_LDO_VSEL_DNU_MAX 0x3F
203#define AS3722_LDO_NUM_VOLT 0x80
204
205#define AS3722_LDO0_CTRL BIT(0)
206#define AS3722_LDO1_CTRL BIT(1)
207#define AS3722_LDO2_CTRL BIT(2)
208#define AS3722_LDO3_CTRL BIT(3)
209#define AS3722_LDO4_CTRL BIT(4)
210#define AS3722_LDO5_CTRL BIT(5)
211#define AS3722_LDO6_CTRL BIT(6)
212#define AS3722_LDO7_CTRL BIT(7)
213#define AS3722_LDO9_CTRL BIT(1)
214#define AS3722_LDO10_CTRL BIT(2)
215#define AS3722_LDO11_CTRL BIT(3)
216
217#define AS3722_LDO3_MODE_MASK (3 << 6)
218#define AS3722_LDO3_MODE_VAL(n) (((n) & 0x3) << 6)
219#define AS3722_LDO3_MODE_PMOS AS3722_LDO3_MODE_VAL(0)
220#define AS3722_LDO3_MODE_PMOS_TRACKING AS3722_LDO3_MODE_VAL(1)
221#define AS3722_LDO3_MODE_NMOS AS3722_LDO3_MODE_VAL(2)
222#define AS3722_LDO3_MODE_SWITCH AS3722_LDO3_MODE_VAL(3)
223
224#define AS3722_SD_VSEL_MASK 0x7F
225#define AS3722_SD0_VSEL_MIN 0x01
226#define AS3722_SD0_VSEL_MAX 0x5A
227#define AS3722_SD2_VSEL_MIN 0x01
228#define AS3722_SD2_VSEL_MAX 0x7F
229
230#define AS3722_SDn_CTRL(n) BIT(n)
231
232#define AS3722_SD0_MODE_FAST BIT(4)
233#define AS3722_SD1_MODE_FAST BIT(4)
234#define AS3722_SD2_MODE_FAST BIT(2)
235#define AS3722_SD3_MODE_FAST BIT(6)
236#define AS3722_SD4_MODE_FAST BIT(2)
237#define AS3722_SD5_MODE_FAST BIT(2)
238#define AS3722_SD6_MODE_FAST BIT(4)
239
240#define AS3722_POWER_OFF BIT(1)
241
242#define AS3722_INTERRUPT_MASK1_LID BIT(0)
243#define AS3722_INTERRUPT_MASK1_ACOK BIT(1)
244#define AS3722_INTERRUPT_MASK1_ENABLE1 BIT(2)
245#define AS3722_INTERRUPT_MASK1_OCURR_ALARM_SD0 BIT(3)
246#define AS3722_INTERRUPT_MASK1_ONKEY_LONG BIT(4)
247#define AS3722_INTERRUPT_MASK1_ONKEY BIT(5)
248#define AS3722_INTERRUPT_MASK1_OVTMP BIT(6)
249#define AS3722_INTERRUPT_MASK1_LOWBAT BIT(7)
250
251#define AS3722_INTERRUPT_MASK2_SD0_LV BIT(0)
252#define AS3722_INTERRUPT_MASK2_SD1_LV BIT(1)
253#define AS3722_INTERRUPT_MASK2_SD2345_LV BIT(2)
254#define AS3722_INTERRUPT_MASK2_PWM1_OV_PROT BIT(3)
255#define AS3722_INTERRUPT_MASK2_PWM2_OV_PROT BIT(4)
256#define AS3722_INTERRUPT_MASK2_ENABLE2 BIT(5)
257#define AS3722_INTERRUPT_MASK2_SD6_LV BIT(6)
258#define AS3722_INTERRUPT_MASK2_RTC_REP BIT(7)
259
260#define AS3722_INTERRUPT_MASK3_RTC_ALARM BIT(0)
261#define AS3722_INTERRUPT_MASK3_GPIO1 BIT(1)
262#define AS3722_INTERRUPT_MASK3_GPIO2 BIT(2)
263#define AS3722_INTERRUPT_MASK3_GPIO3 BIT(3)
264#define AS3722_INTERRUPT_MASK3_GPIO4 BIT(4)
265#define AS3722_INTERRUPT_MASK3_GPIO5 BIT(5)
266#define AS3722_INTERRUPT_MASK3_WATCHDOG BIT(6)
267#define AS3722_INTERRUPT_MASK3_ENABLE3 BIT(7)
268
269#define AS3722_INTERRUPT_MASK4_TEMP_SD0_SHUTDOWN BIT(0)
270#define AS3722_INTERRUPT_MASK4_TEMP_SD1_SHUTDOWN BIT(1)
271#define AS3722_INTERRUPT_MASK4_TEMP_SD6_SHUTDOWN BIT(2)
272#define AS3722_INTERRUPT_MASK4_TEMP_SD0_ALARM BIT(3)
273#define AS3722_INTERRUPT_MASK4_TEMP_SD1_ALARM BIT(4)
274#define AS3722_INTERRUPT_MASK4_TEMP_SD6_ALARM BIT(5)
275#define AS3722_INTERRUPT_MASK4_OCCUR_ALARM_SD6 BIT(6)
276#define AS3722_INTERRUPT_MASK4_ADC BIT(7)
277
278#define AS3722_ADC1_INTERVAL_TIME BIT(0)
279#define AS3722_ADC1_INT_MODE_ON BIT(1)
280#define AS3722_ADC_BUF_ON BIT(2)
281#define AS3722_ADC1_LOW_VOLTAGE_RANGE BIT(5)
282#define AS3722_ADC1_INTEVAL_SCAN BIT(6)
283#define AS3722_ADC1_INT_MASK BIT(7)
284
285#define AS3722_ADC_MSB_VAL_MASK 0x7F
286#define AS3722_ADC_LSB_VAL_MASK 0x07
287
288#define AS3722_ADC0_CONV_START BIT(7)
289#define AS3722_ADC0_CONV_NOTREADY BIT(7)
290#define AS3722_ADC0_SOURCE_SELECT_MASK 0x1F
291
292#define AS3722_ADC1_CONV_START BIT(7)
293#define AS3722_ADC1_CONV_NOTREADY BIT(7)
294#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F
295
296/* GPIO modes */
297#define AS3722_GPIO_MODE_MASK 0x07
298#define AS3722_GPIO_MODE_INPUT 0x00
299#define AS3722_GPIO_MODE_OUTPUT_VDDH 0x01
300#define AS3722_GPIO_MODE_IO_OPEN_DRAIN 0x02
301#define AS3722_GPIO_MODE_ADC_IN 0x03
302#define AS3722_GPIO_MODE_INPUT_PULL_UP 0x04
303#define AS3722_GPIO_MODE_INPUT_PULL_DOWN 0x05
304#define AS3722_GPIO_MODE_IO_OPEN_DRAIN_PULL_UP 0x06
305#define AS3722_GPIO_MODE_OUTPUT_VDDL 0x07
306#define AS3722_GPIO_MODE_VAL(n) ((n) & AS3722_GPIO_MODE_MASK)
307
308#define AS3722_GPIO_INV BIT(7)
309#define AS3722_GPIO_IOSF_MASK 0x78
310#define AS3722_GPIO_IOSF_VAL(n) (((n) & 0xF) << 3)
311#define AS3722_GPIO_IOSF_NORMAL AS3722_GPIO_IOSF_VAL(0)
312#define AS3722_GPIO_IOSF_INTERRUPT_OUT AS3722_GPIO_IOSF_VAL(1)
313#define AS3722_GPIO_IOSF_VSUP_LOW_OUT AS3722_GPIO_IOSF_VAL(2)
314#define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN AS3722_GPIO_IOSF_VAL(3)
315#define AS3722_GPIO_IOSF_ISINK_PWM_IN AS3722_GPIO_IOSF_VAL(4)
316#define AS3722_GPIO_IOSF_VOLTAGE_STBY AS3722_GPIO_IOSF_VAL(5)
317#define AS3722_GPIO_IOSF_PWR_GOOD_OUT AS3722_GPIO_IOSF_VAL(7)
318#define AS3722_GPIO_IOSF_Q32K_OUT AS3722_GPIO_IOSF_VAL(8)
319#define AS3722_GPIO_IOSF_WATCHDOG_IN AS3722_GPIO_IOSF_VAL(9)
320#define AS3722_GPIO_IOSF_SOFT_RESET_IN AS3722_GPIO_IOSF_VAL(11)
321#define AS3722_GPIO_IOSF_PWM_OUT AS3722_GPIO_IOSF_VAL(12)
322#define AS3722_GPIO_IOSF_VSUP_LOW_DEB_OUT AS3722_GPIO_IOSF_VAL(13)
323#define AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW AS3722_GPIO_IOSF_VAL(14)
324
325#define AS3722_GPIOn_SIGNAL(n) BIT(n)
326#define AS3722_GPIOn_CONTROL_REG(n) (AS3722_GPIO0_CONTROL_REG + n)
327#define AS3722_I2C_PULL_UP BIT(4)
328#define AS3722_INT_PULL_UP BIT(5)
329
330#define AS3722_RTC_REP_WAKEUP_EN BIT(0)
331#define AS3722_RTC_ALARM_WAKEUP_EN BIT(1)
332#define AS3722_RTC_ON BIT(2)
333#define AS3722_RTC_IRQMODE BIT(3)
334#define AS3722_RTC_CLK32K_OUT_EN BIT(5)
335
336#define AS3722_WATCHDOG_TIMER_MAX 0x7F
337#define AS3722_WATCHDOG_ON BIT(0)
338#define AS3722_WATCHDOG_SW_SIG BIT(0)
339
340#define AS3722_EXT_CONTROL_ENABLE1 0x1
341#define AS3722_EXT_CONTROL_ENABLE2 0x2
342#define AS3722_EXT_CONTROL_ENABLE3 0x3
343
344/* Interrupt IDs */
345enum as3722_irq {
346 AS3722_IRQ_LID,
347 AS3722_IRQ_ACOK,
348 AS3722_IRQ_ENABLE1,
349 AS3722_IRQ_OCCUR_ALARM_SD0,
350 AS3722_IRQ_ONKEY_LONG_PRESS,
351 AS3722_IRQ_ONKEY,
352 AS3722_IRQ_OVTMP,
353 AS3722_IRQ_LOWBAT,
354 AS3722_IRQ_SD0_LV,
355 AS3722_IRQ_SD1_LV,
356 AS3722_IRQ_SD2_LV,
357 AS3722_IRQ_PWM1_OV_PROT,
358 AS3722_IRQ_PWM2_OV_PROT,
359 AS3722_IRQ_ENABLE2,
360 AS3722_IRQ_SD6_LV,
361 AS3722_IRQ_RTC_REP,
362 AS3722_IRQ_RTC_ALARM,
363 AS3722_IRQ_GPIO1,
364 AS3722_IRQ_GPIO2,
365 AS3722_IRQ_GPIO3,
366 AS3722_IRQ_GPIO4,
367 AS3722_IRQ_GPIO5,
368 AS3722_IRQ_WATCHDOG,
369 AS3722_IRQ_ENABLE3,
370 AS3722_IRQ_TEMP_SD0_SHUTDOWN,
371 AS3722_IRQ_TEMP_SD1_SHUTDOWN,
372 AS3722_IRQ_TEMP_SD2_SHUTDOWN,
373 AS3722_IRQ_TEMP_SD0_ALARM,
374 AS3722_IRQ_TEMP_SD1_ALARM,
375 AS3722_IRQ_TEMP_SD6_ALARM,
376 AS3722_IRQ_OCCUR_ALARM_SD6,
377 AS3722_IRQ_ADC,
378 AS3722_IRQ_MAX,
379};
380
381struct as3722 {
382 struct device *dev;
383 struct regmap *regmap;
384 int chip_irq;
385 unsigned long irq_flags;
386 bool en_intern_int_pullup;
387 bool en_intern_i2c_pullup;
388 struct regmap_irq_chip_data *irq_data;
389};
390
391static inline int as3722_read(struct as3722 *as3722, u32 reg, u32 *dest)
392{
393 return regmap_read(as3722->regmap, reg, dest);
394}
395
396static inline int as3722_write(struct as3722 *as3722, u32 reg, u32 value)
397{
398 return regmap_write(as3722->regmap, reg, value);
399}
400
401static inline int as3722_block_read(struct as3722 *as3722, u32 reg,
402 int count, u8 *buf)
403{
404 return regmap_bulk_read(as3722->regmap, reg, buf, count);
405}
406
407static inline int as3722_block_write(struct as3722 *as3722, u32 reg,
408 int count, u8 *data)
409{
410 return regmap_bulk_write(as3722->regmap, reg, data, count);
411}
412
413static inline int as3722_update_bits(struct as3722 *as3722, u32 reg,
414 u32 mask, u8 val)
415{
416 return regmap_update_bits(as3722->regmap, reg, mask, val);
417}
418
419static inline int as3722_irq_get_virq(struct as3722 *as3722, int irq)
420{
421 return regmap_irq_get_virq(as3722->irq_data, irq);
422}
423#endif /* __LINUX_MFD_AS3722_H__ */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index cebe97ee98b8..bdba8c61207b 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -59,6 +59,12 @@ struct mfd_cell {
59 * pm_runtime_no_callbacks(). 59 * pm_runtime_no_callbacks().
60 */ 60 */
61 bool pm_runtime_no_callbacks; 61 bool pm_runtime_no_callbacks;
62
63 /* A list of regulator supplies that should be mapped to the MFD
64 * device rather than the child device when requested
65 */
66 const char **parent_supplies;
67 int num_parent_supplies;
62}; 68};
63 69
64/* 70/*
@@ -98,7 +104,7 @@ static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
98} 104}
99 105
100extern int mfd_add_devices(struct device *parent, int id, 106extern int mfd_add_devices(struct device *parent, int id,
101 struct mfd_cell *cells, int n_devs, 107 const struct mfd_cell *cells, int n_devs,
102 struct resource *mem_base, 108 struct resource *mem_base,
103 int irq_base, struct irq_domain *irq_domain); 109 int irq_base, struct irq_domain *irq_domain);
104 110
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 786d02eb79d2..21e21b81cc75 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -148,10 +148,15 @@ static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
148 unsigned reg_cnt, unsigned char *val) 148 unsigned reg_cnt, unsigned char *val)
149{ 149{
150 int ret; 150 int ret;
151 unsigned int tmp;
152 int i;
151 153
152 ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 154 for (i = 0; i < reg_cnt; i++) {
153 if (ret < 0) 155 ret = regmap_read(da9052->regmap, reg + i, &tmp);
154 return ret; 156 val[i] = (unsigned char)tmp;
157 if (ret < 0)
158 return ret;
159 }
155 160
156 if (da9052->fix_io) { 161 if (da9052->fix_io) {
157 ret = da9052->fix_io(da9052, reg); 162 ret = da9052->fix_io(da9052, reg);
@@ -166,10 +171,13 @@ static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
166 unsigned reg_cnt, unsigned char *val) 171 unsigned reg_cnt, unsigned char *val)
167{ 172{
168 int ret; 173 int ret;
174 int i;
169 175
170 ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 176 for (i = 0; i < reg_cnt; i++) {
171 if (ret < 0) 177 ret = regmap_write(da9052->regmap, reg + i, val[i]);
172 return ret; 178 if (ret < 0)
179 return ret;
180 }
173 181
174 if (da9052->fix_io) { 182 if (da9052->fix_io) {
175 ret = da9052->fix_io(da9052, reg); 183 ret = da9052->fix_io(da9052, reg);
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
new file mode 100644
index 000000000000..2d2a0af675fd
--- /dev/null
+++ b/include/linux/mfd/da9063/core.h
@@ -0,0 +1,93 @@
1/*
2 * Definitions for DA9063 MFD driver
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_CORE_H__
17#define __MFD_DA9063_CORE_H__
18
19#include <linux/interrupt.h>
20#include <linux/mfd/da9063/registers.h>
21
22/* DA9063 modules */
23#define DA9063_DRVNAME_CORE "da9063-core"
24#define DA9063_DRVNAME_REGULATORS "da9063-regulators"
25#define DA9063_DRVNAME_LEDS "da9063-leds"
26#define DA9063_DRVNAME_WATCHDOG "da9063-watchdog"
27#define DA9063_DRVNAME_HWMON "da9063-hwmon"
28#define DA9063_DRVNAME_ONKEY "da9063-onkey"
29#define DA9063_DRVNAME_RTC "da9063-rtc"
30#define DA9063_DRVNAME_VIBRATION "da9063-vibration"
31
32enum da9063_models {
33 PMIC_DA9063 = 0x61,
34};
35
36/* Interrupts */
37enum da9063_irqs {
38 DA9063_IRQ_ONKEY = 0,
39 DA9063_IRQ_ALARM,
40 DA9063_IRQ_TICK,
41 DA9063_IRQ_ADC_RDY,
42 DA9063_IRQ_SEQ_RDY,
43 DA9063_IRQ_WAKE,
44 DA9063_IRQ_TEMP,
45 DA9063_IRQ_COMP_1V2,
46 DA9063_IRQ_LDO_LIM,
47 DA9063_IRQ_REG_UVOV,
48 DA9063_IRQ_VDD_MON,
49 DA9063_IRQ_WARN,
50 DA9063_IRQ_GPI0,
51 DA9063_IRQ_GPI1,
52 DA9063_IRQ_GPI2,
53 DA9063_IRQ_GPI3,
54 DA9063_IRQ_GPI4,
55 DA9063_IRQ_GPI5,
56 DA9063_IRQ_GPI6,
57 DA9063_IRQ_GPI7,
58 DA9063_IRQ_GPI8,
59 DA9063_IRQ_GPI9,
60 DA9063_IRQ_GPI10,
61 DA9063_IRQ_GPI11,
62 DA9063_IRQ_GPI12,
63 DA9063_IRQ_GPI13,
64 DA9063_IRQ_GPI14,
65 DA9063_IRQ_GPI15,
66};
67
68#define DA9063_IRQ_BASE_OFFSET 0
69#define DA9063_NUM_IRQ (DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
70
71struct da9063 {
72 /* Device */
73 struct device *dev;
74 unsigned short model;
75 unsigned short revision;
76 unsigned int flags;
77
78 /* Control interface */
79 struct regmap *regmap;
80
81 /* Interrupts */
82 int chip_irq;
83 unsigned int irq_base;
84 struct regmap_irq_chip_data *regmap_irq;
85};
86
87int da9063_device_init(struct da9063 *da9063, unsigned int irq);
88int da9063_irq_init(struct da9063 *da9063);
89
90void da9063_device_exit(struct da9063 *da9063);
91void da9063_irq_exit(struct da9063 *da9063);
92
93#endif /* __MFD_DA9063_CORE_H__ */
diff --git a/include/linux/mfd/da9063/pdata.h b/include/linux/mfd/da9063/pdata.h
new file mode 100644
index 000000000000..95c8742215a7
--- /dev/null
+++ b/include/linux/mfd/da9063/pdata.h
@@ -0,0 +1,111 @@
1/*
2 * Platform configuration options for DA9063
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Author: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_PDATA_H__
17#define __MFD_DA9063_PDATA_H__
18
19#include <linux/regulator/machine.h>
20
21/*
22 * Regulator configuration
23 */
24/* DA9063 regulator IDs */
25enum {
26 /* BUCKs */
27 DA9063_ID_BCORE1,
28 DA9063_ID_BCORE2,
29 DA9063_ID_BPRO,
30 DA9063_ID_BMEM,
31 DA9063_ID_BIO,
32 DA9063_ID_BPERI,
33
34 /* BCORE1 and BCORE2 in merged mode */
35 DA9063_ID_BCORES_MERGED,
36 /* BMEM and BIO in merged mode */
37 DA9063_ID_BMEM_BIO_MERGED,
38 /* When two BUCKs are merged, they cannot be reused separately */
39
40 /* LDOs */
41 DA9063_ID_LDO1,
42 DA9063_ID_LDO2,
43 DA9063_ID_LDO3,
44 DA9063_ID_LDO4,
45 DA9063_ID_LDO5,
46 DA9063_ID_LDO6,
47 DA9063_ID_LDO7,
48 DA9063_ID_LDO8,
49 DA9063_ID_LDO9,
50 DA9063_ID_LDO10,
51 DA9063_ID_LDO11,
52};
53
54/* Regulators platform data */
55struct da9063_regulator_data {
56 int id;
57 struct regulator_init_data *initdata;
58};
59
60struct da9063_regulators_pdata {
61 unsigned n_regulators;
62 struct da9063_regulator_data *regulator_data;
63};
64
65
66/*
67 * RGB LED configuration
68 */
69/* LED IDs for flags in struct led_info. */
70enum {
71 DA9063_GPIO11_LED,
72 DA9063_GPIO14_LED,
73 DA9063_GPIO15_LED,
74
75 DA9063_LED_NUM
76};
77#define DA9063_LED_ID_MASK 0x3
78
79/* LED polarity for flags in struct led_info. */
80#define DA9063_LED_HIGH_LEVEL_ACTIVE 0x0
81#define DA9063_LED_LOW_LEVEL_ACTIVE 0x4
82
83
84/*
85 * General PMIC configuration
86 */
87/* HWMON ADC channels configuration */
88#define DA9063_FLG_FORCE_IN0_MANUAL_MODE 0x0010
89#define DA9063_FLG_FORCE_IN0_AUTO_MODE 0x0020
90#define DA9063_FLG_FORCE_IN1_MANUAL_MODE 0x0040
91#define DA9063_FLG_FORCE_IN1_AUTO_MODE 0x0080
92#define DA9063_FLG_FORCE_IN2_MANUAL_MODE 0x0100
93#define DA9063_FLG_FORCE_IN2_AUTO_MODE 0x0200
94#define DA9063_FLG_FORCE_IN3_MANUAL_MODE 0x0400
95#define DA9063_FLG_FORCE_IN3_AUTO_MODE 0x0800
96
97/* Disable register caching. */
98#define DA9063_FLG_NO_CACHE 0x0008
99
100struct da9063;
101
102/* DA9063 platform data */
103struct da9063_pdata {
104 int (*init)(struct da9063 *da9063);
105 int irq_base;
106 unsigned flags;
107 struct da9063_regulators_pdata *regulators_pdata;
108 struct led_platform_data *leds_pdata;
109};
110
111#endif /* __MFD_DA9063_PDATA_H__ */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
new file mode 100644
index 000000000000..5834813fb5f3
--- /dev/null
+++ b/include/linux/mfd/da9063/registers.h
@@ -0,0 +1,1028 @@
1/*
2 * Registers definition for DA9063 modules
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef _DA9063_REG_H
17#define _DA9063_REG_H
18
19#define DA9063_I2C_PAGE_SEL_SHIFT 1
20
21#define DA9063_EVENT_REG_NUM 4
22#define DA9210_EVENT_REG_NUM 2
23#define DA9063_EXT_EVENT_REG_NUM (DA9063_EVENT_REG_NUM + \
24 DA9210_EVENT_REG_NUM)
25
26/* Page selection I2C or SPI always in the begining of any page. */
27/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */
28/* Page 1 : SPI access 0x080 - 0x0FF */
29/* Page 2 : I2C access 0x100 - 0x1FF SPI access 0x100 - 0x17F */
30/* Page 3 : SPI access 0x180 - 0x1FF */
31#define DA9063_REG_PAGE_CON 0x00
32
33/* System Control and Event Registers */
34#define DA9063_REG_STATUS_A 0x01
35#define DA9063_REG_STATUS_B 0x02
36#define DA9063_REG_STATUS_C 0x03
37#define DA9063_REG_STATUS_D 0x04
38#define DA9063_REG_FAULT_LOG 0x05
39#define DA9063_REG_EVENT_A 0x06
40#define DA9063_REG_EVENT_B 0x07
41#define DA9063_REG_EVENT_C 0x08
42#define DA9063_REG_EVENT_D 0x09
43#define DA9063_REG_IRQ_MASK_A 0x0A
44#define DA9063_REG_IRQ_MASK_B 0x0B
45#define DA9063_REG_IRQ_MASK_C 0x0C
46#define DA9063_REG_IRQ_MASK_D 0x0D
47#define DA9063_REG_CONTROL_A 0x0E
48#define DA9063_REG_CONTROL_B 0x0F
49#define DA9063_REG_CONTROL_C 0x10
50#define DA9063_REG_CONTROL_D 0x11
51#define DA9063_REG_CONTROL_E 0x12
52#define DA9063_REG_CONTROL_F 0x13
53#define DA9063_REG_PD_DIS 0x14
54
55/* GPIO Control Registers */
56#define DA9063_REG_GPIO_0_1 0x15
57#define DA9063_REG_GPIO_2_3 0x16
58#define DA9063_REG_GPIO_4_5 0x17
59#define DA9063_REG_GPIO_6_7 0x18
60#define DA9063_REG_GPIO_8_9 0x19
61#define DA9063_REG_GPIO_10_11 0x1A
62#define DA9063_REG_GPIO_12_13 0x1B
63#define DA9063_REG_GPIO_14_15 0x1C
64#define DA9063_REG_GPIO_MODE_0_7 0x1D
65#define DA9063_REG_GPIO_MODE_8_15 0x1E
66#define DA9063_REG_GPIO_SWITCH_CONT 0x1F
67
68/* Regulator Control Registers */
69#define DA9063_REG_BCORE2_CONT 0x20
70#define DA9063_REG_BCORE1_CONT 0x21
71#define DA9063_REG_BPRO_CONT 0x22
72#define DA9063_REG_BMEM_CONT 0x23
73#define DA9063_REG_BIO_CONT 0x24
74#define DA9063_REG_BPERI_CONT 0x25
75#define DA9063_REG_LDO1_CONT 0x26
76#define DA9063_REG_LDO2_CONT 0x27
77#define DA9063_REG_LDO3_CONT 0x28
78#define DA9063_REG_LDO4_CONT 0x29
79#define DA9063_REG_LDO5_CONT 0x2A
80#define DA9063_REG_LDO6_CONT 0x2B
81#define DA9063_REG_LDO7_CONT 0x2C
82#define DA9063_REG_LDO8_CONT 0x2D
83#define DA9063_REG_LDO9_CONT 0x2E
84#define DA9063_REG_LDO10_CONT 0x2F
85#define DA9063_REG_LDO11_CONT 0x30
86#define DA9063_REG_VIB 0x31
87#define DA9063_REG_DVC_1 0x32
88#define DA9063_REG_DVC_2 0x33
89
90/* GP-ADC Control Registers */
91#define DA9063_REG_ADC_MAN 0x34
92#define DA9063_REG_ADC_CONT 0x35
93#define DA9063_REG_VSYS_MON 0x36
94#define DA9063_REG_ADC_RES_L 0x37
95#define DA9063_REG_ADC_RES_H 0x38
96#define DA9063_REG_VSYS_RES 0x39
97#define DA9063_REG_ADCIN1_RES 0x3A
98#define DA9063_REG_ADCIN2_RES 0x3B
99#define DA9063_REG_ADCIN3_RES 0x3C
100#define DA9063_REG_MON1_RES 0x3D
101#define DA9063_REG_MON2_RES 0x3E
102#define DA9063_REG_MON3_RES 0x3F
103
104/* RTC Calendar and Alarm Registers */
105#define DA9063_REG_COUNT_S 0x40
106#define DA9063_REG_COUNT_MI 0x41
107#define DA9063_REG_COUNT_H 0x42
108#define DA9063_REG_COUNT_D 0x43
109#define DA9063_REG_COUNT_MO 0x44
110#define DA9063_REG_COUNT_Y 0x45
111#define DA9063_REG_ALARM_MI 0x46
112#define DA9063_REG_ALARM_H 0x47
113#define DA9063_REG_ALARM_D 0x48
114#define DA9063_REG_ALARM_MO 0x49
115#define DA9063_REG_ALARM_Y 0x4A
116#define DA9063_REG_SECOND_A 0x4B
117#define DA9063_REG_SECOND_B 0x4C
118#define DA9063_REG_SECOND_C 0x4D
119#define DA9063_REG_SECOND_D 0x4E
120
121/* Sequencer Control Registers */
122#define DA9063_REG_SEQ 0x81
123#define DA9063_REG_SEQ_TIMER 0x82
124#define DA9063_REG_ID_2_1 0x83
125#define DA9063_REG_ID_4_3 0x84
126#define DA9063_REG_ID_6_5 0x85
127#define DA9063_REG_ID_8_7 0x86
128#define DA9063_REG_ID_10_9 0x87
129#define DA9063_REG_ID_12_11 0x88
130#define DA9063_REG_ID_14_13 0x89
131#define DA9063_REG_ID_16_15 0x8A
132#define DA9063_REG_ID_18_17 0x8B
133#define DA9063_REG_ID_20_19 0x8C
134#define DA9063_REG_ID_22_21 0x8D
135#define DA9063_REG_ID_24_23 0x8E
136#define DA9063_REG_ID_26_25 0x8F
137#define DA9063_REG_ID_28_27 0x90
138#define DA9063_REG_ID_30_29 0x91
139#define DA9063_REG_ID_32_31 0x92
140#define DA9063_REG_SEQ_A 0x95
141#define DA9063_REG_SEQ_B 0x96
142#define DA9063_REG_WAIT 0x97
143#define DA9063_REG_EN_32K 0x98
144#define DA9063_REG_RESET 0x99
145
146/* Regulator Setting Registers */
147#define DA9063_REG_BUCK_ILIM_A 0x9A
148#define DA9063_REG_BUCK_ILIM_B 0x9B
149#define DA9063_REG_BUCK_ILIM_C 0x9C
150#define DA9063_REG_BCORE2_CFG 0x9D
151#define DA9063_REG_BCORE1_CFG 0x9E
152#define DA9063_REG_BPRO_CFG 0x9F
153#define DA9063_REG_BIO_CFG 0xA0
154#define DA9063_REG_BMEM_CFG 0xA1
155#define DA9063_REG_BPERI_CFG 0xA2
156#define DA9063_REG_VBCORE2_A 0xA3
157#define DA9063_REG_VBCORE1_A 0xA4
158#define DA9063_REG_VBPRO_A 0xA5
159#define DA9063_REG_VBMEM_A 0xA6
160#define DA9063_REG_VBIO_A 0xA7
161#define DA9063_REG_VBPERI_A 0xA8
162#define DA9063_REG_VLDO1_A 0xA9
163#define DA9063_REG_VLDO2_A 0xAA
164#define DA9063_REG_VLDO3_A 0xAB
165#define DA9063_REG_VLDO4_A 0xAC
166#define DA9063_REG_VLDO5_A 0xAD
167#define DA9063_REG_VLDO6_A 0xAE
168#define DA9063_REG_VLDO7_A 0xAF
169#define DA9063_REG_VLDO8_A 0xB0
170#define DA9063_REG_VLDO9_A 0xB1
171#define DA9063_REG_VLDO10_A 0xB2
172#define DA9063_REG_VLDO11_A 0xB3
173#define DA9063_REG_VBCORE2_B 0xB4
174#define DA9063_REG_VBCORE1_B 0xB5
175#define DA9063_REG_VBPRO_B 0xB6
176#define DA9063_REG_VBMEM_B 0xB7
177#define DA9063_REG_VBIO_B 0xB8
178#define DA9063_REG_VBPERI_B 0xB9
179#define DA9063_REG_VLDO1_B 0xBA
180#define DA9063_REG_VLDO2_B 0xBB
181#define DA9063_REG_VLDO3_B 0xBC
182#define DA9063_REG_VLDO4_B 0xBD
183#define DA9063_REG_VLDO5_B 0xBE
184#define DA9063_REG_VLDO6_B 0xBF
185#define DA9063_REG_VLDO7_B 0xC0
186#define DA9063_REG_VLDO8_B 0xC1
187#define DA9063_REG_VLDO9_B 0xC2
188#define DA9063_REG_VLDO10_B 0xC3
189#define DA9063_REG_VLDO11_B 0xC4
190
191/* Backup Battery Charger Control Register */
192#define DA9063_REG_BBAT_CONT 0xC5
193
194/* GPIO PWM (LED) */
195#define DA9063_REG_GPO11_LED 0xC6
196#define DA9063_REG_GPO14_LED 0xC7
197#define DA9063_REG_GPO15_LED 0xC8
198
199/* GP-ADC Threshold Registers */
200#define DA9063_REG_ADC_CFG 0xC9
201#define DA9063_REG_AUTO1_HIGH 0xCA
202#define DA9063_REG_AUTO1_LOW 0xCB
203#define DA9063_REG_AUTO2_HIGH 0xCC
204#define DA9063_REG_AUTO2_LOW 0xCD
205#define DA9063_REG_AUTO3_HIGH 0xCE
206#define DA9063_REG_AUTO3_LOW 0xCF
207
208/* DA9063 Configuration registers */
209/* OTP */
210#define DA9063_REG_OPT_COUNT 0x101
211#define DA9063_REG_OPT_ADDR 0x102
212#define DA9063_REG_OPT_DATA 0x103
213
214/* Customer Trim and Configuration */
215#define DA9063_REG_T_OFFSET 0x104
216#define DA9063_REG_INTERFACE 0x105
217#define DA9063_REG_CONFIG_A 0x106
218#define DA9063_REG_CONFIG_B 0x107
219#define DA9063_REG_CONFIG_C 0x108
220#define DA9063_REG_CONFIG_D 0x109
221#define DA9063_REG_CONFIG_E 0x10A
222#define DA9063_REG_CONFIG_F 0x10B
223#define DA9063_REG_CONFIG_G 0x10C
224#define DA9063_REG_CONFIG_H 0x10D
225#define DA9063_REG_CONFIG_I 0x10E
226#define DA9063_REG_CONFIG_J 0x10F
227#define DA9063_REG_CONFIG_K 0x110
228#define DA9063_REG_CONFIG_L 0x111
229#define DA9063_REG_MON_REG_1 0x112
230#define DA9063_REG_MON_REG_2 0x113
231#define DA9063_REG_MON_REG_3 0x114
232#define DA9063_REG_MON_REG_4 0x115
233#define DA9063_REG_MON_REG_5 0x116
234#define DA9063_REG_MON_REG_6 0x117
235#define DA9063_REG_TRIM_CLDR 0x118
236
237/* General Purpose Registers */
238#define DA9063_REG_GP_ID_0 0x119
239#define DA9063_REG_GP_ID_1 0x11A
240#define DA9063_REG_GP_ID_2 0x11B
241#define DA9063_REG_GP_ID_3 0x11C
242#define DA9063_REG_GP_ID_4 0x11D
243#define DA9063_REG_GP_ID_5 0x11E
244#define DA9063_REG_GP_ID_6 0x11F
245#define DA9063_REG_GP_ID_7 0x120
246#define DA9063_REG_GP_ID_8 0x121
247#define DA9063_REG_GP_ID_9 0x122
248#define DA9063_REG_GP_ID_10 0x123
249#define DA9063_REG_GP_ID_11 0x124
250#define DA9063_REG_GP_ID_12 0x125
251#define DA9063_REG_GP_ID_13 0x126
252#define DA9063_REG_GP_ID_14 0x127
253#define DA9063_REG_GP_ID_15 0x128
254#define DA9063_REG_GP_ID_16 0x129
255#define DA9063_REG_GP_ID_17 0x12A
256#define DA9063_REG_GP_ID_18 0x12B
257#define DA9063_REG_GP_ID_19 0x12C
258
259/* Chip ID and variant */
260#define DA9063_REG_CHIP_ID 0x181
261#define DA9063_REG_CHIP_VARIANT 0x182
262
263/*
264 * PMIC registers bits
265 */
266/* DA9063_REG_PAGE_CON (addr=0x00) */
267#define DA9063_PEG_PAGE_SHIFT 0
268#define DA9063_REG_PAGE_MASK 0x07
269#define DA9063_REG_PAGE0 0x00
270#define DA9063_REG_PAGE2 0x02
271#define DA9063_PAGE_WRITE_MODE 0x00
272#define DA9063_REPEAT_WRITE_MODE 0x40
273#define DA9063_PAGE_REVERT 0x80
274
275/* DA9063_REG_STATUS_A (addr=0x01) */
276#define DA9063_NONKEY 0x01
277#define DA9063_WAKE 0x02
278#define DA9063_DVC_BUSY 0x04
279#define DA9063_COMP_1V2 0x08
280
281/* DA9063_REG_STATUS_B (addr=0x02) */
282#define DA9063_GPI0 0x01
283#define DA9063_GPI1 0x02
284#define DA9063_GPI2 0x04
285#define DA9063_GPI3 0x08
286#define DA9063_GPI4 0x10
287#define DA9063_GPI5 0x20
288#define DA9063_GPI6 0x40
289#define DA9063_GPI7 0x80
290
291/* DA9063_REG_STATUS_C (addr=0x03) */
292#define DA9063_GPI8 0x01
293#define DA9063_GPI9 0x02
294#define DA9063_GPI10 0x04
295#define DA9063_GPI11 0x08
296#define DA9063_GPI12 0x10
297#define DA9063_GPI13 0x20
298#define DA9063_GPI14 0x40
299#define DA9063_GPI15 0x80
300
301/* DA9063_REG_STATUS_D (addr=0x04) */
302#define DA9063_LDO3_LIM 0x08
303#define DA9063_LDO4_LIM 0x10
304#define DA9063_LDO7_LIM 0x20
305#define DA9063_LDO8_LIM 0x40
306#define DA9063_LDO11_LIM 0x80
307
308/* DA9063_REG_FAULT_LOG (addr=0x05) */
309#define DA9063_TWD_ERROR 0x01
310#define DA9063_POR 0x02
311#define DA9063_VDD_FAULT 0x04
312#define DA9063_VDD_START 0x08
313#define DA9063_TEMP_CRIT 0x10
314#define DA9063_KEY_RESET 0x20
315#define DA9063_NSHUTDOWN 0x40
316#define DA9063_WAIT_SHUT 0x80
317
318/* DA9063_REG_EVENT_A (addr=0x06) */
319#define DA9063_E_NONKEY 0x01
320#define DA9063_E_ALARM 0x02
321#define DA9063_E_TICK 0x04
322#define DA9063_E_ADC_RDY 0x08
323#define DA9063_E_SEQ_RDY 0x10
324#define DA9063_EVENTS_B 0x20
325#define DA9063_EVENTS_C 0x40
326#define DA9063_EVENTS_D 0x80
327
328/* DA9063_REG_EVENT_B (addr=0x07) */
329#define DA9063_E_WAKE 0x01
330#define DA9063_E_TEMP 0x02
331#define DA9063_E_COMP_1V2 0x04
332#define DA9063_E_LDO_LIM 0x08
333#define DA9063_E_REG_UVOV 0x10
334#define DA9063_E_DVC_RDY 0x20
335#define DA9063_E_VDD_MON 0x40
336#define DA9063_E_VDD_WARN 0x80
337
338/* DA9063_REG_EVENT_C (addr=0x08) */
339#define DA9063_E_GPI0 0x01
340#define DA9063_E_GPI1 0x02
341#define DA9063_E_GPI2 0x04
342#define DA9063_E_GPI3 0x08
343#define DA9063_E_GPI4 0x10
344#define DA9063_E_GPI5 0x20
345#define DA9063_E_GPI6 0x40
346#define DA9063_E_GPI7 0x80
347
348/* DA9063_REG_EVENT_D (addr=0x09) */
349#define DA9063_E_GPI8 0x01
350#define DA9063_E_GPI9 0x02
351#define DA9063_E_GPI10 0x04
352#define DA9063_E_GPI11 0x08
353#define DA9063_E_GPI12 0x10
354#define DA9063_E_GPI13 0x20
355#define DA9063_E_GPI14 0x40
356#define DA9063_E_GPI15 0x80
357
358/* DA9063_REG_IRQ_MASK_A (addr=0x0A) */
359#define DA9063_M_ONKEY 0x01
360#define DA9063_M_ALARM 0x02
361#define DA9063_M_TICK 0x04
362#define DA9063_M_ADC_RDY 0x08
363#define DA9063_M_SEQ_RDY 0x10
364
365/* DA9063_REG_IRQ_MASK_B (addr=0x0B) */
366#define DA9063_M_WAKE 0x01
367#define DA9063_M_TEMP 0x02
368#define DA9063_M_COMP_1V2 0x04
369#define DA9063_M_LDO_LIM 0x08
370#define DA9063_M_UVOV 0x10
371#define DA9063_M_DVC_RDY 0x20
372#define DA9063_M_VDD_MON 0x40
373#define DA9063_M_VDD_WARN 0x80
374
375/* DA9063_REG_IRQ_MASK_C (addr=0x0C) */
376#define DA9063_M_GPI0 0x01
377#define DA9063_M_GPI1 0x02
378#define DA9063_M_GPI2 0x04
379#define DA9063_M_GPI3 0x08
380#define DA9063_M_GPI4 0x10
381#define DA9063_M_GPI5 0x20
382#define DA9063_M_GPI6 0x40
383#define DA9063_M_GPI7 0x80
384
385/* DA9063_REG_IRQ_MASK_D (addr=0x0D) */
386#define DA9063_M_GPI8 0x01
387#define DA9063_M_GPI9 0x02
388#define DA9063_M_GPI10 0x04
389#define DA9063_M_GPI11 0x08
390#define DA9063_M_GPI12 0x10
391#define DA9063_M_GPI13 0x20
392#define DA9063_M_GPI14 0x40
393#define DA9063_M_GPI15 0x80
394
395/* DA9063_REG_CONTROL_A (addr=0x0E) */
396#define DA9063_SYSTEM_EN 0x01
397#define DA9063_POWER_EN 0x02
398#define DA9063_POWER1_EN 0x04
399#define DA9063_STANDBY 0x08
400#define DA9063_M_SYSTEM_EN 0x10
401#define DA9063_M_POWER_EN 0x20
402#define DA9063_M_POWER1_EN 0x40
403#define DA9063_CP_EN 0x80
404
405/* DA9063_REG_CONTROL_B (addr=0x0F) */
406#define DA9063_CHG_SEL 0x01
407#define DA9063_WATCHDOG_PD 0x02
408#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10
410
411/* DA9063_REG_CONTROL_C (addr=0x10) */
412#define DA9063_DEBOUNCING_MASK 0x07
413#define DA9063_DEBOUNCING_OFF 0x0
414#define DA9063_DEBOUNCING_0MS1 0x1
415#define DA9063_DEBOUNCING_1MS 0x2
416#define DA9063_DEBOUNCING_10MS24 0x3
417#define DA9063_DEBOUNCING_51MS2 0x4
418#define DA9063_DEBOUNCING_256MS 0x5
419#define DA9063_DEBOUNCING_512MS 0x6
420#define DA9063_DEBOUNCING_1024MS 0x7
421
422#define DA9063_AUTO_BOOT 0x08
423#define DA9063_OTPREAD_EN 0x10
424#define DA9063_SLEW_RATE_MASK 0x60
425#define DA9063_SLEW_RATE_4US 0x00
426#define DA9063_SLEW_RATE_3US 0x20
427#define DA9063_SLEW_RATE_1US 0x40
428#define DA9063_SLEW_RATE_0US5 0x60
429#define DA9063_DEF_SUPPLY 0x80
430
431/* DA9063_REG_CONTROL_D (addr=0x11) */
432#define DA9063_TWDSCALE_MASK 0x07
433#define DA9063_BLINK_FRQ_MASK 0x38
434#define DA9063_BLINK_FRQ_OFF 0x00
435#define DA9063_BLINK_FRQ_1S0 0x08
436#define DA9063_BLINK_FRQ_2S0 0x10
437#define DA9063_BLINK_FRQ_4S0 0x18
438#define DA9063_BLINK_FRQ_0S18 0x20
439#define DA9063_BLINK_FRQ_2S0_VDD 0x28
440#define DA9063_BLINK_FRQ_4S0_VDD 0x30
441#define DA9063_BLINK_FRQ_0S18_VDD 0x38
442
443#define DA9063_BLINK_DUR_MASK 0xC0
444#define DA9063_BLINK_DUR_10MS 0x00
445#define DA9063_BLINK_DUR_20MS 0x40
446#define DA9063_BLINK_DUR_40MS 0x80
447#define DA9063_BLINK_DUR_20MSDBL 0xC0
448
449/* DA9063_REG_CONTROL_E (addr=0x12) */
450#define DA9063_RTC_MODE_PD 0x01
451#define DA9063_RTC_MODE_SD 0x02
452#define DA9063_RTC_EN 0x04
453#define DA9063_ECO_MODE 0x08
454#define DA9063_PM_FB1_PIN 0x10
455#define DA9063_PM_FB2_PIN 0x20
456#define DA9063_PM_FB3_PIN 0x40
457#define DA9063_V_LOCK 0x80
458
459/* DA9063_REG_CONTROL_F (addr=0x13) */
460#define DA9063_WATCHDOG 0x01
461#define DA9063_SHUTDOWN 0x02
462#define DA9063_WAKE_UP 0x04
463
464/* DA9063_REG_PD_DIS (addr=0x14) */
465#define DA9063_GPI_DIS 0x01
466#define DA9063_GPADC_PAUSE 0x02
467#define DA9063_PMIF_DIS 0x04
468#define DA9063_HS2WIRE_DIS 0x08
469#define DA9063_BBAT_DIS 0x20
470#define DA9063_OUT_32K_PAUSE 0x40
471#define DA9063_PMCONT_DIS 0x80
472
473/* DA9063_REG_GPIO_0_1 (addr=0x15) */
474#define DA9063_GPIO0_PIN_MASK 0x03
475#define DA9063_GPIO0_PIN_ADCIN1 0x00
476#define DA9063_GPIO0_PIN_GPI 0x01
477#define DA9063_GPIO0_PIN_GPO_OD 0x02
478#define DA9063_GPIO0_PIN_GPO 0x03
479#define DA9063_GPIO0_TYPE 0x04
480#define DA9063_GPIO0_TYPE_GPI_ACT_LOW 0x00
481#define DA9063_GPIO0_TYPE_GPO_VDD_IO1 0x00
482#define DA9063_GPIO0_TYPE_GPI_ACT_HIGH 0x04
483#define DA9063_GPIO0_TYPE_GPO_VDD_IO2 0x04
484#define DA9063_GPIO0_NO_WAKEUP 0x08
485#define DA9063_GPIO1_PIN_MASK 0x30
486#define DA9063_GPIO1_PIN_ADCIN2_COMP 0x00
487#define DA9063_GPIO1_PIN_GPI 0x10
488#define DA9063_GPIO1_PIN_GPO_OD 0x20
489#define DA9063_GPIO1_PIN_GPO 0x30
490#define DA9063_GPIO1_TYPE 0x40
491#define DA9063_GPIO1_TYPE_GPI_ACT_LOW 0x00
492#define DA9063_GPIO1_TYPE_GPO_VDD_IO1 0x00
493#define DA9063_GPIO1_TYPE_GPI_ACT_HIGH 0x04
494#define DA9063_GPIO1_TYPE_GPO_VDD_IO2 0x04
495#define DA9063_GPIO1_NO_WAKEUP 0x80
496
497/* DA9063_REG_GPIO_2_3 (addr=0x16) */
498#define DA9063_GPIO2_PIN_MASK 0x03
499#define DA9063_GPIO2_PIN_ADCIN3 0x00
500#define DA9063_GPIO2_PIN_GPI 0x01
501#define DA9063_GPIO2_PIN_GPO_PSS 0x02
502#define DA9063_GPIO2_PIN_GPO 0x03
503#define DA9063_GPIO2_TYPE 0x04
504#define DA9063_GPIO2_TYPE_GPI_ACT_LOW 0x00
505#define DA9063_GPIO2_TYPE_GPO_VDD_IO1 0x00
506#define DA9063_GPIO2_TYPE_GPI_ACT_HIGH 0x04
507#define DA9063_GPIO2_TYPE_GPO_VDD_IO2 0x04
508#define DA9063_GPIO2_NO_WAKEUP 0x08
509#define DA9063_GPIO3_PIN_MASK 0x30
510#define DA9063_GPIO3_PIN_CORE_SW_G 0x00
511#define DA9063_GPIO3_PIN_GPI 0x10
512#define DA9063_GPIO3_PIN_GPO_OD 0x20
513#define DA9063_GPIO3_PIN_GPO 0x30
514#define DA9063_GPIO3_TYPE 0x40
515#define DA9063_GPIO3_TYPE_GPI_ACT_LOW 0x00
516#define DA9063_GPIO3_TYPE_GPO_VDD_IO1 0x00
517#define DA9063_GPIO3_TYPE_GPI_ACT_HIGH 0x04
518#define DA9063_GPIO3_TYPE_GPO_VDD_IO2 0x04
519#define DA9063_GPIO3_NO_WAKEUP 0x80
520
521/* DA9063_REG_GPIO_4_5 (addr=0x17) */
522#define DA9063_GPIO4_PIN_MASK 0x03
523#define DA9063_GPIO4_PIN_CORE_SW_S 0x00
524#define DA9063_GPIO4_PIN_GPI 0x01
525#define DA9063_GPIO4_PIN_GPO_OD 0x02
526#define DA9063_GPIO4_PIN_GPO 0x03
527#define DA9063_GPIO4_TYPE 0x04
528#define DA9063_GPIO4_TYPE_GPI_ACT_LOW 0x00
529#define DA9063_GPIO4_TYPE_GPO_VDD_IO1 0x00
530#define DA9063_GPIO4_TYPE_GPI_ACT_HIGH 0x04
531#define DA9063_GPIO4_TYPE_GPO_VDD_IO2 0x04
532#define DA9063_GPIO4_NO_WAKEUP 0x08
533#define DA9063_GPIO5_PIN_MASK 0x30
534#define DA9063_GPIO5_PIN_PERI_SW_G 0x00
535#define DA9063_GPIO5_PIN_GPI 0x10
536#define DA9063_GPIO5_PIN_GPO_OD 0x20
537#define DA9063_GPIO5_PIN_GPO 0x30
538#define DA9063_GPIO5_TYPE 0x40
539#define DA9063_GPIO5_TYPE_GPI_ACT_LOW 0x00
540#define DA9063_GPIO5_TYPE_GPO_VDD_IO1 0x00
541#define DA9063_GPIO5_TYPE_GPI_ACT_HIGH 0x04
542#define DA9063_GPIO5_TYPE_GPO_VDD_IO2 0x04
543#define DA9063_GPIO5_NO_WAKEUP 0x80
544
545/* DA9063_REG_GPIO_6_7 (addr=0x18) */
546#define DA9063_GPIO6_PIN_MASK 0x03
547#define DA9063_GPIO6_PIN_PERI_SW_S 0x00
548#define DA9063_GPIO6_PIN_GPI 0x01
549#define DA9063_GPIO6_PIN_GPO_OD 0x02
550#define DA9063_GPIO6_PIN_GPO 0x03
551#define DA9063_GPIO6_TYPE 0x04
552#define DA9063_GPIO6_TYPE_GPI_ACT_LOW 0x00
553#define DA9063_GPIO6_TYPE_GPO_VDD_IO1 0x00
554#define DA9063_GPIO6_TYPE_GPI_ACT_HIGH 0x04
555#define DA9063_GPIO6_TYPE_GPO_VDD_IO2 0x04
556#define DA9063_GPIO6_NO_WAKEUP 0x08
557#define DA9063_GPIO7_PIN_MASK 0x30
558#define DA9063_GPIO7_PIN_GPI 0x10
559#define DA9063_GPIO7_PIN_GPO_PSS 0x20
560#define DA9063_GPIO7_PIN_GPO 0x30
561#define DA9063_GPIO7_TYPE 0x40
562#define DA9063_GPIO7_TYPE_GPI_ACT_LOW 0x00
563#define DA9063_GPIO7_TYPE_GPO_VDD_IO1 0x00
564#define DA9063_GPIO7_TYPE_GPI_ACT_HIGH 0x04
565#define DA9063_GPIO7_TYPE_GPO_VDD_IO2 0x04
566#define DA9063_GPIO7_NO_WAKEUP 0x80
567
568/* DA9063_REG_GPIO_8_9 (addr=0x19) */
569#define DA9063_GPIO8_PIN_MASK 0x03
570#define DA9063_GPIO8_PIN_GPI_SYS_EN 0x00
571#define DA9063_GPIO8_PIN_GPI 0x01
572#define DA9063_GPIO8_PIN_GPO_PSS 0x02
573#define DA9063_GPIO8_PIN_GPO 0x03
574#define DA9063_GPIO8_TYPE 0x04
575#define DA9063_GPIO8_TYPE_GPI_ACT_LOW 0x00
576#define DA9063_GPIO8_TYPE_GPO_VDD_IO1 0x00
577#define DA9063_GPIO8_TYPE_GPI_ACT_HIGH 0x04
578#define DA9063_GPIO8_TYPE_GPO_VDD_IO2 0x04
579#define DA9063_GPIO8_NO_WAKEUP 0x08
580#define DA9063_GPIO9_PIN_MASK 0x30
581#define DA9063_GPIO9_PIN_GPI_PWR_EN 0x00
582#define DA9063_GPIO9_PIN_GPI 0x10
583#define DA9063_GPIO9_PIN_GPO_PSS 0x20
584#define DA9063_GPIO9_PIN_GPO 0x30
585#define DA9063_GPIO9_TYPE 0x40
586#define DA9063_GPIO9_TYPE_GPI_ACT_LOW 0x00
587#define DA9063_GPIO9_TYPE_GPO_VDD_IO1 0x00
588#define DA9063_GPIO9_TYPE_GPI_ACT_HIGH 0x04
589#define DA9063_GPIO9_TYPE_GPO_VDD_IO2 0x04
590#define DA9063_GPIO9_NO_WAKEUP 0x80
591
592/* DA9063_REG_GPIO_10_11 (addr=0x1A) */
593#define DA9063_GPIO10_PIN_MASK 0x03
594#define DA9063_GPIO10_PIN_GPI_PWR1_EN 0x00
595#define DA9063_GPIO10_PIN_GPI 0x01
596#define DA9063_GPIO10_PIN_GPO_OD 0x02
597#define DA9063_GPIO10_PIN_GPO 0x03
598#define DA9063_GPIO10_TYPE 0x04
599#define DA9063_GPIO10_TYPE_GPI_ACT_LOW 0x00
600#define DA9063_GPIO10_TYPE_GPO_VDD_IO1 0x00
601#define DA9063_GPIO10_TYPE_GPI_ACT_HIGH 0x04
602#define DA9063_GPIO10_TYPE_GPO_VDD_IO2 0x04
603#define DA9063_GPIO10_NO_WAKEUP 0x08
604#define DA9063_GPIO11_PIN_MASK 0x30
605#define DA9063_GPIO11_PIN_GPO_OD 0x00
606#define DA9063_GPIO11_PIN_GPI 0x10
607#define DA9063_GPIO11_PIN_GPO_PSS 0x20
608#define DA9063_GPIO11_PIN_GPO 0x30
609#define DA9063_GPIO11_TYPE 0x40
610#define DA9063_GPIO11_TYPE_GPI_ACT_LOW 0x00
611#define DA9063_GPIO11_TYPE_GPO_VDD_IO1 0x00
612#define DA9063_GPIO11_TYPE_GPI_ACT_HIGH 0x04
613#define DA9063_GPIO11_TYPE_GPO_VDD_IO2 0x04
614#define DA9063_GPIO11_NO_WAKEUP 0x80
615
616/* DA9063_REG_GPIO_12_13 (addr=0x1B) */
617#define DA9063_GPIO12_PIN_MASK 0x03
618#define DA9063_GPIO12_PIN_NVDDFLT_OUT 0x00
619#define DA9063_GPIO12_PIN_GPI 0x01
620#define DA9063_GPIO12_PIN_VSYSMON_OUT 0x02
621#define DA9063_GPIO12_PIN_GPO 0x03
622#define DA9063_GPIO12_TYPE 0x04
623#define DA9063_GPIO12_TYPE_GPI_ACT_LOW 0x00
624#define DA9063_GPIO12_TYPE_GPO_VDD_IO1 0x00
625#define DA9063_GPIO12_TYPE_GPI_ACT_HIGH 0x04
626#define DA9063_GPIO12_TYPE_GPO_VDD_IO2 0x04
627#define DA9063_GPIO12_NO_WAKEUP 0x08
628#define DA9063_GPIO13_PIN_MASK 0x30
629#define DA9063_GPIO13_PIN_GPFB1_OUT 0x00
630#define DA9063_GPIO13_PIN_GPI 0x10
631#define DA9063_GPIO13_PIN_GPFB1_OUTOD 0x20
632#define DA9063_GPIO13_PIN_GPO 0x30
633#define DA9063_GPIO13_TYPE 0x40
634#define DA9063_GPIO13_TYPE_GPFB1_OUT 0x00
635#define DA9063_GPIO13_TYPE_GPI 0x00
636#define DA9063_GPIO13_TYPE_GPFB1_OUTOD 0x04
637#define DA9063_GPIO13_TYPE_GPO 0x04
638#define DA9063_GPIO13_NO_WAKEUP 0x80
639
640/* DA9063_REG_GPIO_14_15 (addr=0x1C) */
641#define DA9063_GPIO14_PIN_MASK 0x03
642#define DA9063_GPIO14_PIN_GPO_OD 0x00
643#define DA9063_GPIO14_PIN_GPI 0x01
644#define DA9063_GPIO14_PIN_HS2DATA 0x02
645#define DA9063_GPIO14_PIN_GPO 0x03
646#define DA9063_GPIO14_TYPE 0x04
647#define DA9063_GPIO14_TYPE_GPI_ACT_LOW 0x00
648#define DA9063_GPIO14_TYPE_GPO_VDD_IO1 0x00
649#define DA9063_GPIO14_TYPE_GPI_ACT_HIGH 0x04
650#define DA9063_GPIO14_TYPE_GPO_VDD_IO2 0x04
651#define DA9063_GPIO14_NO_WAKEUP 0x08
652#define DA9063_GPIO15_PIN_MASK 0x30
653#define DA9063_GPIO15_PIN_GPO_OD 0x00
654#define DA9063_GPIO15_PIN_GPI 0x10
655#define DA9063_GPIO15_PIN_GPO 0x30
656#define DA9063_GPIO15_TYPE 0x40
657#define DA9063_GPIO15_TYPE_GPFB1_OUT 0x00
658#define DA9063_GPIO15_TYPE_GPI 0x00
659#define DA9063_GPIO15_TYPE_GPFB1_OUTOD 0x04
660#define DA9063_GPIO15_TYPE_GPO 0x04
661#define DA9063_GPIO15_NO_WAKEUP 0x80
662
663/* DA9063_REG_GPIO_MODE_0_7 (addr=0x1D) */
664#define DA9063_GPIO0_MODE 0x01
665#define DA9063_GPIO1_MODE 0x02
666#define DA9063_GPIO2_MODE 0x04
667#define DA9063_GPIO3_MODE 0x08
668#define DA9063_GPIO4_MODE 0x10
669#define DA9063_GPIO5_MODE 0x20
670#define DA9063_GPIO6_MODE 0x40
671#define DA9063_GPIO7_MODE 0x80
672
673/* DA9063_REG_GPIO_MODE_8_15 (addr=0x1E) */
674#define DA9063_GPIO8_MODE 0x01
675#define DA9063_GPIO9_MODE 0x02
676#define DA9063_GPIO10_MODE 0x04
677#define DA9063_GPIO11_MODE 0x08
678#define DA9063_GPIO11_MODE_LED_ACT_HIGH 0x00
679#define DA9063_GPIO11_MODE_LED_ACT_LOW 0x08
680#define DA9063_GPIO12_MODE 0x10
681#define DA9063_GPIO13_MODE 0x20
682#define DA9063_GPIO14_MODE 0x40
683#define DA9063_GPIO14_MODE_LED_ACT_HIGH 0x00
684#define DA9063_GPIO14_MODE_LED_ACT_LOW 0x40
685#define DA9063_GPIO15_MODE 0x80
686#define DA9063_GPIO15_MODE_LED_ACT_HIGH 0x00
687#define DA9063_GPIO15_MODE_LED_ACT_LOW 0x80
688
689/* DA9063_REG_SWITCH_CONT (addr=0x1F) */
690#define DA9063_CORE_SW_GPI_MASK 0x03
691#define DA9063_CORE_SW_GPI_OFF 0x00
692#define DA9063_CORE_SW_GPI_GPIO1 0x01
693#define DA9063_CORE_SW_GPI_GPIO2 0x02
694#define DA9063_CORE_SW_GPI_GPIO13 0x03
695#define DA9063_PERI_SW_GPI_MASK 0x0C
696#define DA9063_PERI_SW_GPI_OFF 0x00
697#define DA9063_PERI_SW_GPI_GPIO1 0x04
698#define DA9063_PERI_SW_GPI_GPIO2 0x08
699#define DA9063_PERI_SW_GPI_GPIO13 0x0C
700#define DA9063_SWITCH_SR_MASK 0x30
701#define DA9063_SWITCH_SR_1MV 0x00
702#define DA9063_SWITCH_SR_5MV 0x10
703#define DA9063_SWITCH_SR_10MV 0x20
704#define DA9063_SWITCH_SR_50MV 0x30
705#define DA9063_SWITCH_SR_DIS 0x40
706#define DA9063_CP_EN_MODE 0x80
707
708/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */
709#define DA9063_BUCK_EN 0x01
710#define DA9063_BUCK_GPI_MASK 0x06
711#define DA9063_BUCK_GPI_OFF 0x00
712#define DA9063_BUCK_GPI_GPIO1 0x02
713#define DA9063_BUCK_GPI_GPIO2 0x04
714#define DA9063_BUCK_GPI_GPIO13 0x06
715#define DA9063_BUCK_CONF 0x08
716#define DA9063_VBUCK_GPI_MASK 0x60
717#define DA9063_VBUCK_GPI_OFF 0x00
718#define DA9063_VBUCK_GPI_GPIO1 0x20
719#define DA9063_VBUCK_GPI_GPIO2 0x40
720#define DA9063_VBUCK_GPI_GPIO13 0x60
721
722/* DA9063_REG_BCORE1_CONT specific bits (addr=0x21) */
723#define DA9063_CORE_SW_EN 0x10
724#define DA9063_CORE_SW_CONF 0x80
725
726/* DA9063_REG_BPERI_CONT specific bits (addr=0x25) */
727#define DA9063_PERI_SW_EN 0x10
728#define DA9063_PERI_SW_CONF 0x80
729
730/* DA9063_REG_LDOx_CONT common bits (addr=0x26-0x30) */
731#define DA9063_LDO_EN 0x01
732#define DA9063_LDO_GPI_MASK 0x06
733#define DA9063_LDO_GPI_OFF 0x00
734#define DA9063_LDO_GPI_GPIO1 0x02
735#define DA9063_LDO_GPI_GPIO2 0x04
736#define DA9063_LDO_GPI_GPIO13 0x06
737#define DA9063_LDO_PD_DIS 0x08
738#define DA9063_VLDO_GPI_MASK 0x60
739#define DA9063_VLDO_GPI_OFF 0x00
740#define DA9063_VLDO_GPI_GPIO1 0x20
741#define DA9063_VLDO_GPI_GPIO2 0x40
742#define DA9063_VLDO_GPI_GPIO13 0x60
743#define DA9063_LDO_CONF 0x80
744
745/* DA9063_REG_LDO5_CONT specific bits (addr=0x2A) */
746#define DA9063_VLDO5_SEL 0x10
747
748/* DA9063_REG_LDO6_CONT specific bits (addr=0x2B) */
749#define DA9063_VLDO6_SEL 0x10
750
751/* DA9063_REG_LDO7_CONT specific bits (addr=0x2C) */
752#define DA9063_VLDO7_SEL 0x10
753
754/* DA9063_REG_LDO8_CONT specific bits (addr=0x2D) */
755#define DA9063_VLDO8_SEL 0x10
756
757/* DA9063_REG_LDO9_CONT specific bits (addr=0x2E) */
758#define DA9063_VLDO9_SEL 0x10
759
760/* DA9063_REG_LDO10_CONT specific bits (addr=0x2F) */
761#define DA9063_VLDO10_SEL 0x10
762
763/* DA9063_REG_LDO11_CONT specific bits (addr=0x30) */
764#define DA9063_VLDO11_SEL 0x10
765
766/* DA9063_REG_VIB (addr=0x31) */
767#define DA9063_VIB_SET_MASK 0x3F
768#define DA9063_VIB_SET_OFF 0
769#define DA9063_VIB_SET_MAX 0x3F
770
771/* DA9063_REG_DVC_1 (addr=0x32) */
772#define DA9063_VBCORE1_SEL 0x01
773#define DA9063_VBCORE2_SEL 0x02
774#define DA9063_VBPRO_SEL 0x04
775#define DA9063_VBMEM_SEL 0x08
776#define DA9063_VBPERI_SEL 0x10
777#define DA9063_VLDO1_SEL 0x20
778#define DA9063_VLDO2_SEL 0x40
779#define DA9063_VLDO3_SEL 0x80
780
781/* DA9063_REG_DVC_2 (addr=0x33) */
782#define DA9063_VBIO_SEL 0x01
783#define DA9063_VLDO4_SEL 0x80
784
785/* DA9063_REG_ADC_MAN (addr=0x34) */
786#define DA9063_ADC_MUX_MASK 0x0F
787#define DA9063_ADC_MUX_VSYS 0x00
788#define DA9063_ADC_MUX_ADCIN1 0x01
789#define DA9063_ADC_MUX_ADCIN2 0x02
790#define DA9063_ADC_MUX_ADCIN3 0x03
791#define DA9063_ADC_MUX_T_SENSE 0x04
792#define DA9063_ADC_MUX_VBBAT 0x05
793#define DA9063_ADC_MUX_LDO_G1 0x08
794#define DA9063_ADC_MUX_LDO_G2 0x09
795#define DA9063_ADC_MUX_LDO_G3 0x0A
796#define DA9063_ADC_MAN 0x10
797#define DA9063_ADC_MODE 0x20
798
799/* DA9063_REG_ADC_CONT (addr=0x35) */
800#define DA9063_ADC_AUTO_VSYS_EN 0x01
801#define DA9063_ADC_AUTO_AD1_EN 0x02
802#define DA9063_ADC_AUTO_AD2_EN 0x04
803#define DA9063_ADC_AUTO_AD3_EN 0x08
804#define DA9063_ADC_AD1_ISRC_EN 0x10
805#define DA9063_ADC_AD2_ISRC_EN 0x20
806#define DA9063_ADC_AD3_ISRC_EN 0x40
807#define DA9063_COMP1V2_EN 0x80
808
809/* DA9063_REG_VSYS_MON (addr=0x36) */
810#define DA9063_VSYS_VAL_MASK 0xFF
811#define DA9063_VSYS_VAL_BASE 0x00
812
813/* DA9063_REG_ADC_RES_L (addr=0x37) */
814#define DA9063_ADC_RES_L_BITS 2
815#define DA9063_ADC_RES_L_MASK 0xC0
816
817/* DA9063_REG_ADC_RES_H (addr=0x38) */
818#define DA9063_ADC_RES_M_BITS 8
819#define DA9063_ADC_RES_M_MASK 0xFF
820
821/* DA9063_REG_(xxx_RES/ADC_RES_H) (addr=0x39-0x3F) */
822#define DA9063_ADC_VAL_MASK 0xFF
823
824/* DA9063_REG_COUNT_S (addr=0x40) */
825#define DA9063_RTC_READ 0x80
826#define DA9063_COUNT_SEC_MASK 0x3F
827
828/* DA9063_REG_COUNT_MI (addr=0x41) */
829#define DA9063_COUNT_MIN_MASK 0x3F
830
831/* DA9063_REG_COUNT_H (addr=0x42) */
832#define DA9063_COUNT_HOUR_MASK 0x1F
833
834/* DA9063_REG_COUNT_D (addr=0x43) */
835#define DA9063_COUNT_DAY_MASK 0x1F
836
837/* DA9063_REG_COUNT_MO (addr=0x44) */
838#define DA9063_COUNT_MONTH_MASK 0x0F
839
840/* DA9063_REG_COUNT_Y (addr=0x45) */
841#define DA9063_COUNT_YEAR_MASK 0x3F
842#define DA9063_MONITOR 0x40
843
844/* DA9063_REG_ALARM_MI (addr=0x46) */
845#define DA9063_ALARM_STATUS_ALARM 0x80
846#define DA9063_ALARM_STATUS_TICK 0x40
847#define DA9063_ALARM_MIN_MASK 0x3F
848
849/* DA9063_REG_ALARM_H (addr=0x47) */
850#define DA9063_ALARM_HOUR_MASK 0x1F
851
852/* DA9063_REG_ALARM_D (addr=0x48) */
853#define DA9063_ALARM_DAY_MASK 0x1F
854
855/* DA9063_REG_ALARM_MO (addr=0x49) */
856#define DA9063_TICK_WAKE 0x20
857#define DA9063_TICK_TYPE 0x10
858#define DA9063_TICK_TYPE_SEC 0x00
859#define DA9063_TICK_TYPE_MIN 0x10
860#define DA9063_ALARM_MONTH_MASK 0x0F
861
862/* DA9063_REG_ALARM_Y (addr=0x4A) */
863#define DA9063_TICK_ON 0x80
864#define DA9063_ALARM_ON 0x40
865#define DA9063_ALARM_YEAR_MASK 0x3F
866
867/* DA9063_REG_WAIT (addr=0x97)*/
868#define DA9063_REG_WAIT_TIME_MASK 0xF
869#define DA9063_WAIT_TIME_0_US 0x0
870#define DA9063_WAIT_TIME_512_US 0x1
871#define DA9063_WAIT_TIME_1_MS 0x2
872#define DA9063_WAIT_TIME_2_MS 0x3
873#define DA9063_WAIT_TIME_4_1_MS 0x4
874#define DA9063_WAIT_TIME_8_2_MS 0x5
875#define DA9063_WAIT_TIME_16_4_MS 0x6
876#define DA9063_WAIT_TIME_32_8_MS 0x7
877#define DA9063_WAIT_TIME_65_5_MS 0x8
878#define DA9063_WAIT_TIME_128_MS 0x9
879#define DA9063_WAIT_TIME_256_MS 0xA
880#define DA9063_WAIT_TIME_512_MS 0xB
881#define DA9063_WAIT_TIME_1_S 0xC
882#define DA9063_WAIT_TIME_2_1_S 0xD
883
884/* DA9063_REG_EN_32K (addr=0x98)*/
885#define DA9063_STABILIZ_TIME_MASK 0x7
886#define DA9063_CRYSTAL 0x08
887#define DA9063_DELAY_MODE 0x10
888#define DA9063_OUT_CLOCK 0x20
889#define DA9063_RTC_CLOCK 0x40
890#define DA9063_OUT_32K_EN 0x80
891
892/* DA9063_REG_CHIP_VARIANT */
893#define DA9063_CHIP_VARIANT_SHIFT 4
894
895/* DA9063_REG_BUCK_ILIM_A (addr=0x9A) */
896#define DA9063_BIO_ILIM_MASK 0x0F
897#define DA9063_BMEM_ILIM_MASK 0xF0
898
899/* DA9063_REG_BUCK_ILIM_B (addr=0x9B) */
900#define DA9063_BPRO_ILIM_MASK 0x0F
901#define DA9063_BPERI_ILIM_MASK 0xF0
902
903/* DA9063_REG_BUCK_ILIM_C (addr=0x9C) */
904#define DA9063_BCORE1_ILIM_MASK 0x0F
905#define DA9063_BCORE2_ILIM_MASK 0xF0
906
907/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */
908#define DA9063_BUCK_FB_MASK 0x07
909#define DA9063_BUCK_PD_DIS_SHIFT 5
910#define DA9063_BUCK_MODE_MASK 0xC0
911#define DA9063_BUCK_MODE_MANUAL 0x00
912#define DA9063_BUCK_MODE_SLEEP 0x40
913#define DA9063_BUCK_MODE_SYNC 0x80
914#define DA9063_BUCK_MODE_AUTO 0xC0
915
916/* DA9063_REG_BPRO_CFG (addr=0x9F) */
917#define DA9063_BPRO_VTTR_EN 0x08
918#define DA9063_BPRO_VTT_EN 0x10
919
920/* DA9063_REG_VBxxxx_A/B (addr=0xA3-0xA8, 0xB4-0xB9) */
921#define DA9063_VBUCK_MASK 0x7F
922#define DA9063_VBUCK_BIAS 0
923#define DA9063_BUCK_SL 0x80
924
925/* DA9063_REG_VLDOx_A/B (addr=0xA9-0x3, 0xBA-0xC4) */
926#define DA9063_LDO_SL 0x80
927
928/* DA9063_REG_VLDO1_A/B (addr=0xA9, 0xBA) */
929#define DA9063_VLDO1_MASK 0x3F
930#define DA9063_VLDO1_BIAS 0
931
932/* DA9063_REG_VLDO2_A/B (addr=0xAA, 0xBB) */
933#define DA9063_VLDO2_MASK 0x3F
934#define DA9063_VLDO2_BIAS 0
935
936/* DA9063_REG_VLDO3_A/B (addr=0xAB, 0xBC) */
937#define DA9063_VLDO3_MASK 0x7F
938#define DA9063_VLDO3_BIAS 0
939
940/* DA9063_REG_VLDO4_A/B (addr=0xAC, 0xBD) */
941#define DA9063_VLDO4_MASK 0x7F
942#define DA9063_VLDO4_BIAS 0
943
944/* DA9063_REG_VLDO5_A/B (addr=0xAD, 0xBE) */
945#define DA9063_VLDO5_MASK 0x3F
946#define DA9063_VLDO5_BIAS 2
947
948/* DA9063_REG_VLDO6_A/B (addr=0xAE, 0xBF) */
949#define DA9063_VLDO6_MASK 0x3F
950#define DA9063_VLDO6_BIAS 2
951
952/* DA9063_REG_VLDO7_A/B (addr=0xAF, 0xC0) */
953#define DA9063_VLDO7_MASK 0x3F
954#define DA9063_VLDO7_BIAS 2
955
956/* DA9063_REG_VLDO8_A/B (addr=0xB0, 0xC1) */
957#define DA9063_VLDO8_MASK 0x3F
958#define DA9063_VLDO8_BIAS 2
959
960/* DA9063_REG_VLDO9_A/B (addr=0xB1, 0xC2) */
961#define DA9063_VLDO9_MASK 0x3F
962#define DA9063_VLDO9_BIAS 3
963
964/* DA9063_REG_VLDO10_A/B (addr=0xB2, 0xC3) */
965#define DA9063_VLDO10_MASK 0x3F
966#define DA9063_VLDO10_BIAS 2
967
968/* DA9063_REG_VLDO11_A/B (addr=0xB3, 0xC4) */
969#define DA9063_VLDO11_MASK 0x3F
970#define DA9063_VLDO11_BIAS 2
971
972/* DA9063_REG_GPO11_LED (addr=0xC6) */
973/* DA9063_REG_GPO14_LED (addr=0xC7) */
974/* DA9063_REG_GPO15_LED (addr=0xC8) */
975#define DA9063_GPIO_DIM 0x80
976#define DA9063_GPIO_PWM_MASK 0x7F
977
978/* DA9063_REG_CONFIG_H (addr=0x10D) */
979#define DA9063_PWM_CLK_MASK 0x01
980#define DA9063_PWM_CLK_PWM2MHZ 0x00
981#define DA9063_PWM_CLK_PWM1MHZ 0x01
982#define DA9063_LDO8_MODE_MASK 0x02
983#define DA9063_LDO8_MODE_LDO 0
984#define DA9063_LDO8_MODE_VIBR 0x02
985#define DA9063_MERGE_SENSE_MASK 0x04
986#define DA9063_MERGE_SENSE_GP_FB2 0x00
987#define DA9063_MERGE_SENSE_GPIO4 0x04
988#define DA9063_BCORE_MERGE 0x08
989#define DA9063_BPRO_OD 0x10
990#define DA9063_BCORE2_OD 0x20
991#define DA9063_BCORE1_OD 0x40
992#define DA9063_BUCK_MERGE 0x80
993
994/* DA9063_REG_CONFIG_I (addr=0x10E) */
995#define DA9063_NONKEY_PIN_MASK 0x03
996#define DA9063_NONKEY_PIN_PORT 0x00
997#define DA9063_NONKEY_PIN_SWDOWN 0x01
998#define DA9063_NONKEY_PIN_AUTODOWN 0x02
999#define DA9063_NONKEY_PIN_AUTOFLPRT 0x03
1000
1001/* DA9063_REG_MON_REG_5 (addr=0x116) */
1002#define DA9063_MON_A8_IDX_MASK 0x07
1003#define DA9063_MON_A8_IDX_NONE 0x00
1004#define DA9063_MON_A8_IDX_BCORE1 0x01
1005#define DA9063_MON_A8_IDX_BCORE2 0x02
1006#define DA9063_MON_A8_IDX_BPRO 0x03
1007#define DA9063_MON_A8_IDX_LDO3 0x04
1008#define DA9063_MON_A8_IDX_LDO4 0x05
1009#define DA9063_MON_A8_IDX_LDO11 0x06
1010#define DA9063_MON_A9_IDX_MASK 0x70
1011#define DA9063_MON_A9_IDX_NONE 0x00
1012#define DA9063_MON_A9_IDX_BIO 0x01
1013#define DA9063_MON_A9_IDX_BMEM 0x02
1014#define DA9063_MON_A9_IDX_BPERI 0x03
1015#define DA9063_MON_A9_IDX_LDO1 0x04
1016#define DA9063_MON_A9_IDX_LDO2 0x05
1017#define DA9063_MON_A9_IDX_LDO5 0x06
1018
1019/* DA9063_REG_MON_REG_6 (addr=0x117) */
1020#define DA9063_MON_A10_IDX_MASK 0x07
1021#define DA9063_MON_A10_IDX_NONE 0x00
1022#define DA9063_MON_A10_IDX_LDO6 0x01
1023#define DA9063_MON_A10_IDX_LDO7 0x02
1024#define DA9063_MON_A10_IDX_LDO8 0x03
1025#define DA9063_MON_A10_IDX_LDO9 0x04
1026#define DA9063_MON_A10_IDX_LDO10 0x05
1027
1028#endif /* _DA9063_REG_H */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 13a1ee95a233..5166935ce66d 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -30,6 +30,8 @@
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32 32
33struct regmap;
34
33/* 35/*
34 * Register values. 36 * Register values.
35 */ 37 */
@@ -113,6 +115,7 @@ struct davinci_vc {
113 115
114 /* Memory resources */ 116 /* Memory resources */
115 void __iomem *base; 117 void __iomem *base;
118 struct regmap *regmap;
116 119
117 /* MFD cells */ 120 /* MFD cells */
118 struct mfd_cell cells[DAVINCI_VC_CELLS]; 121 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index ca0790fba2f5..060e11256fbc 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -12,6 +12,8 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/err.h> 13#include <linux/err.h>
14 14
15#include <dt-bindings/mfd/dbx500-prcmu.h> /* For clock identifiers */
16
15/* Offset for the firmware version within the TCPM */ 17/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4 18#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8 19#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
@@ -94,74 +96,6 @@ enum prcmu_wakeup_index {
94#define PRCMU_CLKSRC_ARMCLKFIX 0x46 96#define PRCMU_CLKSRC_ARMCLKFIX 0x46
95#define PRCMU_CLKSRC_HDMICLK 0x47 97#define PRCMU_CLKSRC_HDMICLK 0x47
96 98
97/*
98 * Clock identifiers.
99 */
100enum prcmu_clock {
101 PRCMU_SGACLK,
102 PRCMU_UARTCLK,
103 PRCMU_MSP02CLK,
104 PRCMU_MSP1CLK,
105 PRCMU_I2CCLK,
106 PRCMU_SDMMCCLK,
107 PRCMU_SPARE1CLK,
108 PRCMU_SLIMCLK,
109 PRCMU_PER1CLK,
110 PRCMU_PER2CLK,
111 PRCMU_PER3CLK,
112 PRCMU_PER5CLK,
113 PRCMU_PER6CLK,
114 PRCMU_PER7CLK,
115 PRCMU_LCDCLK,
116 PRCMU_BMLCLK,
117 PRCMU_HSITXCLK,
118 PRCMU_HSIRXCLK,
119 PRCMU_HDMICLK,
120 PRCMU_APEATCLK,
121 PRCMU_APETRACECLK,
122 PRCMU_MCDECLK,
123 PRCMU_IPI2CCLK,
124 PRCMU_DSIALTCLK,
125 PRCMU_DMACLK,
126 PRCMU_B2R2CLK,
127 PRCMU_TVCLK,
128 PRCMU_SSPCLK,
129 PRCMU_RNGCLK,
130 PRCMU_UICCCLK,
131 PRCMU_PWMCLK,
132 PRCMU_IRDACLK,
133 PRCMU_IRRCCLK,
134 PRCMU_SIACLK,
135 PRCMU_SVACLK,
136 PRCMU_ACLK,
137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
141 PRCMU_BML8580CLK,
142 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
144 PRCMU_CDCLK,
145 PRCMU_TIMCLK,
146 PRCMU_PLLSOC0,
147 PRCMU_PLLSOC1,
148 PRCMU_ARMSS,
149 PRCMU_PLLDDR,
150 PRCMU_PLLDSI,
151 PRCMU_DSI0CLK,
152 PRCMU_DSI1CLK,
153 PRCMU_DSI0ESCCLK,
154 PRCMU_DSI1ESCCLK,
155 PRCMU_DSI2ESCCLK,
156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
163};
164
165/** 99/**
166 * enum prcmu_wdog_id - PRCMU watchdog IDs 100 * enum prcmu_wdog_id - PRCMU watchdog IDs
167 * @PRCMU_WDOG_ALL: use all timers 101 * @PRCMU_WDOG_ALL: use all timers
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 244fb0d51589..3e050b933dd0 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -323,7 +323,6 @@ struct max77693_dev {
323 323
324 int irq; 324 int irq;
325 int irq_gpio; 325 int irq_gpio;
326 bool wakeup;
327 struct mutex irqlock; 326 struct mutex irqlock;
328 int irq_masks_cur[MAX77693_IRQ_GROUP_NR]; 327 int irq_masks_cur[MAX77693_IRQ_GROUP_NR];
329 int irq_masks_cache[MAX77693_IRQ_GROUP_NR]; 328 int irq_masks_cache[MAX77693_IRQ_GROUP_NR];
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 676f0f388992..3f3dc45f93ee 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -64,8 +64,6 @@ struct max77693_muic_platform_data {
64}; 64};
65 65
66struct max77693_platform_data { 66struct max77693_platform_data {
67 int wakeup;
68
69 /* regulator data */ 67 /* regulator data */
70 struct max77693_regulator_data *regulators; 68 struct max77693_regulator_data *regulators;
71 int num_regulators; 69 int num_regulators;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 41ed59276c00..67c17b5a6f44 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
41 unsigned int mode, unsigned int channel, 41 unsigned int mode, unsigned int channel,
42 u8 ato, bool atox, unsigned int *sample); 42 u8 ato, bool atox, unsigned int *sample);
43 43
44#define MC13783_AUDIO_RX0 36
45#define MC13783_AUDIO_RX1 37
46#define MC13783_AUDIO_TX 38
47#define MC13783_SSI_NETWORK 39
48#define MC13783_AUDIO_CODEC 40
49#define MC13783_AUDIO_DAC 41
50
44#define MC13XXX_IRQ_ADCDONE 0 51#define MC13XXX_IRQ_ADCDONE 0
45#define MC13XXX_IRQ_ADCBISDONE 1 52#define MC13XXX_IRQ_ADCBISDONE 1
46#define MC13XXX_IRQ_TS 2 53#define MC13XXX_IRQ_TS 2
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index a9e8bd157673..f682953043ba 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,6 +10,8 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <linux/device.h>
14
13struct mcp_ops; 15struct mcp_ops;
14 16
15struct mcp { 17struct mcp {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 37e48c957791..9974e387e483 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -184,6 +184,50 @@ enum palmas_regulators {
184 PALMAS_NUM_REGS, 184 PALMAS_NUM_REGS,
185}; 185};
186 186
187/* External controll signal name */
188enum {
189 PALMAS_EXT_CONTROL_ENABLE1 = 0x1,
190 PALMAS_EXT_CONTROL_ENABLE2 = 0x2,
191 PALMAS_EXT_CONTROL_NSLEEP = 0x4,
192};
193
194/*
195 * Palmas device resources can be controlled externally for
196 * enabling/disabling it rather than register write through i2c.
197 * Add the external controlled requestor ID for different resources.
198 */
199enum palmas_external_requestor_id {
200 PALMAS_EXTERNAL_REQSTR_ID_REGEN1,
201 PALMAS_EXTERNAL_REQSTR_ID_REGEN2,
202 PALMAS_EXTERNAL_REQSTR_ID_SYSEN1,
203 PALMAS_EXTERNAL_REQSTR_ID_SYSEN2,
204 PALMAS_EXTERNAL_REQSTR_ID_CLK32KG,
205 PALMAS_EXTERNAL_REQSTR_ID_CLK32KGAUDIO,
206 PALMAS_EXTERNAL_REQSTR_ID_REGEN3,
207 PALMAS_EXTERNAL_REQSTR_ID_SMPS12,
208 PALMAS_EXTERNAL_REQSTR_ID_SMPS3,
209 PALMAS_EXTERNAL_REQSTR_ID_SMPS45,
210 PALMAS_EXTERNAL_REQSTR_ID_SMPS6,
211 PALMAS_EXTERNAL_REQSTR_ID_SMPS7,
212 PALMAS_EXTERNAL_REQSTR_ID_SMPS8,
213 PALMAS_EXTERNAL_REQSTR_ID_SMPS9,
214 PALMAS_EXTERNAL_REQSTR_ID_SMPS10,
215 PALMAS_EXTERNAL_REQSTR_ID_LDO1,
216 PALMAS_EXTERNAL_REQSTR_ID_LDO2,
217 PALMAS_EXTERNAL_REQSTR_ID_LDO3,
218 PALMAS_EXTERNAL_REQSTR_ID_LDO4,
219 PALMAS_EXTERNAL_REQSTR_ID_LDO5,
220 PALMAS_EXTERNAL_REQSTR_ID_LDO6,
221 PALMAS_EXTERNAL_REQSTR_ID_LDO7,
222 PALMAS_EXTERNAL_REQSTR_ID_LDO8,
223 PALMAS_EXTERNAL_REQSTR_ID_LDO9,
224 PALMAS_EXTERNAL_REQSTR_ID_LDOLN,
225 PALMAS_EXTERNAL_REQSTR_ID_LDOUSB,
226
227 /* Last entry */
228 PALMAS_EXTERNAL_REQSTR_ID_MAX,
229};
230
187struct palmas_pmic_platform_data { 231struct palmas_pmic_platform_data {
188 /* An array of pointers to regulator init data indexed by regulator 232 /* An array of pointers to regulator init data indexed by regulator
189 * ID 233 * ID
@@ -259,6 +303,7 @@ struct palmas_platform_data {
259 */ 303 */
260 int mux_from_pdata; 304 int mux_from_pdata;
261 u8 pad1, pad2; 305 u8 pad1, pad2;
306 bool pm_off;
262 307
263 struct palmas_pmic_platform_data *pmic_pdata; 308 struct palmas_pmic_platform_data *pmic_pdata;
264 struct palmas_gpadc_platform_data *gpadc_pdata; 309 struct palmas_gpadc_platform_data *gpadc_pdata;
@@ -2878,4 +2923,9 @@ static inline int palmas_irq_get_virq(struct palmas *palmas, int irq)
2878 return regmap_irq_get_virq(palmas->irq_data, irq); 2923 return regmap_irq_get_virq(palmas->irq_data, irq);
2879} 2924}
2880 2925
2926
2927int palmas_ext_control_req_config(struct palmas *palmas,
2928 enum palmas_external_requestor_id ext_control_req_id,
2929 int ext_ctrl, bool enable);
2930
2881#endif /* __LINUX_MFD_PALMAS_H */ 2931#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index 2b13970596f5..443176ee1ab0 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek driver-based card reader 1/* Driver for Realtek driver-based card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_COMMON_H 22#ifndef __RTSX_COMMON_H
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 7a9f7089435d..0ce772105508 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek PCI-Express card reader 1/* Driver for Realtek PCI-Express card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_PCI_H 22#ifndef __RTSX_PCI_H
@@ -25,8 +24,7 @@
25 24
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/pci.h> 26#include <linux/pci.h>
28 27#include <linux/mfd/rtsx_common.h>
29#include "rtsx_common.h"
30 28
31#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
32 30
@@ -184,11 +182,26 @@
184#define CARD_SHARE_BAROSSA_SD 0x01 182#define CARD_SHARE_BAROSSA_SD 0x01
185#define CARD_SHARE_BAROSSA_MS 0x02 183#define CARD_SHARE_BAROSSA_MS 0x02
186 184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195
187/* SD30_DRIVE_SEL */ 196/* SD30_DRIVE_SEL */
188#define DRIVER_TYPE_A 0x05 197#define DRIVER_TYPE_A 0x05
189#define DRIVER_TYPE_B 0x03 198#define DRIVER_TYPE_B 0x03
190#define DRIVER_TYPE_C 0x02 199#define DRIVER_TYPE_C 0x02
191#define DRIVER_TYPE_D 0x01 200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
192 205
193/* FPDCTL */ 206/* FPDCTL */
194#define SSC_POWER_DOWN 0x01 207#define SSC_POWER_DOWN 0x01
@@ -521,6 +534,10 @@
521#define SAMPLE_VAR_CLK0 (0x01 << 4) 534#define SAMPLE_VAR_CLK0 (0x01 << 4)
522#define SAMPLE_VAR_CLK1 (0x02 << 4) 535#define SAMPLE_VAR_CLK1 (0x02 << 4)
523 536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540
524#define MS_CFG 0xFD40 541#define MS_CFG 0xFD40
525#define MS_TPC 0xFD41 542#define MS_TPC 0xFD41
526#define MS_TRANS_CFG 0xFD42 543#define MS_TRANS_CFG 0xFD42
@@ -669,6 +686,7 @@
669#define PME_FORCE_CTL 0xFE56 686#define PME_FORCE_CTL 0xFE56
670#define ASPM_FORCE_CTL 0xFE57 687#define ASPM_FORCE_CTL 0xFE57
671#define PM_CLK_FORCE_CTL 0xFE58 688#define PM_CLK_FORCE_CTL 0xFE58
689#define FUNC_FORCE_CTL 0xFE59
672#define PERST_GLITCH_WIDTH 0xFE5C 690#define PERST_GLITCH_WIDTH 0xFE5C
673#define CHANGE_LINK_STATE 0xFE5B 691#define CHANGE_LINK_STATE 0xFE5B
674#define RESET_LOAD_REG 0xFE5E 692#define RESET_LOAD_REG 0xFE5E
@@ -684,6 +702,13 @@
684 702
685#define DUMMY_REG_RESET_0 0xFE90 703#define DUMMY_REG_RESET_0 0xFE90
686 704
705#define AUTOLOAD_CFG_BASE 0xFF00
706
707#define PM_CTRL1 0xFF44
708#define PM_CTRL2 0xFF45
709#define PM_CTRL3 0xFF46
710#define PM_CTRL4 0xFF47
711
687/* Memory mapping */ 712/* Memory mapping */
688#define SRAM_BASE 0xE600 713#define SRAM_BASE 0xE600
689#define RBUF_BASE 0xF400 714#define RBUF_BASE 0xF400
@@ -726,6 +751,64 @@
726#define PHY_FLD4 0x1E 751#define PHY_FLD4 0x1E
727#define PHY_DUM_REG 0x1F 752#define PHY_DUM_REG 0x1F
728 753
754#define LCTLR 0x80
755#define PCR_SETTING_REG1 0x724
756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747
758
759/* Phy bits */
760#define PHY_PCR_FORCE_CODE 0xB000
761#define PHY_PCR_OOBS_CALI_50 0x0800
762#define PHY_PCR_OOBS_VCM_08 0x0200
763#define PHY_PCR_OOBS_SEN_90 0x0040
764#define PHY_PCR_RSSI_EN 0x0002
765
766#define PHY_RCR1_ADP_TIME 0x0100
767#define PHY_RCR1_VCO_COARSE 0x001F
768
769#define PHY_RCR2_EMPHASE_EN 0x8000
770#define PHY_RCR2_NADJR 0x4000
771#define PHY_RCR2_CDR_CP_10 0x0400
772#define PHY_RCR2_CDR_SR_2 0x0100
773#define PHY_RCR2_FREQSEL_12 0x0040
774#define PHY_RCR2_CPADJEN 0x0020
775#define PHY_RCR2_CDR_SC_8 0x0008
776#define PHY_RCR2_CALIB_LATE 0x0002
777
778#define PHY_RDR_RXDSEL_1_9 0x4000
779
780#define PHY_TUNE_TUNEREF_1_0 0x4000
781#define PHY_TUNE_VBGSEL_1252 0x0C00
782#define PHY_TUNE_SDBUS_33 0x0200
783#define PHY_TUNE_TUNED18 0x01C0
784#define PHY_TUNE_TUNED12 0X0020
785
786#define PHY_BPCR_IBRXSEL 0x0400
787#define PHY_BPCR_IBTXSEL 0x0100
788#define PHY_BPCR_IB_FILTER 0x0080
789#define PHY_BPCR_CMIRROR_EN 0x0040
790
791#define PHY_REG_REV_RESV 0xE000
792#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
793#define PHY_REG_REV_P1_EN 0x0800
794#define PHY_REG_REV_RXIDLE_EN 0x0400
795#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
796#define PHY_REG_REV_STOP_CLKRD 0x0020
797#define PHY_REG_REV_RX_PWST 0x0008
798#define PHY_REG_REV_STOP_CLKWR 0x0004
799
800#define PHY_FLD3_TIMER_4 0x7800
801#define PHY_FLD3_TIMER_6 0x00E0
802#define PHY_FLD3_RXDELINK 0x0004
803
804#define PHY_FLD4_FLDEN_SEL 0x4000
805#define PHY_FLD4_REQ_REF 0x2000
806#define PHY_FLD4_RXAMP_OFF 0x1000
807#define PHY_FLD4_REQ_ADDA 0x0800
808#define PHY_FLD4_BER_COUNT 0x00E0
809#define PHY_FLD4_BER_TIMER 0x000A
810#define PHY_FLD4_BER_CHK_EN 0x0001
811
729#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 812#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
730 813
731struct rtsx_pcr; 814struct rtsx_pcr;
@@ -747,6 +830,8 @@ struct pcr_ops {
747 u8 voltage); 830 u8 voltage);
748 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 831 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
749 int (*conv_clk_and_div_n)(int clk, int dir); 832 int (*conv_clk_and_div_n)(int clk, int dir);
833 void (*fetch_vendor_settings)(struct rtsx_pcr *pcr);
834 void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state);
750}; 835};
751 836
752enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 837enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -788,7 +873,6 @@ struct rtsx_pcr {
788 struct completion *finish_me; 873 struct completion *finish_me;
789 874
790 unsigned int cur_clock; 875 unsigned int cur_clock;
791 bool ms_pmos;
792 bool remove_pci; 876 bool remove_pci;
793 bool msi_en; 877 bool msi_en;
794 878
@@ -806,6 +890,19 @@ struct rtsx_pcr {
806#define IC_VER_D 3 890#define IC_VER_D 3
807 u8 ic_version; 891 u8 ic_version;
808 892
893 u8 sd30_drive_sel_1v8;
894 u8 sd30_drive_sel_3v3;
895 u8 card_drive_sel;
896#define ASPM_L1_EN 0x02
897 u8 aspm_en;
898
899#define PCR_MS_PMOS (1 << 0)
900#define PCR_REVERSE_SOCKET (1 << 1)
901 u32 flags;
902
903 u32 tx_initial_phase;
904 u32 rx_initial_phase;
905
809 const u32 *sd_pull_ctl_enable_tbl; 906 const u32 *sd_pull_ctl_enable_tbl;
810 const u32 *sd_pull_ctl_disable_tbl; 907 const u32 *sd_pull_ctl_disable_tbl;
811 const u32 *ms_pull_ctl_enable_tbl; 908 const u32 *ms_pull_ctl_enable_tbl;
@@ -822,6 +919,18 @@ struct rtsx_pcr {
822#define PCI_VID(pcr) ((pcr)->pci->vendor) 919#define PCI_VID(pcr) ((pcr)->pci->vendor)
823#define PCI_PID(pcr) ((pcr)->pci->device) 920#define PCI_PID(pcr) ((pcr)->pci->device)
824 921
922#define SDR104_PHASE(val) ((val) & 0xFF)
923#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
924#define DDR50_PHASE(val) (((val) >> 16) & 0xFF)
925#define SDR104_TX_PHASE(pcr) SDR104_PHASE((pcr)->tx_initial_phase)
926#define SDR50_TX_PHASE(pcr) SDR50_PHASE((pcr)->tx_initial_phase)
927#define DDR50_TX_PHASE(pcr) DDR50_PHASE((pcr)->tx_initial_phase)
928#define SDR104_RX_PHASE(pcr) SDR104_PHASE((pcr)->rx_initial_phase)
929#define SDR50_RX_PHASE(pcr) SDR50_PHASE((pcr)->rx_initial_phase)
930#define DDR50_RX_PHASE(pcr) DDR50_PHASE((pcr)->rx_initial_phase)
931#define SET_CLOCK_PHASE(sdr104, sdr50, ddr50) \
932 (((ddr50) << 16) | ((sdr50) << 8) | (sdr104))
933
825void rtsx_pci_start_run(struct rtsx_pcr *pcr); 934void rtsx_pci_start_run(struct rtsx_pcr *pcr);
826int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data); 935int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data);
827int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data); 936int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 378ae8a04c6a..cab2dd279076 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -39,7 +39,8 @@ enum sec_device_type {
39struct sec_pmic_dev { 39struct sec_pmic_dev {
40 struct device *dev; 40 struct device *dev;
41 struct sec_platform_data *pdata; 41 struct sec_platform_data *pdata;
42 struct regmap *regmap; 42 struct regmap *regmap_pmic;
43 struct regmap *regmap_rtc;
43 struct i2c_client *i2c; 44 struct i2c_client *i2c;
44 struct i2c_client *rtc; 45 struct i2c_client *rtc;
45 46
@@ -51,6 +52,7 @@ struct sec_pmic_dev {
51 int ono; 52 int ono;
52 int type; 53 int type;
53 bool wakeup; 54 bool wakeup;
55 bool wtsr_smpl;
54}; 56};
55 57
56int sec_irq_init(struct sec_pmic_dev *sec_pmic); 58int sec_irq_init(struct sec_pmic_dev *sec_pmic);
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index 71597e20cddb..94b7cd6d8891 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -62,6 +62,11 @@ enum sec_rtc_reg {
62/* RTC Update Register1 */ 62/* RTC Update Register1 */
63#define RTC_UDR_SHIFT 0 63#define RTC_UDR_SHIFT 0
64#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) 64#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
65#define RTC_TCON_SHIFT 1
66#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
67#define RTC_TIME_EN_SHIFT 3
68#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT)
69
65/* RTC Hour register */ 70/* RTC Hour register */
66#define HOUR_PM_SHIFT 6 71#define HOUR_PM_SHIFT 6
67#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT) 72#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
@@ -69,6 +74,12 @@ enum sec_rtc_reg {
69#define ALARM_ENABLE_SHIFT 7 74#define ALARM_ENABLE_SHIFT 7
70#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT) 75#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
71 76
77#define SMPL_ENABLE_SHIFT 7
78#define SMPL_ENABLE_MASK (1 << SMPL_ENABLE_SHIFT)
79
80#define WTSR_ENABLE_SHIFT 6
81#define WTSR_ENABLE_MASK (1 << WTSR_ENABLE_SHIFT)
82
72enum { 83enum {
73 RTC_SEC = 0, 84 RTC_SEC = 0,
74 RTC_MIN, 85 RTC_MIN,
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index d0d52ea60074..b3ddf98dec37 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -167,11 +167,8 @@ enum s2mps11_regulators {
167 S2MPS11_BUCK8, 167 S2MPS11_BUCK8,
168 S2MPS11_BUCK9, 168 S2MPS11_BUCK9,
169 S2MPS11_BUCK10, 169 S2MPS11_BUCK10,
170 S2MPS11_AP_EN32KHZ,
171 S2MPS11_CP_EN32KHZ,
172 S2MPS11_BT_EN32KHZ,
173 170
174 S2MPS11_REG_MAX, 171 S2MPS11_REGULATOR_MAX,
175}; 172};
176 173
177#define S2MPS11_BUCK_MIN1 600000 174#define S2MPS11_BUCK_MIN1 600000
@@ -203,6 +200,5 @@ enum s2mps11_regulators {
203#define S2MPS11_BUCK4_RAMP_EN_SHIFT 1 200#define S2MPS11_BUCK4_RAMP_EN_SHIFT 1
204#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0 201#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
205#define S2MPS11_PMIC_EN_SHIFT 6 202#define S2MPS11_PMIC_EN_SHIFT 6
206#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
207 203
208#endif /* __LINUX_MFD_S2MPS11_H */ 204#endif /* __LINUX_MFD_S2MPS11_H */
diff --git a/include/linux/mfd/stw481x.h b/include/linux/mfd/stw481x.h
new file mode 100644
index 000000000000..eda121556e5d
--- /dev/null
+++ b/include/linux/mfd/stw481x.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA
3 * Written on behalf of Linaro for ST-Ericsson
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9#ifndef MFD_STW481X_H
10#define MFD_STW481X_H
11
12#include <linux/i2c.h>
13#include <linux/regulator/machine.h>
14#include <linux/regmap.h>
15#include <linux/bitops.h>
16
17/* These registers are accessed from more than one driver */
18#define STW_CONF1 0x11U
19#define STW_CONF1_PDN_VMMC 0x01U
20#define STW_CONF1_VMMC_MASK 0x0eU
21#define STW_CONF1_VMMC_1_8V 0x02U
22#define STW_CONF1_VMMC_2_85V 0x04U
23#define STW_CONF1_VMMC_3V 0x06U
24#define STW_CONF1_VMMC_1_85V 0x08U
25#define STW_CONF1_VMMC_2_6V 0x0aU
26#define STW_CONF1_VMMC_2_7V 0x0cU
27#define STW_CONF1_VMMC_3_3V 0x0eU
28#define STW_CONF1_MMC_LS_STATUS 0x10U
29#define STW_PCTL_REG_LO 0x1eU
30#define STW_PCTL_REG_HI 0x1fU
31#define STW_CONF1_V_MONITORING 0x20U
32#define STW_CONF1_IT_WARN 0x40U
33#define STW_CONF1_PDN_VAUX 0x80U
34#define STW_CONF2 0x20U
35#define STW_CONF2_MASK_TWARN 0x01U
36#define STW_CONF2_VMMC_EXT 0x02U
37#define STW_CONF2_MASK_IT_WAKE_UP 0x04U
38#define STW_CONF2_GPO1 0x08U
39#define STW_CONF2_GPO2 0x10U
40#define STW_VCORE_SLEEP 0x21U
41
42/**
43 * struct stw481x - state holder for the Stw481x drivers
44 * @mutex: mutex to serialize I2C accesses
45 * @i2c_client: corresponding I2C client
46 * @regulator: regulator device for regulator children
47 * @map: regmap handle to access device registers
48 */
49struct stw481x {
50 struct mutex lock;
51 struct i2c_client *client;
52 struct regulator_dev *vmmc_regulator;
53 struct regmap *map;
54};
55
56#endif
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index b473577f36db..8789fa3c7fd9 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -17,10 +17,35 @@
17 17
18struct device_node; 18struct device_node;
19 19
20#ifdef CONFIG_MFD_SYSCON
20extern struct regmap *syscon_node_to_regmap(struct device_node *np); 21extern struct regmap *syscon_node_to_regmap(struct device_node *np);
21extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); 22extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
22extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); 23extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
23extern struct regmap *syscon_regmap_lookup_by_phandle( 24extern struct regmap *syscon_regmap_lookup_by_phandle(
24 struct device_node *np, 25 struct device_node *np,
25 const char *property); 26 const char *property);
27#else
28static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
29{
30 return ERR_PTR(-ENOSYS);
31}
32
33static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
34{
35 return ERR_PTR(-ENOSYS);
36}
37
38static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
39{
40 return ERR_PTR(-ENOSYS);
41}
42
43static inline struct regmap *syscon_regmap_lookup_by_phandle(
44 struct device_node *np,
45 const char *property)
46{
47 return ERR_PTR(-ENOSYS);
48}
49#endif
50
26#endif /* __LINUX_MFD_SYSCON_H__ */ 51#endif /* __LINUX_MFD_SYSCON_H__ */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index b6bdcd66c07d..b6d36b38b99c 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -241,6 +241,12 @@
241 241
242#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) 242#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
243 243
244#define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25)
245#define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18)
246#define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12)
247#define IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB (0x3f << 6)
248#define IMX6Q_GPR8_TX_DEEMPH_GEN1 (0x3f << 0)
249
244#define IMX6Q_GPR9_TZASC2_BYP BIT(1) 250#define IMX6Q_GPR9_TZASC2_BYP BIT(1)
245#define IMX6Q_GPR9_TZASC1_BYP BIT(0) 251#define IMX6Q_GPR9_TZASC1_BYP BIT(0)
246 252
@@ -273,7 +279,9 @@
273#define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26) 279#define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26)
274#define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25) 280#define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25)
275#define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24) 281#define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24)
282#define IMX6Q_GPR12_DEVICE_TYPE (0xf << 12)
276#define IMX6Q_GPR12_PCIE_CTL_2 BIT(10) 283#define IMX6Q_GPR12_PCIE_CTL_2 BIT(10)
284#define IMX6Q_GPR12_LOS_LEVEL (0x1f << 4)
277 285
278#define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30) 286#define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30)
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) 287#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
@@ -363,4 +371,9 @@
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2) 371#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1) 372#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0) 373#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
374
375/* For imx6sl iomux gpr register field define */
376#define IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK (0x3 << 17)
377#define IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK (0x1 << 14)
378
366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 379#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index db1791bb997a..d498d98f0c2c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -46,16 +46,24 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define ENB(val) (1 << (val))
50#define STPENB_STEPENB STEPENB(0x1FFFF)
51#define STPENB_STEPENB_TC STEPENB(0x1FFF)
49 52
50/* IRQ enable */ 53/* IRQ enable */
51#define IRQENB_HW_PEN BIT(0) 54#define IRQENB_HW_PEN BIT(0)
52#define IRQENB_FIFO0THRES BIT(2) 55#define IRQENB_FIFO0THRES BIT(2)
56#define IRQENB_FIFO0OVRRUN BIT(3)
57#define IRQENB_FIFO0UNDRFLW BIT(4)
53#define IRQENB_FIFO1THRES BIT(5) 58#define IRQENB_FIFO1THRES BIT(5)
59#define IRQENB_FIFO1OVRRUN BIT(6)
60#define IRQENB_FIFO1UNDRFLW BIT(7)
54#define IRQENB_PENUP BIT(9) 61#define IRQENB_PENUP BIT(9)
55 62
56/* Step Configuration */ 63/* Step Configuration */
57#define STEPCONFIG_MODE_MASK (3 << 0) 64#define STEPCONFIG_MODE_MASK (3 << 0)
58#define STEPCONFIG_MODE(val) ((val) << 0) 65#define STEPCONFIG_MODE(val) ((val) << 0)
66#define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1)
59#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2) 67#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
60#define STEPCONFIG_AVG_MASK (7 << 2) 68#define STEPCONFIG_AVG_MASK (7 << 2)
61#define STEPCONFIG_AVG(val) ((val) << 2) 69#define STEPCONFIG_AVG(val) ((val) << 2)
@@ -121,18 +129,23 @@
121#define SEQ_STATUS BIT(5) 129#define SEQ_STATUS BIT(5)
122 130
123#define ADC_CLK 3000000 131#define ADC_CLK 3000000
124#define MAX_CLK_DIV 7
125#define TOTAL_STEPS 16 132#define TOTAL_STEPS 16
126#define TOTAL_CHANNELS 8 133#define TOTAL_CHANNELS 8
134#define FIFO1_THRESHOLD 19
127 135
128/* 136/*
129* ADC runs at 3MHz, and it takes 137 * time in us for processing a single channel, calculated as follows:
130* 15 cycles to latch one data output. 138 *
131* Hence the idle time for ADC to 139 * num cycles = open delay + (sample delay + conv time) * averaging
132* process one sample data would be 140 *
133* around 5 micro seconds. 141 * num cycles: 152 + (1 + 13) * 16 = 376
134*/ 142 *
135#define IDLE_TIMEOUT 5 /* microsec */ 143 * clock frequency: 26MHz / 8 = 3.25MHz
144 * clock period: 1 / 3.25MHz = 308ns
145 *
146 * processing time: 376 * 308ns = 116us
147 */
148#define IDLE_TIMEOUT 116 /* microsec */
136 149
137#define TSCADC_CELLS 2 150#define TSCADC_CELLS 2
138 151
@@ -147,6 +160,7 @@ struct ti_tscadc_dev {
147 struct mfd_cell cells[TSCADC_CELLS]; 160 struct mfd_cell cells[TSCADC_CELLS];
148 u32 reg_se_cache; 161 u32 reg_se_cache;
149 spinlock_t reg_lock; 162 spinlock_t reg_lock;
163 unsigned int clk_div;
150 164
151 /* tsc device */ 165 /* tsc device */
152 struct titsc *tsc; 166 struct titsc *tsc;
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index ce3511326f80..b22883d60500 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -108,7 +108,6 @@ struct tmio_mmc_data {
108 unsigned int cd_gpio; 108 unsigned int cd_gpio;
109 void (*set_pwr)(struct platform_device *host, int state); 109 void (*set_pwr)(struct platform_device *host, int state);
110 void (*set_clk_div)(struct platform_device *host, int state); 110 void (*set_clk_div)(struct platform_device *host, int state);
111 int (*get_cd)(struct platform_device *host);
112 int (*write16_hook)(struct tmio_mmc_host *host, int addr); 111 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
113 /* clock management callbacks */ 112 /* clock management callbacks */
114 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 113 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 7e7fbce7a308..81f639bc1ae6 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -185,6 +185,7 @@
185 185
186#define TWL6040_GPO_MAX 3 186#define TWL6040_GPO_MAX 3
187 187
188/* TODO: All platform data struct can be removed */
188struct twl6040_codec_data { 189struct twl6040_codec_data {
189 u16 hs_left_step; 190 u16 hs_left_step;
190 u16 hs_right_step; 191 u16 hs_right_step;
@@ -229,7 +230,6 @@ struct twl6040 {
229 int audpwron; 230 int audpwron;
230 int power_count; 231 int power_count;
231 int rev; 232 int rev;
232 u8 vibra_ctrl_cache[2];
233 233
234 /* PLL configuration */ 234 /* PLL configuration */
235 int pll; 235 int pll;
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 28af41756360..88f90cbf8e6a 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -10,6 +10,7 @@
10#ifndef UCB1200_H 10#ifndef UCB1200_H
11#define UCB1200_H 11#define UCB1200_H
12 12
13#include <linux/device.h>
13#include <linux/mfd/mcp.h> 14#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 40854ac0ba3d..eefafa62d304 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -56,8 +56,6 @@ struct irq_domain;
56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN) 56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
57 57
58struct wm8994 { 58struct wm8994 {
59 struct mutex irq_lock;
60
61 struct wm8994_pdata pdata; 59 struct wm8994_pdata pdata;
62 60
63 enum wm8994_type type; 61 enum wm8994_type type;
@@ -85,16 +83,43 @@ struct wm8994 {
85}; 83};
86 84
87/* Device I/O API */ 85/* Device I/O API */
88int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
89int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
90 unsigned short val);
91int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
92 unsigned short mask, unsigned short val);
93int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
94 int count, u16 *buf);
95int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
96 int count, const u16 *buf);
97 86
87static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
88{
89 unsigned int val;
90 int ret;
91
92 ret = regmap_read(wm8994->regmap, reg, &val);
93
94 if (ret < 0)
95 return ret;
96 else
97 return val;
98}
99
100static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
101 unsigned short val)
102{
103 return regmap_write(wm8994->regmap, reg, val);
104}
105
106static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
107 int count, u16 *buf)
108{
109 return regmap_bulk_read(wm8994->regmap, reg, buf, count);
110}
111
112static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
113 int count, const u16 *buf)
114{
115 return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16));
116}
117
118static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
119 unsigned short mask, unsigned short val)
120{
121 return regmap_update_bits(wm8994->regmap, reg, mask, val);
122}
98 123
99/* Helper to save on boilerplate */ 124/* Helper to save on boilerplate */
100static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, 125static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8752dbbc6135..2e5b194b9b19 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -17,10 +17,13 @@
17 17
18#define PHY_ID_KSZ8873MLL 0x000e7237 18#define PHY_ID_KSZ8873MLL 0x000e7237
19#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
20#define PHY_ID_KSZ9021RLRN 0x00221611
20#define PHY_ID_KS8737 0x00221720 21#define PHY_ID_KS8737 0x00221720
21#define PHY_ID_KSZ8021 0x00221555 22#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8031 0x00221556 23#define PHY_ID_KSZ8031 0x00221556
23#define PHY_ID_KSZ8041 0x00221510 24#define PHY_ID_KSZ8041 0x00221510
25/* undocumented */
26#define PHY_ID_KSZ8041RNLI 0x00221537
24#define PHY_ID_KSZ8051 0x00221550 27#define PHY_ID_KSZ8051 0x00221550
25/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ 28/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */
26#define PHY_ID_KSZ8001 0x0022161A 29#define PHY_ID_KSZ8001 0x0022161A
@@ -35,4 +38,9 @@
35/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
36#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
37 40
41#define MICREL_KSZ9021_EXTREG_CTRL 0xB
42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
43#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW 0x104
44#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW 0x105
45
38#endif /* _MICREL_PHY_H */ 46#endif /* _MICREL_PHY_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a405d3dc0f61..f5096b58b20d 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -41,8 +41,6 @@ extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
42extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
43 unsigned long private, enum migrate_mode mode, int reason); 43 unsigned long private, enum migrate_mode mode, int reason);
44extern int migrate_huge_page(struct page *, new_page_t x,
45 unsigned long private, enum migrate_mode mode);
46 44
47extern int fail_migrate_page(struct address_space *, 45extern int fail_migrate_page(struct address_space *,
48 struct page *, struct page *); 46 struct page *, struct page *);
@@ -55,6 +53,9 @@ extern int migrate_vmas(struct mm_struct *mm,
55extern void migrate_page_copy(struct page *newpage, struct page *page); 53extern void migrate_page_copy(struct page *newpage, struct page *page);
56extern int migrate_huge_page_move_mapping(struct address_space *mapping, 54extern int migrate_huge_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page); 55 struct page *newpage, struct page *page);
56extern int migrate_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page,
58 struct buffer_head *head, enum migrate_mode mode);
58#else 59#else
59 60
60static inline void putback_lru_pages(struct list_head *l) {} 61static inline void putback_lru_pages(struct list_head *l) {}
@@ -62,9 +63,6 @@ static inline void putback_movable_pages(struct list_head *l) {}
62static inline int migrate_pages(struct list_head *l, new_page_t x, 63static inline int migrate_pages(struct list_head *l, new_page_t x,
63 unsigned long private, enum migrate_mode mode, int reason) 64 unsigned long private, enum migrate_mode mode, int reason)
64 { return -ENOSYS; } 65 { return -ENOSYS; }
65static inline int migrate_huge_page(struct page *page, new_page_t x,
66 unsigned long private, enum migrate_mode mode)
67 { return -ENOSYS; }
68 66
69static inline int migrate_prep(void) { return -ENOSYS; } 67static inline int migrate_prep(void) { return -ENOSYS; }
70static inline int migrate_prep_local(void) { return -ENOSYS; } 68static inline int migrate_prep_local(void) { return -ENOSYS; }
@@ -92,11 +90,12 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
92#endif /* CONFIG_MIGRATION */ 90#endif /* CONFIG_MIGRATION */
93 91
94#ifdef CONFIG_NUMA_BALANCING 92#ifdef CONFIG_NUMA_BALANCING
95extern int migrate_misplaced_page(struct page *page, int node); 93extern int migrate_misplaced_page(struct page *page,
96extern int migrate_misplaced_page(struct page *page, int node); 94 struct vm_area_struct *vma, int node);
97extern bool migrate_ratelimited(int node); 95extern bool migrate_ratelimited(int node);
98#else 96#else
99static inline int migrate_misplaced_page(struct page *page, int node) 97static inline int migrate_misplaced_page(struct page *page,
98 struct vm_area_struct *vma, int node)
100{ 99{
101 return -EAGAIN; /* can't migrate now */ 100 return -EAGAIN; /* can't migrate now */
102} 101}
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 09c2300ddb37..f7eaf2d60083 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,6 +31,7 @@
31#define I2O_MINOR 166 31#define I2O_MINOR 166
32#define MICROCODE_MINOR 184 32#define MICROCODE_MINOR 184
33#define TUN_MINOR 200 33#define TUN_MINOR 200
34#define CUSE_MINOR 203
34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 35#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
35#define MPT_MINOR 220 36#define MPT_MINOR 220
36#define MPT2SAS_MINOR 221 37#define MPT2SAS_MINOR 221
@@ -45,6 +46,7 @@
45#define MAPPER_CTRL_MINOR 236 46#define MAPPER_CTRL_MINOR 236
46#define LOOP_CTRL_MINOR 237 47#define LOOP_CTRL_MINOR 237
47#define VHOST_NET_MINOR 238 48#define VHOST_NET_MINOR 238
49#define UHID_MINOR 239
48#define MISC_DYNAMIC_MINOR 255 50#define MISC_DYNAMIC_MINOR 255
49 51
50struct device; 52struct device;
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index cd1fdf75103b..8df61bc5da00 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -154,10 +154,6 @@ enum {
154 MLX4_CMD_QUERY_IF_STAT = 0X54, 154 MLX4_CMD_QUERY_IF_STAT = 0X54,
155 MLX4_CMD_SET_IF_STAT = 0X55, 155 MLX4_CMD_SET_IF_STAT = 0X55,
156 156
157 /* set port opcode modifiers */
158 MLX4_SET_PORT_PRIO2TC = 0x8,
159 MLX4_SET_PORT_SCHEDULER = 0x9,
160
161 /* register/delete flow steering network rules */ 157 /* register/delete flow steering network rules */
162 MLX4_QP_FLOW_STEERING_ATTACH = 0x65, 158 MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
163 MLX4_QP_FLOW_STEERING_DETACH = 0x66, 159 MLX4_QP_FLOW_STEERING_DETACH = 0x66,
@@ -182,6 +178,8 @@ enum {
182 MLX4_SET_PORT_VLAN_TABLE = 0x3, 178 MLX4_SET_PORT_VLAN_TABLE = 0x3,
183 MLX4_SET_PORT_PRIO_MAP = 0x4, 179 MLX4_SET_PORT_PRIO_MAP = 0x4,
184 MLX4_SET_PORT_GID_TABLE = 0x5, 180 MLX4_SET_PORT_GID_TABLE = 0x5,
181 MLX4_SET_PORT_PRIO2TC = 0x8,
182 MLX4_SET_PORT_SCHEDULER = 0x9,
185}; 183};
186 184
187enum { 185enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 24ce6bdd540e..7d3a523160ba 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -54,6 +54,7 @@ enum {
54 MLX4_FLAG_MASTER = 1 << 2, 54 MLX4_FLAG_MASTER = 1 << 2,
55 MLX4_FLAG_SLAVE = 1 << 3, 55 MLX4_FLAG_SLAVE = 1 << 3,
56 MLX4_FLAG_SRIOV = 1 << 4, 56 MLX4_FLAG_SRIOV = 1 << 4,
57 MLX4_FLAG_OLD_REG_MAC = 1 << 6,
57}; 58};
58 59
59enum { 60enum {
@@ -155,7 +156,7 @@ enum {
155 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 156 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
156 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 157 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
157 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, 158 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
158 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 159 MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 4,
159 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 160 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
160 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 161 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
161 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, 162 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
@@ -640,16 +641,28 @@ struct mlx4_counter {
640 __be64 tx_bytes; 641 __be64 tx_bytes;
641}; 642};
642 643
644struct mlx4_quotas {
645 int qp;
646 int cq;
647 int srq;
648 int mpt;
649 int mtt;
650 int counter;
651 int xrcd;
652};
653
643struct mlx4_dev { 654struct mlx4_dev {
644 struct pci_dev *pdev; 655 struct pci_dev *pdev;
645 unsigned long flags; 656 unsigned long flags;
646 unsigned long num_slaves; 657 unsigned long num_slaves;
647 struct mlx4_caps caps; 658 struct mlx4_caps caps;
648 struct mlx4_phys_caps phys_caps; 659 struct mlx4_phys_caps phys_caps;
660 struct mlx4_quotas quotas;
649 struct radix_tree_root qp_table_tree; 661 struct radix_tree_root qp_table_tree;
650 u8 rev_id; 662 u8 rev_id;
651 char board_id[MLX4_BOARD_ID_LEN]; 663 char board_id[MLX4_BOARD_ID_LEN];
652 int num_vfs; 664 int num_vfs;
665 int numa_node;
653 int oper_log_mgm_entry_size; 666 int oper_log_mgm_entry_size;
654 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 667 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
655 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 668 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
@@ -771,6 +784,12 @@ static inline int mlx4_is_master(struct mlx4_dev *dev)
771 return dev->flags & MLX4_FLAG_MASTER; 784 return dev->flags & MLX4_FLAG_MASTER;
772} 785}
773 786
787static inline int mlx4_num_reserved_sqps(struct mlx4_dev *dev)
788{
789 return dev->phys_caps.base_sqpn + 8 +
790 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev);
791}
792
774static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 793static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
775{ 794{
776 return (qpn < dev->phys_caps.base_sqpn + 8 + 795 return (qpn < dev->phys_caps.base_sqpn + 8 +
@@ -816,7 +835,7 @@ void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn);
816 835
817int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 836int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar);
818void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 837void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar);
819int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf); 838int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node);
820void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf); 839void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf);
821 840
822int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 841int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
@@ -1078,7 +1097,7 @@ int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
1078 u8 *pg, u16 *ratelimit); 1097 u8 *pg, u16 *ratelimit);
1079int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1098int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1080int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1099int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
1081void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 1100void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan);
1082 1101
1083int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 1102int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
1084 int npages, u64 iova, u32 *lkey, u32 *rkey); 1103 int npages, u64 iova, u32 *lkey, u32 *rkey);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 68029b30c3dc..da78875807fc 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -181,7 +181,7 @@ enum {
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41, 183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46, 184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
185}; 185};
186 186
187enum { 187enum {
@@ -230,6 +230,15 @@ enum {
230 MLX5_MAX_PAGE_SHIFT = 31 230 MLX5_MAX_PAGE_SHIFT = 31
231}; 231};
232 232
233enum {
234 MLX5_ADAPTER_PAGE_SHIFT = 12
235};
236
237enum {
238 MLX5_CAP_OFF_DCT = 41,
239 MLX5_CAP_OFF_CMDIF_CSUM = 46,
240};
241
233struct mlx5_inbox_hdr { 242struct mlx5_inbox_hdr {
234 __be16 opcode; 243 __be16 opcode;
235 u8 rsvd[4]; 244 u8 rsvd[4];
@@ -319,9 +328,9 @@ struct mlx5_hca_cap {
319 u8 rsvd25[42]; 328 u8 rsvd25[42];
320 __be16 log_uar_page_sz; 329 __be16 log_uar_page_sz;
321 u8 rsvd26[28]; 330 u8 rsvd26[28];
322 u8 log_msx_atomic_size_qp; 331 u8 log_max_atomic_size_qp;
323 u8 rsvd27[2]; 332 u8 rsvd27[2];
324 u8 log_msx_atomic_size_dc; 333 u8 log_max_atomic_size_dc;
325 u8 rsvd28[76]; 334 u8 rsvd28[76];
326}; 335};
327 336
@@ -417,7 +426,7 @@ struct mlx5_init_seg {
417 struct health_buffer health; 426 struct health_buffer health;
418 __be32 rsvd2[884]; 427 __be32 rsvd2[884];
419 __be32 health_counter; 428 __be32 health_counter;
420 __be32 rsvd3[1023]; 429 __be32 rsvd3[1019];
421 __be64 ieee1588_clk; 430 __be64 ieee1588_clk;
422 __be32 ieee1588_clk_type; 431 __be32 ieee1588_clk_type;
423 __be32 clr_intx; 432 __be32 clr_intx;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 8888381fc150..554548cd3dd4 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -82,7 +82,7 @@ enum {
82}; 82};
83 83
84enum { 84enum {
85 MLX5_MAX_EQ_NAME = 20 85 MLX5_MAX_EQ_NAME = 32
86}; 86};
87 87
88enum { 88enum {
@@ -483,6 +483,7 @@ struct mlx5_priv {
483 struct rb_root page_root; 483 struct rb_root page_root;
484 int fw_pages; 484 int fw_pages;
485 int reg_pages; 485 int reg_pages;
486 struct list_head free_list;
486 487
487 struct mlx5_core_health health; 488 struct mlx5_core_health health;
488 489
@@ -557,9 +558,11 @@ typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
557struct mlx5_cmd_work_ent { 558struct mlx5_cmd_work_ent {
558 struct mlx5_cmd_msg *in; 559 struct mlx5_cmd_msg *in;
559 struct mlx5_cmd_msg *out; 560 struct mlx5_cmd_msg *out;
561 void *uout;
562 int uout_size;
560 mlx5_cmd_cbk_t callback; 563 mlx5_cmd_cbk_t callback;
561 void *context; 564 void *context;
562 int idx; 565 int idx;
563 struct completion done; 566 struct completion done;
564 struct mlx5_cmd *cmd; 567 struct mlx5_cmd *cmd;
565 struct work_struct work; 568 struct work_struct work;
@@ -570,6 +573,7 @@ struct mlx5_cmd_work_ent {
570 u8 token; 573 u8 token;
571 struct timespec ts1; 574 struct timespec ts1;
572 struct timespec ts2; 575 struct timespec ts2;
576 u16 op;
573}; 577};
574 578
575struct mlx5_pas { 579struct mlx5_pas {
@@ -653,6 +657,9 @@ void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr); 657int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, 658int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
655 int out_size); 659 int out_size);
660int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
661 void *out, int out_size, mlx5_cmd_cbk_t callback,
662 void *context);
656int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); 663int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
657int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); 664int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
658int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); 665int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
@@ -676,7 +683,9 @@ int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
676int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, 683int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
677 u16 lwm, int is_srq); 684 u16 lwm, int is_srq);
678int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, 685int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
679 struct mlx5_create_mkey_mbox_in *in, int inlen); 686 struct mlx5_create_mkey_mbox_in *in, int inlen,
687 mlx5_cmd_cbk_t callback, void *context,
688 struct mlx5_create_mkey_mbox_out *out);
680int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr); 689int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr);
681int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, 690int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
682 struct mlx5_query_mkey_mbox_out *out, int outlen); 691 struct mlx5_query_mkey_mbox_out *out, int outlen);
@@ -745,10 +754,14 @@ static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
745 return mkey_idx << 8; 754 return mkey_idx << 8;
746} 755}
747 756
757static inline u8 mlx5_mkey_variant(u32 mkey)
758{
759 return mkey & 0xff;
760}
761
748enum { 762enum {
749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0, 763 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
750 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1, 764 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 1,
751 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
752}; 765};
753 766
754enum { 767enum {
@@ -758,7 +771,6 @@ enum {
758struct mlx5_profile { 771struct mlx5_profile {
759 u64 mask; 772 u64 mask;
760 u32 log_max_qp; 773 u32 log_max_qp;
761 int cmdif_csum;
762 struct { 774 struct {
763 int size; 775 int size;
764 int limit; 776 int limit;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d2d59b4149d0..1cedd000cf29 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -50,6 +50,10 @@ extern int sysctl_legacy_va_layout;
50#include <asm/pgtable.h> 50#include <asm/pgtable.h>
51#include <asm/processor.h> 51#include <asm/processor.h>
52 52
53#ifndef __pa_symbol
54#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
55#endif
56
53extern unsigned long sysctl_user_reserve_kbytes; 57extern unsigned long sysctl_user_reserve_kbytes;
54extern unsigned long sysctl_admin_reserve_kbytes; 58extern unsigned long sysctl_admin_reserve_kbytes;
55 59
@@ -115,6 +119,12 @@ extern unsigned int kobjsize(const void *objp);
115#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ 119#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
116#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ 120#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
117 121
122#ifdef CONFIG_MEM_SOFT_DIRTY
123# define VM_SOFTDIRTY 0x08000000 /* Not soft dirty clean area */
124#else
125# define VM_SOFTDIRTY 0
126#endif
127
118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 128#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
119#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */ 129#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
120#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */ 130#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
@@ -170,6 +180,7 @@ extern pgprot_t protection_map[16];
170#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ 180#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
171#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */ 181#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */
172#define FAULT_FLAG_TRIED 0x40 /* second try */ 182#define FAULT_FLAG_TRIED 0x40 /* second try */
183#define FAULT_FLAG_USER 0x80 /* The fault originated in userspace */
173 184
174/* 185/*
175 * vm_fault is filled by the the pagefault handler and passed to the vma's 186 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -290,12 +301,26 @@ static inline int put_page_testzero(struct page *page)
290/* 301/*
291 * Try to grab a ref unless the page has a refcount of zero, return false if 302 * Try to grab a ref unless the page has a refcount of zero, return false if
292 * that is the case. 303 * that is the case.
304 * This can be called when MMU is off so it must not access
305 * any of the virtual mappings.
293 */ 306 */
294static inline int get_page_unless_zero(struct page *page) 307static inline int get_page_unless_zero(struct page *page)
295{ 308{
296 return atomic_inc_not_zero(&page->_count); 309 return atomic_inc_not_zero(&page->_count);
297} 310}
298 311
312/*
313 * Try to drop a ref unless the page has a refcount of one, return false if
314 * that is the case.
315 * This is to make sure that the refcount won't become zero after this drop.
316 * This can be called when MMU is off so it must not access
317 * any of the virtual mappings.
318 */
319static inline int put_page_unless_one(struct page *page)
320{
321 return atomic_add_unless(&page->_count, -1, 1);
322}
323
299extern int page_is_ram(unsigned long pfn); 324extern int page_is_ram(unsigned long pfn);
300 325
301/* Support for virtually mapped pages */ 326/* Support for virtually mapped pages */
@@ -489,20 +514,6 @@ static inline int compound_order(struct page *page)
489 return (unsigned long)page[1].lru.prev; 514 return (unsigned long)page[1].lru.prev;
490} 515}
491 516
492static inline int compound_trans_order(struct page *page)
493{
494 int order;
495 unsigned long flags;
496
497 if (!PageHead(page))
498 return 0;
499
500 flags = compound_lock_irqsave(page);
501 order = compound_order(page);
502 compound_unlock_irqrestore(page, flags);
503 return order;
504}
505
506static inline void set_compound_order(struct page *page, unsigned long order) 517static inline void set_compound_order(struct page *page, unsigned long order)
507{ 518{
508 page[1].lru.prev = (void *)order; 519 page[1].lru.prev = (void *)order;
@@ -588,11 +599,11 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
588 * sets it, so none of the operations on it need to be atomic. 599 * sets it, so none of the operations on it need to be atomic.
589 */ 600 */
590 601
591/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_NID] | ... | FLAGS | */ 602/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_CPUPID] | ... | FLAGS | */
592#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) 603#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
593#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) 604#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
594#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) 605#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
595#define LAST_NID_PGOFF (ZONES_PGOFF - LAST_NID_WIDTH) 606#define LAST_CPUPID_PGOFF (ZONES_PGOFF - LAST_CPUPID_WIDTH)
596 607
597/* 608/*
598 * Define the bit shifts to access each section. For non-existent 609 * Define the bit shifts to access each section. For non-existent
@@ -602,7 +613,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
602#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) 613#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
603#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 614#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
604#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 615#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
605#define LAST_NID_PGSHIFT (LAST_NID_PGOFF * (LAST_NID_WIDTH != 0)) 616#define LAST_CPUPID_PGSHIFT (LAST_CPUPID_PGOFF * (LAST_CPUPID_WIDTH != 0))
606 617
607/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */ 618/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
608#ifdef NODE_NOT_IN_PAGE_FLAGS 619#ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -624,7 +635,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
624#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 635#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
625#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 636#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
626#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 637#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
627#define LAST_NID_MASK ((1UL << LAST_NID_WIDTH) - 1) 638#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_WIDTH) - 1)
628#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 639#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
629 640
630static inline enum zone_type page_zonenum(const struct page *page) 641static inline enum zone_type page_zonenum(const struct page *page)
@@ -637,12 +648,12 @@ static inline enum zone_type page_zonenum(const struct page *page)
637#endif 648#endif
638 649
639/* 650/*
640 * The identification function is only used by the buddy allocator for 651 * The identification function is mainly used by the buddy allocator for
641 * determining if two pages could be buddies. We are not really 652 * determining if two pages could be buddies. We are not really identifying
642 * identifying a zone since we could be using a the section number 653 * the zone since we could be using the section number id if we do not have
643 * id if we have not node id available in page flags. 654 * node id available in page flags.
644 * We guarantee only that it will return the same value for two 655 * We only guarantee that it will return the same value for two combinable
645 * combinable pages in a zone. 656 * pages in a zone.
646 */ 657 */
647static inline int page_zone_id(struct page *page) 658static inline int page_zone_id(struct page *page)
648{ 659{
@@ -668,51 +679,117 @@ static inline int page_to_nid(const struct page *page)
668#endif 679#endif
669 680
670#ifdef CONFIG_NUMA_BALANCING 681#ifdef CONFIG_NUMA_BALANCING
671#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 682static inline int cpu_pid_to_cpupid(int cpu, int pid)
672static inline int page_nid_xchg_last(struct page *page, int nid)
673{ 683{
674 return xchg(&page->_last_nid, nid); 684 return ((cpu & LAST__CPU_MASK) << LAST__PID_SHIFT) | (pid & LAST__PID_MASK);
675} 685}
676 686
677static inline int page_nid_last(struct page *page) 687static inline int cpupid_to_pid(int cpupid)
678{ 688{
679 return page->_last_nid; 689 return cpupid & LAST__PID_MASK;
680} 690}
681static inline void page_nid_reset_last(struct page *page) 691
692static inline int cpupid_to_cpu(int cpupid)
682{ 693{
683 page->_last_nid = -1; 694 return (cpupid >> LAST__PID_SHIFT) & LAST__CPU_MASK;
684} 695}
685#else 696
686static inline int page_nid_last(struct page *page) 697static inline int cpupid_to_nid(int cpupid)
687{ 698{
688 return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK; 699 return cpu_to_node(cpupid_to_cpu(cpupid));
689} 700}
690 701
691extern int page_nid_xchg_last(struct page *page, int nid); 702static inline bool cpupid_pid_unset(int cpupid)
703{
704 return cpupid_to_pid(cpupid) == (-1 & LAST__PID_MASK);
705}
706
707static inline bool cpupid_cpu_unset(int cpupid)
708{
709 return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK);
710}
711
712static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid)
713{
714 return (task_pid & LAST__PID_MASK) == cpupid_to_pid(cpupid);
715}
692 716
693static inline void page_nid_reset_last(struct page *page) 717#define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid)
718#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
719static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
694{ 720{
695 int nid = (1 << LAST_NID_SHIFT) - 1; 721 return xchg(&page->_last_cpupid, cpupid);
722}
696 723
697 page->flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT); 724static inline int page_cpupid_last(struct page *page)
698 page->flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT; 725{
726 return page->_last_cpupid;
727}
728static inline void page_cpupid_reset_last(struct page *page)
729{
730 page->_last_cpupid = -1;
699} 731}
700#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
701#else 732#else
702static inline int page_nid_xchg_last(struct page *page, int nid) 733static inline int page_cpupid_last(struct page *page)
703{ 734{
704 return page_to_nid(page); 735 return (page->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
705} 736}
706 737
707static inline int page_nid_last(struct page *page) 738extern int page_cpupid_xchg_last(struct page *page, int cpupid);
739
740static inline void page_cpupid_reset_last(struct page *page)
708{ 741{
709 return page_to_nid(page); 742 int cpupid = (1 << LAST_CPUPID_SHIFT) - 1;
743
744 page->flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
745 page->flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT;
746}
747#endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */
748#else /* !CONFIG_NUMA_BALANCING */
749static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
750{
751 return page_to_nid(page); /* XXX */
710} 752}
711 753
712static inline void page_nid_reset_last(struct page *page) 754static inline int page_cpupid_last(struct page *page)
713{ 755{
756 return page_to_nid(page); /* XXX */
714} 757}
715#endif 758
759static inline int cpupid_to_nid(int cpupid)
760{
761 return -1;
762}
763
764static inline int cpupid_to_pid(int cpupid)
765{
766 return -1;
767}
768
769static inline int cpupid_to_cpu(int cpupid)
770{
771 return -1;
772}
773
774static inline int cpu_pid_to_cpupid(int nid, int pid)
775{
776 return -1;
777}
778
779static inline bool cpupid_pid_unset(int cpupid)
780{
781 return 1;
782}
783
784static inline void page_cpupid_reset_last(struct page *page)
785{
786}
787
788static inline bool cpupid_match_pid(struct task_struct *task, int cpupid)
789{
790 return false;
791}
792#endif /* CONFIG_NUMA_BALANCING */
716 793
717static inline struct zone *page_zone(const struct page *page) 794static inline struct zone *page_zone(const struct page *page)
718{ 795{
@@ -884,11 +961,12 @@ static inline int page_mapped(struct page *page)
884#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 961#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
885#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 962#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
886#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */ 963#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */
964#define VM_FAULT_FALLBACK 0x0800 /* huge page fault failed, fall back to small */
887 965
888#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ 966#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
889 967
890#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \ 968#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
891 VM_FAULT_HWPOISON_LARGE) 969 VM_FAULT_FALLBACK | VM_FAULT_HWPOISON_LARGE)
892 970
893/* Encode hstate index for a hwpoisoned large page */ 971/* Encode hstate index for a hwpoisoned large page */
894#define VM_FAULT_SET_HINDEX(x) ((x) << 12) 972#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
@@ -992,7 +1070,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
992 unmap_mapping_range(mapping, holebegin, holelen, 0); 1070 unmap_mapping_range(mapping, holebegin, holelen, 0);
993} 1071}
994 1072
995extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 1073extern void truncate_pagecache(struct inode *inode, loff_t new);
996extern void truncate_setsize(struct inode *inode, loff_t newsize); 1074extern void truncate_setsize(struct inode *inode, loff_t newsize);
997void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1075void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
998int truncate_inode_page(struct address_space *mapping, struct page *page); 1076int truncate_inode_page(struct address_space *mapping, struct page *page);
@@ -1238,32 +1316,76 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
1238} 1316}
1239#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ 1317#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
1240 1318
1241#if USE_SPLIT_PTLOCKS 1319#if USE_SPLIT_PTE_PTLOCKS
1242/* 1320#if BLOATED_SPINLOCKS
1243 * We tuck a spinlock to guard each pagetable page into its struct page, 1321extern bool ptlock_alloc(struct page *page);
1244 * at page->private, with BUILD_BUG_ON to make sure that this will not 1322extern void ptlock_free(struct page *page);
1245 * overflow into the next struct page (as it might with DEBUG_SPINLOCK). 1323
1246 * When freeing, reset page->mapping so free_pages_check won't complain. 1324static inline spinlock_t *ptlock_ptr(struct page *page)
1247 */ 1325{
1248#define __pte_lockptr(page) &((page)->ptl) 1326 return page->ptl;
1249#define pte_lock_init(_page) do { \ 1327}
1250 spin_lock_init(__pte_lockptr(_page)); \ 1328#else /* BLOATED_SPINLOCKS */
1251} while (0) 1329static inline bool ptlock_alloc(struct page *page)
1252#define pte_lock_deinit(page) ((page)->mapping = NULL) 1330{
1253#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) 1331 return true;
1254#else /* !USE_SPLIT_PTLOCKS */ 1332}
1333
1334static inline void ptlock_free(struct page *page)
1335{
1336}
1337
1338static inline spinlock_t *ptlock_ptr(struct page *page)
1339{
1340 return &page->ptl;
1341}
1342#endif /* BLOATED_SPINLOCKS */
1343
1344static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
1345{
1346 return ptlock_ptr(pmd_page(*pmd));
1347}
1348
1349static inline bool ptlock_init(struct page *page)
1350{
1351 /*
1352 * prep_new_page() initialize page->private (and therefore page->ptl)
1353 * with 0. Make sure nobody took it in use in between.
1354 *
1355 * It can happen if arch try to use slab for page table allocation:
1356 * slab code uses page->slab_cache and page->first_page (for tail
1357 * pages), which share storage with page->ptl.
1358 */
1359 VM_BUG_ON(*(unsigned long *)&page->ptl);
1360 if (!ptlock_alloc(page))
1361 return false;
1362 spin_lock_init(ptlock_ptr(page));
1363 return true;
1364}
1365
1366/* Reset page->mapping so free_pages_check won't complain. */
1367static inline void pte_lock_deinit(struct page *page)
1368{
1369 page->mapping = NULL;
1370 ptlock_free(page);
1371}
1372
1373#else /* !USE_SPLIT_PTE_PTLOCKS */
1255/* 1374/*
1256 * We use mm->page_table_lock to guard all pagetable pages of the mm. 1375 * We use mm->page_table_lock to guard all pagetable pages of the mm.
1257 */ 1376 */
1258#define pte_lock_init(page) do {} while (0) 1377static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
1259#define pte_lock_deinit(page) do {} while (0) 1378{
1260#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) 1379 return &mm->page_table_lock;
1261#endif /* USE_SPLIT_PTLOCKS */ 1380}
1381static inline bool ptlock_init(struct page *page) { return true; }
1382static inline void pte_lock_deinit(struct page *page) {}
1383#endif /* USE_SPLIT_PTE_PTLOCKS */
1262 1384
1263static inline void pgtable_page_ctor(struct page *page) 1385static inline bool pgtable_page_ctor(struct page *page)
1264{ 1386{
1265 pte_lock_init(page);
1266 inc_zone_page_state(page, NR_PAGETABLE); 1387 inc_zone_page_state(page, NR_PAGETABLE);
1388 return ptlock_init(page);
1267} 1389}
1268 1390
1269static inline void pgtable_page_dtor(struct page *page) 1391static inline void pgtable_page_dtor(struct page *page)
@@ -1300,6 +1422,52 @@ static inline void pgtable_page_dtor(struct page *page)
1300 ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \ 1422 ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
1301 NULL: pte_offset_kernel(pmd, address)) 1423 NULL: pte_offset_kernel(pmd, address))
1302 1424
1425#if USE_SPLIT_PMD_PTLOCKS
1426
1427static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
1428{
1429 return ptlock_ptr(virt_to_page(pmd));
1430}
1431
1432static inline bool pgtable_pmd_page_ctor(struct page *page)
1433{
1434#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1435 page->pmd_huge_pte = NULL;
1436#endif
1437 return ptlock_init(page);
1438}
1439
1440static inline void pgtable_pmd_page_dtor(struct page *page)
1441{
1442#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1443 VM_BUG_ON(page->pmd_huge_pte);
1444#endif
1445 ptlock_free(page);
1446}
1447
1448#define pmd_huge_pte(mm, pmd) (virt_to_page(pmd)->pmd_huge_pte)
1449
1450#else
1451
1452static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
1453{
1454 return &mm->page_table_lock;
1455}
1456
1457static inline bool pgtable_pmd_page_ctor(struct page *page) { return true; }
1458static inline void pgtable_pmd_page_dtor(struct page *page) {}
1459
1460#define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte)
1461
1462#endif
1463
1464static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd)
1465{
1466 spinlock_t *ptl = pmd_lockptr(mm, pmd);
1467 spin_lock(ptl);
1468 return ptl;
1469}
1470
1303extern void free_area_init(unsigned long * zones_size); 1471extern void free_area_init(unsigned long * zones_size);
1304extern void free_area_init_node(int nid, unsigned long * zones_size, 1472extern void free_area_init_node(int nid, unsigned long * zones_size,
1305 unsigned long zone_start_pfn, unsigned long *zholes_size); 1473 unsigned long zone_start_pfn, unsigned long *zholes_size);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 1397ccf81e91..cf55945c83fb 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -2,6 +2,7 @@
2#define LINUX_MM_INLINE_H 2#define LINUX_MM_INLINE_H
3 3
4#include <linux/huge_mm.h> 4#include <linux/huge_mm.h>
5#include <linux/swap.h>
5 6
6/** 7/**
7 * page_is_file_cache - should the page be on a file LRU or anon LRU? 8 * page_is_file_cache - should the page be on a file LRU or anon LRU?
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index faf4b7c1ad12..bd299418a934 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -23,7 +23,9 @@
23 23
24struct address_space; 24struct address_space;
25 25
26#define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) 26#define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
27#define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \
28 IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
27 29
28/* 30/*
29 * Each physical page in the system has a struct page associated with 31 * Each physical page in the system has a struct page associated with
@@ -42,18 +44,22 @@ struct page {
42 /* First double word block */ 44 /* First double word block */
43 unsigned long flags; /* Atomic flags, some possibly 45 unsigned long flags; /* Atomic flags, some possibly
44 * updated asynchronously */ 46 * updated asynchronously */
45 struct address_space *mapping; /* If low bit clear, points to 47 union {
46 * inode address_space, or NULL. 48 struct address_space *mapping; /* If low bit clear, points to
47 * If page mapped as anonymous 49 * inode address_space, or NULL.
48 * memory, low bit is set, and 50 * If page mapped as anonymous
49 * it points to anon_vma object: 51 * memory, low bit is set, and
50 * see PAGE_MAPPING_ANON below. 52 * it points to anon_vma object:
51 */ 53 * see PAGE_MAPPING_ANON below.
54 */
55 void *s_mem; /* slab first object */
56 };
57
52 /* Second double word */ 58 /* Second double word */
53 struct { 59 struct {
54 union { 60 union {
55 pgoff_t index; /* Our offset within mapping. */ 61 pgoff_t index; /* Our offset within mapping. */
56 void *freelist; /* slub/slob first free object */ 62 void *freelist; /* sl[aou]b first free object */
57 bool pfmemalloc; /* If set by the page allocator, 63 bool pfmemalloc; /* If set by the page allocator,
58 * ALLOC_NO_WATERMARKS was set 64 * ALLOC_NO_WATERMARKS was set
59 * and the low watermark was not 65 * and the low watermark was not
@@ -109,6 +115,7 @@ struct page {
109 }; 115 };
110 atomic_t _count; /* Usage count, see below. */ 116 atomic_t _count; /* Usage count, see below. */
111 }; 117 };
118 unsigned int active; /* SLAB */
112 }; 119 };
113 }; 120 };
114 121
@@ -130,6 +137,12 @@ struct page {
130 137
131 struct list_head list; /* slobs list of pages */ 138 struct list_head list; /* slobs list of pages */
132 struct slab *slab_page; /* slab fields */ 139 struct slab *slab_page; /* slab fields */
140 struct rcu_head rcu_head; /* Used by SLAB
141 * when destroying via RCU
142 */
143#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS
144 pgtable_t pmd_huge_pte; /* protected by page->ptl */
145#endif
133 }; 146 };
134 147
135 /* Remainder is not double word aligned */ 148 /* Remainder is not double word aligned */
@@ -141,9 +154,13 @@ struct page {
141 * indicates order in the buddy 154 * indicates order in the buddy
142 * system if PG_buddy is set. 155 * system if PG_buddy is set.
143 */ 156 */
144#if USE_SPLIT_PTLOCKS 157#if USE_SPLIT_PTE_PTLOCKS
158#if BLOATED_SPINLOCKS
159 spinlock_t *ptl;
160#else
145 spinlock_t ptl; 161 spinlock_t ptl;
146#endif 162#endif
163#endif
147 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */ 164 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
148 struct page *first_page; /* Compound tail pages */ 165 struct page *first_page; /* Compound tail pages */
149 }; 166 };
@@ -174,8 +191,8 @@ struct page {
174 void *shadow; 191 void *shadow;
175#endif 192#endif
176 193
177#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 194#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
178 int _last_nid; 195 int _last_cpupid;
179#endif 196#endif
180} 197}
181/* 198/*
@@ -309,19 +326,20 @@ enum {
309 NR_MM_COUNTERS 326 NR_MM_COUNTERS
310}; 327};
311 328
312#if USE_SPLIT_PTLOCKS && defined(CONFIG_MMU) 329#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU)
313#define SPLIT_RSS_COUNTING 330#define SPLIT_RSS_COUNTING
314/* per-thread cached information, */ 331/* per-thread cached information, */
315struct task_rss_stat { 332struct task_rss_stat {
316 int events; /* for synchronization threshold */ 333 int events; /* for synchronization threshold */
317 int count[NR_MM_COUNTERS]; 334 int count[NR_MM_COUNTERS];
318}; 335};
319#endif /* USE_SPLIT_PTLOCKS */ 336#endif /* USE_SPLIT_PTE_PTLOCKS */
320 337
321struct mm_rss_stat { 338struct mm_rss_stat {
322 atomic_long_t count[NR_MM_COUNTERS]; 339 atomic_long_t count[NR_MM_COUNTERS];
323}; 340};
324 341
342struct kioctx_table;
325struct mm_struct { 343struct mm_struct {
326 struct vm_area_struct * mmap; /* list of VMAs */ 344 struct vm_area_struct * mmap; /* list of VMAs */
327 struct rb_root mm_rb; 345 struct rb_root mm_rb;
@@ -338,6 +356,7 @@ struct mm_struct {
338 pgd_t * pgd; 356 pgd_t * pgd;
339 atomic_t mm_users; /* How many users with user space? */ 357 atomic_t mm_users; /* How many users with user space? */
340 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 358 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
359 atomic_long_t nr_ptes; /* Page table pages */
341 int map_count; /* number of VMAs */ 360 int map_count; /* number of VMAs */
342 361
343 spinlock_t page_table_lock; /* Protects page tables and some counters */ 362 spinlock_t page_table_lock; /* Protects page tables and some counters */
@@ -359,7 +378,6 @@ struct mm_struct {
359 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */ 378 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */
360 unsigned long stack_vm; /* VM_GROWSUP/DOWN */ 379 unsigned long stack_vm; /* VM_GROWSUP/DOWN */
361 unsigned long def_flags; 380 unsigned long def_flags;
362 unsigned long nr_ptes; /* Page table pages */
363 unsigned long start_code, end_code, start_data, end_data; 381 unsigned long start_code, end_code, start_data, end_data;
364 unsigned long start_brk, brk, start_stack; 382 unsigned long start_brk, brk, start_stack;
365 unsigned long arg_start, arg_end, env_start, env_end; 383 unsigned long arg_start, arg_end, env_start, env_end;
@@ -383,8 +401,8 @@ struct mm_struct {
383 401
384 struct core_state *core_state; /* coredumping support */ 402 struct core_state *core_state; /* coredumping support */
385#ifdef CONFIG_AIO 403#ifdef CONFIG_AIO
386 spinlock_t ioctx_lock; 404 spinlock_t ioctx_lock;
387 struct hlist_head ioctx_list; 405 struct kioctx_table __rcu *ioctx_table;
388#endif 406#endif
389#ifdef CONFIG_MM_OWNER 407#ifdef CONFIG_MM_OWNER
390 /* 408 /*
@@ -405,7 +423,7 @@ struct mm_struct {
405#ifdef CONFIG_MMU_NOTIFIER 423#ifdef CONFIG_MMU_NOTIFIER
406 struct mmu_notifier_mm *mmu_notifier_mm; 424 struct mmu_notifier_mm *mmu_notifier_mm;
407#endif 425#endif
408#ifdef CONFIG_TRANSPARENT_HUGEPAGE 426#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
409 pgtable_t pmd_huge_pte; /* protected by page_table_lock */ 427 pgtable_t pmd_huge_pte; /* protected by page_table_lock */
410#endif 428#endif
411#ifdef CONFIG_CPUMASK_OFFSTACK 429#ifdef CONFIG_CPUMASK_OFFSTACK
@@ -419,28 +437,15 @@ struct mm_struct {
419 */ 437 */
420 unsigned long numa_next_scan; 438 unsigned long numa_next_scan;
421 439
422 /* numa_next_reset is when the PTE scanner period will be reset */
423 unsigned long numa_next_reset;
424
425 /* Restart point for scanning and setting pte_numa */ 440 /* Restart point for scanning and setting pte_numa */
426 unsigned long numa_scan_offset; 441 unsigned long numa_scan_offset;
427 442
428 /* numa_scan_seq prevents two threads setting pte_numa */ 443 /* numa_scan_seq prevents two threads setting pte_numa */
429 int numa_scan_seq; 444 int numa_scan_seq;
430
431 /*
432 * The first node a task was scheduled on. If a task runs on
433 * a different node than Make PTE Scan Go Now.
434 */
435 int first_nid;
436#endif 445#endif
437 struct uprobes_state uprobes_state; 446 struct uprobes_state uprobes_state;
438}; 447};
439 448
440/* first nid will either be a valid NID or one of these values */
441#define NUMA_PTE_SCAN_INIT -1
442#define NUMA_PTE_SCAN_ACTIVE -2
443
444static inline void mm_init_cpumask(struct mm_struct *mm) 449static inline void mm_init_cpumask(struct mm_struct *mm)
445{ 450{
446#ifdef CONFIG_CPUMASK_OFFSTACK 451#ifdef CONFIG_CPUMASK_OFFSTACK
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 92dc257251e4..7f7f8dae4b1d 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -87,4 +87,6 @@ calc_vm_flag_bits(unsigned long flags)
87 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 87 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
88 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 88 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED );
89} 89}
90
91unsigned long vm_commit_limit(void);
90#endif /* _LINUX_MMAN_H */ 92#endif /* _LINUX_MMAN_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 842de3e21e70..176fdf824b14 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -240,6 +240,7 @@ struct mmc_part {
240struct mmc_card { 240struct mmc_card {
241 struct mmc_host *host; /* the host this device belongs to */ 241 struct mmc_host *host; /* the host this device belongs to */
242 struct device dev; /* the device */ 242 struct device dev; /* the device */
243 u32 ocr; /* the current OCR setting */
243 unsigned int rca; /* relative card address of device */ 244 unsigned int rca; /* relative card address of device */
244 unsigned int type; /* card type */ 245 unsigned int type; /* card type */
245#define MMC_TYPE_MMC 0 /* MMC card */ 246#define MMC_TYPE_MMC 0 /* MMC card */
@@ -257,6 +258,7 @@ struct mmc_card {
257#define MMC_CARD_REMOVED (1<<7) /* card has been removed */ 258#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
258#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */ 259#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
259#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */ 260#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */
261#define MMC_STATE_SUSPENDED (1<<11) /* card is suspended */
260 unsigned int quirks; /* card quirks */ 262 unsigned int quirks; /* card quirks */
261#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 263#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
262#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 264#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -420,10 +422,10 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
420#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 422#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
421#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 423#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
422#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 424#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
423#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
424#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 425#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
425#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) 426#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
426#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS) 427#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
428#define mmc_card_suspended(c) ((c)->state & MMC_STATE_SUSPENDED)
427 429
428#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 430#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
429#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 431#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
@@ -432,11 +434,12 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
432#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 434#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
433#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 435#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
434#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 436#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
435#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
436#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 437#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
437#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED) 438#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
438#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS) 439#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
439#define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS) 440#define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS)
441#define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED)
442#define mmc_card_clr_suspended(c) ((c)->state &= ~MMC_STATE_SUSPENDED)
440 443
441/* 444/*
442 * Quirk add/remove for MMC products. 445 * Quirk add/remove for MMC products.
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 443243b241d5..87079fc38011 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -151,7 +151,8 @@ extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
151extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 151extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
152 struct mmc_command *, int); 152 struct mmc_command *, int);
153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool); 154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool,
155 bool);
155extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
156extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); 157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
157 158
@@ -188,7 +189,6 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
188 189
189extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 190extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
190extern void mmc_release_host(struct mmc_host *host); 191extern void mmc_release_host(struct mmc_host *host);
191extern int mmc_try_claim_host(struct mmc_host *host);
192 192
193extern void mmc_get_card(struct mmc_card *card); 193extern void mmc_get_card(struct mmc_card *card);
194extern void mmc_put_card(struct mmc_card *card); 194extern void mmc_put_card(struct mmc_card *card);
@@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host)
208 __mmc_claim_host(host, NULL); 208 __mmc_claim_host(host, NULL);
209} 209}
210 210
211struct device_node;
211extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); 212extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
213extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
212 214
213#endif /* LINUX_MMC_CORE_H */ 215#endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 198f0fa44e9f..6ce7d2cd3c7a 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -15,6 +15,7 @@
15#define LINUX_MMC_DW_MMC_H 15#define LINUX_MMC_DW_MMC_H
16 16
17#include <linux/scatterlist.h> 17#include <linux/scatterlist.h>
18#include <linux/mmc/core.h>
18 19
19#define MAX_MCI_SLOTS 2 20#define MAX_MCI_SLOTS 2
20 21
@@ -129,6 +130,9 @@ struct dw_mci {
129 struct mmc_request *mrq; 130 struct mmc_request *mrq;
130 struct mmc_command *cmd; 131 struct mmc_command *cmd;
131 struct mmc_data *data; 132 struct mmc_data *data;
133 struct mmc_command stop_abort;
134 unsigned int prev_blksz;
135 unsigned char timing;
132 struct workqueue_struct *card_workqueue; 136 struct workqueue_struct *card_workqueue;
133 137
134 /* DMA interface members*/ 138 /* DMA interface members*/
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3b0c33ae13e1..99f5709ac343 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -254,6 +254,7 @@ struct mmc_host {
254#define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */ 254#define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */
255#define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */ 255#define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */
256#define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */ 256#define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */
257#define MMC_CAP_RUNTIME_RESUME (1 << 20) /* Resume at runtime_resume. */
257#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ 258#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
258#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ 259#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
259#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ 260#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
@@ -309,7 +310,6 @@ struct mmc_host {
309 spinlock_t lock; /* lock for claim and bus ops */ 310 spinlock_t lock; /* lock for claim and bus ops */
310 311
311 struct mmc_ios ios; /* current io bus settings */ 312 struct mmc_ios ios; /* current io bus settings */
312 u32 ocr; /* the current OCR setting */
313 313
314 /* group bitfields together to minimize padding */ 314 /* group bitfields together to minimize padding */
315 unsigned int use_spi_crc:1; 315 unsigned int use_spi_crc:1;
@@ -382,9 +382,6 @@ static inline void *mmc_priv(struct mmc_host *host)
382#define mmc_classdev(x) (&(x)->class_dev) 382#define mmc_classdev(x) (&(x)->class_dev)
383#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 383#define mmc_hostname(x) (dev_name(&(x)->class_dev))
384 384
385int mmc_suspend_host(struct mmc_host *);
386int mmc_resume_host(struct mmc_host *);
387
388int mmc_power_save_host(struct mmc_host *host); 385int mmc_power_save_host(struct mmc_host *host);
389int mmc_power_restore_host(struct mmc_host *host); 386int mmc_power_restore_host(struct mmc_host *host);
390 387
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e3c6a74d980a..3e781b8c0be7 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -171,6 +171,7 @@ struct sdhci_host {
171 unsigned int ocr_avail_sdio; /* OCR bit masks */ 171 unsigned int ocr_avail_sdio; /* OCR bit masks */
172 unsigned int ocr_avail_sd; 172 unsigned int ocr_avail_sd;
173 unsigned int ocr_avail_mmc; 173 unsigned int ocr_avail_mmc;
174 u32 ocr_mask; /* available voltages */
174 175
175 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ 176 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
176 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ 177 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index e7d5dd67bb74..ccd8fb2cad52 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -16,7 +16,6 @@
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sh_dma.h>
20 19
21/* 20/*
22 * MMCIF : CE_CLK_CTRL [19:16] 21 * MMCIF : CE_CLK_CTRL [19:16]
@@ -33,12 +32,12 @@
33 */ 32 */
34 33
35struct sh_mmcif_plat_data { 34struct sh_mmcif_plat_data {
36 void (*set_pwr)(struct platform_device *pdev, int state);
37 void (*down_pwr)(struct platform_device *pdev);
38 int (*get_cd)(struct platform_device *pdef); 35 int (*get_cd)(struct platform_device *pdef);
39 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ 36 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */
40 unsigned int slave_id_rx; 37 unsigned int slave_id_rx;
41 bool use_cd_gpio : 1; 38 bool use_cd_gpio : 1;
39 bool ccs_unsupported : 1;
40 bool clk_ctrl2_present : 1;
42 unsigned int cd_gpio; 41 unsigned int cd_gpio;
43 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 42 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
44 unsigned long caps; 43 unsigned long caps;
@@ -62,6 +61,7 @@ struct sh_mmcif_plat_data {
62#define MMCIF_CE_INT_MASK 0x00000044 61#define MMCIF_CE_INT_MASK 0x00000044
63#define MMCIF_CE_HOST_STS1 0x00000048 62#define MMCIF_CE_HOST_STS1 0x00000048
64#define MMCIF_CE_HOST_STS2 0x0000004C 63#define MMCIF_CE_HOST_STS2 0x0000004C
64#define MMCIF_CE_CLK_CTRL2 0x00000070
65#define MMCIF_CE_VERSION 0x0000007C 65#define MMCIF_CE_VERSION 0x0000007C
66 66
67/* CE_BUF_ACC */ 67/* CE_BUF_ACC */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index b76bcf0621f6..68927ae50845 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -25,8 +25,6 @@ struct sh_mobile_sdhi_info {
25 unsigned long tmio_caps2; 25 unsigned long tmio_caps2;
26 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
27 unsigned int cd_gpio; 27 unsigned int cd_gpio;
28 void (*set_pwr)(struct platform_device *pdev, int state);
29 int (*get_cd)(struct platform_device *pdev);
30 28
31 /* callbacks for board specific setup code */ 29 /* callbacks for board specific setup code */
32 int (*init)(struct platform_device *pdev, 30 int (*init)(struct platform_device *pdev,
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index 7d88d27bfafa..b0c73e4cacea 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -18,7 +18,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio);
18void mmc_gpio_free_ro(struct mmc_host *host); 18void mmc_gpio_free_ro(struct mmc_host *host);
19 19
20int mmc_gpio_get_cd(struct mmc_host *host); 20int mmc_gpio_get_cd(struct mmc_host *host);
21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio); 21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
22 unsigned int debounce);
22void mmc_gpio_free_cd(struct mmc_host *host); 23void mmc_gpio_free_cd(struct mmc_host *host);
23 24
24#endif 25#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index af4a3b77a8de..bd791e452ad7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -105,6 +105,7 @@ struct zone_padding {
105enum zone_stat_item { 105enum zone_stat_item {
106 /* First 128 byte cacheline (assuming 64 bit words) */ 106 /* First 128 byte cacheline (assuming 64 bit words) */
107 NR_FREE_PAGES, 107 NR_FREE_PAGES,
108 NR_ALLOC_BATCH,
108 NR_LRU_BASE, 109 NR_LRU_BASE,
109 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */ 110 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */
110 NR_ACTIVE_ANON, /* " " " " " */ 111 NR_ACTIVE_ANON, /* " " " " " */
@@ -352,7 +353,6 @@ struct zone {
352 * free areas of different sizes 353 * free areas of different sizes
353 */ 354 */
354 spinlock_t lock; 355 spinlock_t lock;
355 int all_unreclaimable; /* All pages pinned */
356#if defined CONFIG_COMPACTION || defined CONFIG_CMA 356#if defined CONFIG_COMPACTION || defined CONFIG_CMA
357 /* Set to true when the PG_migrate_skip bits should be cleared */ 357 /* Set to true when the PG_migrate_skip bits should be cleared */
358 bool compact_blockskip_flush; 358 bool compact_blockskip_flush;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 329aa307cb77..45e921401b06 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -277,7 +277,7 @@ struct pcmcia_device_id {
277#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 277#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
278#define INPUT_DEVICE_ID_KEY_MAX 0x2ff 278#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
279#define INPUT_DEVICE_ID_REL_MAX 0x0f 279#define INPUT_DEVICE_ID_REL_MAX 0x0f
280#define INPUT_DEVICE_ID_ABS_MAX 0x4f 280#define INPUT_DEVICE_ID_ABS_MAX 0x3f
281#define INPUT_DEVICE_ID_MSC_MAX 0x07 281#define INPUT_DEVICE_ID_MSC_MAX 0x07
282#define INPUT_DEVICE_ID_LED_MAX 0x0f 282#define INPUT_DEVICE_ID_LED_MAX 0x0f
283#define INPUT_DEVICE_ID_SND_MAX 0x07 283#define INPUT_DEVICE_ID_SND_MAX 0x07
diff --git a/include/linux/module.h b/include/linux/module.h
index 05f2447f8c15..15cd6b1b211e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -367,9 +367,6 @@ struct module
367 /* What modules do I depend on? */ 367 /* What modules do I depend on? */
368 struct list_head target_list; 368 struct list_head target_list;
369 369
370 /* Who is waiting for us to be unloaded */
371 struct task_struct *waiter;
372
373 /* Destruction function. */ 370 /* Destruction function. */
374 void (*exit)(void); 371 void (*exit)(void);
375 372
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 73005f9957ea..371d346fa270 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -48,6 +48,9 @@ struct mnt_namespace;
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50#define MNT_LOCK_READONLY 0x400000 50#define MNT_LOCK_READONLY 0x400000
51#define MNT_LOCKED 0x800000
52#define MNT_DOOMED 0x1000000
53#define MNT_SYNC_UMOUNT 0x2000000
51 54
52struct vfsmount { 55struct vfsmount {
53 struct dentry *mnt_root; /* root of the mounted tree */ 56 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 391af8d11cce..e21f9d44307f 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -6,9 +6,9 @@
6 6
7/* one msg_msg structure for each message */ 7/* one msg_msg structure for each message */
8struct msg_msg { 8struct msg_msg {
9 struct list_head m_list; 9 struct list_head m_list;
10 long m_type; 10 long m_type;
11 int m_ts; /* message text size */ 11 size_t m_ts; /* message text size */
12 struct msg_msgseg* next; 12 struct msg_msgseg* next;
13 void *security; 13 void *security;
14 /* the actual message follows immediately */ 14 /* the actual message follows immediately */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ee66f3a12fb6..009b02481436 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -26,11 +26,11 @@ struct msi_desc {
26 struct { 26 struct {
27 __u8 is_msix : 1; 27 __u8 is_msix : 1;
28 __u8 multiple: 3; /* log2 number of messages */ 28 __u8 multiple: 3; /* log2 number of messages */
29 __u8 maskbit : 1; /* mask-pending bit supported ? */ 29 __u8 maskbit : 1; /* mask-pending bit supported ? */
30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
31 __u8 pos; /* Location of the msi capability */ 31 __u8 pos; /* Location of the msi capability */
32 __u16 entry_nr; /* specific enabled entry */ 32 __u16 entry_nr; /* specific enabled entry */
33 unsigned default_irq; /* default pre-assigned irq */ 33 unsigned default_irq; /* default pre-assigned irq */
34 } msi_attrib; 34 } msi_attrib;
35 35
36 u32 masked; /* mask bits */ 36 u32 masked; /* mask bits */
@@ -51,12 +51,33 @@ struct msi_desc {
51}; 51};
52 52
53/* 53/*
54 * The arch hook for setup up msi irqs 54 * The arch hooks to setup up msi irqs. Those functions are
55 * implemented as weak symbols so that they /can/ be overriden by
56 * architecture specific code if needed.
55 */ 57 */
56int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 58int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
57void arch_teardown_msi_irq(unsigned int irq); 59void arch_teardown_msi_irq(unsigned int irq);
58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 60int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
59void arch_teardown_msi_irqs(struct pci_dev *dev); 61void arch_teardown_msi_irqs(struct pci_dev *dev);
60int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 62int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
63void arch_restore_msi_irqs(struct pci_dev *dev, int irq);
64
65void default_teardown_msi_irqs(struct pci_dev *dev);
66void default_restore_msi_irqs(struct pci_dev *dev, int irq);
67u32 default_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
68u32 default_msix_mask_irq(struct msi_desc *desc, u32 flag);
69
70struct msi_chip {
71 struct module *owner;
72 struct device *dev;
73 struct device_node *of_node;
74 struct list_head list;
75
76 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
77 struct msi_desc *desc);
78 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
79 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
80 int nvec, int type);
81};
61 82
62#endif /* LINUX_MSI_H */ 83#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 211ff67e8b0d..36bb6a503f19 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -91,10 +91,6 @@ struct nand_bbt_descr {
91 * with NAND_BBT_CREATE. 91 * with NAND_BBT_CREATE.
92 */ 92 */
93#define NAND_BBT_CREATE_EMPTY 0x00000400 93#define NAND_BBT_CREATE_EMPTY 0x00000400
94/* Search good / bad pattern through all pages of a block */
95#define NAND_BBT_SCANALLPAGES 0x00000800
96/* Scan block empty during good / bad block scan */
97#define NAND_BBT_SCANEMPTY 0x00001000
98/* Write bbt if neccecary */ 94/* Write bbt if neccecary */
99#define NAND_BBT_WRITE 0x00002000 95#define NAND_BBT_WRITE 0x00002000
100/* Read and write back block contents when writing bbt */ 96/* Read and write back block contents when writing bbt */
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index d6ed61ef451d..c8be32e9fc49 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -137,6 +137,7 @@ enum access_mode {
137 137
138/** 138/**
139 * fsmc_nand_platform_data - platform specific NAND controller config 139 * fsmc_nand_platform_data - platform specific NAND controller config
140 * @nand_timings: timing setup for the physical NAND interface
140 * @partitions: partition table for the platform, use a default fallback 141 * @partitions: partition table for the platform, use a default fallback
141 * if this is NULL 142 * if this is NULL
142 * @nr_partitions: the number of partitions in the previous entry 143 * @nr_partitions: the number of partitions in the previous entry
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 4b02512e421c..5f487d776411 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -365,7 +365,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
365 bitpos = (map_bankwidth(map)-1-i)*8; 365 bitpos = (map_bankwidth(map)-1-i)*8;
366#endif 366#endif
367 orig.x[0] &= ~(0xff << bitpos); 367 orig.x[0] &= ~(0xff << bitpos);
368 orig.x[0] |= buf[i-start] << bitpos; 368 orig.x[0] |= (unsigned long)buf[i-start] << bitpos;
369 } 369 }
370 } 370 }
371 return orig; 371 return orig;
@@ -384,7 +384,7 @@ static inline map_word map_word_ff(struct map_info *map)
384 384
385 if (map_bankwidth(map) < MAP_FF_LIMIT) { 385 if (map_bankwidth(map) < MAP_FF_LIMIT) {
386 int bw = 8 * map_bankwidth(map); 386 int bw = 8 * map_bankwidth(map);
387 r.x[0] = (1 << bw) - 1; 387 r.x[0] = (1UL << bw) - 1;
388 } else { 388 } else {
389 for (i=0; i<map_words(map); i++) 389 for (i=0; i<map_words(map); i++)
390 r.x[i] = ~0UL; 390 r.x[i] = ~0UL;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a5cf4e8d6818..8cc0e2fb6894 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -29,9 +29,6 @@
29 29
30#include <asm/div64.h> 30#include <asm/div64.h>
31 31
32#define MTD_CHAR_MAJOR 90
33#define MTD_BLOCK_MAJOR 31
34
35#define MTD_ERASE_PENDING 0x01 32#define MTD_ERASE_PENDING 0x01
36#define MTD_ERASING 0x02 33#define MTD_ERASING 0x02
37#define MTD_ERASE_SUSPEND 0x04 34#define MTD_ERASE_SUSPEND 0x04
@@ -173,6 +170,9 @@ struct mtd_info {
173 /* ECC layout structure pointer - read only! */ 170 /* ECC layout structure pointer - read only! */
174 struct nand_ecclayout *ecclayout; 171 struct nand_ecclayout *ecclayout;
175 172
173 /* the ecc step size. */
174 unsigned int ecc_step_size;
175
176 /* max number of correctible bit errors per ecc step */ 176 /* max number of correctible bit errors per ecc step */
177 unsigned int ecc_strength; 177 unsigned int ecc_strength;
178 178
@@ -351,6 +351,11 @@ static inline int mtd_has_oob(const struct mtd_info *mtd)
351 return mtd->_read_oob && mtd->_write_oob; 351 return mtd->_read_oob && mtd->_write_oob;
352} 352}
353 353
354static inline int mtd_type_is_nand(const struct mtd_info *mtd)
355{
356 return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH;
357}
358
354static inline int mtd_can_have_bb(const struct mtd_info *mtd) 359static inline int mtd_can_have_bb(const struct mtd_info *mtd)
355{ 360{
356 return !!mtd->_block_isbad; 361 return !!mtd->_block_isbad;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ab6363443ce8..9e6c8f9f306e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
56 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly. 57 * adjust this accordingly.
58 */ 58 */
59#define NAND_MAX_OOBSIZE 640 59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192 60#define NAND_MAX_PAGESIZE 8192
61 61
62/* 62/*
@@ -198,10 +198,15 @@ typedef enum {
198/* Cell info constants */ 198/* Cell info constants */
199#define NAND_CI_CHIPNR_MSK 0x03 199#define NAND_CI_CHIPNR_MSK 0x03
200#define NAND_CI_CELLTYPE_MSK 0x0C 200#define NAND_CI_CELLTYPE_MSK 0x0C
201#define NAND_CI_CELLTYPE_SHIFT 2
201 202
202/* Keep gcc happy */ 203/* Keep gcc happy */
203struct nand_chip; 204struct nand_chip;
204 205
206/* ONFI features */
207#define ONFI_FEATURE_16_BIT_BUS (1 << 0)
208#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
209
205/* ONFI timing mode, used in both asynchronous and synchronous mode */ 210/* ONFI timing mode, used in both asynchronous and synchronous mode */
206#define ONFI_TIMING_MODE_0 (1 << 0) 211#define ONFI_TIMING_MODE_0 (1 << 0)
207#define ONFI_TIMING_MODE_1 (1 << 1) 212#define ONFI_TIMING_MODE_1 (1 << 1)
@@ -217,6 +222,9 @@ struct nand_chip;
217/* ONFI subfeature parameters length */ 222/* ONFI subfeature parameters length */
218#define ONFI_SUBFEATURE_PARAM_LEN 4 223#define ONFI_SUBFEATURE_PARAM_LEN 4
219 224
225/* ONFI optional commands SET/GET FEATURES supported? */
226#define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2)
227
220struct nand_onfi_params { 228struct nand_onfi_params {
221 /* rev info and features block */ 229 /* rev info and features block */
222 /* 'O' 'N' 'F' 'I' */ 230 /* 'O' 'N' 'F' 'I' */
@@ -224,7 +232,10 @@ struct nand_onfi_params {
224 __le16 revision; 232 __le16 revision;
225 __le16 features; 233 __le16 features;
226 __le16 opt_cmd; 234 __le16 opt_cmd;
227 u8 reserved[22]; 235 u8 reserved0[2];
236 __le16 ext_param_page_length; /* since ONFI 2.1 */
237 u8 num_of_param_pages; /* since ONFI 2.1 */
238 u8 reserved1[17];
228 239
229 /* manufacturer information block */ 240 /* manufacturer information block */
230 char manufacturer[12]; 241 char manufacturer[12];
@@ -281,6 +292,40 @@ struct nand_onfi_params {
281 292
282#define ONFI_CRC_BASE 0x4F4E 293#define ONFI_CRC_BASE 0x4F4E
283 294
295/* Extended ECC information Block Definition (since ONFI 2.1) */
296struct onfi_ext_ecc_info {
297 u8 ecc_bits;
298 u8 codeword_size;
299 __le16 bb_per_lun;
300 __le16 block_endurance;
301 u8 reserved[2];
302} __packed;
303
304#define ONFI_SECTION_TYPE_0 0 /* Unused section. */
305#define ONFI_SECTION_TYPE_1 1 /* for additional sections. */
306#define ONFI_SECTION_TYPE_2 2 /* for ECC information. */
307struct onfi_ext_section {
308 u8 type;
309 u8 length;
310} __packed;
311
312#define ONFI_EXT_SECTION_MAX 8
313
314/* Extended Parameter Page Definition (since ONFI 2.1) */
315struct onfi_ext_param_page {
316 __le16 crc;
317 u8 sig[4]; /* 'E' 'P' 'P' 'S' */
318 u8 reserved0[10];
319 struct onfi_ext_section sections[ONFI_EXT_SECTION_MAX];
320
321 /*
322 * The actual size of the Extended Parameter Page is in
323 * @ext_param_page_length of nand_onfi_params{}.
324 * The following are the variable length sections.
325 * So we do not add any fields below. Please see the ONFI spec.
326 */
327} __packed;
328
284/** 329/**
285 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 330 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
286 * @lock: protection lock 331 * @lock: protection lock
@@ -390,8 +435,8 @@ struct nand_buffers {
390 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 435 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
391 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 436 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
392 * @select_chip: [REPLACEABLE] select chip nr 437 * @select_chip: [REPLACEABLE] select chip nr
393 * @block_bad: [REPLACEABLE] check, if the block is bad 438 * @block_bad: [REPLACEABLE] check if a block is bad, using OOB markers
394 * @block_markbad: [REPLACEABLE] mark the block bad 439 * @block_markbad: [REPLACEABLE] mark a block bad
395 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling 440 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling
396 * ALE/CLE/nCE. Also used to write command and address 441 * ALE/CLE/nCE. Also used to write command and address
397 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting 442 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting
@@ -433,7 +478,13 @@ struct nand_buffers {
433 * @badblockbits: [INTERN] minimum number of set bits in a good block's 478 * @badblockbits: [INTERN] minimum number of set bits in a good block's
434 * bad block marker position; i.e., BBM == 11110111b is 479 * bad block marker position; i.e., BBM == 11110111b is
435 * not bad when badblockbits == 7 480 * not bad when badblockbits == 7
436 * @cellinfo: [INTERN] MLC/multichip data from chip ident 481 * @bits_per_cell: [INTERN] number of bits per cell. i.e., 1 means SLC.
482 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet.
483 * Minimum amount of bit errors per @ecc_step_ds guaranteed
484 * to be correctable. If unknown, set to zero.
485 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
486 * also from the datasheet. It is the recommended ECC step
487 * size, if known; if unknown, set to zero.
437 * @numchips: [INTERN] number of physical chips 488 * @numchips: [INTERN] number of physical chips
438 * @chipsize: [INTERN] the size of one chip for multichip arrays 489 * @chipsize: [INTERN] the size of one chip for multichip arrays
439 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 490 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -448,7 +499,6 @@ struct nand_buffers {
448 * supported, 0 otherwise. 499 * supported, 0 otherwise.
449 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand 500 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
450 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand 501 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
451 * @ecclayout: [REPLACEABLE] the default ECC placement scheme
452 * @bbt: [INTERN] bad block table pointer 502 * @bbt: [INTERN] bad block table pointer
453 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 503 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
454 * lookup. 504 * lookup.
@@ -509,7 +559,9 @@ struct nand_chip {
509 int pagebuf; 559 int pagebuf;
510 unsigned int pagebuf_bitflips; 560 unsigned int pagebuf_bitflips;
511 int subpagesize; 561 int subpagesize;
512 uint8_t cellinfo; 562 uint8_t bits_per_cell;
563 uint16_t ecc_strength_ds;
564 uint16_t ecc_step_ds;
513 int badblockpos; 565 int badblockpos;
514 int badblockbits; 566 int badblockbits;
515 567
@@ -520,7 +572,6 @@ struct nand_chip {
520 572
521 uint8_t *oob_poi; 573 uint8_t *oob_poi;
522 struct nand_hw_control *controller; 574 struct nand_hw_control *controller;
523 struct nand_ecclayout *ecclayout;
524 575
525 struct nand_ecc_ctrl ecc; 576 struct nand_ecc_ctrl ecc;
526 struct nand_buffers *buffers; 577 struct nand_buffers *buffers;
@@ -576,6 +627,11 @@ struct nand_chip {
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ 627 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) } 628 .options = (opts) }
578 629
630#define NAND_ECC_INFO(_strength, _step) \
631 { .strength_ds = (_strength), .step_ds = (_step) }
632#define NAND_ECC_STRENGTH(type) ((type)->ecc.strength_ds)
633#define NAND_ECC_STEP(type) ((type)->ecc.step_ds)
634
579/** 635/**
580 * struct nand_flash_dev - NAND Flash Device ID Structure 636 * struct nand_flash_dev - NAND Flash Device ID Structure
581 * @name: a human-readable name of the NAND chip 637 * @name: a human-readable name of the NAND chip
@@ -593,6 +649,12 @@ struct nand_chip {
593 * @options: stores various chip bit options 649 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id. 650 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size 651 * @oobsize: OOB size
652 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
653 * @ecc_strength_ds in nand_chip{}.
654 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
655 * @ecc_step_ds in nand_chip{}, also from the datasheet.
656 * For example, the "4bit ECC for each 512Byte" can be set with
657 * NAND_ECC_INFO(4, 512).
596 */ 658 */
597struct nand_flash_dev { 659struct nand_flash_dev {
598 char *name; 660 char *name;
@@ -609,6 +671,10 @@ struct nand_flash_dev {
609 unsigned int options; 671 unsigned int options;
610 uint16_t id_len; 672 uint16_t id_len;
611 uint16_t oobsize; 673 uint16_t oobsize;
674 struct {
675 uint16_t strength_ds;
676 uint16_t step_ds;
677 } ecc;
612}; 678};
613 679
614/** 680/**
@@ -625,8 +691,8 @@ extern struct nand_flash_dev nand_flash_ids[];
625extern struct nand_manufacturers nand_manuf_ids[]; 691extern struct nand_manufacturers nand_manuf_ids[];
626 692
627extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 693extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
628extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
629extern int nand_default_bbt(struct mtd_info *mtd); 694extern int nand_default_bbt(struct mtd_info *mtd);
695extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
630extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 696extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
631extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 697extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
632 int allowbbt); 698 int allowbbt);
@@ -708,6 +774,12 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
708 return chip->priv; 774 return chip->priv;
709} 775}
710 776
777/* return the supported features. */
778static inline int onfi_feature(struct nand_chip *chip)
779{
780 return chip->onfi_version ? le16_to_cpu(chip->onfi_params.features) : 0;
781}
782
711/* return the supported asynchronous timing mode. */ 783/* return the supported asynchronous timing mode. */
712static inline int onfi_get_async_timing_mode(struct nand_chip *chip) 784static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
713{ 785{
@@ -724,4 +796,13 @@ static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
724 return le16_to_cpu(chip->onfi_params.src_sync_timing_mode); 796 return le16_to_cpu(chip->onfi_params.src_sync_timing_mode);
725} 797}
726 798
799/*
800 * Check if it is a SLC nand.
801 * The !nand_is_slc() can be used to check the MLC/TLC nand chips.
802 * We do not distinguish the MLC and TLC now.
803 */
804static inline bool nand_is_slc(struct nand_chip *chip)
805{
806 return chip->bits_per_cell == 1;
807}
727#endif /* __LINUX_MTD_NAND_H */ 808#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index ccd4260834c5..d3181936c138 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -15,8 +15,8 @@
15#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/lockdep.h> 17#include <linux/lockdep.h>
18
19#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h>
20 20
21/* 21/*
22 * Simple, straightforward mutexes with strict semantics: 22 * Simple, straightforward mutexes with strict semantics:
@@ -131,7 +131,7 @@ static inline int mutex_is_locked(struct mutex *lock)
131} 131}
132 132
133/* 133/*
134 * See kernel/mutex.c for detailed documentation of these APIs. 134 * See kernel/locking/mutex.c for detailed documentation of these APIs.
135 * Also see Documentation/mutex-design.txt. 135 * Also see Documentation/mutex-design.txt.
136 */ 136 */
137#ifdef CONFIG_DEBUG_LOCK_ALLOC 137#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -175,8 +175,8 @@ extern void mutex_unlock(struct mutex *lock);
175 175
176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
177 177
178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef arch_mutex_cpu_relax
179#define arch_mutex_cpu_relax() cpu_relax() 179# define arch_mutex_cpu_relax() cpu_relax()
180#endif 180#endif
181 181
182#endif 182#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index cd09751c71a0..492de72560fa 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -16,7 +16,7 @@ struct nameidata {
16 struct path root; 16 struct path root;
17 struct inode *inode; /* path.dentry.d_inode */ 17 struct inode *inode; /* path.dentry.d_inode */
18 unsigned int flags; 18 unsigned int flags;
19 unsigned seq; 19 unsigned seq, m_seq;
20 int last_type; 20 int last_type;
21 unsigned depth; 21 unsigned depth;
22 char *saved_names[MAX_NESTED_LINKS + 1]; 22 char *saved_names[MAX_NESTED_LINKS + 1];
@@ -58,7 +58,6 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
58 58
59extern int user_path_at(int, const char __user *, unsigned, struct path *); 59extern int user_path_at(int, const char __user *, unsigned, struct path *);
60extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty); 60extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
61extern int user_path_umountat(int, const char __user *, unsigned int, struct path *);
62 61
63#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) 62#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
64#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) 63#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
@@ -71,8 +70,7 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne
71extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); 70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
72extern void done_path_create(struct path *, struct dentry *); 71extern void done_path_create(struct path *, struct dentry *);
73extern struct dentry *kern_path_locked(const char *, struct path *); 72extern struct dentry *kern_path_locked(const char *, struct path *);
74extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 73extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
75 const char *, unsigned int, struct path *);
76 74
77extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 75extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
78 76
diff --git a/include/linux/net.h b/include/linux/net.h
index 4f27575ce1d6..69be3e6079c8 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -24,6 +24,7 @@
24#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 24#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
25#include <linux/kmemcheck.h> 25#include <linux/kmemcheck.h>
26#include <linux/rcupdate.h> 26#include <linux/rcupdate.h>
27#include <linux/jump_label.h>
27#include <uapi/linux/net.h> 28#include <uapi/linux/net.h>
28 29
29struct poll_table_struct; 30struct poll_table_struct;
@@ -163,6 +164,14 @@ struct proto_ops {
163#endif 164#endif
164 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
165 struct msghdr *m, size_t total_len); 166 struct msghdr *m, size_t total_len);
167 /* Notes for implementing recvmsg:
168 * ===============================
169 * msg->msg_namelen should get updated by the recvmsg handlers
170 * iff msg_name != NULL. It is by default 0 to prevent
171 * returning uninitialized memory to user space. The recvfrom
172 * handlers can assume that msg.msg_name is either NULL or has
173 * a minimum size of sizeof(struct sockaddr_storage).
174 */
166 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 175 int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
167 struct msghdr *m, size_t total_len, 176 struct msghdr *m, size_t total_len,
168 int flags); 177 int flags);
@@ -172,7 +181,7 @@ struct proto_ops {
172 int offset, size_t size, int flags); 181 int offset, size_t size, int flags);
173 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, 182 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
174 struct pipe_inode_info *pipe, size_t len, unsigned int flags); 183 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
175 void (*set_peek_off)(struct sock *sk, int val); 184 int (*set_peek_off)(struct sock *sk, int val);
176}; 185};
177 186
178#define DECLARE_SOCKADDR(type, dst, src) \ 187#define DECLARE_SOCKADDR(type, dst, src) \
@@ -195,27 +204,23 @@ enum {
195 SOCK_WAKE_URG, 204 SOCK_WAKE_URG,
196}; 205};
197 206
198extern int sock_wake_async(struct socket *sk, int how, int band); 207int sock_wake_async(struct socket *sk, int how, int band);
199extern int sock_register(const struct net_proto_family *fam); 208int sock_register(const struct net_proto_family *fam);
200extern void sock_unregister(int family); 209void sock_unregister(int family);
201extern int __sock_create(struct net *net, int family, int type, int proto, 210int __sock_create(struct net *net, int family, int type, int proto,
202 struct socket **res, int kern); 211 struct socket **res, int kern);
203extern int sock_create(int family, int type, int proto, 212int sock_create(int family, int type, int proto, struct socket **res);
204 struct socket **res); 213int sock_create_kern(int family, int type, int proto, struct socket **res);
205extern int sock_create_kern(int family, int type, int proto, 214int sock_create_lite(int family, int type, int proto, struct socket **res);
206 struct socket **res); 215void sock_release(struct socket *sock);
207extern int sock_create_lite(int family, int type, int proto, 216int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
208 struct socket **res); 217int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
209extern void sock_release(struct socket *sock); 218 int flags);
210extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, 219struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
211 size_t len); 220struct socket *sockfd_lookup(int fd, int *err);
212extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, 221struct socket *sock_from_file(struct file *file, int *err);
213 size_t size, int flags);
214extern struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
215extern struct socket *sockfd_lookup(int fd, int *err);
216extern struct socket *sock_from_file(struct file *file, int *err);
217#define sockfd_put(sock) fput(sock->file) 222#define sockfd_put(sock) fput(sock->file)
218extern int net_ratelimit(void); 223int net_ratelimit(void);
219 224
220#define net_ratelimited_function(function, ...) \ 225#define net_ratelimited_function(function, ...) \
221do { \ 226do { \
@@ -243,32 +248,52 @@ do { \
243#define net_random() prandom_u32() 248#define net_random() prandom_u32()
244#define net_srandom(seed) prandom_seed((__force u32)(seed)) 249#define net_srandom(seed) prandom_seed((__force u32)(seed))
245 250
246extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 251bool __net_get_random_once(void *buf, int nbytes, bool *done,
247 struct kvec *vec, size_t num, size_t len); 252 struct static_key *done_key);
248extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg, 253
249 struct kvec *vec, size_t num, 254#ifdef HAVE_JUMP_LABEL
250 size_t len, int flags); 255#define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \
251 256 { .enabled = ATOMIC_INIT(0), .entries = (void *)1 })
252extern int kernel_bind(struct socket *sock, struct sockaddr *addr, 257#else /* !HAVE_JUMP_LABEL */
253 int addrlen); 258#define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
254extern int kernel_listen(struct socket *sock, int backlog); 259#endif /* HAVE_JUMP_LABEL */
255extern int kernel_accept(struct socket *sock, struct socket **newsock, 260
256 int flags); 261#define net_get_random_once(buf, nbytes) \
257extern int kernel_connect(struct socket *sock, struct sockaddr *addr, 262 ({ \
258 int addrlen, int flags); 263 bool ___ret = false; \
259extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr, 264 static bool ___done = false; \
260 int *addrlen); 265 static struct static_key ___done_key = \
261extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr, 266 ___NET_RANDOM_STATIC_KEY_INIT; \
262 int *addrlen); 267 if (!static_key_true(&___done_key)) \
263extern int kernel_getsockopt(struct socket *sock, int level, int optname, 268 ___ret = __net_get_random_once(buf, \
264 char *optval, int *optlen); 269 nbytes, \
265extern int kernel_setsockopt(struct socket *sock, int level, int optname, 270 &___done, \
266 char *optval, unsigned int optlen); 271 &___done_key); \
267extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 272 ___ret; \
268 size_t size, int flags); 273 })
269extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 274
270extern int kernel_sock_shutdown(struct socket *sock, 275int kernel_sendmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec,
271 enum sock_shutdown_cmd how); 276 size_t num, size_t len);
277int kernel_recvmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec,
278 size_t num, size_t len, int flags);
279
280int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen);
281int kernel_listen(struct socket *sock, int backlog);
282int kernel_accept(struct socket *sock, struct socket **newsock, int flags);
283int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen,
284 int flags);
285int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
286 int *addrlen);
287int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
288 int *addrlen);
289int kernel_getsockopt(struct socket *sock, int level, int optname, char *optval,
290 int *optlen);
291int kernel_setsockopt(struct socket *sock, int level, int optname, char *optval,
292 unsigned int optlen);
293int kernel_sendpage(struct socket *sock, struct page *page, int offset,
294 size_t size, int flags);
295int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
296int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how);
272 297
273#define MODULE_ALIAS_NETPROTO(proto) \ 298#define MODULE_ALIAS_NETPROTO(proto) \
274 MODULE_ALIAS("net-pf-" __stringify(proto)) 299 MODULE_ALIAS("net-pf-" __stringify(proto))
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index a2a89a5c7be5..1005ebf17575 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -42,6 +42,8 @@ enum {
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */
46 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 47 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */ 48 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
47 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 49 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
@@ -60,6 +62,7 @@ enum {
60 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */ 62 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */
61 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ 63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
62 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ 64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
63 66
64 /* 67 /*
65 * Add your fresh new feature above and remember to update 68 * Add your fresh new feature above and remember to update
@@ -107,11 +110,14 @@ enum {
107#define NETIF_F_RXFCS __NETIF_F(RXFCS) 110#define NETIF_F_RXFCS __NETIF_F(RXFCS)
108#define NETIF_F_RXALL __NETIF_F(RXALL) 111#define NETIF_F_RXALL __NETIF_F(RXALL)
109#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 112#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
113#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP)
114#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
110#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 115#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
111#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS) 116#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
112#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 117#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
113#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 118#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
114#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 119#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
120#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
115 121
116/* Features valid for ethtool to change */ 122/* Features valid for ethtool to change */
117/* = all defined minus driver/device-class-related */ 123/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9ff50c9a0009..d9a550bf3e8e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,8 +60,8 @@ struct wireless_dev;
60#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */ 66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
@@ -298,7 +298,7 @@ struct netdev_boot_setup {
298}; 298};
299#define NETDEV_BOOT_SETUP_MAX 8 299#define NETDEV_BOOT_SETUP_MAX 8
300 300
301extern int __init netdev_boot_setup(char *str); 301int __init netdev_boot_setup(char *str);
302 302
303/* 303/*
304 * Structure for NAPI scheduling similar to tasklet but with weighting 304 * Structure for NAPI scheduling similar to tasklet but with weighting
@@ -394,7 +394,7 @@ enum rx_handler_result {
394typedef enum rx_handler_result rx_handler_result_t; 394typedef enum rx_handler_result rx_handler_result_t;
395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
396 396
397extern void __napi_schedule(struct napi_struct *n); 397void __napi_schedule(struct napi_struct *n);
398 398
399static inline bool napi_disable_pending(struct napi_struct *n) 399static inline bool napi_disable_pending(struct napi_struct *n)
400{ 400{
@@ -445,8 +445,8 @@ static inline bool napi_reschedule(struct napi_struct *napi)
445 * 445 *
446 * Mark NAPI processing as complete. 446 * Mark NAPI processing as complete.
447 */ 447 */
448extern void __napi_complete(struct napi_struct *n); 448void __napi_complete(struct napi_struct *n);
449extern void napi_complete(struct napi_struct *n); 449void napi_complete(struct napi_struct *n);
450 450
451/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id 452 * napi_by_id - lookup a NAPI by napi_id
@@ -455,7 +455,7 @@ extern void napi_complete(struct napi_struct *n);
455 * lookup @napi_id in napi_hash table 455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock() 456 * must be called under rcu_read_lock()
457 */ 457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id); 458struct napi_struct *napi_by_id(unsigned int napi_id);
459 459
460/** 460/**
461 * napi_hash_add - add a NAPI to global hashtable 461 * napi_hash_add - add a NAPI to global hashtable
@@ -463,7 +463,7 @@ extern struct napi_struct *napi_by_id(unsigned int napi_id);
463 * 463 *
464 * generate a new napi_id and store a @napi under it in napi_hash 464 * generate a new napi_id and store a @napi under it in napi_hash
465 */ 465 */
466extern void napi_hash_add(struct napi_struct *napi); 466void napi_hash_add(struct napi_struct *napi);
467 467
468/** 468/**
469 * napi_hash_del - remove a NAPI from global table 469 * napi_hash_del - remove a NAPI from global table
@@ -472,7 +472,7 @@ extern void napi_hash_add(struct napi_struct *napi);
472 * Warning: caller must observe rcu grace period 472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi 473 * before freeing memory containing @napi
474 */ 474 */
475extern void napi_hash_del(struct napi_struct *napi); 475void napi_hash_del(struct napi_struct *napi);
476 476
477/** 477/**
478 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
@@ -483,6 +483,7 @@ extern void napi_hash_del(struct napi_struct *napi);
483 */ 483 */
484static inline void napi_disable(struct napi_struct *n) 484static inline void napi_disable(struct napi_struct *n)
485{ 485{
486 might_sleep();
486 set_bit(NAPI_STATE_DISABLE, &n->state); 487 set_bit(NAPI_STATE_DISABLE, &n->state);
487 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 488 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
488 msleep(1); 489 msleep(1);
@@ -664,8 +665,8 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
664extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 665extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
665 666
666#ifdef CONFIG_RFS_ACCEL 667#ifdef CONFIG_RFS_ACCEL
667extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, 668bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
668 u32 flow_id, u16 filter_id); 669 u16 filter_id);
669#endif 670#endif
670 671
671/* This structure contains an instance of an RX queue. */ 672/* This structure contains an instance of an RX queue. */
@@ -950,17 +951,36 @@ struct netdev_phys_port_id {
950 * multiple net devices on single physical port. 951 * multiple net devices on single physical port.
951 * 952 *
952 * void (*ndo_add_vxlan_port)(struct net_device *dev, 953 * void (*ndo_add_vxlan_port)(struct net_device *dev,
953 * sa_family_t sa_family, __u16 port); 954 * sa_family_t sa_family, __be16 port);
954 * Called by vxlan to notiy a driver about the UDP port and socket 955 * Called by vxlan to notiy a driver about the UDP port and socket
955 * address family that vxlan is listnening to. It is called only when 956 * address family that vxlan is listnening to. It is called only when
956 * a new port starts listening. The operation is protected by the 957 * a new port starts listening. The operation is protected by the
957 * vxlan_net->sock_lock. 958 * vxlan_net->sock_lock.
958 * 959 *
959 * void (*ndo_del_vxlan_port)(struct net_device *dev, 960 * void (*ndo_del_vxlan_port)(struct net_device *dev,
960 * sa_family_t sa_family, __u16 port); 961 * sa_family_t sa_family, __be16 port);
961 * Called by vxlan to notify the driver about a UDP port and socket 962 * Called by vxlan to notify the driver about a UDP port and socket
962 * address family that vxlan is not listening to anymore. The operation 963 * address family that vxlan is not listening to anymore. The operation
963 * is protected by the vxlan_net->sock_lock. 964 * is protected by the vxlan_net->sock_lock.
965 *
966 * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
967 * struct net_device *dev)
968 * Called by upper layer devices to accelerate switching or other
969 * station functionality into hardware. 'pdev is the lowerdev
970 * to use for the offload and 'dev' is the net device that will
971 * back the offload. Returns a pointer to the private structure
972 * the upper layer will maintain.
973 * void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv)
974 * Called by upper layer device to delete the station created
975 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
976 * the station and priv is the structure returned by the add
977 * operation.
978 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb,
979 * struct net_device *dev,
980 * void *priv);
981 * Callback to use for xmit over the accelerated station. This
982 * is used in place of ndo_start_xmit on accelerated net
983 * devices.
964 */ 984 */
965struct net_device_ops { 985struct net_device_ops {
966 int (*ndo_init)(struct net_device *dev); 986 int (*ndo_init)(struct net_device *dev);
@@ -1093,10 +1113,19 @@ struct net_device_ops {
1093 struct netdev_phys_port_id *ppid); 1113 struct netdev_phys_port_id *ppid);
1094 void (*ndo_add_vxlan_port)(struct net_device *dev, 1114 void (*ndo_add_vxlan_port)(struct net_device *dev,
1095 sa_family_t sa_family, 1115 sa_family_t sa_family,
1096 __u16 port); 1116 __be16 port);
1097 void (*ndo_del_vxlan_port)(struct net_device *dev, 1117 void (*ndo_del_vxlan_port)(struct net_device *dev,
1098 sa_family_t sa_family, 1118 sa_family_t sa_family,
1099 __u16 port); 1119 __be16 port);
1120
1121 void* (*ndo_dfwd_add_station)(struct net_device *pdev,
1122 struct net_device *dev);
1123 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1124 void *priv);
1125
1126 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1127 struct net_device *dev,
1128 void *priv);
1100}; 1129};
1101 1130
1102/* 1131/*
@@ -1131,7 +1160,7 @@ struct net_device {
1131 unsigned long mem_end; /* shared mem end */ 1160 unsigned long mem_end; /* shared mem end */
1132 unsigned long mem_start; /* shared mem start */ 1161 unsigned long mem_start; /* shared mem start */
1133 unsigned long base_addr; /* device I/O address */ 1162 unsigned long base_addr; /* device I/O address */
1134 unsigned int irq; /* device IRQ number */ 1163 int irq; /* device IRQ number */
1135 1164
1136 /* 1165 /*
1137 * Some hardware also needs these fields, but they are not 1166 * Some hardware also needs these fields, but they are not
@@ -1143,8 +1172,19 @@ struct net_device {
1143 struct list_head dev_list; 1172 struct list_head dev_list;
1144 struct list_head napi_list; 1173 struct list_head napi_list;
1145 struct list_head unreg_list; 1174 struct list_head unreg_list;
1146 struct list_head upper_dev_list; /* List of upper devices */ 1175 struct list_head close_list;
1147 struct list_head lower_dev_list; 1176
1177 /* directly linked devices, like slaves for bonding */
1178 struct {
1179 struct list_head upper;
1180 struct list_head lower;
1181 } adj_list;
1182
1183 /* all linked devices, *including* neighbours */
1184 struct {
1185 struct list_head upper;
1186 struct list_head lower;
1187 } all_adj_list;
1148 1188
1149 1189
1150 /* currently active device features */ 1190 /* currently active device features */
@@ -1183,6 +1223,7 @@ struct net_device {
1183 /* Management operations */ 1223 /* Management operations */
1184 const struct net_device_ops *netdev_ops; 1224 const struct net_device_ops *netdev_ops;
1185 const struct ethtool_ops *ethtool_ops; 1225 const struct ethtool_ops *ethtool_ops;
1226 const struct forwarding_accel_ops *fwd_ops;
1186 1227
1187 /* Hardware header description */ 1228 /* Hardware header description */
1188 const struct header_ops *header_ops; 1229 const struct header_ops *header_ops;
@@ -1214,7 +1255,7 @@ struct net_device {
1214 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1255 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
1215 unsigned char addr_assign_type; /* hw address assignment type */ 1256 unsigned char addr_assign_type; /* hw address assignment type */
1216 unsigned char addr_len; /* hardware address length */ 1257 unsigned char addr_len; /* hardware address length */
1217 unsigned char neigh_priv_len; 1258 unsigned short neigh_priv_len;
1218 unsigned short dev_id; /* Used to differentiate devices 1259 unsigned short dev_id; /* Used to differentiate devices
1219 * that share the same link 1260 * that share the same link
1220 * layer address 1261 * layer address
@@ -1487,9 +1528,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1487 f(dev, &dev->_tx[i], arg); 1528 f(dev, &dev->_tx[i], arg);
1488} 1529}
1489 1530
1490extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1531struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1491 struct sk_buff *skb); 1532 struct sk_buff *skb);
1492extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); 1533u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1493 1534
1494/* 1535/*
1495 * Net namespace inlines 1536 * Net namespace inlines
@@ -1673,8 +1714,8 @@ struct packet_offload {
1673#define NETDEV_CHANGEUPPER 0x0015 1714#define NETDEV_CHANGEUPPER 0x0015
1674#define NETDEV_RESEND_IGMP 0x0016 1715#define NETDEV_RESEND_IGMP 0x0016
1675 1716
1676extern int register_netdevice_notifier(struct notifier_block *nb); 1717int register_netdevice_notifier(struct notifier_block *nb);
1677extern int unregister_netdevice_notifier(struct notifier_block *nb); 1718int unregister_netdevice_notifier(struct notifier_block *nb);
1678 1719
1679struct netdev_notifier_info { 1720struct netdev_notifier_info {
1680 struct net_device *dev; 1721 struct net_device *dev;
@@ -1697,9 +1738,9 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1697 return info->dev; 1738 return info->dev;
1698} 1739}
1699 1740
1700extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, 1741int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1701 struct netdev_notifier_info *info); 1742 struct netdev_notifier_info *info);
1702extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1743int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1703 1744
1704 1745
1705extern rwlock_t dev_base_lock; /* Device list lock */ 1746extern rwlock_t dev_base_lock; /* Device list lock */
@@ -1754,54 +1795,53 @@ static inline struct net_device *first_net_device_rcu(struct net *net)
1754 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1795 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1755} 1796}
1756 1797
1757extern int netdev_boot_setup_check(struct net_device *dev); 1798int netdev_boot_setup_check(struct net_device *dev);
1758extern unsigned long netdev_boot_base(const char *prefix, int unit); 1799unsigned long netdev_boot_base(const char *prefix, int unit);
1759extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1800struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
1760 const char *hwaddr); 1801 const char *hwaddr);
1761extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); 1802struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
1762extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); 1803struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
1763extern void dev_add_pack(struct packet_type *pt); 1804void dev_add_pack(struct packet_type *pt);
1764extern void dev_remove_pack(struct packet_type *pt); 1805void dev_remove_pack(struct packet_type *pt);
1765extern void __dev_remove_pack(struct packet_type *pt); 1806void __dev_remove_pack(struct packet_type *pt);
1766extern void dev_add_offload(struct packet_offload *po); 1807void dev_add_offload(struct packet_offload *po);
1767extern void dev_remove_offload(struct packet_offload *po); 1808void dev_remove_offload(struct packet_offload *po);
1768extern void __dev_remove_offload(struct packet_offload *po); 1809void __dev_remove_offload(struct packet_offload *po);
1769 1810
1770extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1811struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1771 unsigned short mask); 1812 unsigned short mask);
1772extern struct net_device *dev_get_by_name(struct net *net, const char *name); 1813struct net_device *dev_get_by_name(struct net *net, const char *name);
1773extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1814struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
1774extern struct net_device *__dev_get_by_name(struct net *net, const char *name); 1815struct net_device *__dev_get_by_name(struct net *net, const char *name);
1775extern int dev_alloc_name(struct net_device *dev, const char *name); 1816int dev_alloc_name(struct net_device *dev, const char *name);
1776extern int dev_open(struct net_device *dev); 1817int dev_open(struct net_device *dev);
1777extern int dev_close(struct net_device *dev); 1818int dev_close(struct net_device *dev);
1778extern void dev_disable_lro(struct net_device *dev); 1819void dev_disable_lro(struct net_device *dev);
1779extern int dev_loopback_xmit(struct sk_buff *newskb); 1820int dev_loopback_xmit(struct sk_buff *newskb);
1780extern int dev_queue_xmit(struct sk_buff *skb); 1821int dev_queue_xmit(struct sk_buff *skb);
1781extern int register_netdevice(struct net_device *dev); 1822int register_netdevice(struct net_device *dev);
1782extern void unregister_netdevice_queue(struct net_device *dev, 1823void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
1783 struct list_head *head); 1824void unregister_netdevice_many(struct list_head *head);
1784extern void unregister_netdevice_many(struct list_head *head);
1785static inline void unregister_netdevice(struct net_device *dev) 1825static inline void unregister_netdevice(struct net_device *dev)
1786{ 1826{
1787 unregister_netdevice_queue(dev, NULL); 1827 unregister_netdevice_queue(dev, NULL);
1788} 1828}
1789 1829
1790extern int netdev_refcnt_read(const struct net_device *dev); 1830int netdev_refcnt_read(const struct net_device *dev);
1791extern void free_netdev(struct net_device *dev); 1831void free_netdev(struct net_device *dev);
1792extern void synchronize_net(void); 1832void netdev_freemem(struct net_device *dev);
1793extern int init_dummy_netdev(struct net_device *dev); 1833void synchronize_net(void);
1834int init_dummy_netdev(struct net_device *dev);
1794 1835
1795extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1836struct net_device *dev_get_by_index(struct net *net, int ifindex);
1796extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1837struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1797extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1838struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1798extern int netdev_get_name(struct net *net, char *name, int ifindex); 1839int netdev_get_name(struct net *net, char *name, int ifindex);
1799extern int dev_restart(struct net_device *dev); 1840int dev_restart(struct net_device *dev);
1800#ifdef CONFIG_NETPOLL_TRAP 1841#ifdef CONFIG_NETPOLL_TRAP
1801extern int netpoll_trap(void); 1842int netpoll_trap(void);
1802#endif 1843#endif
1803extern int skb_gro_receive(struct sk_buff **head, 1844int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1804 struct sk_buff *skb);
1805 1845
1806static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1846static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1807{ 1847{
@@ -1873,7 +1913,7 @@ static inline int dev_parse_header(const struct sk_buff *skb,
1873} 1913}
1874 1914
1875typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 1915typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
1876extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); 1916int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
1877static inline int unregister_gifconf(unsigned int family) 1917static inline int unregister_gifconf(unsigned int family)
1878{ 1918{
1879 return register_gifconf(family, NULL); 1919 return register_gifconf(family, NULL);
@@ -1944,7 +1984,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1944 1984
1945DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 1985DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1946 1986
1947extern void __netif_schedule(struct Qdisc *q); 1987void __netif_schedule(struct Qdisc *q);
1948 1988
1949static inline void netif_schedule_queue(struct netdev_queue *txq) 1989static inline void netif_schedule_queue(struct netdev_queue *txq)
1950{ 1990{
@@ -2101,6 +2141,15 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2101#endif 2141#endif
2102} 2142}
2103 2143
2144/**
2145 * netdev_sent_queue - report the number of bytes queued to hardware
2146 * @dev: network device
2147 * @bytes: number of bytes queued to the hardware device queue
2148 *
2149 * Report the number of bytes queued for sending/completion to the network
2150 * device hardware queue. @bytes should be a good approximation and should
2151 * exactly match netdev_completed_queue() @bytes
2152 */
2104static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) 2153static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
2105{ 2154{
2106 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); 2155 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
@@ -2130,6 +2179,16 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
2130#endif 2179#endif
2131} 2180}
2132 2181
2182/**
2183 * netdev_completed_queue - report bytes and packets completed by device
2184 * @dev: network device
2185 * @pkts: actual number of packets sent over the medium
2186 * @bytes: actual number of bytes sent over the medium
2187 *
2188 * Report the number of bytes and packets transmitted by the network device
2189 * hardware queue over the physical medium, @bytes must exactly match the
2190 * @bytes amount passed to netdev_sent_queue()
2191 */
2133static inline void netdev_completed_queue(struct net_device *dev, 2192static inline void netdev_completed_queue(struct net_device *dev,
2134 unsigned int pkts, unsigned int bytes) 2193 unsigned int pkts, unsigned int bytes)
2135{ 2194{
@@ -2144,6 +2203,13 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)
2144#endif 2203#endif
2145} 2204}
2146 2205
2206/**
2207 * netdev_reset_queue - reset the packets and bytes count of a network device
2208 * @dev_queue: network device
2209 *
2210 * Reset the bytes and packet count of a network device and clear the
2211 * software flow control OFF bit for this network device
2212 */
2147static inline void netdev_reset_queue(struct net_device *dev_queue) 2213static inline void netdev_reset_queue(struct net_device *dev_queue)
2148{ 2214{
2149 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); 2215 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
@@ -2238,11 +2304,11 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2238} 2304}
2239 2305
2240#ifdef CONFIG_XPS 2306#ifdef CONFIG_XPS
2241extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, 2307int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2242 u16 index); 2308 u16 index);
2243#else 2309#else
2244static inline int netif_set_xps_queue(struct net_device *dev, 2310static inline int netif_set_xps_queue(struct net_device *dev,
2245 struct cpumask *mask, 2311 const struct cpumask *mask,
2246 u16 index) 2312 u16 index)
2247{ 2313{
2248 return 0; 2314 return 0;
@@ -2270,12 +2336,10 @@ static inline bool netif_is_multiqueue(const struct net_device *dev)
2270 return dev->num_tx_queues > 1; 2336 return dev->num_tx_queues > 1;
2271} 2337}
2272 2338
2273extern int netif_set_real_num_tx_queues(struct net_device *dev, 2339int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
2274 unsigned int txq);
2275 2340
2276#ifdef CONFIG_RPS 2341#ifdef CONFIG_RPS
2277extern int netif_set_real_num_rx_queues(struct net_device *dev, 2342int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
2278 unsigned int rxq);
2279#else 2343#else
2280static inline int netif_set_real_num_rx_queues(struct net_device *dev, 2344static inline int netif_set_real_num_rx_queues(struct net_device *dev,
2281 unsigned int rxq) 2345 unsigned int rxq)
@@ -2302,28 +2366,27 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2302} 2366}
2303 2367
2304#define DEFAULT_MAX_NUM_RSS_QUEUES (8) 2368#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
2305extern int netif_get_num_default_rss_queues(void); 2369int netif_get_num_default_rss_queues(void);
2306 2370
2307/* Use this variant when it is known for sure that it 2371/* Use this variant when it is known for sure that it
2308 * is executing from hardware interrupt context or with hardware interrupts 2372 * is executing from hardware interrupt context or with hardware interrupts
2309 * disabled. 2373 * disabled.
2310 */ 2374 */
2311extern void dev_kfree_skb_irq(struct sk_buff *skb); 2375void dev_kfree_skb_irq(struct sk_buff *skb);
2312 2376
2313/* Use this variant in places where it could be invoked 2377/* Use this variant in places where it could be invoked
2314 * from either hardware interrupt or other context, with hardware interrupts 2378 * from either hardware interrupt or other context, with hardware interrupts
2315 * either disabled or enabled. 2379 * either disabled or enabled.
2316 */ 2380 */
2317extern void dev_kfree_skb_any(struct sk_buff *skb); 2381void dev_kfree_skb_any(struct sk_buff *skb);
2318 2382
2319extern int netif_rx(struct sk_buff *skb); 2383int netif_rx(struct sk_buff *skb);
2320extern int netif_rx_ni(struct sk_buff *skb); 2384int netif_rx_ni(struct sk_buff *skb);
2321extern int netif_receive_skb(struct sk_buff *skb); 2385int netif_receive_skb(struct sk_buff *skb);
2322extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2386gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2323 struct sk_buff *skb); 2387void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2324extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2388struct sk_buff *napi_get_frags(struct napi_struct *napi);
2325extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2389gro_result_t napi_gro_frags(struct napi_struct *napi);
2326extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2327 2390
2328static inline void napi_free_frags(struct napi_struct *napi) 2391static inline void napi_free_frags(struct napi_struct *napi)
2329{ 2392{
@@ -2331,40 +2394,36 @@ static inline void napi_free_frags(struct napi_struct *napi)
2331 napi->skb = NULL; 2394 napi->skb = NULL;
2332} 2395}
2333 2396
2334extern int netdev_rx_handler_register(struct net_device *dev, 2397int netdev_rx_handler_register(struct net_device *dev,
2335 rx_handler_func_t *rx_handler, 2398 rx_handler_func_t *rx_handler,
2336 void *rx_handler_data); 2399 void *rx_handler_data);
2337extern void netdev_rx_handler_unregister(struct net_device *dev); 2400void netdev_rx_handler_unregister(struct net_device *dev);
2338 2401
2339extern bool dev_valid_name(const char *name); 2402bool dev_valid_name(const char *name);
2340extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2403int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2341extern int dev_ethtool(struct net *net, struct ifreq *); 2404int dev_ethtool(struct net *net, struct ifreq *);
2342extern unsigned int dev_get_flags(const struct net_device *); 2405unsigned int dev_get_flags(const struct net_device *);
2343extern int __dev_change_flags(struct net_device *, unsigned int flags); 2406int __dev_change_flags(struct net_device *, unsigned int flags);
2344extern int dev_change_flags(struct net_device *, unsigned int); 2407int dev_change_flags(struct net_device *, unsigned int);
2345extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2408void __dev_notify_flags(struct net_device *, unsigned int old_flags,
2346extern int dev_change_name(struct net_device *, const char *); 2409 unsigned int gchanges);
2347extern int dev_set_alias(struct net_device *, const char *, size_t); 2410int dev_change_name(struct net_device *, const char *);
2348extern int dev_change_net_namespace(struct net_device *, 2411int dev_set_alias(struct net_device *, const char *, size_t);
2349 struct net *, const char *); 2412int dev_change_net_namespace(struct net_device *, struct net *, const char *);
2350extern int dev_set_mtu(struct net_device *, int); 2413int dev_set_mtu(struct net_device *, int);
2351extern void dev_set_group(struct net_device *, int); 2414void dev_set_group(struct net_device *, int);
2352extern int dev_set_mac_address(struct net_device *, 2415int dev_set_mac_address(struct net_device *, struct sockaddr *);
2353 struct sockaddr *); 2416int dev_change_carrier(struct net_device *, bool new_carrier);
2354extern int dev_change_carrier(struct net_device *, 2417int dev_get_phys_port_id(struct net_device *dev,
2355 bool new_carrier); 2418 struct netdev_phys_port_id *ppid);
2356extern int dev_get_phys_port_id(struct net_device *dev, 2419int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2357 struct netdev_phys_port_id *ppid); 2420 struct netdev_queue *txq, void *accel_priv);
2358extern int dev_hard_start_xmit(struct sk_buff *skb, 2421int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2359 struct net_device *dev,
2360 struct netdev_queue *txq);
2361extern int dev_forward_skb(struct net_device *dev,
2362 struct sk_buff *skb);
2363 2422
2364extern int netdev_budget; 2423extern int netdev_budget;
2365 2424
2366/* Called by rtnetlink.c:rtnl_unlock() */ 2425/* Called by rtnetlink.c:rtnl_unlock() */
2367extern void netdev_run_todo(void); 2426void netdev_run_todo(void);
2368 2427
2369/** 2428/**
2370 * dev_put - release reference to device 2429 * dev_put - release reference to device
@@ -2397,9 +2456,9 @@ static inline void dev_hold(struct net_device *dev)
2397 * kind of lower layer not just hardware media. 2456 * kind of lower layer not just hardware media.
2398 */ 2457 */
2399 2458
2400extern void linkwatch_init_dev(struct net_device *dev); 2459void linkwatch_init_dev(struct net_device *dev);
2401extern void linkwatch_fire_event(struct net_device *dev); 2460void linkwatch_fire_event(struct net_device *dev);
2402extern void linkwatch_forget_dev(struct net_device *dev); 2461void linkwatch_forget_dev(struct net_device *dev);
2403 2462
2404/** 2463/**
2405 * netif_carrier_ok - test if carrier present 2464 * netif_carrier_ok - test if carrier present
@@ -2412,13 +2471,13 @@ static inline bool netif_carrier_ok(const struct net_device *dev)
2412 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2471 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2413} 2472}
2414 2473
2415extern unsigned long dev_trans_start(struct net_device *dev); 2474unsigned long dev_trans_start(struct net_device *dev);
2416 2475
2417extern void __netdev_watchdog_up(struct net_device *dev); 2476void __netdev_watchdog_up(struct net_device *dev);
2418 2477
2419extern void netif_carrier_on(struct net_device *dev); 2478void netif_carrier_on(struct net_device *dev);
2420 2479
2421extern void netif_carrier_off(struct net_device *dev); 2480void netif_carrier_off(struct net_device *dev);
2422 2481
2423/** 2482/**
2424 * netif_dormant_on - mark device as dormant. 2483 * netif_dormant_on - mark device as dormant.
@@ -2486,9 +2545,9 @@ static inline bool netif_device_present(struct net_device *dev)
2486 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2545 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2487} 2546}
2488 2547
2489extern void netif_device_detach(struct net_device *dev); 2548void netif_device_detach(struct net_device *dev);
2490 2549
2491extern void netif_device_attach(struct net_device *dev); 2550void netif_device_attach(struct net_device *dev);
2492 2551
2493/* 2552/*
2494 * Network interface message level settings 2553 * Network interface message level settings
@@ -2697,119 +2756,138 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
2697 2756
2698/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 2757/* These functions live elsewhere (drivers/net/net_init.c, but related) */
2699 2758
2700extern void ether_setup(struct net_device *dev); 2759void ether_setup(struct net_device *dev);
2701 2760
2702/* Support for loadable net-drivers */ 2761/* Support for loadable net-drivers */
2703extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 2762struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
2704 void (*setup)(struct net_device *), 2763 void (*setup)(struct net_device *),
2705 unsigned int txqs, unsigned int rxqs); 2764 unsigned int txqs, unsigned int rxqs);
2706#define alloc_netdev(sizeof_priv, name, setup) \ 2765#define alloc_netdev(sizeof_priv, name, setup) \
2707 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 2766 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
2708 2767
2709#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 2768#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
2710 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 2769 alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
2711 2770
2712extern int register_netdev(struct net_device *dev); 2771int register_netdev(struct net_device *dev);
2713extern void unregister_netdev(struct net_device *dev); 2772void unregister_netdev(struct net_device *dev);
2714 2773
2715/* General hardware address lists handling functions */ 2774/* General hardware address lists handling functions */
2716extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, 2775int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2717 struct netdev_hw_addr_list *from_list, 2776 struct netdev_hw_addr_list *from_list,
2718 int addr_len, unsigned char addr_type); 2777 int addr_len, unsigned char addr_type);
2719extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, 2778void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2720 struct netdev_hw_addr_list *from_list, 2779 struct netdev_hw_addr_list *from_list,
2721 int addr_len, unsigned char addr_type); 2780 int addr_len, unsigned char addr_type);
2722extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, 2781int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2723 struct netdev_hw_addr_list *from_list, 2782 struct netdev_hw_addr_list *from_list, int addr_len);
2724 int addr_len); 2783void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2725extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 2784 struct netdev_hw_addr_list *from_list, int addr_len);
2726 struct netdev_hw_addr_list *from_list, 2785void __hw_addr_flush(struct netdev_hw_addr_list *list);
2727 int addr_len); 2786void __hw_addr_init(struct netdev_hw_addr_list *list);
2728extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2729extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2730 2787
2731/* Functions used for device addresses handling */ 2788/* Functions used for device addresses handling */
2732extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, 2789int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2733 unsigned char addr_type); 2790 unsigned char addr_type);
2734extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, 2791int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2735 unsigned char addr_type); 2792 unsigned char addr_type);
2736extern int dev_addr_add_multiple(struct net_device *to_dev, 2793int dev_addr_add_multiple(struct net_device *to_dev,
2737 struct net_device *from_dev, 2794 struct net_device *from_dev, unsigned char addr_type);
2738 unsigned char addr_type); 2795int dev_addr_del_multiple(struct net_device *to_dev,
2739extern int dev_addr_del_multiple(struct net_device *to_dev, 2796 struct net_device *from_dev, unsigned char addr_type);
2740 struct net_device *from_dev, 2797void dev_addr_flush(struct net_device *dev);
2741 unsigned char addr_type); 2798int dev_addr_init(struct net_device *dev);
2742extern void dev_addr_flush(struct net_device *dev);
2743extern int dev_addr_init(struct net_device *dev);
2744 2799
2745/* Functions used for unicast addresses handling */ 2800/* Functions used for unicast addresses handling */
2746extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); 2801int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2747extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); 2802int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2748extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2803int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2749extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2804int dev_uc_sync(struct net_device *to, struct net_device *from);
2750extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); 2805int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
2751extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2806void dev_uc_unsync(struct net_device *to, struct net_device *from);
2752extern void dev_uc_flush(struct net_device *dev); 2807void dev_uc_flush(struct net_device *dev);
2753extern void dev_uc_init(struct net_device *dev); 2808void dev_uc_init(struct net_device *dev);
2754 2809
2755/* Functions used for multicast addresses handling */ 2810/* Functions used for multicast addresses handling */
2756extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); 2811int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2757extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 2812int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2758extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); 2813int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2759extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2814int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2760extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); 2815int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2761extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2816int dev_mc_sync(struct net_device *to, struct net_device *from);
2762extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); 2817int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
2763extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2818void dev_mc_unsync(struct net_device *to, struct net_device *from);
2764extern void dev_mc_flush(struct net_device *dev); 2819void dev_mc_flush(struct net_device *dev);
2765extern void dev_mc_init(struct net_device *dev); 2820void dev_mc_init(struct net_device *dev);
2766 2821
2767/* Functions used for secondary unicast and multicast support */ 2822/* Functions used for secondary unicast and multicast support */
2768extern void dev_set_rx_mode(struct net_device *dev); 2823void dev_set_rx_mode(struct net_device *dev);
2769extern void __dev_set_rx_mode(struct net_device *dev); 2824void __dev_set_rx_mode(struct net_device *dev);
2770extern int dev_set_promiscuity(struct net_device *dev, int inc); 2825int dev_set_promiscuity(struct net_device *dev, int inc);
2771extern int dev_set_allmulti(struct net_device *dev, int inc); 2826int dev_set_allmulti(struct net_device *dev, int inc);
2772extern void netdev_state_change(struct net_device *dev); 2827void netdev_state_change(struct net_device *dev);
2773extern void netdev_notify_peers(struct net_device *dev); 2828void netdev_notify_peers(struct net_device *dev);
2774extern void netdev_features_change(struct net_device *dev); 2829void netdev_features_change(struct net_device *dev);
2775/* Load a device via the kmod */ 2830/* Load a device via the kmod */
2776extern void dev_load(struct net *net, const char *name); 2831void dev_load(struct net *net, const char *name);
2777extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2832struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2778 struct rtnl_link_stats64 *storage); 2833 struct rtnl_link_stats64 *storage);
2779extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2834void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2780 const struct net_device_stats *netdev_stats); 2835 const struct net_device_stats *netdev_stats);
2781 2836
2782extern int netdev_max_backlog; 2837extern int netdev_max_backlog;
2783extern int netdev_tstamp_prequeue; 2838extern int netdev_tstamp_prequeue;
2784extern int weight_p; 2839extern int weight_p;
2785extern int bpf_jit_enable; 2840extern int bpf_jit_enable;
2786 2841
2787extern bool netdev_has_upper_dev(struct net_device *dev, 2842bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
2788 struct net_device *upper_dev); 2843bool netdev_has_any_upper_dev(struct net_device *dev);
2789extern bool netdev_has_any_upper_dev(struct net_device *dev); 2844struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
2790extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, 2845 struct list_head **iter);
2791 struct list_head **iter);
2792 2846
2793/* iterate through upper list, must be called under RCU read lock */ 2847/* iterate through upper list, must be called under RCU read lock */
2794#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \ 2848#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
2795 for (iter = &(dev)->upper_dev_list, \ 2849 for (iter = &(dev)->all_adj_list.upper, \
2796 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ 2850 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
2797 upper; \ 2851 updev; \
2798 upper = netdev_upper_get_next_dev_rcu(dev, &(iter))) 2852 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
2799 2853
2800extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2854void *netdev_lower_get_next_private(struct net_device *dev,
2801extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2855 struct list_head **iter);
2802extern int netdev_upper_dev_link(struct net_device *dev, 2856void *netdev_lower_get_next_private_rcu(struct net_device *dev,
2857 struct list_head **iter);
2858
2859#define netdev_for_each_lower_private(dev, priv, iter) \
2860 for (iter = (dev)->adj_list.lower.next, \
2861 priv = netdev_lower_get_next_private(dev, &(iter)); \
2862 priv; \
2863 priv = netdev_lower_get_next_private(dev, &(iter)))
2864
2865#define netdev_for_each_lower_private_rcu(dev, priv, iter) \
2866 for (iter = &(dev)->adj_list.lower, \
2867 priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
2868 priv; \
2869 priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
2870
2871void *netdev_adjacent_get_private(struct list_head *adj_list);
2872struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2873struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2874int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
2875int netdev_master_upper_dev_link(struct net_device *dev,
2803 struct net_device *upper_dev); 2876 struct net_device *upper_dev);
2804extern int netdev_master_upper_dev_link(struct net_device *dev, 2877int netdev_master_upper_dev_link_private(struct net_device *dev,
2805 struct net_device *upper_dev); 2878 struct net_device *upper_dev,
2806extern void netdev_upper_dev_unlink(struct net_device *dev, 2879 void *private);
2807 struct net_device *upper_dev); 2880void netdev_upper_dev_unlink(struct net_device *dev,
2808extern int skb_checksum_help(struct sk_buff *skb); 2881 struct net_device *upper_dev);
2809extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 2882void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
2810 netdev_features_t features, bool tx_path); 2883 struct net_device *lower_dev);
2811extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 2884void *netdev_lower_dev_get_private(struct net_device *dev,
2812 netdev_features_t features); 2885 struct net_device *lower_dev);
2886int skb_checksum_help(struct sk_buff *skb);
2887struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
2888 netdev_features_t features, bool tx_path);
2889struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2890 netdev_features_t features);
2813 2891
2814static inline 2892static inline
2815struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) 2893struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
@@ -2831,30 +2909,42 @@ static inline bool can_checksum_protocol(netdev_features_t features,
2831} 2909}
2832 2910
2833#ifdef CONFIG_BUG 2911#ifdef CONFIG_BUG
2834extern void netdev_rx_csum_fault(struct net_device *dev); 2912void netdev_rx_csum_fault(struct net_device *dev);
2835#else 2913#else
2836static inline void netdev_rx_csum_fault(struct net_device *dev) 2914static inline void netdev_rx_csum_fault(struct net_device *dev)
2837{ 2915{
2838} 2916}
2839#endif 2917#endif
2840/* rx skb timestamps */ 2918/* rx skb timestamps */
2841extern void net_enable_timestamp(void); 2919void net_enable_timestamp(void);
2842extern void net_disable_timestamp(void); 2920void net_disable_timestamp(void);
2843 2921
2844#ifdef CONFIG_PROC_FS 2922#ifdef CONFIG_PROC_FS
2845extern int __init dev_proc_init(void); 2923int __init dev_proc_init(void);
2846#else 2924#else
2847#define dev_proc_init() 0 2925#define dev_proc_init() 0
2848#endif 2926#endif
2849 2927
2850extern int netdev_class_create_file(struct class_attribute *class_attr); 2928int netdev_class_create_file_ns(struct class_attribute *class_attr,
2851extern void netdev_class_remove_file(struct class_attribute *class_attr); 2929 const void *ns);
2930void netdev_class_remove_file_ns(struct class_attribute *class_attr,
2931 const void *ns);
2932
2933static inline int netdev_class_create_file(struct class_attribute *class_attr)
2934{
2935 return netdev_class_create_file_ns(class_attr, NULL);
2936}
2937
2938static inline void netdev_class_remove_file(struct class_attribute *class_attr)
2939{
2940 netdev_class_remove_file_ns(class_attr, NULL);
2941}
2852 2942
2853extern struct kobj_ns_type_operations net_ns_type_operations; 2943extern struct kobj_ns_type_operations net_ns_type_operations;
2854 2944
2855extern const char *netdev_drivername(const struct net_device *dev); 2945const char *netdev_drivername(const struct net_device *dev);
2856 2946
2857extern void linkwatch_run_queue(void); 2947void linkwatch_run_queue(void);
2858 2948
2859static inline netdev_features_t netdev_get_wanted_features( 2949static inline netdev_features_t netdev_get_wanted_features(
2860 struct net_device *dev) 2950 struct net_device *dev)
@@ -2918,6 +3008,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2918 dev->gso_max_size = size; 3008 dev->gso_max_size = size;
2919} 3009}
2920 3010
3011static inline bool netif_is_macvlan(struct net_device *dev)
3012{
3013 return dev->priv_flags & IFF_MACVLAN;
3014}
3015
2921static inline bool netif_is_bond_master(struct net_device *dev) 3016static inline bool netif_is_bond_master(struct net_device *dev)
2922{ 3017{
2923 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3018 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
@@ -2946,22 +3041,22 @@ static inline const char *netdev_name(const struct net_device *dev)
2946 return dev->name; 3041 return dev->name;
2947} 3042}
2948 3043
2949extern __printf(3, 4) 3044__printf(3, 4)
2950int netdev_printk(const char *level, const struct net_device *dev, 3045int netdev_printk(const char *level, const struct net_device *dev,
2951 const char *format, ...); 3046 const char *format, ...);
2952extern __printf(2, 3) 3047__printf(2, 3)
2953int netdev_emerg(const struct net_device *dev, const char *format, ...); 3048int netdev_emerg(const struct net_device *dev, const char *format, ...);
2954extern __printf(2, 3) 3049__printf(2, 3)
2955int netdev_alert(const struct net_device *dev, const char *format, ...); 3050int netdev_alert(const struct net_device *dev, const char *format, ...);
2956extern __printf(2, 3) 3051__printf(2, 3)
2957int netdev_crit(const struct net_device *dev, const char *format, ...); 3052int netdev_crit(const struct net_device *dev, const char *format, ...);
2958extern __printf(2, 3) 3053__printf(2, 3)
2959int netdev_err(const struct net_device *dev, const char *format, ...); 3054int netdev_err(const struct net_device *dev, const char *format, ...);
2960extern __printf(2, 3) 3055__printf(2, 3)
2961int netdev_warn(const struct net_device *dev, const char *format, ...); 3056int netdev_warn(const struct net_device *dev, const char *format, ...);
2962extern __printf(2, 3) 3057__printf(2, 3)
2963int netdev_notice(const struct net_device *dev, const char *format, ...); 3058int netdev_notice(const struct net_device *dev, const char *format, ...);
2964extern __printf(2, 3) 3059__printf(2, 3)
2965int netdev_info(const struct net_device *dev, const char *format, ...); 3060int netdev_info(const struct net_device *dev, const char *format, ...);
2966 3061
2967#define MODULE_ALIAS_NETDEV(device) \ 3062#define MODULE_ALIAS_NETDEV(device) \
@@ -3002,7 +3097,7 @@ do { \
3002 * file/line information and a backtrace. 3097 * file/line information and a backtrace.
3003 */ 3098 */
3004#define netdev_WARN(dev, format, args...) \ 3099#define netdev_WARN(dev, format, args...) \
3005 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); 3100 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
3006 3101
3007/* netif printk helpers, similar to netdev_printk */ 3102/* netif printk helpers, similar to netdev_printk */
3008 3103
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 708fe72ab913..2077489f9887 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,14 +35,15 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern int netfilter_init(void); 38int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
42 42
43struct sk_buff; 43struct sk_buff;
44 44
45typedef unsigned int nf_hookfn(unsigned int hooknum, 45struct nf_hook_ops;
46typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
46 struct sk_buff *skb, 47 struct sk_buff *skb,
47 const struct net_device *in, 48 const struct net_device *in,
48 const struct net_device *out, 49 const struct net_device *out,
@@ -52,12 +53,13 @@ struct nf_hook_ops {
52 struct list_head list; 53 struct list_head list;
53 54
54 /* User fills in from here down. */ 55 /* User fills in from here down. */
55 nf_hookfn *hook; 56 nf_hookfn *hook;
56 struct module *owner; 57 struct module *owner;
57 u_int8_t pf; 58 void *priv;
58 unsigned int hooknum; 59 u_int8_t pf;
60 unsigned int hooknum;
59 /* Hooks are ordered in ascending priority. */ 61 /* Hooks are ordered in ascending priority. */
60 int priority; 62 int priority;
61}; 63};
62 64
63struct nf_sockopt_ops { 65struct nf_sockopt_ops {
@@ -208,7 +210,7 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
208/* Call this before modifying an existing packet: ensures it is 210/* Call this before modifying an existing packet: ensures it is
209 modifiable and linear to the point you care about (writable_len). 211 modifiable and linear to the point you care about (writable_len).
210 Returns true or false. */ 212 Returns true or false. */
211extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); 213int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
212 214
213struct flowi; 215struct flowi;
214struct nf_queue_entry; 216struct nf_queue_entry;
@@ -269,8 +271,8 @@ nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
269 return csum; 271 return csum;
270} 272}
271 273
272extern int nf_register_afinfo(const struct nf_afinfo *afinfo); 274int nf_register_afinfo(const struct nf_afinfo *afinfo);
273extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 275void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
274 276
275#include <net/flow.h> 277#include <net/flow.h>
276extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *); 278extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
@@ -315,7 +317,7 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
315 317
316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 318#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
317extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; 319extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
318extern void nf_ct_attach(struct sk_buff *, const struct sk_buff *); 320void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu; 321extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
320 322
321struct nf_conn; 323struct nf_conn;
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index d80e2753847c..c7174b816674 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -49,31 +49,68 @@ enum ip_set_feature {
49 49
50/* Set extensions */ 50/* Set extensions */
51enum ip_set_extension { 51enum ip_set_extension {
52 IPSET_EXT_NONE = 0, 52 IPSET_EXT_BIT_TIMEOUT = 0,
53 IPSET_EXT_BIT_TIMEOUT = 1,
54 IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT), 53 IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT),
55 IPSET_EXT_BIT_COUNTER = 2, 54 IPSET_EXT_BIT_COUNTER = 1,
56 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), 55 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
57}; 56 IPSET_EXT_BIT_COMMENT = 2,
58 57 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT),
59/* Extension offsets */ 58 /* Mark set with an extension which needs to call destroy */
60enum ip_set_offset { 59 IPSET_EXT_BIT_DESTROY = 7,
61 IPSET_OFFSET_TIMEOUT = 0, 60 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY),
62 IPSET_OFFSET_COUNTER,
63 IPSET_OFFSET_MAX,
64}; 61};
65 62
66#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 63#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
67#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 64#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
65#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
66
67/* Extension id, in size order */
68enum ip_set_ext_id {
69 IPSET_EXT_ID_COUNTER = 0,
70 IPSET_EXT_ID_TIMEOUT,
71 IPSET_EXT_ID_COMMENT,
72 IPSET_EXT_ID_MAX,
73};
74
75/* Extension type */
76struct ip_set_ext_type {
77 /* Destroy extension private data (can be NULL) */
78 void (*destroy)(void *ext);
79 enum ip_set_extension type;
80 enum ipset_cadt_flags flag;
81 /* Size and minimal alignment */
82 u8 len;
83 u8 align;
84};
85
86extern const struct ip_set_ext_type ip_set_extensions[];
68 87
69struct ip_set_ext { 88struct ip_set_ext {
70 unsigned long timeout;
71 u64 packets; 89 u64 packets;
72 u64 bytes; 90 u64 bytes;
91 u32 timeout;
92 char *comment;
93};
94
95struct ip_set_counter {
96 atomic64_t bytes;
97 atomic64_t packets;
98};
99
100struct ip_set_comment {
101 char *str;
73}; 102};
74 103
75struct ip_set; 104struct ip_set;
76 105
106#define ext_timeout(e, s) \
107(unsigned long *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_TIMEOUT])
108#define ext_counter(e, s) \
109(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER])
110#define ext_comment(e, s) \
111(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT])
112
113
77typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 114typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
78 const struct ip_set_ext *ext, 115 const struct ip_set_ext *ext,
79 struct ip_set_ext *mext, u32 cmdflags); 116 struct ip_set_ext *mext, u32 cmdflags);
@@ -147,7 +184,8 @@ struct ip_set_type {
147 u8 revision_min, revision_max; 184 u8 revision_min, revision_max;
148 185
149 /* Create set */ 186 /* Create set */
150 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags); 187 int (*create)(struct net *net, struct ip_set *set,
188 struct nlattr *tb[], u32 flags);
151 189
152 /* Attribute policies */ 190 /* Attribute policies */
153 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1]; 191 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1];
@@ -179,14 +217,45 @@ struct ip_set {
179 u8 revision; 217 u8 revision;
180 /* Extensions */ 218 /* Extensions */
181 u8 extensions; 219 u8 extensions;
220 /* Default timeout value, if enabled */
221 u32 timeout;
222 /* Element data size */
223 size_t dsize;
224 /* Offsets to extensions in elements */
225 size_t offset[IPSET_EXT_ID_MAX];
182 /* The type specific data */ 226 /* The type specific data */
183 void *data; 227 void *data;
184}; 228};
185 229
186struct ip_set_counter { 230static inline void
187 atomic64_t bytes; 231ip_set_ext_destroy(struct ip_set *set, void *data)
188 atomic64_t packets; 232{
189}; 233 /* Check that the extension is enabled for the set and
234 * call it's destroy function for its extension part in data.
235 */
236 if (SET_WITH_COMMENT(set))
237 ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy(
238 ext_comment(data, set));
239}
240
241static inline int
242ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
243{
244 u32 cadt_flags = 0;
245
246 if (SET_WITH_TIMEOUT(set))
247 if (unlikely(nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
248 htonl(set->timeout))))
249 return -EMSGSIZE;
250 if (SET_WITH_COUNTER(set))
251 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
252 if (SET_WITH_COMMENT(set))
253 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
254
255 if (!cadt_flags)
256 return 0;
257 return nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(cadt_flags));
258}
190 259
191static inline void 260static inline void
192ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) 261ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter)
@@ -247,13 +316,24 @@ ip_set_init_counter(struct ip_set_counter *counter,
247 atomic64_set(&(counter)->packets, (long long)(ext->packets)); 316 atomic64_set(&(counter)->packets, (long long)(ext->packets));
248} 317}
249 318
319/* Netlink CB args */
320enum {
321 IPSET_CB_NET = 0,
322 IPSET_CB_DUMP,
323 IPSET_CB_INDEX,
324 IPSET_CB_ARG0,
325 IPSET_CB_ARG1,
326 IPSET_CB_ARG2,
327};
328
250/* register and unregister set references */ 329/* register and unregister set references */
251extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); 330extern ip_set_id_t ip_set_get_byname(struct net *net,
252extern void ip_set_put_byindex(ip_set_id_t index); 331 const char *name, struct ip_set **set);
253extern const char *ip_set_name_byindex(ip_set_id_t index); 332extern void ip_set_put_byindex(struct net *net, ip_set_id_t index);
254extern ip_set_id_t ip_set_nfnl_get(const char *name); 333extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index);
255extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index); 334extern ip_set_id_t ip_set_nfnl_get(struct net *net, const char *name);
256extern void ip_set_nfnl_put(ip_set_id_t index); 335extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index);
336extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index);
257 337
258/* API for iptables set match, and SET target */ 338/* API for iptables set match, and SET target */
259 339
@@ -272,6 +352,8 @@ extern void *ip_set_alloc(size_t size);
272extern void ip_set_free(void *members); 352extern void ip_set_free(void *members);
273extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); 353extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
274extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); 354extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
355extern size_t ip_set_elem_len(struct ip_set *set, struct nlattr *tb[],
356 size_t len);
275extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], 357extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
276 struct ip_set_ext *ext); 358 struct ip_set_ext *ext);
277 359
@@ -296,10 +378,12 @@ ip_set_eexist(int ret, u32 flags)
296 378
297/* Match elements marked with nomatch */ 379/* Match elements marked with nomatch */
298static inline bool 380static inline bool
299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) 381ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt, struct ip_set *set)
300{ 382{
301 return adt == IPSET_TEST && 383 return adt == IPSET_TEST &&
302 ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); 384 (set->type->features & IPSET_TYPE_NOMATCH) &&
385 ((flags >> 16) & IPSET_FLAG_NOMATCH) &&
386 (ret > 0 || ret == -ENOTEMPTY);
303} 387}
304 388
305/* Check the NLA_F_NET_BYTEORDER flag */ 389/* Check the NLA_F_NET_BYTEORDER flag */
@@ -387,13 +471,40 @@ bitmap_bytes(u32 a, u32 b)
387} 471}
388 472
389#include <linux/netfilter/ipset/ip_set_timeout.h> 473#include <linux/netfilter/ipset/ip_set_timeout.h>
474#include <linux/netfilter/ipset/ip_set_comment.h>
475
476static inline int
477ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
478 const void *e, bool active)
479{
480 if (SET_WITH_TIMEOUT(set)) {
481 unsigned long *timeout = ext_timeout(e, set);
482
483 if (nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
484 htonl(active ? ip_set_timeout_get(timeout)
485 : *timeout)))
486 return -EMSGSIZE;
487 }
488 if (SET_WITH_COUNTER(set) &&
489 ip_set_put_counter(skb, ext_counter(e, set)))
490 return -EMSGSIZE;
491 if (SET_WITH_COMMENT(set) &&
492 ip_set_put_comment(skb, ext_comment(e, set)))
493 return -EMSGSIZE;
494 return 0;
495}
390 496
391#define IP_SET_INIT_KEXT(skb, opt, map) \ 497#define IP_SET_INIT_KEXT(skb, opt, set) \
392 { .bytes = (skb)->len, .packets = 1, \ 498 { .bytes = (skb)->len, .packets = 1, \
393 .timeout = ip_set_adt_opt_timeout(opt, map) } 499 .timeout = ip_set_adt_opt_timeout(opt, set) }
394 500
395#define IP_SET_INIT_UEXT(map) \ 501#define IP_SET_INIT_UEXT(set) \
396 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \ 502 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \
397 .timeout = (map)->timeout } 503 .timeout = (set)->timeout }
504
505#define IP_SET_INIT_CIDR(a, b) ((a) ? (a) : (b))
506
507#define IPSET_CONCAT(a, b) a##b
508#define IPSET_TOKEN(a, b) IPSET_CONCAT(a, b)
398 509
399#endif /*_IP_SET_H */ 510#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_comment.h b/include/linux/netfilter/ipset/ip_set_comment.h
new file mode 100644
index 000000000000..21217ea008d7
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_comment.h
@@ -0,0 +1,57 @@
1#ifndef _IP_SET_COMMENT_H
2#define _IP_SET_COMMENT_H
3
4/* Copyright (C) 2013 Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifdef __KERNEL__
12
13static inline char*
14ip_set_comment_uget(struct nlattr *tb)
15{
16 return nla_data(tb);
17}
18
19static inline void
20ip_set_init_comment(struct ip_set_comment *comment,
21 const struct ip_set_ext *ext)
22{
23 size_t len = ext->comment ? strlen(ext->comment) : 0;
24
25 if (unlikely(comment->str)) {
26 kfree(comment->str);
27 comment->str = NULL;
28 }
29 if (!len)
30 return;
31 if (unlikely(len > IPSET_MAX_COMMENT_SIZE))
32 len = IPSET_MAX_COMMENT_SIZE;
33 comment->str = kzalloc(len + 1, GFP_ATOMIC);
34 if (unlikely(!comment->str))
35 return;
36 strlcpy(comment->str, ext->comment, len + 1);
37}
38
39static inline int
40ip_set_put_comment(struct sk_buff *skb, struct ip_set_comment *comment)
41{
42 if (!comment->str)
43 return 0;
44 return nla_put_string(skb, IPSET_ATTR_COMMENT, comment->str);
45}
46
47static inline void
48ip_set_comment_free(struct ip_set_comment *comment)
49{
50 if (unlikely(!comment->str))
51 return;
52 kfree(comment->str);
53 comment->str = NULL;
54}
55
56#endif
57#endif
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 3aac04167ca7..83c2f9e0886c 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -23,8 +23,8 @@
23/* Set is defined with timeout support: timeout value may be 0 */ 23/* Set is defined with timeout support: timeout value may be 0 */
24#define IPSET_NO_TIMEOUT UINT_MAX 24#define IPSET_NO_TIMEOUT UINT_MAX
25 25
26#define ip_set_adt_opt_timeout(opt, map) \ 26#define ip_set_adt_opt_timeout(opt, set) \
27((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout) 27((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout)
28 28
29static inline unsigned int 29static inline unsigned int
30ip_set_timeout_uget(struct nlattr *tb) 30ip_set_timeout_uget(struct nlattr *tb)
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 127d0b90604f..275505792664 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -23,6 +23,6 @@ struct ip_conntrack_stat {
23}; 23};
24 24
25/* call to create an explicit dependency on nf_conntrack. */ 25/* call to create an explicit dependency on nf_conntrack. */
26extern void need_conntrack(void); 26void need_conntrack(void);
27 27
28#endif /* _NF_CONNTRACK_COMMON_H */ 28#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index f381020eee92..858d9b214053 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -29,13 +29,13 @@ struct nf_ct_h323_master {
29 29
30struct nf_conn; 30struct nf_conn;
31 31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, 32int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr, 33 TransportAddress *taddr, union nf_inet_addr *addr,
34 union nf_inet_addr *addr, __be16 *port); 34 __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new, 35void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this); 38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 6a0664c0c451..ec2ffaf418c8 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -87,8 +87,8 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
87/* delete keymap entries */ 87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct); 88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89 89
90extern void nf_ct_gre_keymap_flush(struct net *net); 90void nf_ct_gre_keymap_flush(struct net *net);
91extern void nf_nat_need_gre(void); 91void nf_nat_need_gre(void);
92 92
93#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
94#endif /* _CONNTRACK_PROTO_GRE_H */ 94#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index ba7f571a2b1c..d5af3c27fb7d 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -107,85 +107,93 @@ enum sdp_header_types {
107 SDP_HDR_MEDIA, 107 SDP_HDR_MEDIA,
108}; 108};
109 109
110extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 110struct nf_nat_sip_hooks {
111 unsigned int protoff, 111 unsigned int (*msg)(struct sk_buff *skb,
112 unsigned int dataoff, 112 unsigned int protoff,
113 const char **dptr, 113 unsigned int dataoff,
114 unsigned int *datalen); 114 const char **dptr,
115extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, 115 unsigned int *datalen);
116 unsigned int protoff, s16 off); 116
117extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, 117 void (*seq_adjust)(struct sk_buff *skb,
118 unsigned int protoff, 118 unsigned int protoff, s16 off);
119 unsigned int dataoff, 119
120 const char **dptr, 120 unsigned int (*expect)(struct sk_buff *skb,
121 unsigned int *datalen, 121 unsigned int protoff,
122 struct nf_conntrack_expect *exp, 122 unsigned int dataoff,
123 unsigned int matchoff, 123 const char **dptr,
124 unsigned int matchlen); 124 unsigned int *datalen,
125extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, 125 struct nf_conntrack_expect *exp,
126 unsigned int protoff, 126 unsigned int matchoff,
127 unsigned int dataoff, 127 unsigned int matchlen);
128 const char **dptr, 128
129 unsigned int *datalen, 129 unsigned int (*sdp_addr)(struct sk_buff *skb,
130 unsigned int sdpoff, 130 unsigned int protoff,
131 enum sdp_header_types type, 131 unsigned int dataoff,
132 enum sdp_header_types term, 132 const char **dptr,
133 const union nf_inet_addr *addr); 133 unsigned int *datalen,
134extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, 134 unsigned int sdpoff,
135 unsigned int protoff,
136 unsigned int dataoff,
137 const char **dptr,
138 unsigned int *datalen,
139 unsigned int matchoff,
140 unsigned int matchlen,
141 u_int16_t port);
142extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
143 unsigned int protoff,
144 unsigned int dataoff,
145 const char **dptr,
146 unsigned int *datalen,
147 unsigned int sdpoff,
148 const union nf_inet_addr *addr);
149extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
150 unsigned int protoff,
151 unsigned int dataoff,
152 const char **dptr,
153 unsigned int *datalen,
154 struct nf_conntrack_expect *rtp_exp,
155 struct nf_conntrack_expect *rtcp_exp,
156 unsigned int mediaoff,
157 unsigned int medialen,
158 union nf_inet_addr *rtp_addr);
159
160extern int ct_sip_parse_request(const struct nf_conn *ct,
161 const char *dptr, unsigned int datalen,
162 unsigned int *matchoff, unsigned int *matchlen,
163 union nf_inet_addr *addr, __be16 *port);
164extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
165 unsigned int dataoff, unsigned int datalen,
166 enum sip_header_types type,
167 unsigned int *matchoff, unsigned int *matchlen);
168extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
169 unsigned int *dataoff, unsigned int datalen,
170 enum sip_header_types type, int *in_header,
171 unsigned int *matchoff, unsigned int *matchlen,
172 union nf_inet_addr *addr, __be16 *port);
173extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
174 unsigned int dataoff, unsigned int datalen,
175 const char *name,
176 unsigned int *matchoff, unsigned int *matchlen,
177 union nf_inet_addr *addr, bool delim);
178extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
179 unsigned int off, unsigned int datalen,
180 const char *name,
181 unsigned int *matchoff, unsigned int *matchen,
182 unsigned int *val);
183
184extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
185 unsigned int dataoff, unsigned int datalen,
186 enum sdp_header_types type, 135 enum sdp_header_types type,
187 enum sdp_header_types term, 136 enum sdp_header_types term,
188 unsigned int *matchoff, unsigned int *matchlen); 137 const union nf_inet_addr *addr);
138
139 unsigned int (*sdp_port)(struct sk_buff *skb,
140 unsigned int protoff,
141 unsigned int dataoff,
142 const char **dptr,
143 unsigned int *datalen,
144 unsigned int matchoff,
145 unsigned int matchlen,
146 u_int16_t port);
147
148 unsigned int (*sdp_session)(struct sk_buff *skb,
149 unsigned int protoff,
150 unsigned int dataoff,
151 const char **dptr,
152 unsigned int *datalen,
153 unsigned int sdpoff,
154 const union nf_inet_addr *addr);
155
156 unsigned int (*sdp_media)(struct sk_buff *skb,
157 unsigned int protoff,
158 unsigned int dataoff,
159 const char **dptr,
160 unsigned int *datalen,
161 struct nf_conntrack_expect *rtp_exp,
162 struct nf_conntrack_expect *rtcp_exp,
163 unsigned int mediaoff,
164 unsigned int medialen,
165 union nf_inet_addr *rtp_addr);
166};
167extern const struct nf_nat_sip_hooks *nf_nat_sip_hooks;
168
169int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr,
170 unsigned int datalen, unsigned int *matchoff,
171 unsigned int *matchlen, union nf_inet_addr *addr,
172 __be16 *port);
173int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
174 unsigned int dataoff, unsigned int datalen,
175 enum sip_header_types type, unsigned int *matchoff,
176 unsigned int *matchlen);
177int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
178 unsigned int *dataoff, unsigned int datalen,
179 enum sip_header_types type, int *in_header,
180 unsigned int *matchoff, unsigned int *matchlen,
181 union nf_inet_addr *addr, __be16 *port);
182int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
183 unsigned int dataoff, unsigned int datalen,
184 const char *name, unsigned int *matchoff,
185 unsigned int *matchlen, union nf_inet_addr *addr,
186 bool delim);
187int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
188 unsigned int off, unsigned int datalen,
189 const char *name, unsigned int *matchoff,
190 unsigned int *matchen, unsigned int *val);
191
192int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
193 unsigned int dataoff, unsigned int datalen,
194 enum sdp_header_types type,
195 enum sdp_header_types term,
196 unsigned int *matchoff, unsigned int *matchlen);
189 197
190#endif /* __KERNEL__ */ 198#endif /* __KERNEL__ */
191#endif /* __NF_CONNTRACK_SIP_H__ */ 199#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index cadb7402d7a7..28c74367e900 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -14,6 +14,9 @@ struct nfnl_callback {
14 int (*call_rcu)(struct sock *nl, struct sk_buff *skb, 14 int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
15 const struct nlmsghdr *nlh, 15 const struct nlmsghdr *nlh,
16 const struct nlattr * const cda[]); 16 const struct nlattr * const cda[]);
17 int (*call_batch)(struct sock *nl, struct sk_buff *skb,
18 const struct nlmsghdr *nlh,
19 const struct nlattr * const cda[]);
17 const struct nla_policy *policy; /* netlink attribute policy */ 20 const struct nla_policy *policy; /* netlink attribute policy */
18 const u_int16_t attr_count; /* number of nlattr's */ 21 const u_int16_t attr_count; /* number of nlattr's */
19}; 22};
@@ -23,22 +26,24 @@ struct nfnetlink_subsystem {
23 __u8 subsys_id; /* nfnetlink subsystem ID */ 26 __u8 subsys_id; /* nfnetlink subsystem ID */
24 __u8 cb_count; /* number of callbacks */ 27 __u8 cb_count; /* number of callbacks */
25 const struct nfnl_callback *cb; /* callback for individual types */ 28 const struct nfnl_callback *cb; /* callback for individual types */
29 int (*commit)(struct sk_buff *skb);
30 int (*abort)(struct sk_buff *skb);
26}; 31};
27 32
28extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); 33int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 34int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30 35
31extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 36int nfnetlink_has_listeners(struct net *net, unsigned int group);
32extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, 37struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33 u32 dst_portid, gfp_t gfp_mask); 38 u32 dst_portid, gfp_t gfp_mask);
34extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, 39int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
35 unsigned int group, int echo, gfp_t flags); 40 unsigned int group, int echo, gfp_t flags);
36extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); 41int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
37extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, 42int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
38 u32 portid, int flags); 43 int flags);
39 44
40extern void nfnl_lock(__u8 subsys_id); 45void nfnl_lock(__u8 subsys_id);
41extern void nfnl_unlock(__u8 subsys_id); 46void nfnl_unlock(__u8 subsys_id);
42 47
43#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 48#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
44 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 49 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
index bb4bbc9b7a18..b2e85e59f760 100644
--- a/include/linux/netfilter/nfnetlink_acct.h
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -6,8 +6,8 @@
6 6
7struct nf_acct; 7struct nf_acct;
8 8
9extern struct nf_acct *nfnl_acct_find_get(const char *filter_name); 9struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10extern void nfnl_acct_put(struct nf_acct *acct); 10void nfnl_acct_put(struct nf_acct *acct);
11extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); 11void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
12 12
13#endif /* _NFNL_ACCT_H */ 13#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index dd49566315c6..a3e215bb0241 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -229,50 +229,48 @@ struct xt_table_info {
229 229
230#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \ 230#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
231 + nr_cpu_ids * sizeof(char *)) 231 + nr_cpu_ids * sizeof(char *))
232extern int xt_register_target(struct xt_target *target); 232int xt_register_target(struct xt_target *target);
233extern void xt_unregister_target(struct xt_target *target); 233void xt_unregister_target(struct xt_target *target);
234extern int xt_register_targets(struct xt_target *target, unsigned int n); 234int xt_register_targets(struct xt_target *target, unsigned int n);
235extern void xt_unregister_targets(struct xt_target *target, unsigned int n); 235void xt_unregister_targets(struct xt_target *target, unsigned int n);
236 236
237extern int xt_register_match(struct xt_match *target); 237int xt_register_match(struct xt_match *target);
238extern void xt_unregister_match(struct xt_match *target); 238void xt_unregister_match(struct xt_match *target);
239extern int xt_register_matches(struct xt_match *match, unsigned int n); 239int xt_register_matches(struct xt_match *match, unsigned int n);
240extern void xt_unregister_matches(struct xt_match *match, unsigned int n); 240void xt_unregister_matches(struct xt_match *match, unsigned int n);
241 241
242extern int xt_check_match(struct xt_mtchk_param *, 242int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
243 unsigned int size, u_int8_t proto, bool inv_proto); 243 bool inv_proto);
244extern int xt_check_target(struct xt_tgchk_param *, 244int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
245 unsigned int size, u_int8_t proto, bool inv_proto); 245 bool inv_proto);
246 246
247extern struct xt_table *xt_register_table(struct net *net, 247struct xt_table *xt_register_table(struct net *net,
248 const struct xt_table *table, 248 const struct xt_table *table,
249 struct xt_table_info *bootstrap, 249 struct xt_table_info *bootstrap,
250 struct xt_table_info *newinfo); 250 struct xt_table_info *newinfo);
251extern void *xt_unregister_table(struct xt_table *table); 251void *xt_unregister_table(struct xt_table *table);
252 252
253extern struct xt_table_info *xt_replace_table(struct xt_table *table, 253struct xt_table_info *xt_replace_table(struct xt_table *table,
254 unsigned int num_counters, 254 unsigned int num_counters,
255 struct xt_table_info *newinfo, 255 struct xt_table_info *newinfo,
256 int *error); 256 int *error);
257 257
258extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); 258struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
259extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); 259struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
260extern struct xt_match *xt_request_find_match(u8 af, const char *name, 260struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision);
261 u8 revision); 261struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision);
262extern struct xt_target *xt_request_find_target(u8 af, const char *name, 262int xt_find_revision(u8 af, const char *name, u8 revision, int target,
263 u8 revision); 263 int *err);
264extern int xt_find_revision(u8 af, const char *name, u8 revision, 264
265 int target, int *err); 265struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
266 266 const char *name);
267extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, 267void xt_table_unlock(struct xt_table *t);
268 const char *name); 268
269extern void xt_table_unlock(struct xt_table *t); 269int xt_proto_init(struct net *net, u_int8_t af);
270 270void xt_proto_fini(struct net *net, u_int8_t af);
271extern int xt_proto_init(struct net *net, u_int8_t af); 271
272extern void xt_proto_fini(struct net *net, u_int8_t af); 272struct xt_table_info *xt_alloc_table_info(unsigned int size);
273 273void xt_free_table_info(struct xt_table_info *info);
274extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
275extern void xt_free_table_info(struct xt_table_info *info);
276 274
277/** 275/**
278 * xt_recseq - recursive seqcount for netfilter use 276 * xt_recseq - recursive seqcount for netfilter use
@@ -353,8 +351,8 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
353 return ret; 351 return ret;
354} 352}
355 353
356extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); 354struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
357extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *); 355void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
358 356
359#ifdef CONFIG_COMPAT 357#ifdef CONFIG_COMPAT
360#include <net/compat.h> 358#include <net/compat.h>
@@ -414,25 +412,25 @@ struct _compat_xt_align {
414 412
415#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align)) 413#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
416 414
417extern void xt_compat_lock(u_int8_t af); 415void xt_compat_lock(u_int8_t af);
418extern void xt_compat_unlock(u_int8_t af); 416void xt_compat_unlock(u_int8_t af);
419 417
420extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta); 418int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
421extern void xt_compat_flush_offsets(u_int8_t af); 419void xt_compat_flush_offsets(u_int8_t af);
422extern void xt_compat_init_offsets(u_int8_t af, unsigned int number); 420void xt_compat_init_offsets(u_int8_t af, unsigned int number);
423extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); 421int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
424 422
425extern int xt_compat_match_offset(const struct xt_match *match); 423int xt_compat_match_offset(const struct xt_match *match);
426extern int xt_compat_match_from_user(struct xt_entry_match *m, 424int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
427 void **dstptr, unsigned int *size); 425 unsigned int *size);
428extern int xt_compat_match_to_user(const struct xt_entry_match *m, 426int xt_compat_match_to_user(const struct xt_entry_match *m,
429 void __user **dstptr, unsigned int *size); 427 void __user **dstptr, unsigned int *size);
430 428
431extern int xt_compat_target_offset(const struct xt_target *target); 429int xt_compat_target_offset(const struct xt_target *target);
432extern void xt_compat_target_from_user(struct xt_entry_target *t, 430void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
433 void **dstptr, unsigned int *size); 431 unsigned int *size);
434extern int xt_compat_target_to_user(const struct xt_entry_target *t, 432int xt_compat_target_to_user(const struct xt_entry_target *t,
435 void __user **dstptr, unsigned int *size); 433 void __user **dstptr, unsigned int *size);
436 434
437#endif /* CONFIG_COMPAT */ 435#endif /* CONFIG_COMPAT */
438#endif /* _X_TABLES_H */ 436#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index dfb4d9e52bcb..8ab1c278b66d 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -25,7 +25,7 @@ enum nf_br_hook_priorities {
25#define BRNF_PPPoE 0x20 25#define BRNF_PPPoE 0x20
26 26
27/* Only used in br_forward.c */ 27/* Only used in br_forward.c */
28extern int nf_bridge_copy_header(struct sk_buff *skb); 28int nf_bridge_copy_header(struct sk_buff *skb);
29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
30{ 30{
31 if (skb->nf_bridge && 31 if (skb->nf_bridge &&
@@ -53,7 +53,7 @@ static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
53 return 0; 53 return 0;
54} 54}
55 55
56extern int br_handle_frame_finish(struct sk_buff *skb); 56int br_handle_frame_finish(struct sk_buff *skb);
57/* Only used in br_device.c */ 57/* Only used in br_device.c */
58static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb) 58static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
59{ 59{
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index dfaf116b3e81..6e4591bb54d4 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -6,7 +6,7 @@
6 6
7#include <uapi/linux/netfilter_ipv4.h> 7#include <uapi/linux/netfilter_ipv4.h>
8 8
9extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type); 9int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
10extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 10__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
11 unsigned int dataoff, u_int8_t protocol); 11 unsigned int dataoff, u_int8_t protocol);
12#endif /*__LINUX_IP_NETFILTER_H*/ 12#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 2d4df6ce043e..64dad1cc1a4b 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -11,12 +11,12 @@
11 11
12 12
13#ifdef CONFIG_NETFILTER 13#ifdef CONFIG_NETFILTER
14extern int ip6_route_me_harder(struct sk_buff *skb); 14int ip6_route_me_harder(struct sk_buff *skb);
15extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 15__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
16 unsigned int dataoff, u_int8_t protocol); 16 unsigned int dataoff, u_int8_t protocol);
17 17
18extern int ipv6_netfilter_init(void); 18int ipv6_netfilter_init(void);
19extern void ipv6_netfilter_fini(void); 19void ipv6_netfilter_fini(void);
20 20
21/* 21/*
22 * Hook functions for ipv6 to allow xt_* modules to be built-in even 22 * Hook functions for ipv6 to allow xt_* modules to be built-in even
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index f3c7c24bec1c..fbfdb9d8d3a7 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,7 +24,8 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_hook)(struct netpoll *, int, char *, int); 27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
28 29
29 union inet_addr local_ip, remote_ip; 30 union inet_addr local_ip, remote_ip;
30 bool ipv6; 31 bool ipv6;
@@ -41,7 +42,7 @@ struct netpoll_info {
41 unsigned long rx_flags; 42 unsigned long rx_flags;
42 spinlock_t rx_lock; 43 spinlock_t rx_lock;
43 struct semaphore dev_lock; 44 struct semaphore dev_lock;
44 struct list_head rx_np; /* netpolls that registered an rx_hook */ 45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
45 46
46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ 47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
47 struct sk_buff_head txq; 48 struct sk_buff_head txq;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e36dee52f224..12c2cb947df5 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -118,6 +118,9 @@ Needs to be updated if more operations are defined in future.*/
118 118
119#define FIRST_NFS4_OP OP_ACCESS 119#define FIRST_NFS4_OP OP_ACCESS
120#define LAST_NFS4_OP OP_RECLAIM_COMPLETE 120#define LAST_NFS4_OP OP_RECLAIM_COMPLETE
121#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
122#define LAST_NFS41_OP OP_RECLAIM_COMPLETE
123#define LAST_NFS42_OP OP_RECLAIM_COMPLETE
121 124
122enum nfsstat4 { 125enum nfsstat4 {
123 NFS4_OK = 0, 126 NFS4_OK = 0,
@@ -395,7 +398,9 @@ enum lock_type4 {
395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 398#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 399#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 400#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) 401#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
402#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
403 (1UL << 17)
399 404
400/* MDS threshold bitmap bits */ 405/* MDS threshold bitmap bits */
401#define THRESHOLD_RD (1UL << 0) 406#define THRESHOLD_RD (1UL << 0)
@@ -408,16 +413,6 @@ enum lock_type4 {
408#define NFS4_VERSION 4 413#define NFS4_VERSION 4
409#define NFS4_MINOR_VERSION 0 414#define NFS4_MINOR_VERSION 0
410 415
411#if defined(CONFIG_NFS_V4_2)
412#define NFS4_MAX_MINOR_VERSION 2
413#else
414#if defined(CONFIG_NFS_V4_1)
415#define NFS4_MAX_MINOR_VERSION 1
416#else
417#define NFS4_MAX_MINOR_VERSION 0
418#endif /* CONFIG_NFS_V4_1 */
419#endif /* CONFIG_NFS_V4_2 */
420
421#define NFS4_DEBUG 1 416#define NFS4_DEBUG 1
422 417
423/* Index of predefined Linux client operations */ 418/* Index of predefined Linux client operations */
@@ -460,6 +455,7 @@ enum {
460 NFSPROC4_CLNT_FS_LOCATIONS, 455 NFSPROC4_CLNT_FS_LOCATIONS,
461 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 456 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
462 NFSPROC4_CLNT_SECINFO, 457 NFSPROC4_CLNT_SECINFO,
458 NFSPROC4_CLNT_FSID_PRESENT,
463 459
464 /* nfs41 */ 460 /* nfs41 */
465 NFSPROC4_CLNT_EXCHANGE_ID, 461 NFSPROC4_CLNT_EXCHANGE_ID,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7125cef74164..48997374eaf0 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -269,9 +269,13 @@ static inline int NFS_STALE(const struct inode *inode)
269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
270} 270}
271 271
272static inline int NFS_FSCACHE(const struct inode *inode) 272static inline struct fscache_cookie *nfs_i_fscache(struct inode *inode)
273{ 273{
274 return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); 274#ifdef CONFIG_NFS_FSCACHE
275 return NFS_I(inode)->fscache;
276#else
277 return NULL;
278#endif
275} 279}
276 280
277static inline __u64 NFS_FILEID(const struct inode *inode) 281static inline __u64 NFS_FILEID(const struct inode *inode)
@@ -503,27 +507,10 @@ extern int nfs_mountpoint_expiry_timeout;
503extern void nfs_release_automount_timer(void); 507extern void nfs_release_automount_timer(void);
504 508
505/* 509/*
506 * linux/fs/nfs/nfs4proc.c
507 */
508#ifdef CONFIG_NFS_V4_SECURITY_LABEL
509extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
510static inline void nfs4_label_free(struct nfs4_label *label)
511{
512 if (label) {
513 kfree(label->label);
514 kfree(label);
515 }
516 return;
517}
518#else
519static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
520static inline void nfs4_label_free(void *label) {}
521#endif
522
523/*
524 * linux/fs/nfs/unlink.c 510 * linux/fs/nfs/unlink.c
525 */ 511 */
526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 512extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
513extern void nfs_wait_on_sillyrename(struct dentry *dentry);
527extern void nfs_block_sillyrename(struct dentry *dentry); 514extern void nfs_block_sillyrename(struct dentry *dentry);
528extern void nfs_unblock_sillyrename(struct dentry *dentry); 515extern void nfs_unblock_sillyrename(struct dentry *dentry);
529extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry); 516extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index d2212432c456..1150ea41b626 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -41,6 +41,7 @@ struct nfs_client {
41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ 41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */ 42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ 43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
44#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */
44 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
45 size_t cl_addrlen; 46 size_t cl_addrlen;
46 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
@@ -56,6 +57,7 @@ struct nfs_client {
56 struct rpc_cred *cl_machine_cred; 57 struct rpc_cred *cl_machine_cred;
57 58
58#if IS_ENABLED(CONFIG_NFS_V4) 59#if IS_ENABLED(CONFIG_NFS_V4)
60 struct list_head cl_ds_clients; /* auth flavor data servers */
59 u64 cl_clientid; /* constant */ 61 u64 cl_clientid; /* constant */
60 nfs4_verifier cl_confirm; /* Clientid verifier */ 62 nfs4_verifier cl_confirm; /* Clientid verifier */
61 unsigned long cl_state; 63 unsigned long cl_state;
@@ -77,6 +79,10 @@ struct nfs_client {
77 char cl_ipaddr[48]; 79 char cl_ipaddr[48];
78 u32 cl_cb_ident; /* v4.0 callback identifier */ 80 u32 cl_cb_ident; /* v4.0 callback identifier */
79 const struct nfs4_minor_version_ops *cl_mvops; 81 const struct nfs4_minor_version_ops *cl_mvops;
82 unsigned long cl_mig_gen;
83
84 /* NFSv4.0 transport blocking */
85 struct nfs4_slot_table *cl_slot_tbl;
80 86
81 /* The sequence id to use for the next CREATE_SESSION */ 87 /* The sequence id to use for the next CREATE_SESSION */
82 u32 cl_seqid; 88 u32 cl_seqid;
@@ -87,6 +93,15 @@ struct nfs_client {
87 struct nfs41_server_owner *cl_serverowner; 93 struct nfs41_server_owner *cl_serverowner;
88 struct nfs41_server_scope *cl_serverscope; 94 struct nfs41_server_scope *cl_serverscope;
89 struct nfs41_impl_id *cl_implid; 95 struct nfs41_impl_id *cl_implid;
96 /* nfs 4.1+ state protection modes: */
97 unsigned long cl_sp4_flags;
98#define NFS_SP4_MACH_CRED_MINIMAL 1 /* Minimal sp4_mach_cred - state ops
99 * must use machine cred */
100#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */
101#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */
102#define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */
103#define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */
104#define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */
90#endif /* CONFIG_NFS_V4 */ 105#endif /* CONFIG_NFS_V4 */
91 106
92#ifdef CONFIG_NFS_FSCACHE 107#ifdef CONFIG_NFS_FSCACHE
@@ -134,7 +149,9 @@ struct nfs_server {
134 __u64 maxfilesize; /* maximum file size */ 149 __u64 maxfilesize; /* maximum file size */
135 struct timespec time_delta; /* smallest time granularity */ 150 struct timespec time_delta; /* smallest time granularity */
136 unsigned long mount_time; /* when this fs was mounted */ 151 unsigned long mount_time; /* when this fs was mounted */
152 struct super_block *super; /* VFS super block */
137 dev_t s_dev; /* superblock dev numbers */ 153 dev_t s_dev; /* superblock dev numbers */
154 struct nfs_auth_info auth_info; /* parsed auth flavors */
138 155
139#ifdef CONFIG_NFS_FSCACHE 156#ifdef CONFIG_NFS_FSCACHE
140 struct nfs_fscache_key *fscache_key; /* unique key for superblock */ 157 struct nfs_fscache_key *fscache_key; /* unique key for superblock */
@@ -174,6 +191,12 @@ struct nfs_server {
174 struct list_head state_owners_lru; 191 struct list_head state_owners_lru;
175 struct list_head layouts; 192 struct list_head layouts;
176 struct list_head delegations; 193 struct list_head delegations;
194
195 unsigned long mig_gen;
196 unsigned long mig_status;
197#define NFS_MIG_IN_TRANSITION (1)
198#define NFS_MIG_FAILED (2)
199
177 void (*destroy)(struct nfs_server *); 200 void (*destroy)(struct nfs_server *);
178 201
179 atomic_t active; /* Keep trace of any activity to this server */ 202 atomic_t active; /* Keep trace of any activity to this server */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8651574a305b..3ccfcecf8999 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -591,6 +591,13 @@ struct nfs_renameres {
591 struct nfs_fattr *new_fattr; 591 struct nfs_fattr *new_fattr;
592}; 592};
593 593
594/* parsed sec= options */
595#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
596struct nfs_auth_info {
597 unsigned int flavor_len;
598 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
599};
600
594/* 601/*
595 * Argument struct for decode_entry function 602 * Argument struct for decode_entry function
596 */ 603 */
@@ -1053,14 +1060,18 @@ struct nfs4_fs_locations {
1053struct nfs4_fs_locations_arg { 1060struct nfs4_fs_locations_arg {
1054 struct nfs4_sequence_args seq_args; 1061 struct nfs4_sequence_args seq_args;
1055 const struct nfs_fh *dir_fh; 1062 const struct nfs_fh *dir_fh;
1063 const struct nfs_fh *fh;
1056 const struct qstr *name; 1064 const struct qstr *name;
1057 struct page *page; 1065 struct page *page;
1058 const u32 *bitmask; 1066 const u32 *bitmask;
1067 clientid4 clientid;
1068 unsigned char migration:1, renew:1;
1059}; 1069};
1060 1070
1061struct nfs4_fs_locations_res { 1071struct nfs4_fs_locations_res {
1062 struct nfs4_sequence_res seq_res; 1072 struct nfs4_sequence_res seq_res;
1063 struct nfs4_fs_locations *fs_locations; 1073 struct nfs4_fs_locations *fs_locations;
1074 unsigned char migration:1, renew:1;
1064}; 1075};
1065 1076
1066struct nfs4_secinfo4 { 1077struct nfs4_secinfo4 {
@@ -1084,6 +1095,19 @@ struct nfs4_secinfo_res {
1084 struct nfs4_secinfo_flavors *flavors; 1095 struct nfs4_secinfo_flavors *flavors;
1085}; 1096};
1086 1097
1098struct nfs4_fsid_present_arg {
1099 struct nfs4_sequence_args seq_args;
1100 const struct nfs_fh *fh;
1101 clientid4 clientid;
1102 unsigned char renew:1;
1103};
1104
1105struct nfs4_fsid_present_res {
1106 struct nfs4_sequence_res seq_res;
1107 struct nfs_fh *fh;
1108 unsigned char renew:1;
1109};
1110
1087#endif /* CONFIG_NFS_V4 */ 1111#endif /* CONFIG_NFS_V4 */
1088 1112
1089struct nfstime4 { 1113struct nfstime4 {
@@ -1107,6 +1131,23 @@ struct pnfs_ds_commit_info {
1107 struct pnfs_commit_bucket *buckets; 1131 struct pnfs_commit_bucket *buckets;
1108}; 1132};
1109 1133
1134#define NFS4_OP_MAP_NUM_LONGS \
1135 DIV_ROUND_UP(LAST_NFS4_OP, 8 * sizeof(unsigned long))
1136#define NFS4_OP_MAP_NUM_WORDS \
1137 (NFS4_OP_MAP_NUM_LONGS * sizeof(unsigned long) / sizeof(u32))
1138struct nfs4_op_map {
1139 union {
1140 unsigned long longs[NFS4_OP_MAP_NUM_LONGS];
1141 u32 words[NFS4_OP_MAP_NUM_WORDS];
1142 } u;
1143};
1144
1145struct nfs41_state_protection {
1146 u32 how;
1147 struct nfs4_op_map enforce;
1148 struct nfs4_op_map allow;
1149};
1150
1110#define NFS4_EXCHANGE_ID_LEN (48) 1151#define NFS4_EXCHANGE_ID_LEN (48)
1111struct nfs41_exchange_id_args { 1152struct nfs41_exchange_id_args {
1112 struct nfs_client *client; 1153 struct nfs_client *client;
@@ -1114,6 +1155,7 @@ struct nfs41_exchange_id_args {
1114 unsigned int id_len; 1155 unsigned int id_len;
1115 char id[NFS4_EXCHANGE_ID_LEN]; 1156 char id[NFS4_EXCHANGE_ID_LEN];
1116 u32 flags; 1157 u32 flags;
1158 struct nfs41_state_protection state_protect;
1117}; 1159};
1118 1160
1119struct nfs41_server_owner { 1161struct nfs41_server_owner {
@@ -1146,6 +1188,7 @@ struct nfs41_exchange_id_res {
1146 struct nfs41_server_owner *server_owner; 1188 struct nfs41_server_owner *server_owner;
1147 struct nfs41_server_scope *server_scope; 1189 struct nfs41_server_scope *server_scope;
1148 struct nfs41_impl_id *impl_id; 1190 struct nfs41_impl_id *impl_id;
1191 struct nfs41_state_protection state_protect;
1149}; 1192};
1150 1193
1151struct nfs41_create_session_args { 1194struct nfs41_create_session_args {
@@ -1419,12 +1462,12 @@ struct nfs_rpc_ops {
1419 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1462 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1420 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, 1463 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *,
1421 const struct nfs_pgio_completion_ops *); 1464 const struct nfs_pgio_completion_ops *);
1422 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1465 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1423 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1466 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1424 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1467 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1425 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int, 1468 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1426 const struct nfs_pgio_completion_ops *); 1469 const struct nfs_pgio_completion_ops *);
1427 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); 1470 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1428 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1471 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1429 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1472 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1430 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1473 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
@@ -1436,13 +1479,14 @@ struct nfs_rpc_ops {
1436 struct inode * (*open_context) (struct inode *dir, 1479 struct inode * (*open_context) (struct inode *dir,
1437 struct nfs_open_context *ctx, 1480 struct nfs_open_context *ctx,
1438 int open_flags, 1481 int open_flags,
1439 struct iattr *iattr); 1482 struct iattr *iattr,
1483 int *);
1440 int (*have_delegation)(struct inode *, fmode_t); 1484 int (*have_delegation)(struct inode *, fmode_t);
1441 int (*return_delegation)(struct inode *); 1485 int (*return_delegation)(struct inode *);
1442 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); 1486 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1443 struct nfs_client * 1487 struct nfs_client *
1444 (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1488 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1445 const char *, rpc_authflavor_t); 1489 const char *);
1446 void (*free_client) (struct nfs_client *); 1490 void (*free_client) (struct nfs_client *);
1447 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *); 1491 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1448 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *, 1492 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index f451c8d6e231..26ebcf41c213 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011, Intel Corporation. 3 * Copyright (c) 2011-2013, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -19,7 +19,10 @@
19#ifndef _LINUX_NVME_H 19#ifndef _LINUX_NVME_H
20#define _LINUX_NVME_H 20#define _LINUX_NVME_H
21 21
22#include <linux/types.h> 22#include <uapi/linux/nvme.h>
23#include <linux/pci.h>
24#include <linux/miscdevice.h>
25#include <linux/kref.h>
23 26
24struct nvme_bar { 27struct nvme_bar {
25 __u64 cap; /* Controller Capabilities */ 28 __u64 cap; /* Controller Capabilities */
@@ -50,6 +53,7 @@ enum {
50 NVME_CC_SHN_NONE = 0 << 14, 53 NVME_CC_SHN_NONE = 0 << 14,
51 NVME_CC_SHN_NORMAL = 1 << 14, 54 NVME_CC_SHN_NORMAL = 1 << 14,
52 NVME_CC_SHN_ABRUPT = 2 << 14, 55 NVME_CC_SHN_ABRUPT = 2 << 14,
56 NVME_CC_SHN_MASK = 3 << 14,
53 NVME_CC_IOSQES = 6 << 16, 57 NVME_CC_IOSQES = 6 << 16,
54 NVME_CC_IOCQES = 4 << 20, 58 NVME_CC_IOCQES = 4 << 20,
55 NVME_CSTS_RDY = 1 << 0, 59 NVME_CSTS_RDY = 1 << 0,
@@ -57,462 +61,11 @@ enum {
57 NVME_CSTS_SHST_NORMAL = 0 << 2, 61 NVME_CSTS_SHST_NORMAL = 0 << 2,
58 NVME_CSTS_SHST_OCCUR = 1 << 2, 62 NVME_CSTS_SHST_OCCUR = 1 << 2,
59 NVME_CSTS_SHST_CMPLT = 2 << 2, 63 NVME_CSTS_SHST_CMPLT = 2 << 2,
60}; 64 NVME_CSTS_SHST_MASK = 3 << 2,
61
62struct nvme_id_power_state {
63 __le16 max_power; /* centiwatts */
64 __u16 rsvd2;
65 __le32 entry_lat; /* microseconds */
66 __le32 exit_lat; /* microseconds */
67 __u8 read_tput;
68 __u8 read_lat;
69 __u8 write_tput;
70 __u8 write_lat;
71 __u8 rsvd16[16];
72}; 65};
73 66
74#define NVME_VS(major, minor) (major << 16 | minor) 67#define NVME_VS(major, minor) (major << 16 | minor)
75 68
76struct nvme_id_ctrl {
77 __le16 vid;
78 __le16 ssvid;
79 char sn[20];
80 char mn[40];
81 char fr[8];
82 __u8 rab;
83 __u8 ieee[3];
84 __u8 mic;
85 __u8 mdts;
86 __u8 rsvd78[178];
87 __le16 oacs;
88 __u8 acl;
89 __u8 aerl;
90 __u8 frmw;
91 __u8 lpa;
92 __u8 elpe;
93 __u8 npss;
94 __u8 rsvd264[248];
95 __u8 sqes;
96 __u8 cqes;
97 __u8 rsvd514[2];
98 __le32 nn;
99 __le16 oncs;
100 __le16 fuses;
101 __u8 fna;
102 __u8 vwc;
103 __le16 awun;
104 __le16 awupf;
105 __u8 rsvd530[1518];
106 struct nvme_id_power_state psd[32];
107 __u8 vs[1024];
108};
109
110enum {
111 NVME_CTRL_ONCS_COMPARE = 1 << 0,
112 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
113 NVME_CTRL_ONCS_DSM = 1 << 2,
114};
115
116struct nvme_lbaf {
117 __le16 ms;
118 __u8 ds;
119 __u8 rp;
120};
121
122struct nvme_id_ns {
123 __le64 nsze;
124 __le64 ncap;
125 __le64 nuse;
126 __u8 nsfeat;
127 __u8 nlbaf;
128 __u8 flbas;
129 __u8 mc;
130 __u8 dpc;
131 __u8 dps;
132 __u8 rsvd30[98];
133 struct nvme_lbaf lbaf[16];
134 __u8 rsvd192[192];
135 __u8 vs[3712];
136};
137
138enum {
139 NVME_NS_FEAT_THIN = 1 << 0,
140 NVME_LBAF_RP_BEST = 0,
141 NVME_LBAF_RP_BETTER = 1,
142 NVME_LBAF_RP_GOOD = 2,
143 NVME_LBAF_RP_DEGRADED = 3,
144};
145
146struct nvme_smart_log {
147 __u8 critical_warning;
148 __u8 temperature[2];
149 __u8 avail_spare;
150 __u8 spare_thresh;
151 __u8 percent_used;
152 __u8 rsvd6[26];
153 __u8 data_units_read[16];
154 __u8 data_units_written[16];
155 __u8 host_reads[16];
156 __u8 host_writes[16];
157 __u8 ctrl_busy_time[16];
158 __u8 power_cycles[16];
159 __u8 power_on_hours[16];
160 __u8 unsafe_shutdowns[16];
161 __u8 media_errors[16];
162 __u8 num_err_log_entries[16];
163 __u8 rsvd192[320];
164};
165
166enum {
167 NVME_SMART_CRIT_SPARE = 1 << 0,
168 NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
169 NVME_SMART_CRIT_RELIABILITY = 1 << 2,
170 NVME_SMART_CRIT_MEDIA = 1 << 3,
171 NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
172};
173
174struct nvme_lba_range_type {
175 __u8 type;
176 __u8 attributes;
177 __u8 rsvd2[14];
178 __u64 slba;
179 __u64 nlb;
180 __u8 guid[16];
181 __u8 rsvd48[16];
182};
183
184enum {
185 NVME_LBART_TYPE_FS = 0x01,
186 NVME_LBART_TYPE_RAID = 0x02,
187 NVME_LBART_TYPE_CACHE = 0x03,
188 NVME_LBART_TYPE_SWAP = 0x04,
189
190 NVME_LBART_ATTRIB_TEMP = 1 << 0,
191 NVME_LBART_ATTRIB_HIDE = 1 << 1,
192};
193
194/* I/O commands */
195
196enum nvme_opcode {
197 nvme_cmd_flush = 0x00,
198 nvme_cmd_write = 0x01,
199 nvme_cmd_read = 0x02,
200 nvme_cmd_write_uncor = 0x04,
201 nvme_cmd_compare = 0x05,
202 nvme_cmd_dsm = 0x09,
203};
204
205struct nvme_common_command {
206 __u8 opcode;
207 __u8 flags;
208 __u16 command_id;
209 __le32 nsid;
210 __le32 cdw2[2];
211 __le64 metadata;
212 __le64 prp1;
213 __le64 prp2;
214 __le32 cdw10[6];
215};
216
217struct nvme_rw_command {
218 __u8 opcode;
219 __u8 flags;
220 __u16 command_id;
221 __le32 nsid;
222 __u64 rsvd2;
223 __le64 metadata;
224 __le64 prp1;
225 __le64 prp2;
226 __le64 slba;
227 __le16 length;
228 __le16 control;
229 __le32 dsmgmt;
230 __le32 reftag;
231 __le16 apptag;
232 __le16 appmask;
233};
234
235enum {
236 NVME_RW_LR = 1 << 15,
237 NVME_RW_FUA = 1 << 14,
238 NVME_RW_DSM_FREQ_UNSPEC = 0,
239 NVME_RW_DSM_FREQ_TYPICAL = 1,
240 NVME_RW_DSM_FREQ_RARE = 2,
241 NVME_RW_DSM_FREQ_READS = 3,
242 NVME_RW_DSM_FREQ_WRITES = 4,
243 NVME_RW_DSM_FREQ_RW = 5,
244 NVME_RW_DSM_FREQ_ONCE = 6,
245 NVME_RW_DSM_FREQ_PREFETCH = 7,
246 NVME_RW_DSM_FREQ_TEMP = 8,
247 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
248 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
249 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
250 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
251 NVME_RW_DSM_SEQ_REQ = 1 << 6,
252 NVME_RW_DSM_COMPRESSED = 1 << 7,
253};
254
255struct nvme_dsm_cmd {
256 __u8 opcode;
257 __u8 flags;
258 __u16 command_id;
259 __le32 nsid;
260 __u64 rsvd2[2];
261 __le64 prp1;
262 __le64 prp2;
263 __le32 nr;
264 __le32 attributes;
265 __u32 rsvd12[4];
266};
267
268enum {
269 NVME_DSMGMT_IDR = 1 << 0,
270 NVME_DSMGMT_IDW = 1 << 1,
271 NVME_DSMGMT_AD = 1 << 2,
272};
273
274struct nvme_dsm_range {
275 __le32 cattr;
276 __le32 nlb;
277 __le64 slba;
278};
279
280/* Admin commands */
281
282enum nvme_admin_opcode {
283 nvme_admin_delete_sq = 0x00,
284 nvme_admin_create_sq = 0x01,
285 nvme_admin_get_log_page = 0x02,
286 nvme_admin_delete_cq = 0x04,
287 nvme_admin_create_cq = 0x05,
288 nvme_admin_identify = 0x06,
289 nvme_admin_abort_cmd = 0x08,
290 nvme_admin_set_features = 0x09,
291 nvme_admin_get_features = 0x0a,
292 nvme_admin_async_event = 0x0c,
293 nvme_admin_activate_fw = 0x10,
294 nvme_admin_download_fw = 0x11,
295 nvme_admin_format_nvm = 0x80,
296 nvme_admin_security_send = 0x81,
297 nvme_admin_security_recv = 0x82,
298};
299
300enum {
301 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
302 NVME_CQ_IRQ_ENABLED = (1 << 1),
303 NVME_SQ_PRIO_URGENT = (0 << 1),
304 NVME_SQ_PRIO_HIGH = (1 << 1),
305 NVME_SQ_PRIO_MEDIUM = (2 << 1),
306 NVME_SQ_PRIO_LOW = (3 << 1),
307 NVME_FEAT_ARBITRATION = 0x01,
308 NVME_FEAT_POWER_MGMT = 0x02,
309 NVME_FEAT_LBA_RANGE = 0x03,
310 NVME_FEAT_TEMP_THRESH = 0x04,
311 NVME_FEAT_ERR_RECOVERY = 0x05,
312 NVME_FEAT_VOLATILE_WC = 0x06,
313 NVME_FEAT_NUM_QUEUES = 0x07,
314 NVME_FEAT_IRQ_COALESCE = 0x08,
315 NVME_FEAT_IRQ_CONFIG = 0x09,
316 NVME_FEAT_WRITE_ATOMIC = 0x0a,
317 NVME_FEAT_ASYNC_EVENT = 0x0b,
318 NVME_FEAT_SW_PROGRESS = 0x0c,
319 NVME_FWACT_REPL = (0 << 3),
320 NVME_FWACT_REPL_ACTV = (1 << 3),
321 NVME_FWACT_ACTV = (2 << 3),
322};
323
324struct nvme_identify {
325 __u8 opcode;
326 __u8 flags;
327 __u16 command_id;
328 __le32 nsid;
329 __u64 rsvd2[2];
330 __le64 prp1;
331 __le64 prp2;
332 __le32 cns;
333 __u32 rsvd11[5];
334};
335
336struct nvme_features {
337 __u8 opcode;
338 __u8 flags;
339 __u16 command_id;
340 __le32 nsid;
341 __u64 rsvd2[2];
342 __le64 prp1;
343 __le64 prp2;
344 __le32 fid;
345 __le32 dword11;
346 __u32 rsvd12[4];
347};
348
349struct nvme_create_cq {
350 __u8 opcode;
351 __u8 flags;
352 __u16 command_id;
353 __u32 rsvd1[5];
354 __le64 prp1;
355 __u64 rsvd8;
356 __le16 cqid;
357 __le16 qsize;
358 __le16 cq_flags;
359 __le16 irq_vector;
360 __u32 rsvd12[4];
361};
362
363struct nvme_create_sq {
364 __u8 opcode;
365 __u8 flags;
366 __u16 command_id;
367 __u32 rsvd1[5];
368 __le64 prp1;
369 __u64 rsvd8;
370 __le16 sqid;
371 __le16 qsize;
372 __le16 sq_flags;
373 __le16 cqid;
374 __u32 rsvd12[4];
375};
376
377struct nvme_delete_queue {
378 __u8 opcode;
379 __u8 flags;
380 __u16 command_id;
381 __u32 rsvd1[9];
382 __le16 qid;
383 __u16 rsvd10;
384 __u32 rsvd11[5];
385};
386
387struct nvme_download_firmware {
388 __u8 opcode;
389 __u8 flags;
390 __u16 command_id;
391 __u32 rsvd1[5];
392 __le64 prp1;
393 __le64 prp2;
394 __le32 numd;
395 __le32 offset;
396 __u32 rsvd12[4];
397};
398
399struct nvme_format_cmd {
400 __u8 opcode;
401 __u8 flags;
402 __u16 command_id;
403 __le32 nsid;
404 __u64 rsvd2[4];
405 __le32 cdw10;
406 __u32 rsvd11[5];
407};
408
409struct nvme_command {
410 union {
411 struct nvme_common_command common;
412 struct nvme_rw_command rw;
413 struct nvme_identify identify;
414 struct nvme_features features;
415 struct nvme_create_cq create_cq;
416 struct nvme_create_sq create_sq;
417 struct nvme_delete_queue delete_queue;
418 struct nvme_download_firmware dlfw;
419 struct nvme_format_cmd format;
420 struct nvme_dsm_cmd dsm;
421 };
422};
423
424enum {
425 NVME_SC_SUCCESS = 0x0,
426 NVME_SC_INVALID_OPCODE = 0x1,
427 NVME_SC_INVALID_FIELD = 0x2,
428 NVME_SC_CMDID_CONFLICT = 0x3,
429 NVME_SC_DATA_XFER_ERROR = 0x4,
430 NVME_SC_POWER_LOSS = 0x5,
431 NVME_SC_INTERNAL = 0x6,
432 NVME_SC_ABORT_REQ = 0x7,
433 NVME_SC_ABORT_QUEUE = 0x8,
434 NVME_SC_FUSED_FAIL = 0x9,
435 NVME_SC_FUSED_MISSING = 0xa,
436 NVME_SC_INVALID_NS = 0xb,
437 NVME_SC_CMD_SEQ_ERROR = 0xc,
438 NVME_SC_LBA_RANGE = 0x80,
439 NVME_SC_CAP_EXCEEDED = 0x81,
440 NVME_SC_NS_NOT_READY = 0x82,
441 NVME_SC_CQ_INVALID = 0x100,
442 NVME_SC_QID_INVALID = 0x101,
443 NVME_SC_QUEUE_SIZE = 0x102,
444 NVME_SC_ABORT_LIMIT = 0x103,
445 NVME_SC_ABORT_MISSING = 0x104,
446 NVME_SC_ASYNC_LIMIT = 0x105,
447 NVME_SC_FIRMWARE_SLOT = 0x106,
448 NVME_SC_FIRMWARE_IMAGE = 0x107,
449 NVME_SC_INVALID_VECTOR = 0x108,
450 NVME_SC_INVALID_LOG_PAGE = 0x109,
451 NVME_SC_INVALID_FORMAT = 0x10a,
452 NVME_SC_BAD_ATTRIBUTES = 0x180,
453 NVME_SC_WRITE_FAULT = 0x280,
454 NVME_SC_READ_ERROR = 0x281,
455 NVME_SC_GUARD_CHECK = 0x282,
456 NVME_SC_APPTAG_CHECK = 0x283,
457 NVME_SC_REFTAG_CHECK = 0x284,
458 NVME_SC_COMPARE_FAILED = 0x285,
459 NVME_SC_ACCESS_DENIED = 0x286,
460};
461
462struct nvme_completion {
463 __le32 result; /* Used by admin commands to return data */
464 __u32 rsvd;
465 __le16 sq_head; /* how much of this queue may be reclaimed */
466 __le16 sq_id; /* submission queue that generated this entry */
467 __u16 command_id; /* of the command which completed */
468 __le16 status; /* did the command fail, and if so, why? */
469};
470
471struct nvme_user_io {
472 __u8 opcode;
473 __u8 flags;
474 __u16 control;
475 __u16 nblocks;
476 __u16 rsvd;
477 __u64 metadata;
478 __u64 addr;
479 __u64 slba;
480 __u32 dsmgmt;
481 __u32 reftag;
482 __u16 apptag;
483 __u16 appmask;
484};
485
486struct nvme_admin_cmd {
487 __u8 opcode;
488 __u8 flags;
489 __u16 rsvd1;
490 __u32 nsid;
491 __u32 cdw2;
492 __u32 cdw3;
493 __u64 metadata;
494 __u64 addr;
495 __u32 metadata_len;
496 __u32 data_len;
497 __u32 cdw10;
498 __u32 cdw11;
499 __u32 cdw12;
500 __u32 cdw13;
501 __u32 cdw14;
502 __u32 cdw15;
503 __u32 timeout_ms;
504 __u32 result;
505};
506
507#define NVME_IOCTL_ID _IO('N', 0x40)
508#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
509#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
510
511#ifdef __KERNEL__
512#include <linux/pci.h>
513#include <linux/miscdevice.h>
514#include <linux/kref.h>
515
516#define NVME_IO_TIMEOUT (5 * HZ) 69#define NVME_IO_TIMEOUT (5 * HZ)
517 70
518/* 71/*
@@ -553,7 +106,7 @@ struct nvme_ns {
553 struct request_queue *queue; 106 struct request_queue *queue;
554 struct gendisk *disk; 107 struct gendisk *disk;
555 108
556 int ns_id; 109 unsigned ns_id;
557 int lba_shift; 110 int lba_shift;
558 int ms; 111 int ms;
559 u64 mode_select_num_blocks; 112 u64 mode_select_num_blocks;
@@ -572,6 +125,7 @@ struct nvme_iod {
572 int offset; /* Of PRP list */ 125 int offset; /* Of PRP list */
573 int nents; /* Used in scatterlist */ 126 int nents; /* Used in scatterlist */
574 int length; /* Of data, in bytes */ 127 int length; /* Of data, in bytes */
128 unsigned long start_time;
575 dma_addr_t first_dma; 129 dma_addr_t first_dma;
576 struct scatterlist sg[0]; 130 struct scatterlist sg[0];
577}; 131};
@@ -613,6 +167,4 @@ struct sg_io_hdr;
613int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr); 167int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr);
614int nvme_sg_get_version_num(int __user *ip); 168int nvme_sg_get_version_num(int __user *ip);
615 169
616#endif
617
618#endif /* _LINUX_NVME_H */ 170#endif /* _LINUX_NVME_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 3a45c4f593ad..276c546980d8 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -136,7 +136,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
136 return of_read_number(cell, size); 136 return of_read_number(cell, size);
137} 137}
138 138
139#if defined(CONFIG_SPARC)
139#include <asm/prom.h> 140#include <asm/prom.h>
141#endif
140 142
141/* Default #address and #size cells. Allow arch asm/prom.h to override */ 143/* Default #address and #size cells. Allow arch asm/prom.h to override */
142#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) 144#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
@@ -226,6 +228,19 @@ static inline int of_get_child_count(const struct device_node *np)
226 return num; 228 return num;
227} 229}
228 230
231static inline int of_get_available_child_count(const struct device_node *np)
232{
233 struct device_node *child;
234 int num = 0;
235
236 for_each_available_child_of_node(np, child)
237 num++;
238
239 return num;
240}
241
242/* cache lookup */
243extern struct device_node *of_find_next_cache_node(const struct device_node *);
229extern struct device_node *of_find_node_with_property( 244extern struct device_node *of_find_node_with_property(
230 struct device_node *from, const char *prop_name); 245 struct device_node *from, const char *prop_name);
231#define for_each_node_with_property(dn, prop_name) \ 246#define for_each_node_with_property(dn, prop_name) \
@@ -275,12 +290,16 @@ extern int of_n_size_cells(struct device_node *np);
275extern const struct of_device_id *of_match_node( 290extern const struct of_device_id *of_match_node(
276 const struct of_device_id *matches, const struct device_node *node); 291 const struct of_device_id *matches, const struct device_node *node);
277extern int of_modalias_node(struct device_node *node, char *modalias, int len); 292extern int of_modalias_node(struct device_node *node, char *modalias, int len);
293extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
278extern struct device_node *of_parse_phandle(const struct device_node *np, 294extern struct device_node *of_parse_phandle(const struct device_node *np,
279 const char *phandle_name, 295 const char *phandle_name,
280 int index); 296 int index);
281extern int of_parse_phandle_with_args(const struct device_node *np, 297extern int of_parse_phandle_with_args(const struct device_node *np,
282 const char *list_name, const char *cells_name, int index, 298 const char *list_name, const char *cells_name, int index,
283 struct of_phandle_args *out_args); 299 struct of_phandle_args *out_args);
300extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
301 const char *list_name, int cells_count, int index,
302 struct of_phandle_args *out_args);
284extern int of_count_phandle_with_args(const struct device_node *np, 303extern int of_count_phandle_with_args(const struct device_node *np,
285 const char *list_name, const char *cells_name); 304 const char *list_name, const char *cells_name);
286 305
@@ -324,12 +343,6 @@ extern int of_detach_node(struct device_node *);
324 */ 343 */
325const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 344const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
326 u32 *pu); 345 u32 *pu);
327#define of_property_for_each_u32(np, propname, prop, p, u) \
328 for (prop = of_find_property(np, propname, NULL), \
329 p = of_prop_next_u32(prop, NULL, &u); \
330 p; \
331 p = of_prop_next_u32(prop, p, &u))
332
333/* 346/*
334 * struct property *prop; 347 * struct property *prop;
335 * const char *s; 348 * const char *s;
@@ -338,11 +351,6 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
338 * printk("String value: %s\n", s); 351 * printk("String value: %s\n", s);
339 */ 352 */
340const char *of_prop_next_string(struct property *prop, const char *cur); 353const char *of_prop_next_string(struct property *prop, const char *cur);
341#define of_property_for_each_string(np, propname, prop, s) \
342 for (prop = of_find_property(np, propname, NULL), \
343 s = of_prop_next_string(prop, NULL); \
344 s; \
345 s = of_prop_next_string(prop, s))
346 354
347int of_device_is_stdout_path(struct device_node *dn); 355int of_device_is_stdout_path(struct device_node *dn);
348 356
@@ -372,6 +380,9 @@ static inline bool of_have_populated_dt(void)
372#define for_each_child_of_node(parent, child) \ 380#define for_each_child_of_node(parent, child) \
373 while (0) 381 while (0)
374 382
383#define for_each_available_child_of_node(parent, child) \
384 while (0)
385
375static inline struct device_node *of_get_child_by_name( 386static inline struct device_node *of_get_child_by_name(
376 const struct device_node *node, 387 const struct device_node *node,
377 const char *name) 388 const char *name)
@@ -384,6 +395,11 @@ static inline int of_get_child_count(const struct device_node *np)
384 return 0; 395 return 0;
385} 396}
386 397
398static inline int of_get_available_child_count(const struct device_node *np)
399{
400 return 0;
401}
402
387static inline int of_device_is_compatible(const struct device_node *device, 403static inline int of_device_is_compatible(const struct device_node *device,
388 const char *name) 404 const char *name)
389{ 405{
@@ -497,6 +513,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
497 return -ENOSYS; 513 return -ENOSYS;
498} 514}
499 515
516static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
517 const char *list_name, int cells_count, int index,
518 struct of_phandle_args *out_args)
519{
520 return -ENOSYS;
521}
522
500static inline int of_count_phandle_with_args(struct device_node *np, 523static inline int of_count_phandle_with_args(struct device_node *np,
501 const char *list_name, 524 const char *list_name,
502 const char *cells_name) 525 const char *cells_name)
@@ -519,21 +542,26 @@ static inline int of_device_is_stdout_path(struct device_node *dn)
519 return 0; 542 return 0;
520} 543}
521 544
522#define of_match_ptr(_ptr) NULL 545static inline const __be32 *of_prop_next_u32(struct property *prop,
523#define of_match_node(_matches, _node) NULL 546 const __be32 *cur, u32 *pu)
524#define of_property_for_each_u32(np, propname, prop, p, u) \ 547{
525 while (0) 548 return NULL;
526#define of_property_for_each_string(np, propname, prop, s) \ 549}
527 while (0)
528#endif /* CONFIG_OF */
529 550
530#ifndef of_node_to_nid 551static inline const char *of_prop_next_string(struct property *prop,
531static inline int of_node_to_nid(struct device_node *np) 552 const char *cur)
532{ 553{
533 return numa_node_id(); 554 return NULL;
534} 555}
535 556
536#define of_node_to_nid of_node_to_nid 557#define of_match_ptr(_ptr) NULL
558#define of_match_node(_matches, _node) NULL
559#endif /* CONFIG_OF */
560
561#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
562extern int of_node_to_nid(struct device_node *np);
563#else
564static inline int of_node_to_nid(struct device_node *device) { return 0; }
537#endif 565#endif
538 566
539/** 567/**
@@ -573,6 +601,18 @@ static inline int of_property_read_u32(const struct device_node *np,
573 return of_property_read_u32_array(np, propname, out_value, 1); 601 return of_property_read_u32_array(np, propname, out_value, 1);
574} 602}
575 603
604#define of_property_for_each_u32(np, propname, prop, p, u) \
605 for (prop = of_find_property(np, propname, NULL), \
606 p = of_prop_next_u32(prop, NULL, &u); \
607 p; \
608 p = of_prop_next_u32(prop, p, &u))
609
610#define of_property_for_each_string(np, propname, prop, s) \
611 for (prop = of_find_property(np, propname, NULL), \
612 s = of_prop_next_string(prop, NULL); \
613 s; \
614 s = of_prop_next_string(prop, s))
615
576#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) 616#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
577extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 617extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
578extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 618extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 4c2e6f26432c..5f6ed6b182b8 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -34,6 +34,10 @@ static inline void of_pci_range_to_resource(struct of_pci_range *range,
34 res->name = np->full_name; 34 res->name = np->full_name;
35} 35}
36 36
37/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr);
40
37#ifdef CONFIG_OF_ADDRESS 41#ifdef CONFIG_OF_ADDRESS
38extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 42extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
39extern bool of_can_translate_address(struct device_node *dev); 43extern bool of_can_translate_address(struct device_node *dev);
@@ -52,10 +56,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
52extern const __be32 *of_get_address(struct device_node *dev, int index, 56extern const __be32 *of_get_address(struct device_node *dev, int index,
53 u64 *size, unsigned int *flags); 57 u64 *size, unsigned int *flags);
54 58
55#ifndef pci_address_to_pio 59extern unsigned long pci_address_to_pio(phys_addr_t addr);
56static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
57#define pci_address_to_pio pci_address_to_pio
58#endif
59 60
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 61extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 62 struct device_node *node);
@@ -63,13 +64,6 @@ extern struct of_pci_range *of_pci_range_parser_one(
63 struct of_pci_range_parser *parser, 64 struct of_pci_range_parser *parser,
64 struct of_pci_range *range); 65 struct of_pci_range *range);
65#else /* CONFIG_OF_ADDRESS */ 66#else /* CONFIG_OF_ADDRESS */
66#ifndef of_address_to_resource
67static inline int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r)
69{
70 return -EINVAL;
71}
72#endif
73static inline struct device_node *of_find_matching_node_by_address( 67static inline struct device_node *of_find_matching_node_by_address(
74 struct device_node *from, 68 struct device_node *from,
75 const struct of_device_id *matches, 69 const struct of_device_id *matches,
@@ -77,12 +71,7 @@ static inline struct device_node *of_find_matching_node_by_address(
77{ 71{
78 return NULL; 72 return NULL;
79} 73}
80#ifndef of_iomap 74
81static inline void __iomem *of_iomap(struct device_node *device, int index)
82{
83 return NULL;
84}
85#endif
86static inline const __be32 *of_get_address(struct device_node *dev, int index, 75static inline const __be32 *of_get_address(struct device_node *dev, int index,
87 u64 *size, unsigned int *flags) 76 u64 *size, unsigned int *flags)
88{ 77{
@@ -103,6 +92,22 @@ static inline struct of_pci_range *of_pci_range_parser_one(
103} 92}
104#endif /* CONFIG_OF_ADDRESS */ 93#endif /* CONFIG_OF_ADDRESS */
105 94
95#ifdef CONFIG_OF
96extern int of_address_to_resource(struct device_node *dev, int index,
97 struct resource *r);
98void __iomem *of_iomap(struct device_node *node, int index);
99#else
100static inline int of_address_to_resource(struct device_node *dev, int index,
101 struct resource *r)
102{
103 return -EINVAL;
104}
105
106static inline void __iomem *of_iomap(struct device_node *device, int index)
107{
108 return NULL;
109}
110#endif
106 111
107#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 112#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
108extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 113extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ed136ad698ce..0beaee9dac1f 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -90,35 +90,36 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
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 *const *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);
93extern int of_scan_flat_dt_by_path(const char *path,
94 int (*it)(unsigned long node, const char *name, int depth, void *data),
95 void *data);
93 96
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
95 int depth, void *data); 98 int depth, void *data);
96extern void early_init_dt_check_for_initrd(unsigned long node);
97extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 99extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
98 int depth, void *data); 100 int depth, void *data);
99extern void early_init_dt_add_memory_arch(u64 base, u64 size); 101extern void early_init_dt_add_memory_arch(u64 base, u64 size);
100extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
101extern u64 dt_mem_next_cell(int s, __be32 **cellp); 103extern u64 dt_mem_next_cell(int s, __be32 **cellp);
102 104
103/*
104 * If BLK_DEV_INITRD, the fdt early init code will call this function,
105 * to be provided by the arch code. start and end are specified as
106 * physical addresses.
107 */
108#ifdef CONFIG_BLK_DEV_INITRD
109extern void early_init_dt_setup_initrd_arch(unsigned long start,
110 unsigned long end);
111#endif
112
113/* Early flat tree scan hooks */ 105/* Early flat tree scan hooks */
114extern int early_init_dt_scan_root(unsigned long node, const char *uname, 106extern int early_init_dt_scan_root(unsigned long node, const char *uname,
115 int depth, void *data); 107 int depth, void *data);
116 108
109extern bool early_init_dt_scan(void *params);
110
111extern const char *of_flat_dt_get_machine_name(void);
112extern const void *of_flat_dt_match_machine(const void *default_match,
113 const void * (*get_next_compat)(const char * const**));
114
117/* Other Prototypes */ 115/* Other Prototypes */
118extern void unflatten_device_tree(void); 116extern void unflatten_device_tree(void);
117extern void unflatten_and_copy_device_tree(void);
119extern void early_init_devtree(void *); 118extern void early_init_devtree(void *);
120#else /* CONFIG_OF_FLATTREE */ 119#else /* CONFIG_OF_FLATTREE */
120static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
121static inline void unflatten_device_tree(void) {} 121static inline void unflatten_device_tree(void) {}
122static inline void unflatten_and_copy_device_tree(void) {}
122#endif /* CONFIG_OF_FLATTREE */ 123#endif /* CONFIG_OF_FLATTREE */
123 124
124#endif /* __ASSEMBLY__ */ 125#endif /* __ASSEMBLY__ */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index a83dc6f5008e..f14123a5a9df 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -19,6 +19,7 @@
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#include <linux/of.h>
22#include <linux/gpio/consumer.h>
22 23
23struct device_node; 24struct device_node;
24 25
@@ -47,7 +48,7 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
47 return container_of(gc, struct of_mm_gpio_chip, gc); 48 return container_of(gc, struct of_mm_gpio_chip, gc);
48} 49}
49 50
50extern int of_get_named_gpio_flags(struct device_node *np, 51extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
51 const char *list_name, int index, enum of_gpio_flags *flags); 52 const char *list_name, int index, enum of_gpio_flags *flags);
52 53
53extern int of_mm_gpiochip_add(struct device_node *np, 54extern int of_mm_gpiochip_add(struct device_node *np,
@@ -62,10 +63,10 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
62#else /* CONFIG_OF_GPIO */ 63#else /* CONFIG_OF_GPIO */
63 64
64/* Drivers may not strictly depend on the GPIO support, so let them link. */ 65/* Drivers may not strictly depend on the GPIO support, so let them link. */
65static inline int of_get_named_gpio_flags(struct device_node *np, 66static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
66 const char *list_name, int index, enum of_gpio_flags *flags) 67 const char *list_name, int index, enum of_gpio_flags *flags)
67{ 68{
68 return -ENOSYS; 69 return ERR_PTR(-ENOSYS);
69} 70}
70 71
71static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 72static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
@@ -80,6 +81,18 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
80 81
81#endif /* CONFIG_OF_GPIO */ 82#endif /* CONFIG_OF_GPIO */
82 83
84static inline int of_get_named_gpio_flags(struct device_node *np,
85 const char *list_name, int index, enum of_gpio_flags *flags)
86{
87 struct gpio_desc *desc;
88 desc = of_get_named_gpiod_flags(np, list_name, index, flags);
89
90 if (IS_ERR(desc))
91 return PTR_ERR(desc);
92 else
93 return desc_to_gpio(desc);
94}
95
83/** 96/**
84 * of_gpio_named_count() - Count GPIOs for a device 97 * of_gpio_named_count() - Count GPIOs for a device
85 * @np: device node to count GPIOs for 98 * @np: device node to count GPIOs for
@@ -117,15 +130,21 @@ static inline int of_gpio_count(struct device_node *np)
117} 130}
118 131
119/** 132/**
120 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API 133 * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API
121 * @np: device node to get GPIO from 134 * @np: device node to get GPIO from
122 * @index: index of the GPIO 135 * @index: index of the GPIO
123 * @flags: a flags pointer to fill in 136 * @flags: a flags pointer to fill in
124 * 137 *
125 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno 138 * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno
126 * value on the error condition. If @flags is not NULL the function also fills 139 * value on the error condition. If @flags is not NULL the function also fills
127 * in flags for the GPIO. 140 * in flags for the GPIO.
128 */ 141 */
142static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np,
143 int index, enum of_gpio_flags *flags)
144{
145 return of_get_named_gpiod_flags(np, "gpios", index, flags);
146}
147
129static inline int of_get_gpio_flags(struct device_node *np, int index, 148static inline int of_get_gpio_flags(struct device_node *np, int index,
130 enum of_gpio_flags *flags) 149 enum of_gpio_flags *flags)
131{ 150{
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 535cecf1e02f..3f23b4472c31 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -1,8 +1,6 @@
1#ifndef __OF_IRQ_H 1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H 2#define __OF_IRQ_H
3 3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/errno.h> 5#include <linux/errno.h>
8#include <linux/irq.h> 6#include <linux/irq.h>
@@ -10,30 +8,6 @@ struct of_irq;
10#include <linux/ioport.h> 8#include <linux/ioport.h>
11#include <linux/of.h> 9#include <linux/of.h>
12 10
13/*
14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */
18extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
19
20#if defined(CONFIG_OF_IRQ)
21/**
22 * of_irq - container for device_node/irq_specifier pair for an irq controller
23 * @controller: pointer to interrupt controller device tree node
24 * @size: size of interrupt specifier
25 * @specifier: array of cells @size long specifing the specific interrupt
26 *
27 * This structure is returned when an interrupt is mapped. The controller
28 * field needs to be put() after use
29 */
30#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
31struct of_irq {
32 struct device_node *controller; /* Interrupt controller node */
33 u32 size; /* Specifier size */
34 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
35};
36
37typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); 11typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
38 12
39/* 13/*
@@ -45,37 +19,46 @@ typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
45#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 19#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
46extern unsigned int of_irq_workarounds; 20extern unsigned int of_irq_workarounds;
47extern struct device_node *of_irq_dflt_pic; 21extern struct device_node *of_irq_dflt_pic;
48extern int of_irq_map_oldworld(struct device_node *device, int index, 22extern int of_irq_parse_oldworld(struct device_node *device, int index,
49 struct of_irq *out_irq); 23 struct of_phandle_args *out_irq);
50#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 24#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
51#define of_irq_workarounds (0) 25#define of_irq_workarounds (0)
52#define of_irq_dflt_pic (NULL) 26#define of_irq_dflt_pic (NULL)
53static inline int of_irq_map_oldworld(struct device_node *device, int index, 27static inline int of_irq_parse_oldworld(struct device_node *device, int index,
54 struct of_irq *out_irq) 28 struct of_phandle_args *out_irq)
55{ 29{
56 return -EINVAL; 30 return -EINVAL;
57} 31}
58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 32#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
59 33
60 34extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
61extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 35extern int of_irq_parse_one(struct device_node *device, int index,
62 u32 ointsize, const __be32 *addr, 36 struct of_phandle_args *out_irq);
63 struct of_irq *out_irq); 37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
64extern int of_irq_map_one(struct device_node *device, int index,
65 struct of_irq *out_irq);
66extern unsigned int irq_create_of_mapping(struct device_node *controller,
67 const u32 *intspec,
68 unsigned int intsize);
69extern int of_irq_to_resource(struct device_node *dev, int index, 38extern int of_irq_to_resource(struct device_node *dev, int index,
70 struct resource *r); 39 struct resource *r);
71extern int of_irq_count(struct device_node *dev);
72extern int of_irq_to_resource_table(struct device_node *dev, 40extern int of_irq_to_resource_table(struct device_node *dev,
73 struct resource *res, int nr_irqs); 41 struct resource *res, int nr_irqs);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
75 42
76extern void of_irq_init(const struct of_device_id *matches); 43extern void of_irq_init(const struct of_device_id *matches);
77 44
78#endif /* CONFIG_OF_IRQ */ 45#ifdef CONFIG_OF_IRQ
46extern int of_irq_count(struct device_node *dev);
47#else
48static inline int of_irq_count(struct device_node *dev)
49{
50 return 0;
51}
52#endif
53
54#if defined(CONFIG_OF)
55/*
56 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
57 * implements it differently. However, the prototype is the same for all,
58 * so declare it here regardless of the CONFIG_OF_IRQ setting.
59 */
60extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
61extern struct device_node *of_irq_find_parent(struct device_node *child);
79 62
80#else /* !CONFIG_OF */ 63#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev, 64static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
index ed7f267e6389..6f10e938ff7e 100644
--- a/include/linux/of_mtd.h
+++ b/include/linux/of_mtd.h
@@ -10,10 +10,29 @@
10#define __LINUX_OF_NET_H 10#define __LINUX_OF_NET_H
11 11
12#ifdef CONFIG_OF_MTD 12#ifdef CONFIG_OF_MTD
13
13#include <linux/of.h> 14#include <linux/of.h>
14int of_get_nand_ecc_mode(struct device_node *np); 15int of_get_nand_ecc_mode(struct device_node *np);
15int of_get_nand_bus_width(struct device_node *np); 16int of_get_nand_bus_width(struct device_node *np);
16bool of_get_nand_on_flash_bbt(struct device_node *np); 17bool of_get_nand_on_flash_bbt(struct device_node *np);
17#endif 18
19#else /* CONFIG_OF_MTD */
20
21static inline int of_get_nand_ecc_mode(struct device_node *np)
22{
23 return -ENOSYS;
24}
25
26static inline int of_get_nand_bus_width(struct device_node *np)
27{
28 return -ENOSYS;
29}
30
31static inline bool of_get_nand_on_flash_bbt(struct device_node *np)
32{
33 return false;
34}
35
36#endif /* CONFIG_OF_MTD */
18 37
19#endif /* __LINUX_OF_MTD_H */ 38#endif /* __LINUX_OF_MTD_H */
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 61bf53b02779..34597c8c1a4c 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,10 +9,10 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np); 12extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
14#else 14#else
15static inline const int of_get_phy_mode(struct device_node *np) 15static inline int of_get_phy_mode(struct device_node *np)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 7a04826018c0..1a1f5ffd5288 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -2,10 +2,12 @@
2#define __OF_PCI_H 2#define __OF_PCI_H
3 3
4#include <linux/pci.h> 4#include <linux/pci.h>
5#include <linux/msi.h>
5 6
6struct pci_dev; 7struct pci_dev;
7struct of_irq; 8struct of_phandle_args;
8int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 9int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
10int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
9 11
10struct device_node; 12struct device_node;
11struct device_node *of_pci_find_child_device(struct device_node *parent, 13struct device_node *of_pci_find_child_device(struct device_node *parent,
@@ -13,4 +15,15 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
13int of_pci_get_devfn(struct device_node *np); 15int of_pci_get_devfn(struct device_node *np);
14int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 16int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
15 17
18#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
19int of_pci_msi_chip_add(struct msi_chip *chip);
20void of_pci_msi_chip_remove(struct msi_chip *chip);
21struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node);
22#else
23static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; }
24static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { }
25static inline struct msi_chip *
26of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
27#endif
28
16#endif 29#endif
diff --git a/include/linux/oom.h b/include/linux/oom.h
index da60007075b5..4cd62677feb9 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -82,6 +82,11 @@ static inline void oom_killer_enable(void)
82 oom_killer_disabled = false; 82 oom_killer_disabled = false;
83} 83}
84 84
85static inline bool oom_gfp_allowed(gfp_t gfp_mask)
86{
87 return (gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY);
88}
89
85extern struct task_struct *find_lock_task_mm(struct task_struct *p); 90extern struct task_struct *find_lock_task_mm(struct task_struct *p);
86 91
87/* sysctls */ 92/* sysctls */
diff --git a/include/linux/opp.h b/include/linux/opp.h
deleted file mode 100644
index 3aca2b8def33..000000000000
--- a/include/linux/opp.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Generic OPP Interface
3 *
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
5 * Nishanth Menon
6 * Romit Dasgupta
7 * Kevin Hilman
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __LINUX_OPP_H__
15#define __LINUX_OPP_H__
16
17#include <linux/err.h>
18#include <linux/cpufreq.h>
19#include <linux/notifier.h>
20
21struct opp;
22struct device;
23
24enum opp_event {
25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26};
27
28#if defined(CONFIG_PM_OPP)
29
30unsigned long opp_get_voltage(struct opp *opp);
31
32unsigned long opp_get_freq(struct opp *opp);
33
34int opp_get_opp_count(struct device *dev);
35
36struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq,
37 bool available);
38
39struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq);
40
41struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq);
42
43int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt);
44
45int opp_enable(struct device *dev, unsigned long freq);
46
47int opp_disable(struct device *dev, unsigned long freq);
48
49struct srcu_notifier_head *opp_get_notifier(struct device *dev);
50#else
51static inline unsigned long opp_get_voltage(struct opp *opp)
52{
53 return 0;
54}
55
56static inline unsigned long opp_get_freq(struct opp *opp)
57{
58 return 0;
59}
60
61static inline int opp_get_opp_count(struct device *dev)
62{
63 return 0;
64}
65
66static inline struct opp *opp_find_freq_exact(struct device *dev,
67 unsigned long freq, bool available)
68{
69 return ERR_PTR(-EINVAL);
70}
71
72static inline struct opp *opp_find_freq_floor(struct device *dev,
73 unsigned long *freq)
74{
75 return ERR_PTR(-EINVAL);
76}
77
78static inline struct opp *opp_find_freq_ceil(struct device *dev,
79 unsigned long *freq)
80{
81 return ERR_PTR(-EINVAL);
82}
83
84static inline int opp_add(struct device *dev, unsigned long freq,
85 unsigned long u_volt)
86{
87 return -EINVAL;
88}
89
90static inline int opp_enable(struct device *dev, unsigned long freq)
91{
92 return 0;
93}
94
95static inline int opp_disable(struct device *dev, unsigned long freq)
96{
97 return 0;
98}
99
100static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev)
101{
102 return ERR_PTR(-EINVAL);
103}
104#endif /* CONFIG_PM_OPP */
105
106#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
107int of_init_opp_table(struct device *dev);
108#else
109static inline int of_init_opp_table(struct device *dev)
110{
111 return -EINVAL;
112}
113#endif
114
115#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
116int opp_init_cpufreq_table(struct device *dev,
117 struct cpufreq_frequency_table **table);
118void opp_free_cpufreq_table(struct device *dev,
119 struct cpufreq_frequency_table **table);
120#else
121static inline int opp_init_cpufreq_table(struct device *dev,
122 struct cpufreq_frequency_table **table)
123{
124 return -EINVAL;
125}
126
127static inline
128void opp_free_cpufreq_table(struct device *dev,
129 struct cpufreq_frequency_table **table)
130{
131}
132#endif /* CONFIG_CPU_FREQ */
133
134#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 86292beebfe2..438694650471 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -129,10 +129,9 @@ struct parallel_data {
129 struct padata_serial_queue __percpu *squeue; 129 struct padata_serial_queue __percpu *squeue;
130 atomic_t reorder_objects; 130 atomic_t reorder_objects;
131 atomic_t refcnt; 131 atomic_t refcnt;
132 atomic_t seq_nr;
132 struct padata_cpumask cpumask; 133 struct padata_cpumask cpumask;
133 spinlock_t lock ____cacheline_aligned; 134 spinlock_t lock ____cacheline_aligned;
134 spinlock_t seq_lock;
135 unsigned int seq_nr;
136 unsigned int processed; 135 unsigned int processed;
137 struct timer_list timer; 136 struct timer_list timer;
138}; 137};
diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
index 93506a114034..da523661500a 100644
--- a/include/linux/page-flags-layout.h
+++ b/include/linux/page-flags-layout.h
@@ -38,10 +38,10 @@
38 * The last is when there is insufficient space in page->flags and a separate 38 * The last is when there is insufficient space in page->flags and a separate
39 * lookup is necessary. 39 * lookup is necessary.
40 * 40 *
41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS | 41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
42 * " plus space for last_nid: | NODE | ZONE | LAST_NID ... | FLAGS | 42 * " plus space for last_cpupid: | NODE | ZONE | LAST_CPUPID ... | FLAGS |
43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS | 43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
44 * " plus space for last_nid: | SECTION | NODE | ZONE | LAST_NID ... | FLAGS | 44 * " plus space for last_cpupid: | SECTION | NODE | ZONE | LAST_CPUPID ... | FLAGS |
45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS | 45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
46 */ 46 */
47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
@@ -62,15 +62,21 @@
62#endif 62#endif
63 63
64#ifdef CONFIG_NUMA_BALANCING 64#ifdef CONFIG_NUMA_BALANCING
65#define LAST_NID_SHIFT NODES_SHIFT 65#define LAST__PID_SHIFT 8
66#define LAST__PID_MASK ((1 << LAST__PID_SHIFT)-1)
67
68#define LAST__CPU_SHIFT NR_CPUS_BITS
69#define LAST__CPU_MASK ((1 << LAST__CPU_SHIFT)-1)
70
71#define LAST_CPUPID_SHIFT (LAST__PID_SHIFT+LAST__CPU_SHIFT)
66#else 72#else
67#define LAST_NID_SHIFT 0 73#define LAST_CPUPID_SHIFT 0
68#endif 74#endif
69 75
70#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_NID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS 76#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
71#define LAST_NID_WIDTH LAST_NID_SHIFT 77#define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT
72#else 78#else
73#define LAST_NID_WIDTH 0 79#define LAST_CPUPID_WIDTH 0
74#endif 80#endif
75 81
76/* 82/*
@@ -81,8 +87,8 @@
81#define NODE_NOT_IN_PAGE_FLAGS 87#define NODE_NOT_IN_PAGE_FLAGS
82#endif 88#endif
83 89
84#if defined(CONFIG_NUMA_BALANCING) && LAST_NID_WIDTH == 0 90#if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0
85#define LAST_NID_NOT_IN_PAGE_FLAGS 91#define LAST_CPUPID_NOT_IN_PAGE_FLAGS
86#endif 92#endif
87 93
88#endif /* _LINUX_PAGE_FLAGS_LAYOUT */ 94#endif /* _LINUX_PAGE_FLAGS_LAYOUT */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6d53675c2b54..98ada58f9942 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -329,7 +329,9 @@ static inline void set_page_writeback(struct page *page)
329 * System with lots of page flags available. This allows separate 329 * System with lots of page flags available. This allows separate
330 * flags for PageHead() and PageTail() checks of compound pages so that bit 330 * flags for PageHead() and PageTail() checks of compound pages so that bit
331 * tests can be used in performance sensitive paths. PageCompound is 331 * tests can be used in performance sensitive paths. PageCompound is
332 * generally not used in hot code paths. 332 * generally not used in hot code paths except arch/powerpc/mm/init_64.c
333 * and arch/powerpc/kvm/book3s_64_vio_hv.c which use it to detect huge pages
334 * and avoid handling those in real mode.
333 */ 335 */
334__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head) 336__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
335__PAGEFLAG(Tail, tail) 337__PAGEFLAG(Tail, tail)
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index d006f0ca60f4..5a462c4e5009 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -27,7 +27,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
27 while (!pci_is_root_bus(pbus)) 27 while (!pci_is_root_bus(pbus))
28 pbus = pbus->parent; 28 pbus = pbus->parent;
29 29
30 return DEVICE_ACPI_HANDLE(pbus->bridge); 30 return ACPI_HANDLE(pbus->bridge);
31} 31}
32 32
33static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 33static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
@@ -39,7 +39,7 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
39 else 39 else
40 dev = &pbus->self->dev; 40 dev = &pbus->self->dev;
41 41
42 return DEVICE_ACPI_HANDLE(dev); 42 return ACPI_HANDLE(dev);
43} 43}
44 44
45void acpi_pci_add_bus(struct pci_bus *bus); 45void acpi_pci_add_bus(struct pci_bus *bus);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 20888589c09e..a13d6825e586 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -32,7 +32,6 @@
32#include <linux/irqreturn.h> 32#include <linux/irqreturn.h>
33#include <uapi/linux/pci.h> 33#include <uapi/linux/pci.h>
34 34
35/* Include the ID list */
36#include <linux/pci_ids.h> 35#include <linux/pci_ids.h>
37 36
38/* 37/*
@@ -42,9 +41,10 @@
42 * 41 *
43 * 7:3 = slot 42 * 7:3 = slot
44 * 2:0 = function 43 * 2:0 = function
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h 44 *
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined in uapi/linux/pci.h.
46 * In the interest of not exposing interfaces to user-space unnecessarily, 46 * In the interest of not exposing interfaces to user-space unnecessarily,
47 * the following kernel only defines are being added here. 47 * the following kernel-only defines are being added here.
48 */ 48 */
49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn)
50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
@@ -153,10 +153,10 @@ enum pcie_reset_state {
153 /* Reset is NOT asserted (Use to deassert reset) */ 153 /* Reset is NOT asserted (Use to deassert reset) */
154 pcie_deassert_reset = (__force pcie_reset_state_t) 1, 154 pcie_deassert_reset = (__force pcie_reset_state_t) 1,
155 155
156 /* Use #PERST to reset PCI-E device */ 156 /* Use #PERST to reset PCIe device */
157 pcie_warm_reset = (__force pcie_reset_state_t) 2, 157 pcie_warm_reset = (__force pcie_reset_state_t) 2,
158 158
159 /* Use PCI-E Hot Reset to reset device */ 159 /* Use PCIe Hot Reset to reset device */
160 pcie_hot_reset = (__force pcie_reset_state_t) 3 160 pcie_hot_reset = (__force pcie_reset_state_t) 3
161}; 161};
162 162
@@ -259,13 +259,13 @@ struct pci_dev {
259 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 259 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
260 u8 revision; /* PCI revision, low byte of class word */ 260 u8 revision; /* PCI revision, low byte of class word */
261 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 261 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
262 u8 pcie_cap; /* PCI-E capability offset */ 262 u8 pcie_cap; /* PCIe capability offset */
263 u8 msi_cap; /* MSI capability offset */ 263 u8 msi_cap; /* MSI capability offset */
264 u8 msix_cap; /* MSI-X capability offset */ 264 u8 msix_cap; /* MSI-X capability offset */
265 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 265 u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */
266 u8 rom_base_reg; /* which config register controls the ROM */ 266 u8 rom_base_reg; /* which config register controls the ROM */
267 u8 pin; /* which interrupt pin this device uses */ 267 u8 pin; /* which interrupt pin this device uses */
268 u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ 268 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
269 269
270 struct pci_driver *driver; /* which driver has allocated this device */ 270 struct pci_driver *driver; /* which driver has allocated this device */
271 u64 dma_mask; /* Mask of the bits of bus address this 271 u64 dma_mask; /* Mask of the bits of bus address this
@@ -300,7 +300,7 @@ struct pci_dev {
300 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 300 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
301 301
302#ifdef CONFIG_PCIEASPM 302#ifdef CONFIG_PCIEASPM
303 struct pcie_link_state *link_state; /* ASPM link state. */ 303 struct pcie_link_state *link_state; /* ASPM link state */
304#endif 304#endif
305 305
306 pci_channel_state_t error_state; /* current connectivity state */ 306 pci_channel_state_t error_state; /* current connectivity state */
@@ -317,7 +317,7 @@ struct pci_dev {
317 317
318 bool match_driver; /* Skip attaching driver */ 318 bool match_driver; /* Skip attaching driver */
319 /* These fields are used by common fixups */ 319 /* These fields are used by common fixups */
320 unsigned int transparent:1; /* Transparent PCI bridge */ 320 unsigned int transparent:1; /* Subtractive decode PCI bridge */
321 unsigned int multifunction:1;/* Part of multi-function device */ 321 unsigned int multifunction:1;/* Part of multi-function device */
322 /* keep track of device state */ 322 /* keep track of device state */
323 unsigned int is_added:1; 323 unsigned int is_added:1;
@@ -326,12 +326,10 @@ struct pci_dev {
326 unsigned int block_cfg_access:1; /* config space access is blocked */ 326 unsigned int block_cfg_access:1; /* config space access is blocked */
327 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 327 unsigned int broken_parity_status:1; /* Device generates false positive parity */
328 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 328 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
329 unsigned int msi_enabled:1; 329 unsigned int msi_enabled:1;
330 unsigned int msix_enabled:1; 330 unsigned int msix_enabled:1;
331 unsigned int ari_enabled:1; /* ARI forwarding */ 331 unsigned int ari_enabled:1; /* ARI forwarding */
332 unsigned int is_managed:1; 332 unsigned int is_managed:1;
333 unsigned int is_pcie:1; /* Obsolete. Will be removed.
334 Use pci_is_pcie() instead */
335 unsigned int needs_freset:1; /* Dev requires fundamental reset */ 333 unsigned int needs_freset:1; /* Dev requires fundamental reset */
336 unsigned int state_saved:1; 334 unsigned int state_saved:1;
337 unsigned int is_physfn:1; 335 unsigned int is_physfn:1;
@@ -373,7 +371,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
373 if (dev->is_virtfn) 371 if (dev->is_virtfn)
374 dev = dev->physfn; 372 dev = dev->physfn;
375#endif 373#endif
376
377 return dev; 374 return dev;
378} 375}
379 376
@@ -446,6 +443,7 @@ struct pci_bus {
446 struct resource busn_res; /* bus numbers routed to this bus */ 443 struct resource busn_res; /* bus numbers routed to this bus */
447 444
448 struct pci_ops *ops; /* configuration access functions */ 445 struct pci_ops *ops; /* configuration access functions */
446 struct msi_chip *msi; /* MSI controller */
449 void *sysdata; /* hook for sys-specific extension */ 447 void *sysdata; /* hook for sys-specific extension */
450 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ 448 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
451 449
@@ -457,7 +455,7 @@ struct pci_bus {
457 char name[48]; 455 char name[48];
458 456
459 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 457 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
460 pci_bus_flags_t bus_flags; /* Inherited by child busses */ 458 pci_bus_flags_t bus_flags; /* inherited by child buses */
461 struct device *bridge; 459 struct device *bridge;
462 struct device dev; 460 struct device dev;
463 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 461 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
@@ -469,14 +467,27 @@ struct pci_bus {
469#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 467#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
470 468
471/* 469/*
472 * Returns true if the pci bus is root (behind host-pci bridge), 470 * Returns true if the PCI bus is root (behind host-PCI bridge),
473 * false otherwise 471 * false otherwise
472 *
473 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
474 * This is incorrect because "virtual" buses added for SR-IOV (via
475 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses.
474 */ 476 */
475static inline bool pci_is_root_bus(struct pci_bus *pbus) 477static inline bool pci_is_root_bus(struct pci_bus *pbus)
476{ 478{
477 return !(pbus->parent); 479 return !(pbus->parent);
478} 480}
479 481
482static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
483{
484 dev = pci_physfn(dev);
485 if (pci_is_root_bus(dev->bus))
486 return NULL;
487
488 return dev->bus->self;
489}
490
480#ifdef CONFIG_PCI_MSI 491#ifdef CONFIG_PCI_MSI
481static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 492static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
482{ 493{
@@ -498,7 +509,7 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false;
498#define PCIBIOS_BUFFER_TOO_SMALL 0x89 509#define PCIBIOS_BUFFER_TOO_SMALL 0x89
499 510
500/* 511/*
501 * Translate above to generic errno for passing back through non-pci. 512 * Translate above to generic errno for passing back through non-PCI code.
502 */ 513 */
503static inline int pcibios_err_to_errno(int err) 514static inline int pcibios_err_to_errno(int err)
504{ 515{
@@ -549,11 +560,12 @@ struct pci_dynids {
549 struct list_head list; /* for IDs added at runtime */ 560 struct list_head list; /* for IDs added at runtime */
550}; 561};
551 562
552/* ---------------------------------------------------------------- */ 563
553/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides 564/*
554 * a set of callbacks in struct pci_error_handlers, then that device driver 565 * PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
555 * will be notified of PCI bus errors, and will be driven to recovery 566 * a set of callbacks in struct pci_error_handlers, that device driver
556 * when an error occurs. 567 * will be notified of PCI bus errors, and will be driven to recovery
568 * when an error occurs.
557 */ 569 */
558 570
559typedef unsigned int __bitwise pci_ers_result_t; 571typedef unsigned int __bitwise pci_ers_result_t;
@@ -597,7 +609,6 @@ struct pci_error_handlers {
597 void (*resume)(struct pci_dev *dev); 609 void (*resume)(struct pci_dev *dev);
598}; 610};
599 611
600/* ---------------------------------------------------------------- */
601 612
602struct module; 613struct module;
603struct pci_driver { 614struct pci_driver {
@@ -701,10 +712,10 @@ extern enum pcie_bus_config_types pcie_bus_config;
701 712
702extern struct bus_type pci_bus_type; 713extern struct bus_type pci_bus_type;
703 714
704/* Do NOT directly access these two variables, unless you are arch specific pci 715/* Do NOT directly access these two variables, unless you are arch-specific PCI
705 * code, or pci core code. */ 716 * code, or PCI core code. */
706extern struct list_head pci_root_buses; /* list of all known PCI buses */ 717extern struct list_head pci_root_buses; /* list of all known PCI buses */
707/* Some device drivers need know if pci is initiated */ 718/* Some device drivers need know if PCI is initiated */
708int no_pci_devices(void); 719int no_pci_devices(void);
709 720
710void pcibios_resource_survey_bus(struct pci_bus *bus); 721void pcibios_resource_survey_bus(struct pci_bus *bus);
@@ -712,7 +723,7 @@ void pcibios_add_bus(struct pci_bus *bus);
712void pcibios_remove_bus(struct pci_bus *bus); 723void pcibios_remove_bus(struct pci_bus *bus);
713void pcibios_fixup_bus(struct pci_bus *); 724void pcibios_fixup_bus(struct pci_bus *);
714int __must_check pcibios_enable_device(struct pci_dev *, int mask); 725int __must_check pcibios_enable_device(struct pci_dev *, int mask);
715/* Architecture specific versions may override this (weak) */ 726/* Architecture-specific versions may override this (weak) */
716char *pcibios_setup(char *str); 727char *pcibios_setup(char *str);
717 728
718/* Used only when drivers/pci/setup.c is used */ 729/* Used only when drivers/pci/setup.c is used */
@@ -949,6 +960,7 @@ void pci_update_resource(struct pci_dev *dev, int resno);
949int __must_check pci_assign_resource(struct pci_dev *dev, int i); 960int __must_check pci_assign_resource(struct pci_dev *dev, int i);
950int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 961int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
951int pci_select_bars(struct pci_dev *dev, unsigned long flags); 962int pci_select_bars(struct pci_dev *dev, unsigned long flags);
963bool pci_device_is_present(struct pci_dev *pdev);
952 964
953/* ROM control related routines */ 965/* ROM control related routines */
954int pci_enable_rom(struct pci_dev *pdev); 966int pci_enable_rom(struct pci_dev *pdev);
@@ -1246,7 +1258,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
1246 1258
1247/* 1259/*
1248 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1260 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
1249 * a PCI domain is defined to be a set of PCI busses which share 1261 * a PCI domain is defined to be a set of PCI buses which share
1250 * configuration space. 1262 * configuration space.
1251 */ 1263 */
1252#ifdef CONFIG_PCI_DOMAINS 1264#ifdef CONFIG_PCI_DOMAINS
@@ -1556,65 +1568,65 @@ enum pci_fixup_pass {
1556/* Anonymous variables would be nice... */ 1568/* Anonymous variables would be nice... */
1557#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1569#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1558 class_shift, hook) \ 1570 class_shift, hook) \
1559 static const struct pci_fixup __pci_fixup_##name __used \ 1571 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \
1560 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1572 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1561 = { vendor, device, class, class_shift, hook }; 1573 = { vendor, device, class, class_shift, hook };
1562 1574
1563#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ 1575#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
1564 class_shift, hook) \ 1576 class_shift, hook) \
1565 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1577 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1566 vendor##device##hook, vendor, device, class, class_shift, hook) 1578 hook, vendor, device, class, class_shift, hook)
1567#define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ 1579#define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \
1568 class_shift, hook) \ 1580 class_shift, hook) \
1569 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1581 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1570 vendor##device##hook, vendor, device, class, class_shift, hook) 1582 hook, vendor, device, class, class_shift, hook)
1571#define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ 1583#define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \
1572 class_shift, hook) \ 1584 class_shift, hook) \
1573 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1585 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1574 vendor##device##hook, vendor, device, class, class_shift, hook) 1586 hook, vendor, device, class, class_shift, hook)
1575#define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ 1587#define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \
1576 class_shift, hook) \ 1588 class_shift, hook) \
1577 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1589 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1578 vendor##device##hook, vendor, device, class, class_shift, hook) 1590 hook, vendor, device, class, class_shift, hook)
1579#define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ 1591#define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \
1580 class_shift, hook) \ 1592 class_shift, hook) \
1581 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1593 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1582 resume##vendor##device##hook, vendor, device, class, \ 1594 resume##hook, vendor, device, class, \
1583 class_shift, hook) 1595 class_shift, hook)
1584#define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ 1596#define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \
1585 class_shift, hook) \ 1597 class_shift, hook) \
1586 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1598 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1587 resume_early##vendor##device##hook, vendor, device, \ 1599 resume_early##hook, vendor, device, \
1588 class, class_shift, hook) 1600 class, class_shift, hook)
1589#define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ 1601#define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \
1590 class_shift, hook) \ 1602 class_shift, hook) \
1591 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1603 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1592 suspend##vendor##device##hook, vendor, device, class, \ 1604 suspend##hook, vendor, device, class, \
1593 class_shift, hook) 1605 class_shift, hook)
1594 1606
1595#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1607#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1596 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1608 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1597 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1609 hook, vendor, device, PCI_ANY_ID, 0, hook)
1598#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1610#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \
1599 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1611 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1600 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1612 hook, vendor, device, PCI_ANY_ID, 0, hook)
1601#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1613#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
1602 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1614 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1603 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1615 hook, vendor, device, PCI_ANY_ID, 0, hook)
1604#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1616#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
1605 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1617 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1606 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) 1618 hook, vendor, device, PCI_ANY_ID, 0, hook)
1607#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1619#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1608 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1620 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1609 resume##vendor##device##hook, vendor, device, \ 1621 resume##hook, vendor, device, \
1610 PCI_ANY_ID, 0, hook) 1622 PCI_ANY_ID, 0, hook)
1611#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1623#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1612 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1624 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1613 resume_early##vendor##device##hook, vendor, device, \ 1625 resume_early##hook, vendor, device, \
1614 PCI_ANY_ID, 0, hook) 1626 PCI_ANY_ID, 0, hook)
1615#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1627#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1616 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1628 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1617 suspend##vendor##device##hook, vendor, device, \ 1629 suspend##hook, vendor, device, \
1618 PCI_ANY_ID, 0, hook) 1630 PCI_ANY_ID, 0, hook)
1619 1631
1620#ifdef CONFIG_PCI_QUIRKS 1632#ifdef CONFIG_PCI_QUIRKS
@@ -1660,7 +1672,7 @@ extern u8 pci_cache_line_size;
1660extern unsigned long pci_hotplug_io_size; 1672extern unsigned long pci_hotplug_io_size;
1661extern unsigned long pci_hotplug_mem_size; 1673extern unsigned long pci_hotplug_mem_size;
1662 1674
1663/* Architecture specific versions may override these (weak) */ 1675/* Architecture-specific versions may override these (weak) */
1664int pcibios_add_platform_entries(struct pci_dev *dev); 1676int pcibios_add_platform_entries(struct pci_dev *dev);
1665void pcibios_disable_device(struct pci_dev *dev); 1677void pcibios_disable_device(struct pci_dev *dev);
1666void pcibios_set_master(struct pci_dev *dev); 1678void pcibios_set_master(struct pci_dev *dev);
@@ -1748,11 +1760,11 @@ static inline int pci_pcie_cap(struct pci_dev *dev)
1748 * pci_is_pcie - check if the PCI device is PCI Express capable 1760 * pci_is_pcie - check if the PCI device is PCI Express capable
1749 * @dev: PCI device 1761 * @dev: PCI device
1750 * 1762 *
1751 * Retrun true if the PCI device is PCI Express capable, false otherwise. 1763 * Returns: true if the PCI device is PCI Express capable, false otherwise.
1752 */ 1764 */
1753static inline bool pci_is_pcie(struct pci_dev *dev) 1765static inline bool pci_is_pcie(struct pci_dev *dev)
1754{ 1766{
1755 return !!pci_pcie_cap(dev); 1767 return pci_pcie_cap(dev);
1756} 1768}
1757 1769
1758/** 1770/**
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 430dd963707b..a2e2f1d17e16 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -39,8 +39,8 @@
39 * @hardware_test: Called to run a specified hardware test on the specified 39 * @hardware_test: Called to run a specified hardware test on the specified
40 * slot. 40 * slot.
41 * @get_power_status: Called to get the current power status of a slot. 41 * @get_power_status: Called to get the current power status of a slot.
42 * If this field is NULL, the value passed in the struct hotplug_slot_info 42 * If this field is NULL, the value passed in the struct hotplug_slot_info
43 * will be used when this value is requested by a user. 43 * will be used when this value is requested by a user.
44 * @get_attention_status: Called to get the current attention status of a slot. 44 * @get_attention_status: Called to get the current attention status of a slot.
45 * If this field is NULL, the value passed in the struct hotplug_slot_info 45 * If this field is NULL, the value passed in the struct hotplug_slot_info
46 * will be used when this value is requested by a user. 46 * will be used when this value is requested by a user.
@@ -191,4 +191,3 @@ static inline int pci_get_hp_params(struct pci_dev *dev,
191 191
192void pci_configure_slot(struct pci_dev *dev); 192void pci_configure_slot(struct pci_dev *dev);
193#endif 193#endif
194
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index bc95b2b391bf..97fbecdd7a40 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -758,6 +758,7 @@
758#define PCI_DEVICE_ID_HP_CISSE 0x323a 758#define PCI_DEVICE_ID_HP_CISSE 0x323a
759#define PCI_DEVICE_ID_HP_CISSF 0x323b 759#define PCI_DEVICE_ID_HP_CISSF 0x323b
760#define PCI_DEVICE_ID_HP_CISSH 0x323c 760#define PCI_DEVICE_ID_HP_CISSH 0x323c
761#define PCI_DEVICE_ID_HP_CISSI 0x3239
761#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 762#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
762 763
763#define PCI_VENDOR_ID_PCTECH 0x1042 764#define PCI_VENDOR_ID_PCTECH 0x1042
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 9572669eea97..4f1089f2cc98 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -23,7 +23,7 @@
23#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) 23#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
24 24
25struct pcie_device { 25struct pcie_device {
26 int irq; /* Service IRQ/MSI/MSI-X Vector */ 26 int irq; /* Service IRQ/MSI/MSI-X Vector */
27 struct pci_dev *port; /* Root/Upstream/Downstream Port */ 27 struct pci_dev *port; /* Root/Upstream/Downstream Port */
28 u32 service; /* Port service this device represents */ 28 u32 service; /* Port service this device represents */
29 void *priv_data; /* Service Private Data */ 29 void *priv_data; /* Service Private Data */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cc88172c7d9a..9e4761caa80c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -332,7 +332,7 @@ do { \
332#endif 332#endif
333 333
334#ifndef this_cpu_sub 334#ifndef this_cpu_sub
335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) 335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
336#endif 336#endif
337 337
338#ifndef this_cpu_inc 338#ifndef this_cpu_inc
@@ -375,22 +375,6 @@ do { \
375# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) 375# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
376#endif 376#endif
377 377
378#ifndef this_cpu_xor
379# ifndef this_cpu_xor_1
380# define this_cpu_xor_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
381# endif
382# ifndef this_cpu_xor_2
383# define this_cpu_xor_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
384# endif
385# ifndef this_cpu_xor_4
386# define this_cpu_xor_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
387# endif
388# ifndef this_cpu_xor_8
389# define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
390# endif
391# define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
392#endif
393
394#define _this_cpu_generic_add_return(pcp, val) \ 378#define _this_cpu_generic_add_return(pcp, val) \
395({ \ 379({ \
396 typeof(pcp) ret__; \ 380 typeof(pcp) ret__; \
@@ -418,7 +402,7 @@ do { \
418# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) 402# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
419#endif 403#endif
420 404
421#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) 405#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
422#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) 406#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
423#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) 407#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
424 408
@@ -586,7 +570,7 @@ do { \
586#endif 570#endif
587 571
588#ifndef __this_cpu_sub 572#ifndef __this_cpu_sub
589# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) 573# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
590#endif 574#endif
591 575
592#ifndef __this_cpu_inc 576#ifndef __this_cpu_inc
@@ -629,22 +613,6 @@ do { \
629# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) 613# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val))
630#endif 614#endif
631 615
632#ifndef __this_cpu_xor
633# ifndef __this_cpu_xor_1
634# define __this_cpu_xor_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
635# endif
636# ifndef __this_cpu_xor_2
637# define __this_cpu_xor_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
638# endif
639# ifndef __this_cpu_xor_4
640# define __this_cpu_xor_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
641# endif
642# ifndef __this_cpu_xor_8
643# define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
644# endif
645# define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val))
646#endif
647
648#define __this_cpu_generic_add_return(pcp, val) \ 616#define __this_cpu_generic_add_return(pcp, val) \
649({ \ 617({ \
650 __this_cpu_add(pcp, val); \ 618 __this_cpu_add(pcp, val); \
@@ -668,7 +636,7 @@ do { \
668 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) 636 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
669#endif 637#endif
670 638
671#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) 639#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
672#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) 640#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
673#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) 641#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
674 642
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h
new file mode 100644
index 000000000000..1900bd0fa639
--- /dev/null
+++ b/include/linux/percpu_ida.h
@@ -0,0 +1,81 @@
1#ifndef __PERCPU_IDA_H__
2#define __PERCPU_IDA_H__
3
4#include <linux/types.h>
5#include <linux/bitops.h>
6#include <linux/init.h>
7#include <linux/spinlock_types.h>
8#include <linux/wait.h>
9#include <linux/cpumask.h>
10
11struct percpu_ida_cpu;
12
13struct percpu_ida {
14 /*
15 * number of tags available to be allocated, as passed to
16 * percpu_ida_init()
17 */
18 unsigned nr_tags;
19 unsigned percpu_max_size;
20 unsigned percpu_batch_size;
21
22 struct percpu_ida_cpu __percpu *tag_cpu;
23
24 /*
25 * Bitmap of cpus that (may) have tags on their percpu freelists:
26 * steal_tags() uses this to decide when to steal tags, and which cpus
27 * to try stealing from.
28 *
29 * It's ok for a freelist to be empty when its bit is set - steal_tags()
30 * will just keep looking - but the bitmap _must_ be set whenever a
31 * percpu freelist does have tags.
32 */
33 cpumask_t cpus_have_tags;
34
35 struct {
36 spinlock_t lock;
37 /*
38 * When we go to steal tags from another cpu (see steal_tags()),
39 * we want to pick a cpu at random. Cycling through them every
40 * time we steal is a bit easier and more or less equivalent:
41 */
42 unsigned cpu_last_stolen;
43
44 /* For sleeping on allocation failure */
45 wait_queue_head_t wait;
46
47 /*
48 * Global freelist - it's a stack where nr_free points to the
49 * top
50 */
51 unsigned nr_free;
52 unsigned *freelist;
53 } ____cacheline_aligned_in_smp;
54};
55
56/*
57 * Number of tags we move between the percpu freelist and the global freelist at
58 * a time
59 */
60#define IDA_DEFAULT_PCPU_BATCH_MOVE 32U
61/* Max size of percpu freelist, */
62#define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2)
63
64int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
65void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
66
67void percpu_ida_destroy(struct percpu_ida *pool);
68int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,
69 unsigned long max_size, unsigned long batch_size);
70static inline int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags)
71{
72 return __percpu_ida_init(pool, nr_tags, IDA_DEFAULT_PCPU_SIZE,
73 IDA_DEFAULT_PCPU_BATCH_MOVE);
74}
75
76typedef int (*percpu_ida_cb)(unsigned, void *);
77int percpu_ida_for_each_free(struct percpu_ida *pool, percpu_ida_cb fn,
78 void *data);
79
80unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu);
81#endif /* __PERCPU_IDA_H__ */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 866e85c5eb94..2e069d1288df 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -294,9 +294,31 @@ struct ring_buffer;
294 */ 294 */
295struct perf_event { 295struct perf_event {
296#ifdef CONFIG_PERF_EVENTS 296#ifdef CONFIG_PERF_EVENTS
297 struct list_head group_entry; 297 /*
298 * entry onto perf_event_context::event_list;
299 * modifications require ctx->lock
300 * RCU safe iterations.
301 */
298 struct list_head event_entry; 302 struct list_head event_entry;
303
304 /*
305 * XXX: group_entry and sibling_list should be mutually exclusive;
306 * either you're a sibling on a group, or you're the group leader.
307 * Rework the code to always use the same list element.
308 *
309 * Locked for modification by both ctx->mutex and ctx->lock; holding
310 * either sufficies for read.
311 */
312 struct list_head group_entry;
299 struct list_head sibling_list; 313 struct list_head sibling_list;
314
315 /*
316 * We need storage to track the entries in perf_pmu_migrate_context; we
317 * cannot use the event_entry because of RCU and we want to keep the
318 * group in tact which avoids us using the other two entries.
319 */
320 struct list_head migrate_entry;
321
300 struct hlist_node hlist_entry; 322 struct hlist_node hlist_entry;
301 int nr_siblings; 323 int nr_siblings;
302 int group_flags; 324 int group_flags;
@@ -562,6 +584,10 @@ struct perf_sample_data {
562 struct perf_regs_user regs_user; 584 struct perf_regs_user regs_user;
563 u64 stack_user_size; 585 u64 stack_user_size;
564 u64 weight; 586 u64 weight;
587 /*
588 * Transaction flags for abort events:
589 */
590 u64 txn;
565}; 591};
566 592
567static inline void perf_sample_data_init(struct perf_sample_data *data, 593static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -577,6 +603,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
577 data->stack_user_size = 0; 603 data->stack_user_size = 0;
578 data->weight = 0; 604 data->weight = 0;
579 data->data_src.val = 0; 605 data->data_src.val = 0;
606 data->txn = 0;
580} 607}
581 608
582extern void perf_output_sample(struct perf_output_handle *handle, 609extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 64ab823f7b74..48a4dc3cb8cf 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -559,6 +559,7 @@ static inline int phy_read_status(struct phy_device *phydev) {
559 return phydev->drv->read_status(phydev); 559 return phydev->drv->read_status(phydev);
560} 560}
561 561
562int genphy_setup_forced(struct phy_device *phydev);
562int genphy_restart_aneg(struct phy_device *phydev); 563int genphy_restart_aneg(struct phy_device *phydev);
563int genphy_config_aneg(struct phy_device *phydev); 564int genphy_config_aneg(struct phy_device *phydev);
564int genphy_update_link(struct phy_device *phydev); 565int genphy_update_link(struct phy_device *phydev);
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
new file mode 100644
index 000000000000..6d722695e027
--- /dev/null
+++ b/include/linux/phy/phy.h
@@ -0,0 +1,270 @@
1/*
2 * phy.h -- generic phy header file
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Kishon Vijay Abraham I <kishon@ti.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
14#ifndef __DRIVERS_PHY_H
15#define __DRIVERS_PHY_H
16
17#include <linux/err.h>
18#include <linux/of.h>
19#include <linux/device.h>
20#include <linux/pm_runtime.h>
21
22struct phy;
23
24/**
25 * struct phy_ops - set of function pointers for performing phy operations
26 * @init: operation to be performed for initializing phy
27 * @exit: operation to be performed while exiting
28 * @power_on: powering on the phy
29 * @power_off: powering off the phy
30 * @owner: the module owner containing the ops
31 */
32struct phy_ops {
33 int (*init)(struct phy *phy);
34 int (*exit)(struct phy *phy);
35 int (*power_on)(struct phy *phy);
36 int (*power_off)(struct phy *phy);
37 struct module *owner;
38};
39
40/**
41 * struct phy - represents the phy device
42 * @dev: phy device
43 * @id: id of the phy device
44 * @ops: function pointers for performing phy operations
45 * @init_data: list of PHY consumers (non-dt only)
46 * @mutex: mutex to protect phy_ops
47 * @init_count: used to protect when the PHY is used by multiple consumers
48 * @power_count: used to protect when the PHY is used by multiple consumers
49 */
50struct phy {
51 struct device dev;
52 int id;
53 const struct phy_ops *ops;
54 struct phy_init_data *init_data;
55 struct mutex mutex;
56 int init_count;
57 int power_count;
58};
59
60/**
61 * struct phy_provider - represents the phy provider
62 * @dev: phy provider device
63 * @owner: the module owner having of_xlate
64 * @of_xlate: function pointer to obtain phy instance from phy pointer
65 * @list: to maintain a linked list of PHY providers
66 */
67struct phy_provider {
68 struct device *dev;
69 struct module *owner;
70 struct list_head list;
71 struct phy * (*of_xlate)(struct device *dev,
72 struct of_phandle_args *args);
73};
74
75/**
76 * struct phy_consumer - represents the phy consumer
77 * @dev_name: the device name of the controller that will use this PHY device
78 * @port: name given to the consumer port
79 */
80struct phy_consumer {
81 const char *dev_name;
82 const char *port;
83};
84
85/**
86 * struct phy_init_data - contains the list of PHY consumers
87 * @num_consumers: number of consumers for this PHY device
88 * @consumers: list of PHY consumers
89 */
90struct phy_init_data {
91 unsigned int num_consumers;
92 struct phy_consumer *consumers;
93};
94
95#define PHY_CONSUMER(_dev_name, _port) \
96{ \
97 .dev_name = _dev_name, \
98 .port = _port, \
99}
100
101#define to_phy(dev) (container_of((dev), struct phy, dev))
102
103#define of_phy_provider_register(dev, xlate) \
104 __of_phy_provider_register((dev), THIS_MODULE, (xlate))
105
106#define devm_of_phy_provider_register(dev, xlate) \
107 __devm_of_phy_provider_register((dev), THIS_MODULE, (xlate))
108
109static inline void phy_set_drvdata(struct phy *phy, void *data)
110{
111 dev_set_drvdata(&phy->dev, data);
112}
113
114static inline void *phy_get_drvdata(struct phy *phy)
115{
116 return dev_get_drvdata(&phy->dev);
117}
118
119#if IS_ENABLED(CONFIG_GENERIC_PHY)
120int phy_pm_runtime_get(struct phy *phy);
121int phy_pm_runtime_get_sync(struct phy *phy);
122int phy_pm_runtime_put(struct phy *phy);
123int phy_pm_runtime_put_sync(struct phy *phy);
124void phy_pm_runtime_allow(struct phy *phy);
125void phy_pm_runtime_forbid(struct phy *phy);
126int phy_init(struct phy *phy);
127int phy_exit(struct phy *phy);
128int phy_power_on(struct phy *phy);
129int phy_power_off(struct phy *phy);
130struct phy *phy_get(struct device *dev, const char *string);
131struct phy *devm_phy_get(struct device *dev, const char *string);
132void phy_put(struct phy *phy);
133void devm_phy_put(struct device *dev, struct phy *phy);
134struct phy *of_phy_simple_xlate(struct device *dev,
135 struct of_phandle_args *args);
136struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
137 struct phy_init_data *init_data);
138struct phy *devm_phy_create(struct device *dev,
139 const struct phy_ops *ops, struct phy_init_data *init_data);
140void phy_destroy(struct phy *phy);
141void devm_phy_destroy(struct device *dev, struct phy *phy);
142struct phy_provider *__of_phy_provider_register(struct device *dev,
143 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
144 struct of_phandle_args *args));
145struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
146 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
147 struct of_phandle_args *args));
148void of_phy_provider_unregister(struct phy_provider *phy_provider);
149void devm_of_phy_provider_unregister(struct device *dev,
150 struct phy_provider *phy_provider);
151#else
152static inline int phy_pm_runtime_get(struct phy *phy)
153{
154 return -ENOSYS;
155}
156
157static inline int phy_pm_runtime_get_sync(struct phy *phy)
158{
159 return -ENOSYS;
160}
161
162static inline int phy_pm_runtime_put(struct phy *phy)
163{
164 return -ENOSYS;
165}
166
167static inline int phy_pm_runtime_put_sync(struct phy *phy)
168{
169 return -ENOSYS;
170}
171
172static inline void phy_pm_runtime_allow(struct phy *phy)
173{
174 return;
175}
176
177static inline void phy_pm_runtime_forbid(struct phy *phy)
178{
179 return;
180}
181
182static inline int phy_init(struct phy *phy)
183{
184 return -ENOSYS;
185}
186
187static inline int phy_exit(struct phy *phy)
188{
189 return -ENOSYS;
190}
191
192static inline int phy_power_on(struct phy *phy)
193{
194 return -ENOSYS;
195}
196
197static inline int phy_power_off(struct phy *phy)
198{
199 return -ENOSYS;
200}
201
202static inline struct phy *phy_get(struct device *dev, const char *string)
203{
204 return ERR_PTR(-ENOSYS);
205}
206
207static inline struct phy *devm_phy_get(struct device *dev, const char *string)
208{
209 return ERR_PTR(-ENOSYS);
210}
211
212static inline void phy_put(struct phy *phy)
213{
214}
215
216static inline void devm_phy_put(struct device *dev, struct phy *phy)
217{
218}
219
220static inline struct phy *of_phy_simple_xlate(struct device *dev,
221 struct of_phandle_args *args)
222{
223 return ERR_PTR(-ENOSYS);
224}
225
226static inline struct phy *phy_create(struct device *dev,
227 const struct phy_ops *ops, struct phy_init_data *init_data)
228{
229 return ERR_PTR(-ENOSYS);
230}
231
232static inline struct phy *devm_phy_create(struct device *dev,
233 const struct phy_ops *ops, struct phy_init_data *init_data)
234{
235 return ERR_PTR(-ENOSYS);
236}
237
238static inline void phy_destroy(struct phy *phy)
239{
240}
241
242static inline void devm_phy_destroy(struct device *dev, struct phy *phy)
243{
244}
245
246static inline struct phy_provider *__of_phy_provider_register(
247 struct device *dev, struct module *owner, struct phy * (*of_xlate)(
248 struct device *dev, struct of_phandle_args *args))
249{
250 return ERR_PTR(-ENOSYS);
251}
252
253static inline struct phy_provider *__devm_of_phy_provider_register(struct device
254 *dev, struct module *owner, struct phy * (*of_xlate)(struct device *dev,
255 struct of_phandle_args *args))
256{
257 return ERR_PTR(-ENOSYS);
258}
259
260static inline void of_phy_provider_unregister(struct phy_provider *phy_provider)
261{
262}
263
264static inline void devm_of_phy_provider_unregister(struct device *dev,
265 struct phy_provider *phy_provider)
266{
267}
268#endif
269
270#endif /* __DRIVERS_PHY_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e2772666f004..7246ef3d4455 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -23,6 +23,7 @@ struct bsd_acct_struct;
23struct pid_namespace { 23struct pid_namespace {
24 struct kref kref; 24 struct kref kref;
25 struct pidmap pidmap[PIDMAP_ENTRIES]; 25 struct pidmap pidmap[PIDMAP_ENTRIES];
26 struct rcu_head rcu;
26 int last_pid; 27 int last_pid;
27 unsigned int nr_hashed; 28 unsigned int nr_hashed;
28 struct task_struct *child_reaper; 29 struct task_struct *child_reaper;
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 5979147d2bda..fefb88663975 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -144,6 +144,9 @@ extern struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
144extern struct pinctrl_gpio_range * 144extern struct pinctrl_gpio_range *
145pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev, 145pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
146 unsigned int pin); 146 unsigned int pin);
147extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
148 const char *pin_group, const unsigned **pins,
149 unsigned *num_pins);
147 150
148#ifdef CONFIG_OF 151#ifdef CONFIG_OF
149extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np); 152extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
diff --git a/include/linux/i2c/at24.h b/include/linux/platform_data/at24.h
index 285025a9cdc9..c42aa89d34ee 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/platform_data/at24.h
@@ -28,7 +28,7 @@
28 * 28 *
29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context) 29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context)
30 * { 30 * {
31 * u8 *mac_addr = ethernet_pdata->mac_addr; 31 * u8 *mac_addr = ethernet_pdata->mac_addr;
32 * off_t offset = context; 32 * off_t offset = context;
33 * 33 *
34 * // Read MAC addr from EEPROM 34 * // Read MAC addr from EEPROM
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index 6a293b7fff3b..cea9f70133c5 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -71,6 +71,10 @@ struct atmel_nand_data {
71 u8 on_flash_bbt; /* bbt on flash */ 71 u8 on_flash_bbt; /* bbt on flash */
72 struct mtd_partition *parts; 72 struct mtd_partition *parts;
73 unsigned int num_parts; 73 unsigned int num_parts;
74 bool has_dma; /* support dma transfer */
75
76 /* default is false, only for at32ap7000 chip is true */
77 bool need_reset_workaround;
74}; 78};
75 79
76 /* Serial */ 80 /* Serial */
diff --git a/include/linux/platform_data/bd6107.h b/include/linux/platform_data/bd6107.h
new file mode 100644
index 000000000000..671d6502d241
--- /dev/null
+++ b/include/linux/platform_data/bd6107.h
@@ -0,0 +1,19 @@
1/*
2 * bd6107.h - Rohm BD6107 LEDs Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __BD6107_H__
9#define __BD6107_H__
10
11struct device;
12
13struct bd6107_platform_data {
14 struct device *fbdev;
15 int reset; /* Reset GPIO */
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87b2477..000000000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Minimal platform data header */
2void nomadik_clk_init(void);
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 9d98f3aaa16c..97baf831e071 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -10,6 +10,9 @@
10#ifndef __CLK_UX500_H 10#ifndef __CLK_UX500_H
11#define __CLK_UX500_H 11#define __CLK_UX500_H
12 12
13void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base);
15
13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 16void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base); 17 u32 clkrst5_base, u32 clkrst6_base);
15void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 18void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 8db5ae03b6e3..689a856b86f9 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -84,6 +84,8 @@ struct snd_platform_data {
84 u8 version; 84 u8 version;
85 u8 txnumevt; 85 u8 txnumevt;
86 u8 rxnumevt; 86 u8 rxnumevt;
87 int tx_dma_channel;
88 int rx_dma_channel;
87}; 89};
88 90
89enum { 91enum {
diff --git a/include/linux/platform_data/dma-rcar-hpbdma.h b/include/linux/platform_data/dma-rcar-hpbdma.h
new file mode 100644
index 000000000000..648b8ea61a22
--- /dev/null
+++ b/include/linux/platform_data/dma-rcar-hpbdma.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2011-2013 Renesas Electronics Corporation
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
8 */
9
10#ifndef __DMA_RCAR_HPBDMA_H
11#define __DMA_RCAR_HPBDMA_H
12
13#include <linux/bitops.h>
14#include <linux/types.h>
15
16/* Transmit sizes and respective register values */
17enum {
18 XMIT_SZ_8BIT = 0,
19 XMIT_SZ_16BIT = 1,
20 XMIT_SZ_32BIT = 2,
21 XMIT_SZ_MAX
22};
23
24/* DMA control register (DCR) bits */
25#define HPB_DMAE_DCR_DTAMD (1u << 26)
26#define HPB_DMAE_DCR_DTAC (1u << 25)
27#define HPB_DMAE_DCR_DTAU (1u << 24)
28#define HPB_DMAE_DCR_DTAU1 (1u << 23)
29#define HPB_DMAE_DCR_SWMD (1u << 22)
30#define HPB_DMAE_DCR_BTMD (1u << 21)
31#define HPB_DMAE_DCR_PKMD (1u << 20)
32#define HPB_DMAE_DCR_CT (1u << 18)
33#define HPB_DMAE_DCR_ACMD (1u << 17)
34#define HPB_DMAE_DCR_DIP (1u << 16)
35#define HPB_DMAE_DCR_SMDL (1u << 13)
36#define HPB_DMAE_DCR_SPDAM (1u << 12)
37#define HPB_DMAE_DCR_SDRMD_MASK (3u << 10)
38#define HPB_DMAE_DCR_SDRMD_MOD (0u << 10)
39#define HPB_DMAE_DCR_SDRMD_AUTO (1u << 10)
40#define HPB_DMAE_DCR_SDRMD_TIMER (2u << 10)
41#define HPB_DMAE_DCR_SPDS_MASK (3u << 8)
42#define HPB_DMAE_DCR_SPDS_8BIT (0u << 8)
43#define HPB_DMAE_DCR_SPDS_16BIT (1u << 8)
44#define HPB_DMAE_DCR_SPDS_32BIT (2u << 8)
45#define HPB_DMAE_DCR_DMDL (1u << 5)
46#define HPB_DMAE_DCR_DPDAM (1u << 4)
47#define HPB_DMAE_DCR_DDRMD_MASK (3u << 2)
48#define HPB_DMAE_DCR_DDRMD_MOD (0u << 2)
49#define HPB_DMAE_DCR_DDRMD_AUTO (1u << 2)
50#define HPB_DMAE_DCR_DDRMD_TIMER (2u << 2)
51#define HPB_DMAE_DCR_DPDS_MASK (3u << 0)
52#define HPB_DMAE_DCR_DPDS_8BIT (0u << 0)
53#define HPB_DMAE_DCR_DPDS_16BIT (1u << 0)
54#define HPB_DMAE_DCR_DPDS_32BIT (2u << 0)
55
56/* Asynchronous reset register (ASYNCRSTR) bits */
57#define HPB_DMAE_ASYNCRSTR_ASRST41 BIT(10)
58#define HPB_DMAE_ASYNCRSTR_ASRST40 BIT(9)
59#define HPB_DMAE_ASYNCRSTR_ASRST39 BIT(8)
60#define HPB_DMAE_ASYNCRSTR_ASRST27 BIT(7)
61#define HPB_DMAE_ASYNCRSTR_ASRST26 BIT(6)
62#define HPB_DMAE_ASYNCRSTR_ASRST25 BIT(5)
63#define HPB_DMAE_ASYNCRSTR_ASRST24 BIT(4)
64#define HPB_DMAE_ASYNCRSTR_ASRST23 BIT(3)
65#define HPB_DMAE_ASYNCRSTR_ASRST22 BIT(2)
66#define HPB_DMAE_ASYNCRSTR_ASRST21 BIT(1)
67#define HPB_DMAE_ASYNCRSTR_ASRST20 BIT(0)
68
69struct hpb_dmae_slave_config {
70 unsigned int id;
71 dma_addr_t addr;
72 u32 dcr;
73 u32 port;
74 u32 rstr;
75 u32 mdr;
76 u32 mdm;
77 u32 flags;
78#define HPB_DMAE_SET_ASYNC_RESET BIT(0)
79#define HPB_DMAE_SET_ASYNC_MODE BIT(1)
80 u32 dma_ch;
81};
82
83#define HPB_DMAE_CHANNEL(_irq, _s_id) \
84{ \
85 .ch_irq = _irq, \
86 .s_id = _s_id, \
87}
88
89struct hpb_dmae_channel {
90 unsigned int ch_irq;
91 unsigned int s_id;
92};
93
94struct hpb_dmae_pdata {
95 const struct hpb_dmae_slave_config *slaves;
96 int num_slaves;
97 const struct hpb_dmae_channel *channels;
98 int num_channels;
99 const unsigned int ts_shift[XMIT_SZ_MAX];
100 int num_hw_channels;
101};
102
103#endif
diff --git a/include/linux/platform_data/dma-s3c24xx.h b/include/linux/platform_data/dma-s3c24xx.h
new file mode 100644
index 000000000000..89ba1b0c90e4
--- /dev/null
+++ b/include/linux/platform_data/dma-s3c24xx.h
@@ -0,0 +1,46 @@
1/*
2 * S3C24XX DMA handling
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 */
11
12/* Helper to encode the source selection constraints for early s3c socs. */
13#define S3C24XX_DMA_CHANREQ(src, chan) ((BIT(3) | src) << chan * 4)
14
15enum s3c24xx_dma_bus {
16 S3C24XX_DMA_APB,
17 S3C24XX_DMA_AHB,
18};
19
20/**
21 * @bus: on which bus does the peripheral reside - AHB or APB.
22 * @handshake: is a handshake with the peripheral necessary
23 * @chansel: channel selection information, depending on variant; reqsel for
24 * s3c2443 and later and channel-selection map for earlier SoCs
25 * see CHANSEL doc in s3c2443-dma.c
26 */
27struct s3c24xx_dma_channel {
28 enum s3c24xx_dma_bus bus;
29 bool handshake;
30 u16 chansel;
31};
32
33/**
34 * struct s3c24xx_dma_platdata - platform specific settings
35 * @num_phy_channels: number of physical channels
36 * @channels: array of virtual channel descriptions
37 * @num_channels: number of virtual channels
38 */
39struct s3c24xx_dma_platdata {
40 int num_phy_channels;
41 struct s3c24xx_dma_channel *channels;
42 int num_channels;
43};
44
45struct dma_chan;
46bool s3c24xx_dma_filter(struct dma_chan *chan, void *param);
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index 57300fd7cc03..f50821cb64be 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -67,10 +67,10 @@ struct edmacc_param {
67#define ITCCHEN BIT(23) 67#define ITCCHEN BIT(23)
68 68
69/*ch_status paramater of callback function possible values*/ 69/*ch_status paramater of callback function possible values*/
70#define DMA_COMPLETE 1 70#define EDMA_DMA_COMPLETE 1
71#define DMA_CC_ERROR 2 71#define EDMA_DMA_CC_ERROR 2
72#define DMA_TC1_ERROR 3 72#define EDMA_DMA_TC1_ERROR 3
73#define DMA_TC2_ERROR 4 73#define EDMA_DMA_TC2_ERROR 4
74 74
75enum address_mode { 75enum address_mode {
76 INCR = 0, 76 INCR = 0,
@@ -180,4 +180,6 @@ struct edma_soc_info {
180 const s16 (*xbar_chans)[2]; 180 const s16 (*xbar_chans)[2];
181}; 181};
182 182
183int edma_trigger_channel(unsigned);
184
183#endif 185#endif
diff --git a/include/linux/platform_data/exynos_thermal.h b/include/linux/platform_data/exynos_thermal.h
deleted file mode 100644
index da7e6274b175..000000000000
--- a/include/linux/platform_data/exynos_thermal.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _LINUX_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS_THERMAL_H
24#include <linux/cpu_cooling.h>
25
26enum calibration_type {
27 TYPE_ONE_POINT_TRIMMING,
28 TYPE_TWO_POINT_TRIMMING,
29 TYPE_NONE,
30};
31
32enum soc_type {
33 SOC_ARCH_EXYNOS4210 = 1,
34 SOC_ARCH_EXYNOS,
35};
36/**
37 * struct freq_clip_table
38 * @freq_clip_max: maximum frequency allowed for this cooling state.
39 * @temp_level: Temperature level at which the temperature clipping will
40 * happen.
41 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
42 *
43 * This structure is required to be filled and passed to the
44 * cpufreq_cooling_unregister function.
45 */
46struct freq_clip_table {
47 unsigned int freq_clip_max;
48 unsigned int temp_level;
49 const struct cpumask *mask_val;
50};
51
52/**
53 * struct exynos_tmu_platform_data
54 * @threshold: basic temperature for generating interrupt
55 * 25 <= threshold <= 125 [unit: degree Celsius]
56 * @threshold_falling: differntial value for setting threshold
57 * of temperature falling interrupt.
58 * @trigger_levels: array for each interrupt levels
59 * [unit: degree Celsius]
60 * 0: temperature for trigger_level0 interrupt
61 * condition for trigger_level0 interrupt:
62 * current temperature > threshold + trigger_levels[0]
63 * 1: temperature for trigger_level1 interrupt
64 * condition for trigger_level1 interrupt:
65 * current temperature > threshold + trigger_levels[1]
66 * 2: temperature for trigger_level2 interrupt
67 * condition for trigger_level2 interrupt:
68 * current temperature > threshold + trigger_levels[2]
69 * 3: temperature for trigger_level3 interrupt
70 * condition for trigger_level3 interrupt:
71 * current temperature > threshold + trigger_levels[3]
72 * @trigger_level0_en:
73 * 1 = enable trigger_level0 interrupt,
74 * 0 = disable trigger_level0 interrupt
75 * @trigger_level1_en:
76 * 1 = enable trigger_level1 interrupt,
77 * 0 = disable trigger_level1 interrupt
78 * @trigger_level2_en:
79 * 1 = enable trigger_level2 interrupt,
80 * 0 = disable trigger_level2 interrupt
81 * @trigger_level3_en:
82 * 1 = enable trigger_level3 interrupt,
83 * 0 = disable trigger_level3 interrupt
84 * @gain: gain of amplifier in the positive-TC generator block
85 * 0 <= gain <= 15
86 * @reference_voltage: reference voltage of amplifier
87 * in the positive-TC generator block
88 * 0 <= reference_voltage <= 31
89 * @noise_cancel_mode: noise cancellation mode
90 * 000, 100, 101, 110 and 111 can be different modes
91 * @type: determines the type of SOC
92 * @efuse_value: platform defined fuse value
93 * @cal_type: calibration type for temperature
94 * @freq_clip_table: Table representing frequency reduction percentage.
95 * @freq_tab_count: Count of the above table as frequency reduction may
96 * applicable to only some of the trigger levels.
97 *
98 * This structure is required for configuration of exynos_tmu driver.
99 */
100struct exynos_tmu_platform_data {
101 u8 threshold;
102 u8 threshold_falling;
103 u8 trigger_levels[4];
104 bool trigger_level0_en;
105 bool trigger_level1_en;
106 bool trigger_level2_en;
107 bool trigger_level3_en;
108
109 u8 gain;
110 u8 reference_voltage;
111 u8 noise_cancel_mode;
112 u32 efuse_value;
113
114 enum calibration_type cal_type;
115 enum soc_type type;
116 struct freq_clip_table freq_tab[4];
117 unsigned int freq_tab_count;
118};
119#endif /* _LINUX_EXYNOS_THERMAL_H */
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
new file mode 100644
index 000000000000..6efd20264585
--- /dev/null
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -0,0 +1,60 @@
1/*
2 * DaVinci GPIO Platform Related Defines
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DAVINCI_GPIO_PLATFORM_H
17#define __DAVINCI_GPIO_PLATFORM_H
18
19#include <linux/io.h>
20#include <linux/spinlock.h>
21
22#include <asm-generic/gpio.h>
23
24enum davinci_gpio_type {
25 GPIO_TYPE_TNETV107X = 0,
26};
27
28struct davinci_gpio_platform_data {
29 u32 ngpio;
30 u32 gpio_unbanked;
31 u32 intc_irq_num;
32};
33
34
35struct davinci_gpio_controller {
36 struct gpio_chip chip;
37 int irq_base;
38 /* Serialize access to GPIO registers */
39 spinlock_t lock;
40 void __iomem *regs;
41 void __iomem *set_data;
42 void __iomem *clr_data;
43 void __iomem *in_data;
44 int gpio_unbanked;
45 unsigned gpio_irq;
46};
47
48/*
49 * basic gpio routines
50 */
51#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
52
53/* Convert GPIO signal to GPIO pin number */
54#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
55
56static inline u32 __gpio_mask(unsigned gpio)
57{
58 return 1 << (gpio % 32);
59}
60#endif
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
index 573edfb046c4..7c5a519d2dcd 100644
--- a/include/linux/platform_data/gpio-em.h
+++ b/include/linux/platform_data/gpio-em.h
@@ -5,6 +5,7 @@ struct gpio_em_config {
5 unsigned int gpio_base; 5 unsigned int gpio_base;
6 unsigned int irq_base; 6 unsigned int irq_base;
7 unsigned int number_of_pins; 7 unsigned int number_of_pins;
8 const char *pctl_name;
8}; 9};
9 10
10#endif /* __GPIO_EM_H__ */ 11#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h
new file mode 100644
index 000000000000..5ae0d9c80d4d
--- /dev/null
+++ b/include/linux/platform_data/gpio_backlight.h
@@ -0,0 +1,21 @@
1/*
2 * gpio_backlight.h - Simple GPIO-controlled backlight
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __GPIO_BACKLIGHT_H__
9#define __GPIO_BACKLIGHT_H__
10
11struct device;
12
13struct gpio_backlight_platform_data {
14 struct device *fbdev;
15 int gpio;
16 int def_value;
17 bool active_low;
18 const char *name;
19};
20
21#endif
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
index 202e290faea8..624ff9edad6f 100644
--- a/include/linux/platform_data/leds-lp55xx.h
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -22,6 +22,7 @@
22 22
23struct lp55xx_led_config { 23struct lp55xx_led_config {
24 const char *name; 24 const char *name;
25 const char *default_trigger;
25 u8 chan_nr; 26 u8 chan_nr;
26 u8 led_current; /* mA x10, 0 if led is not connected */ 27 u8 led_current; /* mA x10, 0 if led is not connected */
27 u8 max_current; 28 u8 max_current;
@@ -36,6 +37,13 @@ struct lp55xx_predef_pattern {
36 u8 size_b; 37 u8 size_b;
37}; 38};
38 39
40enum lp8501_pwr_sel {
41 LP8501_ALL_VDD, /* D1~9 are connected to VDD */
42 LP8501_6VDD_3VOUT, /* D1~6 with VDD, D7~9 with VOUT */
43 LP8501_3VDD_6VOUT, /* D1~6 with VOUT, D7~9 with VDD */
44 LP8501_ALL_VOUT, /* D1~9 are connected to VOUT */
45};
46
39/* 47/*
40 * struct lp55xx_platform_data 48 * struct lp55xx_platform_data
41 * @led_config : Configurable led class device 49 * @led_config : Configurable led class device
@@ -59,14 +67,15 @@ struct lp55xx_platform_data {
59 /* Clock configuration */ 67 /* Clock configuration */
60 u8 clock_mode; 68 u8 clock_mode;
61 69
62 /* Platform specific functions */ 70 /* optional enable GPIO */
63 int (*setup_resources)(void); 71 int enable_gpio;
64 void (*release_resources)(void);
65 void (*enable)(bool state);
66 72
67 /* Predefined pattern data */ 73 /* Predefined pattern data */
68 struct lp55xx_predef_pattern *patterns; 74 struct lp55xx_predef_pattern *patterns;
69 unsigned int num_patterns; 75 unsigned int num_patterns;
76
77 /* LP8501 specific */
78 enum lp8501_pwr_sel pwr_sel;
70}; 79};
71 80
72#endif /* _LEDS_LP55XX_H */ 81#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/leds-pca9633.h b/include/linux/platform_data/leds-pca963x.h
index c5bf29b6fa7f..e731f0036329 100644
--- a/include/linux/platform_data/leds-pca9633.h
+++ b/include/linux/platform_data/leds-pca963x.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * PCA9633 LED chip driver. 2 * PCA963X LED chip driver.
3 * 3 *
4 * Copyright 2012 bct electronic GmbH 4 * Copyright 2012 bct electronic GmbH
5 * Copyright 2013 Qtechnology A/S
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -18,18 +19,24 @@
18 * 02110-1301 USA 19 * 02110-1301 USA
19 */ 20 */
20 21
21#ifndef __LINUX_PCA9633_H 22#ifndef __LINUX_PCA963X_H
22#define __LINUX_PCA9633_H 23#define __LINUX_PCA963X_H
23#include <linux/leds.h> 24#include <linux/leds.h>
24 25
25enum pca9633_outdrv { 26enum pca963x_outdrv {
26 PCA9633_OPEN_DRAIN, 27 PCA963X_OPEN_DRAIN,
27 PCA9633_TOTEM_POLE, /* aka push-pull */ 28 PCA963X_TOTEM_POLE, /* aka push-pull */
28}; 29};
29 30
30struct pca9633_platform_data { 31enum pca963x_blink_type {
32 PCA963X_SW_BLINK,
33 PCA963X_HW_BLINK,
34};
35
36struct pca963x_platform_data {
31 struct led_platform_data leds; 37 struct led_platform_data leds;
32 enum pca9633_outdrv outdrv; 38 enum pca963x_outdrv outdrv;
39 enum pca963x_blink_type blink_type;
33}; 40};
34 41
35#endif /* __LINUX_PCA9633_H*/ 42#endif /* __LINUX_PCA963X_H*/
diff --git a/include/linux/platform_data/leds-pca9685.h b/include/linux/platform_data/leds-pca9685.h
new file mode 100644
index 000000000000..778e9e4249cc
--- /dev/null
+++ b/include/linux/platform_data/leds-pca9685.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright 2013 Maximilian Güntner <maximilian.guentner@gmail.com>
3 *
4 * This file is subject to the terms and conditions of version 2 of
5 * the GNU General Public License. See the file COPYING in the main
6 * directory of this archive for more details.
7 *
8 * Based on leds-pca963x.h by Peter Meerwald <p.meerwald@bct-electronic.com>
9 *
10 * LED driver for the NXP PCA9685 PWM chip
11 *
12 */
13
14#ifndef __LINUX_PCA9685_H
15#define __LINUX_PCA9685_H
16
17#include <linux/leds.h>
18
19enum pca9685_outdrv {
20 PCA9685_OPEN_DRAIN,
21 PCA9685_TOTEM_POLE,
22};
23
24enum pca9685_inverted {
25 PCA9685_NOT_INVERTED,
26 PCA9685_INVERTED,
27};
28
29struct pca9685_platform_data {
30 struct led_platform_data leds;
31 enum pca9685_outdrv outdrv;
32 enum pca9685_inverted inverted;
33};
34
35#endif /* __LINUX_PCA9685_H */
diff --git a/include/linux/platform_data/leds-renesas-tpu.h b/include/linux/platform_data/leds-renesas-tpu.h
deleted file mode 100644
index 055387086fc1..000000000000
--- a/include/linux/platform_data/leds-renesas-tpu.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LEDS_RENESAS_TPU_H__
2#define __LEDS_RENESAS_TPU_H__
3
4struct led_renesas_tpu_config {
5 char *name;
6 unsigned pin_gpio_fn;
7 unsigned pin_gpio;
8 unsigned int channel_offset;
9 unsigned int timer_bit;
10 unsigned int max_brightness;
11 unsigned int refresh_rate;
12};
13
14#endif /* __LEDS_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/lm3630_bl.h b/include/linux/platform_data/lm3630_bl.h
deleted file mode 100644
index 9176dd3f2d63..000000000000
--- a/include/linux/platform_data/lm3630_bl.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2* Simple driver for Texas Instruments LM3630 LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3630_H
12#define __LINUX_LM3630_H
13
14#define LM3630_NAME "lm3630_bl"
15
16enum lm3630_pwm_ctrl {
17 PWM_CTRL_DISABLE = 0,
18 PWM_CTRL_BANK_A,
19 PWM_CTRL_BANK_B,
20 PWM_CTRL_BANK_ALL,
21};
22
23enum lm3630_pwm_active {
24 PWM_ACTIVE_HIGH = 0,
25 PWM_ACTIVE_LOW,
26};
27
28enum lm3630_bank_a_ctrl {
29 BANK_A_CTRL_DISABLE = 0x0,
30 BANK_A_CTRL_LED1 = 0x4,
31 BANK_A_CTRL_LED2 = 0x1,
32 BANK_A_CTRL_ALL = 0x5,
33};
34
35enum lm3630_bank_b_ctrl {
36 BANK_B_CTRL_DISABLE = 0,
37 BANK_B_CTRL_LED2,
38};
39
40struct lm3630_platform_data {
41
42 /* maximum brightness */
43 int max_brt_led1;
44 int max_brt_led2;
45
46 /* initial on brightness */
47 int init_brt_led1;
48 int init_brt_led2;
49 enum lm3630_pwm_ctrl pwm_ctrl;
50 enum lm3630_pwm_active pwm_active;
51 enum lm3630_bank_a_ctrl bank_a_ctrl;
52 enum lm3630_bank_b_ctrl bank_b_ctrl;
53 unsigned int pwm_period;
54 void (*pwm_set_intensity) (int brightness, int max_brightness);
55};
56
57#endif /* __LINUX_LM3630_H */
diff --git a/include/linux/platform_data/lm3630a_bl.h b/include/linux/platform_data/lm3630a_bl.h
new file mode 100644
index 000000000000..7538e38e270b
--- /dev/null
+++ b/include/linux/platform_data/lm3630a_bl.h
@@ -0,0 +1,65 @@
1/*
2* Simple driver for Texas Instruments LM3630A LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3630A_H
12#define __LINUX_LM3630A_H
13
14#define LM3630A_NAME "lm3630a_bl"
15
16enum lm3630a_pwm_ctrl {
17 LM3630A_PWM_DISABLE = 0x00,
18 LM3630A_PWM_BANK_A,
19 LM3630A_PWM_BANK_B,
20 LM3630A_PWM_BANK_ALL,
21 LM3630A_PWM_BANK_A_ACT_LOW = 0x05,
22 LM3630A_PWM_BANK_B_ACT_LOW,
23 LM3630A_PWM_BANK_ALL_ACT_LOW,
24};
25
26enum lm3630a_leda_ctrl {
27 LM3630A_LEDA_DISABLE = 0x00,
28 LM3630A_LEDA_ENABLE = 0x04,
29 LM3630A_LEDA_ENABLE_LINEAR = 0x14,
30};
31
32enum lm3630a_ledb_ctrl {
33 LM3630A_LEDB_DISABLE = 0x00,
34 LM3630A_LEDB_ON_A = 0x01,
35 LM3630A_LEDB_ENABLE = 0x02,
36 LM3630A_LEDB_ENABLE_LINEAR = 0x0A,
37};
38
39#define LM3630A_MAX_BRIGHTNESS 255
40/*
41 *@leda_init_brt : led a init brightness. 4~255
42 *@leda_max_brt : led a max brightness. 4~255
43 *@leda_ctrl : led a disable, enable linear, enable exponential
44 *@ledb_init_brt : led b init brightness. 4~255
45 *@ledb_max_brt : led b max brightness. 4~255
46 *@ledb_ctrl : led b disable, enable linear, enable exponential
47 *@pwm_period : pwm period
48 *@pwm_ctrl : pwm disable, bank a or b, active high or low
49 */
50struct lm3630a_platform_data {
51
52 /* led a config. */
53 int leda_init_brt;
54 int leda_max_brt;
55 enum lm3630a_leda_ctrl leda_ctrl;
56 /* led b config. */
57 int ledb_init_brt;
58 int ledb_max_brt;
59 enum lm3630a_ledb_ctrl ledb_ctrl;
60 /* pwm config. */
61 unsigned int pwm_period;
62 enum lm3630a_pwm_ctrl pwm_ctrl;
63};
64
65#endif /* __LINUX_LM3630A_H */
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index ea3200527dd3..1b2ba24e4e03 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -40,6 +40,17 @@
40#define LP8553_PWM_CONFIG LP8550_PWM_CONFIG 40#define LP8553_PWM_CONFIG LP8550_PWM_CONFIG
41#define LP8553_I2C_CONFIG LP8550_I2C_CONFIG 41#define LP8553_I2C_CONFIG LP8550_I2C_CONFIG
42 42
43/* CONFIG register - LP8555 */
44#define LP8555_PWM_STANDBY BIT(7)
45#define LP8555_PWM_FILTER BIT(6)
46#define LP8555_RELOAD_EPROM BIT(3) /* use it if EPROMs should be reset
47 when the backlight turns on */
48#define LP8555_OFF_OPENLEDS BIT(2)
49#define LP8555_PWM_CONFIG LP8555_PWM_ONLY
50#define LP8555_I2C_CONFIG LP8555_I2C_ONLY
51#define LP8555_COMB1_CONFIG LP8555_COMBINED1
52#define LP8555_COMB2_CONFIG LP8555_COMBINED2
53
43/* DEVICE CONTROL register - LP8556 */ 54/* DEVICE CONTROL register - LP8556 */
44#define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT) 55#define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT)
45#define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT) 56#define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT)
@@ -65,6 +76,7 @@ enum lp855x_chip_id {
65 LP8551, 76 LP8551,
66 LP8552, 77 LP8552,
67 LP8553, 78 LP8553,
79 LP8555,
68 LP8556, 80 LP8556,
69 LP8557, 81 LP8557,
70}; 82};
@@ -89,6 +101,13 @@ enum lp8553_brighntess_source {
89 LP8553_I2C_ONLY = LP8550_I2C_ONLY, 101 LP8553_I2C_ONLY = LP8550_I2C_ONLY,
90}; 102};
91 103
104enum lp8555_brightness_source {
105 LP8555_PWM_ONLY,
106 LP8555_I2C_ONLY,
107 LP8555_COMBINED1, /* Brightness register with shaped PWM */
108 LP8555_COMBINED2, /* PWM with shaped brightness register */
109};
110
92enum lp8556_brightness_source { 111enum lp8556_brightness_source {
93 LP8556_PWM_ONLY, 112 LP8556_PWM_ONLY,
94 LP8556_COMBINED1, /* pwm + i2c before the shaper block */ 113 LP8556_COMBINED1, /* pwm + i2c before the shaper block */
diff --git a/include/linux/platform_data/lv5207lp.h b/include/linux/platform_data/lv5207lp.h
new file mode 100644
index 000000000000..7dc4d9a219a6
--- /dev/null
+++ b/include/linux/platform_data/lv5207lp.h
@@ -0,0 +1,19 @@
1/*
2 * lv5207lp.h - Sanyo LV5207LP LEDs Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __LV5207LP_H__
9#define __LV5207LP_H__
10
11struct device;
12
13struct lv5207lp_platform_data {
14 struct device *fbdev;
15 unsigned int max_value;
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
index bf34e17cee7f..c2fd9024717c 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis {
25 u8 hs_settle; 25 u8 hs_settle;
26}; 26};
27 27
28/**
29 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
30 * @id: MIPI-CSIS harware instance index (0...1)
31 * @on: true to enable D-PHY and deassert its reset
32 * false to disable D-PHY
33 * @return: 0 on success, or negative error code on failure
34 */
35int s5p_csis_phy_enable(int id, bool on);
36
37#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ 28#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index d44912d81578..75f70f6ac137 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -10,6 +10,8 @@
10#ifndef __ASM_ARCH_IMX_ESDHC_H 10#ifndef __ASM_ARCH_IMX_ESDHC_H
11#define __ASM_ARCH_IMX_ESDHC_H 11#define __ASM_ARCH_IMX_ESDHC_H
12 12
13#include <linux/types.h>
14
13enum wp_types { 15enum wp_types {
14 ESDHC_WP_NONE, /* no WP, neither controller nor gpio */ 16 ESDHC_WP_NONE, /* no WP, neither controller nor gpio */
15 ESDHC_WP_CONTROLLER, /* mmc controller internal WP */ 17 ESDHC_WP_CONTROLLER, /* mmc controller internal WP */
@@ -32,6 +34,7 @@ enum cd_types {
32 * @cd_gpio: gpio for card_detect interrupt 34 * @cd_gpio: gpio for card_detect interrupt
33 * @wp_type: type of write_protect method (see wp_types enum above) 35 * @wp_type: type of write_protect method (see wp_types enum above)
34 * @cd_type: type of card_detect method (see cd_types enum above) 36 * @cd_type: type of card_detect method (see cd_types enum above)
37 * @support_vsel: indicate it supports 1.8v switching
35 */ 38 */
36 39
37struct esdhc_platform_data { 40struct esdhc_platform_data {
@@ -41,5 +44,7 @@ struct esdhc_platform_data {
41 enum cd_types cd_type; 44 enum cd_types cd_type;
42 int max_bus_width; 45 int max_bus_width;
43 unsigned int f_max; 46 unsigned int f_max;
47 bool support_vsel;
48 unsigned int delay_line;
44}; 49};
45#endif /* __ASM_ARCH_IMX_ESDHC_H */ 50#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 6bf9ef43ddb1..4da5bfa2147f 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -23,13 +23,16 @@ enum nand_io {
23}; 23};
24 24
25enum omap_ecc { 25enum omap_ecc {
26 /* 1-bit ecc: stored at end of spare area */ 26 /* 1-bit ECC calculation by GPMC, Error detection by Software */
27 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ 27 OMAP_ECC_HAM1_CODE_HW = 0,
28 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ 28 /* 4-bit ECC calculation by GPMC, Error detection by Software */
29 /* 1-bit ecc: stored at beginning of spare area as romcode */ 29 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
30 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ 30 /* 4-bit ECC calculation by GPMC, Error detection by ELM */
31 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */ 31 OMAP_ECC_BCH4_CODE_HW,
32 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */ 32 /* 8-bit ECC calculation by GPMC, Error detection by Software */
33 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
34 /* 8-bit ECC calculation by GPMC, Error detection by ELM */
35 OMAP_ECC_BCH8_CODE_HW,
33}; 36};
34 37
35struct gpmc_nand_regs { 38struct gpmc_nand_regs {
@@ -63,5 +66,6 @@ struct omap_nand_platform_data {
63 66
64 /* for passing the partitions */ 67 /* for passing the partitions */
65 struct device_node *of_node; 68 struct device_node *of_node;
69 struct device_node *elm_of_node;
66}; 70};
67#endif 71#endif
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index c42f39f20195..ffb801998e5d 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -16,19 +16,6 @@ struct pxa3xx_nand_timing {
16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */ 16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */
17}; 17};
18 18
19struct pxa3xx_nand_cmdset {
20 uint16_t read1;
21 uint16_t read2;
22 uint16_t program;
23 uint16_t read_status;
24 uint16_t read_id;
25 uint16_t erase;
26 uint16_t reset;
27 uint16_t lock;
28 uint16_t unlock;
29 uint16_t lock_status;
30};
31
32struct pxa3xx_nand_flash { 19struct pxa3xx_nand_flash {
33 char *name; 20 char *name;
34 uint32_t chip_id; 21 uint32_t chip_id;
diff --git a/include/linux/i2c/pca953x.h b/include/linux/platform_data/pca953x.h
index 3c98dd4f901f..3c98dd4f901f 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/platform_data/pca953x.h
diff --git a/include/linux/platform_data/pinctrl-adi2.h b/include/linux/platform_data/pinctrl-adi2.h
new file mode 100644
index 000000000000..8f91300617ec
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-adi2.h
@@ -0,0 +1,40 @@
1/*
2 * Pinctrl Driver for ADI GPIO2 controller
3 *
4 * Copyright 2007-2013 Analog Devices Inc.
5 *
6 * Licensed under the GPLv2 or later
7 */
8
9
10#ifndef PINCTRL_ADI2_H
11#define PINCTRL_ADI2_H
12
13#include <linux/io.h>
14#include <linux/platform_device.h>
15
16/**
17 * struct adi_pinctrl_gpio_platform_data - Pinctrl gpio platform data
18 * for ADI GPIO2 device.
19 *
20 * @port_gpio_base: Optional global GPIO index of the GPIO bank.
21 * 0 means driver decides.
22 * @port_pin_base: Pin index of the pin controller device.
23 * @port_width: PIN number of the GPIO bank device
24 * @pint_id: GPIO PINT device id that this GPIO bank should map to.
25 * @pint_assign: The 32-bit GPIO PINT registers can be divided into 2 parts. A
26 * GPIO bank can be mapped into either low 16 bits[0] or high 16
27 * bits[1] of each PINT register.
28 * @pint_map: GIOP bank mapping code in PINT device
29 */
30struct adi_pinctrl_gpio_platform_data {
31 unsigned int port_gpio_base;
32 unsigned int port_pin_base;
33 unsigned int port_width;
34 u8 pinctrl_id;
35 u8 pint_id;
36 bool pint_assign;
37 u8 pint_map;
38};
39
40#endif
diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h
new file mode 100644
index 000000000000..72eacda9b360
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-single.h
@@ -0,0 +1,12 @@
1/**
2 * irq: optional wake-up interrupt
3 * rearm: optional soc specific rearm function
4 *
5 * Note that the irq and rearm setup should come from device
6 * tree except for omap where there are still some dependencies
7 * to the legacy PRM code.
8 */
9struct pcs_pdata {
10 int irq;
11 void (*rearm)(void);
12};
diff --git a/include/linux/platform_data/usb-ehci-s5p.h b/include/linux/platform_data/usb-ehci-s5p.h
deleted file mode 100644
index 5f28cae18582..000000000000
--- a/include/linux/platform_data/usb-ehci-s5p.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __PLAT_SAMSUNG_EHCI_H
12#define __PLAT_SAMSUNG_EHCI_H __FILE__
13
14struct s5p_ehci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
20
21#endif /* __PLAT_SAMSUNG_EHCI_H */
diff --git a/include/linux/platform_data/usb-ohci-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h
deleted file mode 100644
index c256c595be5e..000000000000
--- a/include/linux/platform_data/usb-ohci-exynos.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MACH_EXYNOS_OHCI_H
12#define __MACH_EXYNOS_OHCI_H
13
14struct exynos4_ohci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
20
21#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/include/linux/platform_data/usb-rcar-gen2-phy.h b/include/linux/platform_data/usb-rcar-gen2-phy.h
new file mode 100644
index 000000000000..dd3ba46c0d90
--- /dev/null
+++ b/include/linux/platform_data/usb-rcar-gen2-phy.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __USB_RCAR_GEN2_PHY_H
11#define __USB_RCAR_GEN2_PHY_H
12
13#include <linux/types.h>
14
15struct rcar_gen2_phy_platform_data {
16 /* USB channel 0 configuration */
17 bool chan0_pci:1; /* true: PCI USB host 0, false: USBHS */
18 /* USB channel 2 configuration */
19 bool chan2_pci:1; /* true: PCI USB host 2, false: USBSS */
20};
21
22#endif
diff --git a/include/linux/platform_data/zforce_ts.h b/include/linux/platform_data/zforce_ts.h
new file mode 100644
index 000000000000..0472ab2f6ede
--- /dev/null
+++ b/include/linux/platform_data/zforce_ts.h
@@ -0,0 +1,26 @@
1/* drivers/input/touchscreen/zforce.c
2 *
3 * Copyright (C) 2012-2013 MundoReader S.L.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _LINUX_INPUT_ZFORCE_TS_H
16#define _LINUX_INPUT_ZFORCE_TS_H
17
18struct zforce_ts_platdata {
19 int gpio_int;
20 int gpio_rst;
21
22 unsigned int x_max;
23 unsigned int y_max;
24};
25
26#endif /* _LINUX_INPUT_ZFORCE_TS_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ce8e4ffd78c7..16f6654082dd 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -178,6 +178,7 @@ struct platform_driver {
178 int (*resume)(struct platform_device *); 178 int (*resume)(struct platform_device *);
179 struct device_driver driver; 179 struct device_driver driver;
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181 bool prevent_deferred_probe;
181}; 182};
182 183
183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ 184#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
new file mode 100644
index 000000000000..5151b0059585
--- /dev/null
+++ b/include/linux/pm_opp.h
@@ -0,0 +1,139 @@
1/*
2 * Generic OPP Interface
3 *
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
5 * Nishanth Menon
6 * Romit Dasgupta
7 * Kevin Hilman
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __LINUX_OPP_H__
15#define __LINUX_OPP_H__
16
17#include <linux/err.h>
18#include <linux/cpufreq.h>
19#include <linux/notifier.h>
20
21struct dev_pm_opp;
22struct device;
23
24enum dev_pm_opp_event {
25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26};
27
28#if defined(CONFIG_PM_OPP)
29
30unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
31
32unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
33
34int dev_pm_opp_get_opp_count(struct device *dev);
35
36struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
37 unsigned long freq,
38 bool available);
39
40struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
41 unsigned long *freq);
42
43struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
44 unsigned long *freq);
45
46int dev_pm_opp_add(struct device *dev, unsigned long freq,
47 unsigned long u_volt);
48
49int dev_pm_opp_enable(struct device *dev, unsigned long freq);
50
51int dev_pm_opp_disable(struct device *dev, unsigned long freq);
52
53struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
54#else
55static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
56{
57 return 0;
58}
59
60static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
61{
62 return 0;
63}
64
65static inline int dev_pm_opp_get_opp_count(struct device *dev)
66{
67 return 0;
68}
69
70static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
71 unsigned long freq, bool available)
72{
73 return ERR_PTR(-EINVAL);
74}
75
76static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
77 unsigned long *freq)
78{
79 return ERR_PTR(-EINVAL);
80}
81
82static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
83 unsigned long *freq)
84{
85 return ERR_PTR(-EINVAL);
86}
87
88static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
89 unsigned long u_volt)
90{
91 return -EINVAL;
92}
93
94static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
95{
96 return 0;
97}
98
99static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
100{
101 return 0;
102}
103
104static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
105 struct device *dev)
106{
107 return ERR_PTR(-EINVAL);
108}
109#endif /* CONFIG_PM_OPP */
110
111#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
112int of_init_opp_table(struct device *dev);
113#else
114static inline int of_init_opp_table(struct device *dev)
115{
116 return -EINVAL;
117}
118#endif
119
120#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
121int dev_pm_opp_init_cpufreq_table(struct device *dev,
122 struct cpufreq_frequency_table **table);
123void dev_pm_opp_free_cpufreq_table(struct device *dev,
124 struct cpufreq_frequency_table **table);
125#else
126static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
127 struct cpufreq_frequency_table **table)
128{
129 return -EINVAL;
130}
131
132static inline
133void dev_pm_opp_free_cpufreq_table(struct device *dev,
134 struct cpufreq_frequency_table **table)
135{
136}
137#endif /* CONFIG_CPU_FREQ */
138
139#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/power/bq24190_charger.h b/include/linux/power/bq24190_charger.h
new file mode 100644
index 000000000000..9f0283721cbc
--- /dev/null
+++ b/include/linux/power/bq24190_charger.h
@@ -0,0 +1,16 @@
1/*
2 * Platform data for the TI bq24190 battery charger driver.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _BQ24190_CHARGER_H_
10#define _BQ24190_CHARGER_H_
11
12struct bq24190_platform_data {
13 unsigned int gpio_int; /* GPIO pin that's connected to INT# */
14};
15
16#endif
diff --git a/include/linux/irqchip/bcm2835.h b/include/linux/power/bq24735-charger.h
index 48a859bc9dca..f536164a6069 100644
--- a/include/linux/irqchip/bcm2835.h
+++ b/include/linux/power/bq24735-charger.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * Copyright (C) 2010 Broadcom
3 * 2 *
4 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -16,14 +15,25 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 16 */
18 17
19#ifndef __LINUX_IRQCHIP_BCM2835_H_ 18#ifndef __CHARGER_BQ24735_H_
20#define __LINUX_IRQCHIP_BCM2835_H_ 19#define __CHARGER_BQ24735_H_
21 20
22#include <asm/exception.h> 21#include <linux/types.h>
22#include <linux/power_supply.h>
23 23
24extern void bcm2835_init_irq(void); 24struct bq24735_platform {
25 uint32_t charge_current;
26 uint32_t charge_voltage;
27 uint32_t input_current;
25 28
26extern asmlinkage void __exception_irq_entry bcm2835_handle_irq( 29 const char *name;
27 struct pt_regs *regs);
28 30
29#endif 31 int status_gpio;
32 int status_gpio_active_low;
33 bool status_gpio_valid;
34
35 char **supplied_to;
36 size_t num_supplicants;
37};
38
39#endif /* __CHARGER_BQ24735_H_ */
diff --git a/include/linux/power/twl4030_madc_battery.h b/include/linux/power/twl4030_madc_battery.h
new file mode 100644
index 000000000000..23110dc77726
--- /dev/null
+++ b/include/linux/power/twl4030_madc_battery.h
@@ -0,0 +1,39 @@
1/*
2 * Dumb driver for LiIon batteries using TWL4030 madc.
3 *
4 * Copyright 2013 Golden Delicious Computers
5 * Nikolaus Schaller <hns@goldelico.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, write to the Free Software Foundation, Inc.,
14 * 675 Mass Ave, Cambridge, MA 02139, USA.
15 *
16 */
17
18#ifndef __TWL4030_MADC_BATTERY_H
19#define __TWL4030_MADC_BATTERY_H
20
21/*
22 * Usually we can assume 100% @ 4.15V and 0% @ 3.3V but curves differ for
23 * charging and discharging!
24 */
25
26struct twl4030_madc_bat_calibration {
27 short voltage; /* in mV - specify -1 for end of list */
28 short level; /* in percent (0 .. 100%) */
29};
30
31struct twl4030_madc_bat_platform_data {
32 unsigned int capacity; /* total capacity in uAh */
33 struct twl4030_madc_bat_calibration *charging;
34 int charging_size;
35 struct twl4030_madc_bat_calibration *discharging;
36 int discharging_size;
37};
38
39#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 804b90643a85..5c2600630dc9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/workqueue.h> 16#include <linux/workqueue.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/spinlock.h>
18 19
19struct device; 20struct device;
20 21
@@ -194,6 +195,8 @@ struct power_supply {
194 /* private */ 195 /* private */
195 struct device *dev; 196 struct device *dev;
196 struct work_struct changed_work; 197 struct work_struct changed_work;
198 spinlock_t changed_lock;
199 bool changed;
197#ifdef CONFIG_THERMAL 200#ifdef CONFIG_THERMAL
198 struct thermal_zone_device *tzd; 201 struct thermal_zone_device *tzd;
199 struct thermal_cooling_device *tcd; 202 struct thermal_cooling_device *tcd;
diff --git a/include/linux/powercap.h b/include/linux/powercap.h
new file mode 100644
index 000000000000..4e250417ee30
--- /dev/null
+++ b/include/linux/powercap.h
@@ -0,0 +1,325 @@
1/*
2 * powercap.h: Data types and headers for sysfs power capping interface
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.
16 *
17 */
18
19#ifndef __POWERCAP_H__
20#define __POWERCAP_H__
21
22#include <linux/device.h>
23#include <linux/idr.h>
24
25/*
26 * A power cap class device can contain multiple powercap control_types.
27 * Each control_type can have multiple power zones, which can be independently
28 * controlled. Each power zone can have one or more constraints.
29 */
30
31struct powercap_control_type;
32struct powercap_zone;
33struct powercap_zone_constraint;
34
35/**
36 * struct powercap_control_type_ops - Define control type callbacks
37 * @set_enable: Enable/Disable whole control type.
38 * Default is enabled. But this callback allows all zones
39 * to be in disable state and remove any applied power
40 * limits. If disabled power zone can only be monitored
41 * not controlled.
42 * @get_enable: get Enable/Disable status.
43 * @release: Callback to inform that last reference to this
44 * control type is closed. So it is safe to free data
45 * structure associated with this control type.
46 * This callback is mandatory if the client own memory
47 * for the control type.
48 *
49 * This structure defines control type callbacks to be implemented by client
50 * drivers
51 */
52struct powercap_control_type_ops {
53 int (*set_enable) (struct powercap_control_type *, bool mode);
54 int (*get_enable) (struct powercap_control_type *, bool *mode);
55 int (*release) (struct powercap_control_type *);
56};
57
58/**
59 * struct powercap_control_type- Defines a powercap control_type
60 * @name: name of control_type
61 * @dev: device for this control_type
62 * @idr: idr to have unique id for its child
63 * @root_node: Root holding power zones for this control_type
64 * @ops: Pointer to callback struct
65 * @node_lock: mutex for control type
66 * @allocated: This is possible that client owns the memory
67 * used by this structure. In this case
68 * this flag is set to false by framework to
69 * prevent deallocation during release process.
70 * Otherwise this flag is set to true.
71 * @ctrl_inst: link to the control_type list
72 *
73 * Defines powercap control_type. This acts as a container for power
74 * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc.
75 * All fields are private and should not be used by client drivers.
76 */
77struct powercap_control_type {
78 struct device dev;
79 struct idr idr;
80 int nr_zones;
81 const struct powercap_control_type_ops *ops;
82 struct mutex lock;
83 bool allocated;
84 struct list_head node;
85};
86
87/**
88 * struct powercap_zone_ops - Define power zone callbacks
89 * @get_max_energy_range_uj: Get maximum range of energy counter in
90 * micro-joules.
91 * @get_energy_uj: Get current energy counter in micro-joules.
92 * @reset_energy_uj: Reset micro-joules energy counter.
93 * @get_max_power_range_uw: Get maximum range of power counter in
94 * micro-watts.
95 * @get_power_uw: Get current power counter in micro-watts.
96 * @set_enable: Enable/Disable power zone controls.
97 * Default is enabled.
98 * @get_enable: get Enable/Disable status.
99 * @release: Callback to inform that last reference to this
100 * control type is closed. So it is safe to free
101 * data structure associated with this
102 * control type. Mandatory, if client driver owns
103 * the power_zone memory.
104 *
105 * This structure defines zone callbacks to be implemented by client drivers.
106 * Client drives can define both energy and power related callbacks. But at
107 * the least one type (either power or energy) is mandatory. Client drivers
108 * should handle mutual exclusion, if required in callbacks.
109 */
110struct powercap_zone_ops {
111 int (*get_max_energy_range_uj) (struct powercap_zone *, u64 *);
112 int (*get_energy_uj) (struct powercap_zone *, u64 *);
113 int (*reset_energy_uj) (struct powercap_zone *);
114 int (*get_max_power_range_uw) (struct powercap_zone *, u64 *);
115 int (*get_power_uw) (struct powercap_zone *, u64 *);
116 int (*set_enable) (struct powercap_zone *, bool mode);
117 int (*get_enable) (struct powercap_zone *, bool *mode);
118 int (*release) (struct powercap_zone *);
119};
120
121#define POWERCAP_ZONE_MAX_ATTRS 6
122#define POWERCAP_CONSTRAINTS_ATTRS 8
123#define MAX_CONSTRAINTS_PER_ZONE 10
124/**
125 * struct powercap_zone- Defines instance of a power cap zone
126 * @id: Unique id
127 * @name: Power zone name.
128 * @control_type_inst: Control type instance for this zone.
129 * @ops: Pointer to the zone operation structure.
130 * @dev: Instance of a device.
131 * @const_id_cnt: Number of constraint defined.
132 * @idr: Instance to an idr entry for children zones.
133 * @parent_idr: To remove reference from the parent idr.
134 * @private_data: Private data pointer if any for this zone.
135 * @zone_dev_attrs: Attributes associated with this device.
136 * @zone_attr_count: Attribute count.
137 * @dev_zone_attr_group: Attribute group for attributes.
138 * @dev_attr_groups: Attribute group store to register with device.
139 * @allocated: This is possible that client owns the memory
140 * used by this structure. In this case
141 * this flag is set to false by framework to
142 * prevent deallocation during release process.
143 * Otherwise this flag is set to true.
144 * @constraint_ptr: List of constraints for this zone.
145 *
146 * This defines a power zone instance. The fields of this structure are
147 * private, and should not be used by client drivers.
148 */
149struct powercap_zone {
150 int id;
151 char *name;
152 void *control_type_inst;
153 const struct powercap_zone_ops *ops;
154 struct device dev;
155 int const_id_cnt;
156 struct idr idr;
157 struct idr *parent_idr;
158 void *private_data;
159 struct attribute **zone_dev_attrs;
160 int zone_attr_count;
161 struct attribute_group dev_zone_attr_group;
162 const struct attribute_group *dev_attr_groups[2]; /* 1 group + NULL */
163 bool allocated;
164 struct powercap_zone_constraint *constraints;
165};
166
167/**
168 * struct powercap_zone_constraint_ops - Define constraint callbacks
169 * @set_power_limit_uw: Set power limit in micro-watts.
170 * @get_power_limit_uw: Get power limit in micro-watts.
171 * @set_time_window_us: Set time window in micro-seconds.
172 * @get_time_window_us: Get time window in micro-seconds.
173 * @get_max_power_uw: Get max power allowed in micro-watts.
174 * @get_min_power_uw: Get min power allowed in micro-watts.
175 * @get_max_time_window_us: Get max time window allowed in micro-seconds.
176 * @get_min_time_window_us: Get min time window allowed in micro-seconds.
177 * @get_name: Get the name of constraint
178 *
179 * This structure is used to define the constraint callbacks for the client
180 * drivers. The following callbacks are mandatory and can't be NULL:
181 * set_power_limit_uw
182 * get_power_limit_uw
183 * set_time_window_us
184 * get_time_window_us
185 * get_name
186 * Client drivers should handle mutual exclusion, if required in callbacks.
187 */
188struct powercap_zone_constraint_ops {
189 int (*set_power_limit_uw) (struct powercap_zone *, int, u64);
190 int (*get_power_limit_uw) (struct powercap_zone *, int, u64 *);
191 int (*set_time_window_us) (struct powercap_zone *, int, u64);
192 int (*get_time_window_us) (struct powercap_zone *, int, u64 *);
193 int (*get_max_power_uw) (struct powercap_zone *, int, u64 *);
194 int (*get_min_power_uw) (struct powercap_zone *, int, u64 *);
195 int (*get_max_time_window_us) (struct powercap_zone *, int, u64 *);
196 int (*get_min_time_window_us) (struct powercap_zone *, int, u64 *);
197 const char *(*get_name) (struct powercap_zone *, int);
198};
199
200/**
201 * struct powercap_zone_constraint- Defines instance of a constraint
202 * @id: Instance Id of this constraint.
203 * @power_zone: Pointer to the power zone for this constraint.
204 * @ops: Pointer to the constraint callbacks.
205 *
206 * This defines a constraint instance.
207 */
208struct powercap_zone_constraint {
209 int id;
210 struct powercap_zone *power_zone;
211 struct powercap_zone_constraint_ops *ops;
212};
213
214
215/* For clients to get their device pointer, may be used for dev_dbgs */
216#define POWERCAP_GET_DEV(power_zone) (&power_zone->dev)
217
218/**
219* powercap_set_zone_data() - Set private data for a zone
220* @power_zone: A pointer to the valid zone instance.
221* @pdata: A pointer to the user private data.
222*
223* Allows client drivers to associate some private data to zone instance.
224*/
225static inline void powercap_set_zone_data(struct powercap_zone *power_zone,
226 void *pdata)
227{
228 if (power_zone)
229 power_zone->private_data = pdata;
230}
231
232/**
233* powercap_get_zone_data() - Get private data for a zone
234* @power_zone: A pointer to the valid zone instance.
235*
236* Allows client drivers to get private data associate with a zone,
237* using call to powercap_set_zone_data.
238*/
239static inline void *powercap_get_zone_data(struct powercap_zone *power_zone)
240{
241 if (power_zone)
242 return power_zone->private_data;
243 return NULL;
244}
245
246/**
247* powercap_register_control_type() - Register a control_type with framework
248* @control_type: Pointer to client allocated memory for the control type
249* structure storage. If this is NULL, powercap framework
250* will allocate memory and own it.
251* Advantage of this parameter is that client can embed
252* this data in its data structures and allocate in a
253* single call, preventing multiple allocations.
254* @control_type_name: The Name of this control_type, which will be shown
255* in the sysfs Interface.
256* @ops: Callbacks for control type. This parameter is optional.
257*
258* Used to create a control_type with the power capping class. Here control_type
259* can represent a type of technology, which can control a range of power zones.
260* For example a control_type can be RAPL (Running Average Power Limit)
261* Intel® 64 and IA-32 Processor Architectures. The name can be any string
262* which must be unique, otherwise this function returns NULL.
263* A pointer to the control_type instance is returned on success.
264*/
265struct powercap_control_type *powercap_register_control_type(
266 struct powercap_control_type *control_type,
267 const char *name,
268 const struct powercap_control_type_ops *ops);
269
270/**
271* powercap_unregister_control_type() - Unregister a control_type from framework
272* @instance: A pointer to the valid control_type instance.
273*
274* Used to unregister a control_type with the power capping class.
275* All power zones registered under this control type have to be unregistered
276* before calling this function, or it will fail with an error code.
277*/
278int powercap_unregister_control_type(struct powercap_control_type *instance);
279
280/* Zone register/unregister API */
281
282/**
283* powercap_register_zone() - Register a power zone
284* @power_zone: Pointer to client allocated memory for the power zone structure
285* storage. If this is NULL, powercap framework will allocate
286* memory and own it. Advantage of this parameter is that client
287* can embed this data in its data structures and allocate in a
288* single call, preventing multiple allocations.
289* @control_type: A control_type instance under which this zone operates.
290* @name: A name for this zone.
291* @parent: A pointer to the parent power zone instance if any or NULL
292* @ops: Pointer to zone operation callback structure.
293* @no_constraints: Number of constraints for this zone
294* @const_ops: Pointer to constraint callback structure
295*
296* Register a power zone under a given control type. A power zone must register
297* a pointer to a structure representing zone callbacks.
298* A power zone can be located under a parent power zone, in which case @parent
299* should point to it. Otherwise, if @parent is NULL, the new power zone will
300* be located directly under the given control type
301* For each power zone there may be a number of constraints that appear in the
302* sysfs under that zone as attributes with unique numeric IDs.
303* Returns pointer to the power_zone on success.
304*/
305struct powercap_zone *powercap_register_zone(
306 struct powercap_zone *power_zone,
307 struct powercap_control_type *control_type,
308 const char *name,
309 struct powercap_zone *parent,
310 const struct powercap_zone_ops *ops,
311 int nr_constraints,
312 struct powercap_zone_constraint_ops *const_ops);
313
314/**
315* powercap_unregister_zone() - Unregister a zone device
316* @control_type: A pointer to the valid instance of a control_type.
317* @power_zone: A pointer to the valid zone instance for a control_type
318*
319* Used to unregister a zone device for a control_type. Caller should
320* make sure that children for this zone are unregistered first.
321*/
322int powercap_unregister_zone(struct powercap_control_type *control_type,
323 struct powercap_zone *power_zone);
324
325#endif
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index f5d4723cdb3d..a3d9dc8c2c00 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -6,106 +6,95 @@
6 * preempt_count (used for kernel preemption, interrupt count, etc.) 6 * preempt_count (used for kernel preemption, interrupt count, etc.)
7 */ 7 */
8 8
9#include <linux/thread_info.h>
10#include <linux/linkage.h> 9#include <linux/linkage.h>
11#include <linux/list.h> 10#include <linux/list.h>
12 11
13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 12/*
14 extern void add_preempt_count(int val); 13 * We use the MSB mostly because its available; see <linux/preempt_mask.h> for
15 extern void sub_preempt_count(int val); 14 * the other bits -- can't include that header due to inclusion hell.
16#else 15 */
17# define add_preempt_count(val) do { preempt_count() += (val); } while (0) 16#define PREEMPT_NEED_RESCHED 0x80000000
18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
19#endif
20
21#define inc_preempt_count() add_preempt_count(1)
22#define dec_preempt_count() sub_preempt_count(1)
23
24#define preempt_count() (current_thread_info()->preempt_count)
25
26#ifdef CONFIG_PREEMPT
27
28asmlinkage void preempt_schedule(void);
29
30#define preempt_check_resched() \
31do { \
32 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
33 preempt_schedule(); \
34} while (0)
35
36#ifdef CONFIG_CONTEXT_TRACKING
37 17
38void preempt_schedule_context(void); 18#include <asm/preempt.h>
39 19
40#define preempt_check_resched_context() \ 20#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
41do { \ 21extern void preempt_count_add(int val);
42 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ 22extern void preempt_count_sub(int val);
43 preempt_schedule_context(); \ 23#define preempt_count_dec_and_test() ({ preempt_count_sub(1); should_resched(); })
44} while (0)
45#else 24#else
25#define preempt_count_add(val) __preempt_count_add(val)
26#define preempt_count_sub(val) __preempt_count_sub(val)
27#define preempt_count_dec_and_test() __preempt_count_dec_and_test()
28#endif
46 29
47#define preempt_check_resched_context() preempt_check_resched() 30#define __preempt_count_inc() __preempt_count_add(1)
48 31#define __preempt_count_dec() __preempt_count_sub(1)
49#endif /* CONFIG_CONTEXT_TRACKING */
50
51#else /* !CONFIG_PREEMPT */
52
53#define preempt_check_resched() do { } while (0)
54#define preempt_check_resched_context() do { } while (0)
55
56#endif /* CONFIG_PREEMPT */
57 32
33#define preempt_count_inc() preempt_count_add(1)
34#define preempt_count_dec() preempt_count_sub(1)
58 35
59#ifdef CONFIG_PREEMPT_COUNT 36#ifdef CONFIG_PREEMPT_COUNT
60 37
61#define preempt_disable() \ 38#define preempt_disable() \
62do { \ 39do { \
63 inc_preempt_count(); \ 40 preempt_count_inc(); \
64 barrier(); \ 41 barrier(); \
65} while (0) 42} while (0)
66 43
67#define sched_preempt_enable_no_resched() \ 44#define sched_preempt_enable_no_resched() \
68do { \ 45do { \
69 barrier(); \ 46 barrier(); \
70 dec_preempt_count(); \ 47 preempt_count_dec(); \
71} while (0) 48} while (0)
72 49
73#define preempt_enable_no_resched() sched_preempt_enable_no_resched() 50#define preempt_enable_no_resched() sched_preempt_enable_no_resched()
74 51
52#ifdef CONFIG_PREEMPT
75#define preempt_enable() \ 53#define preempt_enable() \
76do { \ 54do { \
77 preempt_enable_no_resched(); \
78 barrier(); \ 55 barrier(); \
79 preempt_check_resched(); \ 56 if (unlikely(preempt_count_dec_and_test())) \
57 __preempt_schedule(); \
58} while (0)
59
60#define preempt_check_resched() \
61do { \
62 if (should_resched()) \
63 __preempt_schedule(); \
80} while (0) 64} while (0)
81 65
82/* For debugging and tracer internals only! */ 66#else
83#define add_preempt_count_notrace(val) \ 67#define preempt_enable() preempt_enable_no_resched()
84 do { preempt_count() += (val); } while (0) 68#define preempt_check_resched() do { } while (0)
85#define sub_preempt_count_notrace(val) \ 69#endif
86 do { preempt_count() -= (val); } while (0)
87#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
88#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
89 70
90#define preempt_disable_notrace() \ 71#define preempt_disable_notrace() \
91do { \ 72do { \
92 inc_preempt_count_notrace(); \ 73 __preempt_count_inc(); \
93 barrier(); \ 74 barrier(); \
94} while (0) 75} while (0)
95 76
96#define preempt_enable_no_resched_notrace() \ 77#define preempt_enable_no_resched_notrace() \
97do { \ 78do { \
98 barrier(); \ 79 barrier(); \
99 dec_preempt_count_notrace(); \ 80 __preempt_count_dec(); \
100} while (0) 81} while (0)
101 82
102/* preempt_check_resched is OK to trace */ 83#ifdef CONFIG_PREEMPT
84
85#ifndef CONFIG_CONTEXT_TRACKING
86#define __preempt_schedule_context() __preempt_schedule()
87#endif
88
103#define preempt_enable_notrace() \ 89#define preempt_enable_notrace() \
104do { \ 90do { \
105 preempt_enable_no_resched_notrace(); \
106 barrier(); \ 91 barrier(); \
107 preempt_check_resched_context(); \ 92 if (unlikely(__preempt_count_dec_and_test())) \
93 __preempt_schedule_context(); \
108} while (0) 94} while (0)
95#else
96#define preempt_enable_notrace() preempt_enable_no_resched_notrace()
97#endif
109 98
110#else /* !CONFIG_PREEMPT_COUNT */ 99#else /* !CONFIG_PREEMPT_COUNT */
111 100
@@ -115,10 +104,11 @@ do { \
115 * that can cause faults and scheduling migrate into our preempt-protected 104 * that can cause faults and scheduling migrate into our preempt-protected
116 * region. 105 * region.
117 */ 106 */
118#define preempt_disable() barrier() 107#define preempt_disable() barrier()
119#define sched_preempt_enable_no_resched() barrier() 108#define sched_preempt_enable_no_resched() barrier()
120#define preempt_enable_no_resched() barrier() 109#define preempt_enable_no_resched() barrier()
121#define preempt_enable() barrier() 110#define preempt_enable() barrier()
111#define preempt_check_resched() do { } while (0)
122 112
123#define preempt_disable_notrace() barrier() 113#define preempt_disable_notrace() barrier()
124#define preempt_enable_no_resched_notrace() barrier() 114#define preempt_enable_no_resched_notrace() barrier()
diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
index 931bc616219f..d169820203dd 100644
--- a/include/linux/preempt_mask.h
+++ b/include/linux/preempt_mask.h
@@ -11,36 +11,23 @@
11 * - bits 0-7 are the preemption count (max preemption depth: 256) 11 * - bits 0-7 are the preemption count (max preemption depth: 256)
12 * - bits 8-15 are the softirq count (max # of softirqs: 256) 12 * - bits 8-15 are the softirq count (max # of softirqs: 256)
13 * 13 *
14 * The hardirq count can in theory reach the same as NR_IRQS. 14 * The hardirq count could in theory be the same as the number of
15 * In reality, the number of nested IRQS is limited to the stack 15 * interrupts in the system, but we run all interrupt handlers with
16 * size as well. For archs with over 1000 IRQS it is not practical 16 * interrupts disabled, so we cannot have nesting interrupts. Though
17 * to expect that they will all nest. We give a max of 10 bits for 17 * there are a few palaeontologic drivers which reenable interrupts in
18 * hardirq nesting. An arch may choose to give less than 10 bits. 18 * the handler, so we need more than one bit here.
19 * m68k expects it to be 8.
20 * 19 *
21 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024) 20 * PREEMPT_MASK: 0x000000ff
22 * - bit 26 is the NMI_MASK 21 * SOFTIRQ_MASK: 0x0000ff00
23 * - bit 27 is the PREEMPT_ACTIVE flag 22 * HARDIRQ_MASK: 0x000f0000
24 * 23 * NMI_MASK: 0x00100000
25 * PREEMPT_MASK: 0x000000ff 24 * PREEMPT_ACTIVE: 0x00200000
26 * SOFTIRQ_MASK: 0x0000ff00
27 * HARDIRQ_MASK: 0x03ff0000
28 * NMI_MASK: 0x04000000
29 */ 25 */
30#define PREEMPT_BITS 8 26#define PREEMPT_BITS 8
31#define SOFTIRQ_BITS 8 27#define SOFTIRQ_BITS 8
28#define HARDIRQ_BITS 4
32#define NMI_BITS 1 29#define NMI_BITS 1
33 30
34#define MAX_HARDIRQ_BITS 10
35
36#ifndef HARDIRQ_BITS
37# define HARDIRQ_BITS MAX_HARDIRQ_BITS
38#endif
39
40#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
41#error HARDIRQ_BITS too high!
42#endif
43
44#define PREEMPT_SHIFT 0 31#define PREEMPT_SHIFT 0
45#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) 32#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
46#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) 33#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
@@ -60,15 +47,9 @@
60 47
61#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET) 48#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
62 49
63#ifndef PREEMPT_ACTIVE
64#define PREEMPT_ACTIVE_BITS 1 50#define PREEMPT_ACTIVE_BITS 1
65#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS) 51#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
66#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT) 52#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
67#endif
68
69#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
70#error PREEMPT_ACTIVE is too low!
71#endif
72 53
73#define hardirq_count() (preempt_count() & HARDIRQ_MASK) 54#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
74#define softirq_count() (preempt_count() & SOFTIRQ_MASK) 55#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a782481..694925837a16 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -233,6 +233,8 @@ extern asmlinkage void dump_stack(void) __cold;
233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
234#endif 234#endif
235 235
236#include <linux/dynamic_debug.h>
237
236/* If you are writing a driver, please use dev_dbg instead */ 238/* If you are writing a driver, please use dev_dbg instead */
237#if defined(CONFIG_DYNAMIC_DEBUG) 239#if defined(CONFIG_DYNAMIC_DEBUG)
238/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 240/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
@@ -343,7 +345,19 @@ extern asmlinkage void dump_stack(void) __cold;
343#endif 345#endif
344 346
345/* If you are writing a driver, please use dev_dbg instead */ 347/* If you are writing a driver, please use dev_dbg instead */
346#if defined(DEBUG) 348#if defined(CONFIG_DYNAMIC_DEBUG)
349/* descriptor check is first to prevent flooding with "callbacks suppressed" */
350#define pr_debug_ratelimited(fmt, ...) \
351do { \
352 static DEFINE_RATELIMIT_STATE(_rs, \
353 DEFAULT_RATELIMIT_INTERVAL, \
354 DEFAULT_RATELIMIT_BURST); \
355 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
356 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
357 __ratelimit(&_rs)) \
358 __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
359} while (0)
360#elif defined(DEBUG)
347#define pr_debug_ratelimited(fmt, ...) \ 361#define pr_debug_ratelimited(fmt, ...) \
348 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 362 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
349#else 363#else
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 56f4a866539a..2de2e275b2cb 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -6,6 +6,9 @@
6 6
7#include <linux/backlight.h> 7#include <linux/backlight.h>
8 8
9/* TODO: convert to gpiod_*() API once it has been merged */
10#define PWM_BACKLIGHT_GPIO_ACTIVE_LOW (1 << 0)
11
9struct platform_pwm_backlight_data { 12struct platform_pwm_backlight_data {
10 int pwm_id; 13 int pwm_id;
11 unsigned int max_brightness; 14 unsigned int max_brightness;
@@ -13,6 +16,8 @@ struct platform_pwm_backlight_data {
13 unsigned int lth_brightness; 16 unsigned int lth_brightness;
14 unsigned int pwm_period_ns; 17 unsigned int pwm_period_ns;
15 unsigned int *levels; 18 unsigned int *levels;
19 int enable_gpio;
20 unsigned long enable_gpio_flags;
16 int (*init)(struct device *dev); 21 int (*init)(struct device *dev);
17 int (*notify)(struct device *dev, int brightness); 22 int (*notify)(struct device *dev, int brightness);
18 void (*notify_after)(struct device *dev, int brightness); 23 void (*notify_after)(struct device *dev, int brightness);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d13371134c59..cc7494a35429 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -328,6 +328,7 @@ struct quotactl_ops {
328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *); 328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
330 int (*set_xstate)(struct super_block *, unsigned int, int); 330 int (*set_xstate)(struct super_block *, unsigned int, int);
331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
331}; 332};
332 333
333struct quota_format_type { 334struct quota_format_type {
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index ffc444c38b0a..403940787be1 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -231,6 +231,7 @@ unsigned long radix_tree_next_hole(struct radix_tree_root *root,
231unsigned long radix_tree_prev_hole(struct radix_tree_root *root, 231unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
232 unsigned long index, unsigned long max_scan); 232 unsigned long index, unsigned long max_scan);
233int radix_tree_preload(gfp_t gfp_mask); 233int radix_tree_preload(gfp_t gfp_mask);
234int radix_tree_maybe_preload(gfp_t gfp_mask);
234void radix_tree_init(void); 235void radix_tree_init(void);
235void *radix_tree_tag_set(struct radix_tree_root *root, 236void *radix_tree_tag_set(struct radix_tree_root *root,
236 unsigned long index, unsigned int tag); 237 unsigned long index, unsigned int tag);
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 0f424698064f..73069cb6c54a 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -101,6 +101,7 @@ extern const struct raid6_calls raid6_altivec8;
101extern const struct raid6_calls raid6_avx2x1; 101extern const struct raid6_calls raid6_avx2x1;
102extern const struct raid6_calls raid6_avx2x2; 102extern const struct raid6_calls raid6_avx2x2;
103extern const struct raid6_calls raid6_avx2x4; 103extern const struct raid6_calls raid6_avx2x4;
104extern const struct raid6_calls raid6_tilegx8;
104 105
105struct raid6_recov_calls { 106struct raid6_recov_calls {
106 void (*data2)(int, size_t, int, int, void **); 107 void (*data2)(int, size_t, int, int, void **);
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 69e37c2d1ea5..753207c8ce20 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -25,7 +25,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
25 25
26extern const struct file_operations ramfs_file_operations; 26extern const struct file_operations ramfs_file_operations;
27extern const struct vm_operations_struct generic_file_vm_ops; 27extern const struct vm_operations_struct generic_file_vm_ops;
28extern int __init init_rootfs(void); 28extern int __init init_ramfs_fs(void);
29 29
30int ramfs_fill_super(struct super_block *sb, void *data, int silent); 30int ramfs_fill_super(struct super_block *sb, void *data, int silent);
31 31
diff --git a/include/linux/random.h b/include/linux/random.h
index 3b9377d6b7a5..4002b3df4c85 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags);
17extern void get_random_bytes(void *buf, int nbytes); 17extern void get_random_bytes(void *buf, int nbytes);
18extern void get_random_bytes_arch(void *buf, int nbytes); 18extern void get_random_bytes_arch(void *buf, int nbytes);
19void generate_random_uuid(unsigned char uuid_out[16]); 19void generate_random_uuid(unsigned char uuid_out[16]);
20extern int random_int_secret_init(void);
20 21
21#ifndef MODULE 22#ifndef MODULE
22extern const struct file_operations random_fops, urandom_fops; 23extern const struct file_operations random_fops, urandom_fops;
@@ -28,8 +29,13 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
28u32 prandom_u32(void); 29u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 30void prandom_bytes(void *buf, int nbytes);
30void prandom_seed(u32 seed); 31void prandom_seed(u32 seed);
32void prandom_reseed_late(void);
31 33
32u32 prandom_u32_state(struct rnd_state *); 34struct rnd_state {
35 __u32 s1, s2, s3, s4;
36};
37
38u32 prandom_u32_state(struct rnd_state *state);
33void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 39void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
34 40
35/* 41/*
@@ -49,9 +55,10 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
49{ 55{
50 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 56 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
51 57
52 state->s1 = __seed(i, 1); 58 state->s1 = __seed(i, 2U);
53 state->s2 = __seed(i, 7); 59 state->s2 = __seed(i, 8U);
54 state->s3 = __seed(i, 15); 60 state->s3 = __seed(i, 16U);
61 state->s4 = __seed(i, 128U);
55} 62}
56 63
57#ifdef CONFIG_ARCH_RANDOM 64#ifdef CONFIG_ARCH_RANDOM
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 0022c1bb1e26..57e75ae9910f 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -68,6 +68,10 @@ extern struct rb_node *rb_prev(const struct rb_node *);
68extern struct rb_node *rb_first(const struct rb_root *); 68extern struct rb_node *rb_first(const struct rb_root *);
69extern struct rb_node *rb_last(const struct rb_root *); 69extern struct rb_node *rb_last(const struct rb_root *);
70 70
71/* Postorder iteration - always visit the parent after its children */
72extern struct rb_node *rb_first_postorder(const struct rb_root *);
73extern struct rb_node *rb_next_postorder(const struct rb_node *);
74
71/* Fast replacement of a single node without remove/rebalance/add/rebalance */ 75/* Fast replacement of a single node without remove/rebalance/add/rebalance */
72extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 76extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
73 struct rb_root *root); 77 struct rb_root *root);
@@ -81,4 +85,24 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
81 *rb_link = node; 85 *rb_link = node;
82} 86}
83 87
88#define rb_entry_safe(ptr, type, member) \
89 ({ typeof(ptr) ____ptr = (ptr); \
90 ____ptr ? rb_entry(____ptr, type, member) : NULL; \
91 })
92
93/**
94 * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
95 * given type safe against removal of rb_node entry
96 *
97 * @pos: the 'type *' to use as a loop cursor.
98 * @n: another 'type *' to use as temporary storage
99 * @root: 'rb_root *' of the rbtree.
100 * @field: the name of the rb_node field within 'type'.
101 */
102#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
103 for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \
104 pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \
105 typeof(*pos), field); 1; }); \
106 pos = n)
107
84#endif /* _LINUX_RBTREE_H */ 108#endif /* _LINUX_RBTREE_H */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 4106721c4e5e..45a0a9e81478 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -19,6 +19,21 @@
19 */ 19 */
20 20
21/* 21/*
22 * INIT_LIST_HEAD_RCU - Initialize a list_head visible to RCU readers
23 * @list: list to be initialized
24 *
25 * You should instead use INIT_LIST_HEAD() for normal initialization and
26 * cleanup tasks, when readers have no access to the list being initialized.
27 * However, if the list being initialized is visible to readers, you
28 * need to keep the compiler from being too mischievous.
29 */
30static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
31{
32 ACCESS_ONCE(list->next) = list;
33 ACCESS_ONCE(list->prev) = list;
34}
35
36/*
22 * return the ->next pointer of a list_head in an rcu safe 37 * return the ->next pointer of a list_head in an rcu safe
23 * way, we must not access it directly 38 * way, we must not access it directly
24 */ 39 */
@@ -191,9 +206,13 @@ static inline void list_splice_init_rcu(struct list_head *list,
191 if (list_empty(list)) 206 if (list_empty(list))
192 return; 207 return;
193 208
194 /* "first" and "last" tracking list, so initialize it. */ 209 /*
210 * "first" and "last" tracking list, so initialize it. RCU readers
211 * have access to this list, so we must use INIT_LIST_HEAD_RCU()
212 * instead of INIT_LIST_HEAD().
213 */
195 214
196 INIT_LIST_HEAD(list); 215 INIT_LIST_HEAD_RCU(list);
197 216
198 /* 217 /*
199 * At this point, the list body still points to the source list. 218 * At this point, the list body still points to the source list.
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index f1f1bc39346b..39cbb889e20d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -261,6 +261,10 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
261 rcu_irq_exit(); \ 261 rcu_irq_exit(); \
262 } while (0) 262 } while (0)
263 263
264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
265extern bool __rcu_is_watching(void);
266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267
264/* 268/*
265 * Infrastructure to implement the synchronize_() primitives in 269 * Infrastructure to implement the synchronize_() primitives in
266 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 270 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
@@ -297,10 +301,6 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
297} 301}
298#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 302#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
299 303
300#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP)
301extern int rcu_is_cpu_idle(void);
302#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP) */
303
304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) 304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU)
305bool rcu_lockdep_current_cpu_online(void); 305bool rcu_lockdep_current_cpu_online(void);
306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
@@ -351,7 +351,7 @@ static inline int rcu_read_lock_held(void)
351{ 351{
352 if (!debug_lockdep_rcu_enabled()) 352 if (!debug_lockdep_rcu_enabled())
353 return 1; 353 return 1;
354 if (rcu_is_cpu_idle()) 354 if (!rcu_is_watching())
355 return 0; 355 return 0;
356 if (!rcu_lockdep_current_cpu_online()) 356 if (!rcu_lockdep_current_cpu_online())
357 return 0; 357 return 0;
@@ -402,7 +402,7 @@ static inline int rcu_read_lock_sched_held(void)
402 402
403 if (!debug_lockdep_rcu_enabled()) 403 if (!debug_lockdep_rcu_enabled())
404 return 1; 404 return 1;
405 if (rcu_is_cpu_idle()) 405 if (!rcu_is_watching())
406 return 0; 406 return 0;
407 if (!rcu_lockdep_current_cpu_online()) 407 if (!rcu_lockdep_current_cpu_online())
408 return 0; 408 return 0;
@@ -771,7 +771,7 @@ static inline void rcu_read_lock(void)
771 __rcu_read_lock(); 771 __rcu_read_lock();
772 __acquire(RCU); 772 __acquire(RCU);
773 rcu_lock_acquire(&rcu_lock_map); 773 rcu_lock_acquire(&rcu_lock_map);
774 rcu_lockdep_assert(!rcu_is_cpu_idle(), 774 rcu_lockdep_assert(rcu_is_watching(),
775 "rcu_read_lock() used illegally while idle"); 775 "rcu_read_lock() used illegally while idle");
776} 776}
777 777
@@ -792,7 +792,7 @@ static inline void rcu_read_lock(void)
792 */ 792 */
793static inline void rcu_read_unlock(void) 793static inline void rcu_read_unlock(void)
794{ 794{
795 rcu_lockdep_assert(!rcu_is_cpu_idle(), 795 rcu_lockdep_assert(rcu_is_watching(),
796 "rcu_read_unlock() used illegally while idle"); 796 "rcu_read_unlock() used illegally while idle");
797 rcu_lock_release(&rcu_lock_map); 797 rcu_lock_release(&rcu_lock_map);
798 __release(RCU); 798 __release(RCU);
@@ -821,7 +821,7 @@ static inline void rcu_read_lock_bh(void)
821 local_bh_disable(); 821 local_bh_disable();
822 __acquire(RCU_BH); 822 __acquire(RCU_BH);
823 rcu_lock_acquire(&rcu_bh_lock_map); 823 rcu_lock_acquire(&rcu_bh_lock_map);
824 rcu_lockdep_assert(!rcu_is_cpu_idle(), 824 rcu_lockdep_assert(rcu_is_watching(),
825 "rcu_read_lock_bh() used illegally while idle"); 825 "rcu_read_lock_bh() used illegally while idle");
826} 826}
827 827
@@ -832,7 +832,7 @@ static inline void rcu_read_lock_bh(void)
832 */ 832 */
833static inline void rcu_read_unlock_bh(void) 833static inline void rcu_read_unlock_bh(void)
834{ 834{
835 rcu_lockdep_assert(!rcu_is_cpu_idle(), 835 rcu_lockdep_assert(rcu_is_watching(),
836 "rcu_read_unlock_bh() used illegally while idle"); 836 "rcu_read_unlock_bh() used illegally while idle");
837 rcu_lock_release(&rcu_bh_lock_map); 837 rcu_lock_release(&rcu_bh_lock_map);
838 __release(RCU_BH); 838 __release(RCU_BH);
@@ -857,7 +857,7 @@ static inline void rcu_read_lock_sched(void)
857 preempt_disable(); 857 preempt_disable();
858 __acquire(RCU_SCHED); 858 __acquire(RCU_SCHED);
859 rcu_lock_acquire(&rcu_sched_lock_map); 859 rcu_lock_acquire(&rcu_sched_lock_map);
860 rcu_lockdep_assert(!rcu_is_cpu_idle(), 860 rcu_lockdep_assert(rcu_is_watching(),
861 "rcu_read_lock_sched() used illegally while idle"); 861 "rcu_read_lock_sched() used illegally while idle");
862} 862}
863 863
@@ -875,7 +875,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
875 */ 875 */
876static inline void rcu_read_unlock_sched(void) 876static inline void rcu_read_unlock_sched(void)
877{ 877{
878 rcu_lockdep_assert(!rcu_is_cpu_idle(), 878 rcu_lockdep_assert(rcu_is_watching(),
879 "rcu_read_unlock_sched() used illegally while idle"); 879 "rcu_read_unlock_sched() used illegally while idle");
880 rcu_lock_release(&rcu_sched_lock_map); 880 rcu_lock_release(&rcu_sched_lock_map);
881 __release(RCU_SCHED); 881 __release(RCU_SCHED);
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e31005ee339e..09ebcbe9fd78 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -132,4 +132,21 @@ static inline void rcu_scheduler_starting(void)
132} 132}
133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
134 134
135#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
136
137static inline bool rcu_is_watching(void)
138{
139 return __rcu_is_watching();
140}
141
142#else /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
143
144static inline bool rcu_is_watching(void)
145{
146 return true;
147}
148
149
150#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
151
135#endif /* __LINUX_RCUTINY_H */ 152#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 226169d1bd2b..4b9c81548742 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -90,4 +90,6 @@ extern void exit_rcu(void);
90extern void rcu_scheduler_starting(void); 90extern void rcu_scheduler_starting(void);
91extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
92 92
93extern bool rcu_is_watching(void);
94
93#endif /* __LINUX_RCUTREE_H */ 95#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a10380bfbeac..e55907804d39 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,6 +23,7 @@ struct device;
23struct i2c_client; 23struct i2c_client;
24struct irq_domain; 24struct irq_domain;
25struct spi_device; 25struct spi_device;
26struct spmi_device;
26struct regmap; 27struct regmap;
27struct regmap_range_cfg; 28struct regmap_range_cfg;
28struct regmap_field; 29struct regmap_field;
@@ -70,6 +71,8 @@ struct regmap_range {
70 unsigned int range_max; 71 unsigned int range_max;
71}; 72};
72 73
74#define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
75
73/* 76/*
74 * A table of ranges including some yes ranges and some no ranges. 77 * A table of ranges including some yes ranges and some no ranges.
75 * If a register belongs to a no_range, the corresponding check function 78 * If a register belongs to a no_range, the corresponding check function
@@ -318,6 +321,8 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
318 const struct regmap_config *config); 321 const struct regmap_config *config);
319struct regmap *regmap_init_spi(struct spi_device *dev, 322struct regmap *regmap_init_spi(struct spi_device *dev,
320 const struct regmap_config *config); 323 const struct regmap_config *config);
324struct regmap *regmap_init_spmi(struct spmi_device *dev,
325 const struct regmap_config *config);
321struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 326struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
322 void __iomem *regs, 327 void __iomem *regs,
323 const struct regmap_config *config); 328 const struct regmap_config *config);
@@ -330,6 +335,8 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
330 const struct regmap_config *config); 335 const struct regmap_config *config);
331struct regmap *devm_regmap_init_spi(struct spi_device *dev, 336struct regmap *devm_regmap_init_spi(struct spi_device *dev,
332 const struct regmap_config *config); 337 const struct regmap_config *config);
338struct regmap *devm_regmap_init_spmi(struct spmi_device *dev,
339 const struct regmap_config *config);
333struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 340struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
334 void __iomem *regs, 341 void __iomem *regs,
335 const struct regmap_config *config); 342 const struct regmap_config *config);
@@ -374,10 +381,13 @@ int regmap_reinit_cache(struct regmap *map,
374 const struct regmap_config *config); 381 const struct regmap_config *config);
375struct regmap *dev_get_regmap(struct device *dev, const char *name); 382struct regmap *dev_get_regmap(struct device *dev, const char *name);
376int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 383int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
384int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
377int regmap_raw_write(struct regmap *map, unsigned int reg, 385int regmap_raw_write(struct regmap *map, unsigned int reg,
378 const void *val, size_t val_len); 386 const void *val, size_t val_len);
379int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 387int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
380 size_t val_count); 388 size_t val_count);
389int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs,
390 int num_regs);
381int regmap_raw_write_async(struct regmap *map, unsigned int reg, 391int regmap_raw_write_async(struct regmap *map, unsigned int reg,
382 const void *val, size_t val_len); 392 const void *val, size_t val_len);
383int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 393int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
@@ -387,9 +397,14 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
387 size_t val_count); 397 size_t val_count);
388int regmap_update_bits(struct regmap *map, unsigned int reg, 398int regmap_update_bits(struct regmap *map, unsigned int reg,
389 unsigned int mask, unsigned int val); 399 unsigned int mask, unsigned int val);
400int regmap_update_bits_async(struct regmap *map, unsigned int reg,
401 unsigned int mask, unsigned int val);
390int regmap_update_bits_check(struct regmap *map, unsigned int reg, 402int regmap_update_bits_check(struct regmap *map, unsigned int reg,
391 unsigned int mask, unsigned int val, 403 unsigned int mask, unsigned int val,
392 bool *change); 404 bool *change);
405int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
406 unsigned int mask, unsigned int val,
407 bool *change);
393int regmap_get_val_bytes(struct regmap *map); 408int regmap_get_val_bytes(struct regmap *map);
394int regmap_async_complete(struct regmap *map); 409int regmap_async_complete(struct regmap *map);
395bool regmap_can_raw_write(struct regmap *map); 410bool regmap_can_raw_write(struct regmap *map);
@@ -425,11 +440,15 @@ bool regmap_reg_in_ranges(unsigned int reg,
425 * @reg: Offset of the register within the regmap bank 440 * @reg: Offset of the register within the regmap bank
426 * @lsb: lsb of the register field. 441 * @lsb: lsb of the register field.
427 * @reg: msb of the register field. 442 * @reg: msb of the register field.
443 * @id_size: port size if it has some ports
444 * @id_offset: address offset for each ports
428 */ 445 */
429struct reg_field { 446struct reg_field {
430 unsigned int reg; 447 unsigned int reg;
431 unsigned int lsb; 448 unsigned int lsb;
432 unsigned int msb; 449 unsigned int msb;
450 unsigned int id_size;
451 unsigned int id_offset;
433}; 452};
434 453
435#define REG_FIELD(_reg, _lsb, _msb) { \ 454#define REG_FIELD(_reg, _lsb, _msb) { \
@@ -448,6 +467,15 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
448 467
449int regmap_field_read(struct regmap_field *field, unsigned int *val); 468int regmap_field_read(struct regmap_field *field, unsigned int *val);
450int regmap_field_write(struct regmap_field *field, unsigned int val); 469int regmap_field_write(struct regmap_field *field, unsigned int val);
470int regmap_field_update_bits(struct regmap_field *field,
471 unsigned int mask, unsigned int val);
472
473int regmap_fields_write(struct regmap_field *field, unsigned int id,
474 unsigned int val);
475int regmap_fields_read(struct regmap_field *field, unsigned int id,
476 unsigned int *val);
477int regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
478 unsigned int mask, unsigned int val);
451 479
452/** 480/**
453 * Description of an IRQ for the generic regmap irq_chip. 481 * Description of an IRQ for the generic regmap irq_chip.
@@ -527,6 +555,13 @@ static inline int regmap_write(struct regmap *map, unsigned int reg,
527 return -EINVAL; 555 return -EINVAL;
528} 556}
529 557
558static inline int regmap_write_async(struct regmap *map, unsigned int reg,
559 unsigned int val)
560{
561 WARN_ONCE(1, "regmap API is disabled");
562 return -EINVAL;
563}
564
530static inline int regmap_raw_write(struct regmap *map, unsigned int reg, 565static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
531 const void *val, size_t val_len) 566 const void *val, size_t val_len)
532{ 567{
@@ -576,6 +611,14 @@ static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
576 return -EINVAL; 611 return -EINVAL;
577} 612}
578 613
614static inline int regmap_update_bits_async(struct regmap *map,
615 unsigned int reg,
616 unsigned int mask, unsigned int val)
617{
618 WARN_ONCE(1, "regmap API is disabled");
619 return -EINVAL;
620}
621
579static inline int regmap_update_bits_check(struct regmap *map, 622static inline int regmap_update_bits_check(struct regmap *map,
580 unsigned int reg, 623 unsigned int reg,
581 unsigned int mask, unsigned int val, 624 unsigned int mask, unsigned int val,
@@ -585,6 +628,16 @@ static inline int regmap_update_bits_check(struct regmap *map,
585 return -EINVAL; 628 return -EINVAL;
586} 629}
587 630
631static inline int regmap_update_bits_check_async(struct regmap *map,
632 unsigned int reg,
633 unsigned int mask,
634 unsigned int val,
635 bool *change)
636{
637 WARN_ONCE(1, "regmap API is disabled");
638 return -EINVAL;
639}
640
588static inline int regmap_get_val_bytes(struct regmap *map) 641static inline int regmap_get_val_bytes(struct regmap *map)
589{ 642{
590 WARN_ONCE(1, "regmap API is disabled"); 643 WARN_ONCE(1, "regmap API is disabled");
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 27be915caa96..e530681bea70 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -146,6 +146,32 @@ struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
146void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
147void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
148 148
149int regulator_register_supply_alias(struct device *dev, const char *id,
150 struct device *alias_dev,
151 const char *alias_id);
152void regulator_unregister_supply_alias(struct device *dev, const char *id);
153
154int regulator_bulk_register_supply_alias(struct device *dev, const char **id,
155 struct device *alias_dev,
156 const char **alias_id, int num_id);
157void regulator_bulk_unregister_supply_alias(struct device *dev,
158 const char **id, int num_id);
159
160int devm_regulator_register_supply_alias(struct device *dev, const char *id,
161 struct device *alias_dev,
162 const char *alias_id);
163void devm_regulator_unregister_supply_alias(struct device *dev,
164 const char *id);
165
166int devm_regulator_bulk_register_supply_alias(struct device *dev,
167 const char **id,
168 struct device *alias_dev,
169 const char **alias_id,
170 int num_id);
171void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
172 const char **id,
173 int num_id);
174
149/* regulator output control and status */ 175/* regulator output control and status */
150int __must_check regulator_enable(struct regulator *regulator); 176int __must_check regulator_enable(struct regulator *regulator);
151int regulator_disable(struct regulator *regulator); 177int regulator_disable(struct regulator *regulator);
@@ -250,6 +276,59 @@ static inline void devm_regulator_put(struct regulator *regulator)
250{ 276{
251} 277}
252 278
279static inline int regulator_register_supply_alias(struct device *dev,
280 const char *id,
281 struct device *alias_dev,
282 const char *alias_id)
283{
284 return 0;
285}
286
287static inline void regulator_unregister_supply_alias(struct device *dev,
288 const char *id)
289{
290}
291
292static inline int regulator_bulk_register_supply_alias(struct device *dev,
293 const char **id,
294 struct device *alias_dev,
295 const char **alias_id,
296 int num_id)
297{
298 return 0;
299}
300
301static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
302 const char **id,
303 int num_id)
304{
305}
306
307static inline int devm_regulator_register_supply_alias(struct device *dev,
308 const char *id,
309 struct device *alias_dev,
310 const char *alias_id)
311{
312 return 0;
313}
314
315static inline void devm_regulator_unregister_supply_alias(struct device *dev,
316 const char *id)
317{
318}
319
320static inline int devm_regulator_bulk_register_supply_alias(
321 struct device *dev, const char **id, struct device *alias_dev,
322 const char **alias_id, int num_id)
323{
324 return 0;
325}
326
327static inline void devm_regulator_bulk_unregister_supply_alias(
328 struct device *dev, const char **id, int num_id)
329{
330}
331
253static inline int regulator_enable(struct regulator *regulator) 332static inline int regulator_enable(struct regulator *regulator)
254{ 333{
255 return 0; 334 return 0;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 67e13aa5a478..9370e65348a4 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -40,23 +40,32 @@ enum regulator_status {
40}; 40};
41 41
42/** 42/**
43 * struct regulator_linear_range - specify linear voltage ranges
44 *
43 * Specify a range of voltages for regulator_map_linar_range() and 45 * Specify a range of voltages for regulator_map_linar_range() and
44 * regulator_list_linear_range(). 46 * regulator_list_linear_range().
45 * 47 *
46 * @min_uV: Lowest voltage in range 48 * @min_uV: Lowest voltage in range
47 * @max_uV: Highest voltage in range
48 * @min_sel: Lowest selector for range 49 * @min_sel: Lowest selector for range
49 * @max_sel: Highest selector for range 50 * @max_sel: Highest selector for range
50 * @uV_step: Step size 51 * @uV_step: Step size
51 */ 52 */
52struct regulator_linear_range { 53struct regulator_linear_range {
53 unsigned int min_uV; 54 unsigned int min_uV;
54 unsigned int max_uV;
55 unsigned int min_sel; 55 unsigned int min_sel;
56 unsigned int max_sel; 56 unsigned int max_sel;
57 unsigned int uV_step; 57 unsigned int uV_step;
58}; 58};
59 59
60/* Initialize struct regulator_linear_range */
61#define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \
62{ \
63 .min_uV = _min_uV, \
64 .min_sel = _min_sel, \
65 .max_sel = _max_sel, \
66 .uV_step = _step_uV, \
67}
68
60/** 69/**
61 * struct regulator_ops - regulator operations. 70 * struct regulator_ops - regulator operations.
62 * 71 *
@@ -207,6 +216,7 @@ enum regulator_type {
207 * @min_uV: Voltage given by the lowest selector (if linear mapping) 216 * @min_uV: Voltage given by the lowest selector (if linear mapping)
208 * @uV_step: Voltage increase with each selector (if linear mapping) 217 * @uV_step: Voltage increase with each selector (if linear mapping)
209 * @linear_min_sel: Minimal selector for starting linear mapping 218 * @linear_min_sel: Minimal selector for starting linear mapping
219 * @fixed_uV: Fixed voltage of rails.
210 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 220 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
211 * @volt_table: Voltage mapping table (if table based mapping) 221 * @volt_table: Voltage mapping table (if table based mapping)
212 * 222 *
@@ -239,6 +249,7 @@ struct regulator_desc {
239 unsigned int min_uV; 249 unsigned int min_uV;
240 unsigned int uV_step; 250 unsigned int uV_step;
241 unsigned int linear_min_sel; 251 unsigned int linear_min_sel;
252 int fixed_uV;
242 unsigned int ramp_delay; 253 unsigned int ramp_delay;
243 254
244 const struct regulator_linear_range *linear_ranges; 255 const struct regulator_linear_range *linear_ranges;
@@ -334,7 +345,12 @@ struct regulator_dev {
334struct regulator_dev * 345struct regulator_dev *
335regulator_register(const struct regulator_desc *regulator_desc, 346regulator_register(const struct regulator_desc *regulator_desc,
336 const struct regulator_config *config); 347 const struct regulator_config *config);
348struct regulator_dev *
349devm_regulator_register(struct device *dev,
350 const struct regulator_desc *regulator_desc,
351 const struct regulator_config *config);
337void regulator_unregister(struct regulator_dev *rdev); 352void regulator_unregister(struct regulator_dev *rdev);
353void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev);
338 354
339int regulator_notifier_call_chain(struct regulator_dev *rdev, 355int regulator_notifier_call_chain(struct regulator_dev *rdev,
340 unsigned long event, void *data); 356 unsigned long event, void *data);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 999b20ce06cf..730e638c5589 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -95,6 +95,7 @@ struct regulator_state {
95 * @initial_state: Suspend state to set by default. 95 * @initial_state: Suspend state to set by default.
96 * @initial_mode: Mode to set at startup. 96 * @initial_mode: Mode to set at startup.
97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
98 * @enable_time: Turn-on time of the rails (unit: microseconds)
98 */ 99 */
99struct regulation_constraints { 100struct regulation_constraints {
100 101
@@ -129,6 +130,7 @@ struct regulation_constraints {
129 unsigned int initial_mode; 130 unsigned int initial_mode;
130 131
131 unsigned int ramp_delay; 132 unsigned int ramp_delay;
133 unsigned int enable_time;
132 134
133 /* constraint flags */ 135 /* constraint flags */
134 unsigned always_on:1; /* regulator never off when system is on */ 136 unsigned always_on:1; /* regulator never off when system is on */
@@ -193,15 +195,10 @@ int regulator_suspend_finish(void);
193 195
194#ifdef CONFIG_REGULATOR 196#ifdef CONFIG_REGULATOR
195void regulator_has_full_constraints(void); 197void regulator_has_full_constraints(void);
196void regulator_use_dummy_regulator(void);
197#else 198#else
198static inline void regulator_has_full_constraints(void) 199static inline void regulator_has_full_constraints(void)
199{ 200{
200} 201}
201
202static inline void regulator_use_dummy_regulator(void)
203{
204}
205#endif 202#endif
206 203
207#endif 204#endif
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 96a509b6be04..201a69749659 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -54,7 +54,7 @@ struct res_counter {
54 struct res_counter *parent; 54 struct res_counter *parent;
55}; 55};
56 56
57#define RESOURCE_MAX (unsigned long long)LLONG_MAX 57#define RES_COUNTER_MAX ULLONG_MAX
58 58
59/** 59/**
60 * Helpers to interact with userspace 60 * Helpers to interact with userspace
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index f28544b2f9af..939428ad25ac 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -15,7 +15,7 @@ extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
15extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 15extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
16 u32 id, long expires, u32 error); 16 u32 id, long expires, u32 error);
17 17
18extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); 18void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags);
19 19
20/* RTNL is used as a global lock for all changes to network configuration */ 20/* RTNL is used as a global lock for all changes to network configuration */
21extern void rtnl_lock(void); 21extern void rtnl_lock(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ce1e1c0aaa33..768b037dfacb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -22,6 +22,7 @@ struct sched_param {
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/nodemask.h> 23#include <linux/nodemask.h>
24#include <linux/mm_types.h> 24#include <linux/mm_types.h>
25#include <linux/preempt_mask.h>
25 26
26#include <asm/page.h> 27#include <asm/page.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -285,6 +286,14 @@ static inline void lockup_detector_init(void)
285} 286}
286#endif 287#endif
287 288
289#ifdef CONFIG_DETECT_HUNG_TASK
290void reset_hung_task_detector(void);
291#else
292static inline void reset_hung_task_detector(void)
293{
294}
295#endif
296
288/* Attach to any functions which should be ignored in wchan output. */ 297/* Attach to any functions which should be ignored in wchan output. */
289#define __sched __attribute__((__section__(".sched.text"))) 298#define __sched __attribute__((__section__(".sched.text")))
290 299
@@ -322,6 +331,10 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
322extern void set_dumpable(struct mm_struct *mm, int value); 331extern void set_dumpable(struct mm_struct *mm, int value);
323extern int get_dumpable(struct mm_struct *mm); 332extern int get_dumpable(struct mm_struct *mm);
324 333
334#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
335#define SUID_DUMP_USER 1 /* Dump as user of process */
336#define SUID_DUMP_ROOT 2 /* Dump as root */
337
325/* mm flags */ 338/* mm flags */
326/* dumpable bits */ 339/* dumpable bits */
327#define MMF_DUMPABLE 0 /* core dump is permitted */ 340#define MMF_DUMPABLE 0 /* core dump is permitted */
@@ -427,6 +440,14 @@ struct task_cputime {
427 .sum_exec_runtime = 0, \ 440 .sum_exec_runtime = 0, \
428 } 441 }
429 442
443#define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)
444
445#ifdef CONFIG_PREEMPT_COUNT
446#define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
447#else
448#define PREEMPT_DISABLED PREEMPT_ENABLED
449#endif
450
430/* 451/*
431 * Disable preemption until the scheduler is running. 452 * Disable preemption until the scheduler is running.
432 * Reset by start_kernel()->sched_init()->init_idle(). 453 * Reset by start_kernel()->sched_init()->init_idle().
@@ -434,7 +455,7 @@ struct task_cputime {
434 * We include PREEMPT_ACTIVE to avoid cond_resched() from working 455 * We include PREEMPT_ACTIVE to avoid cond_resched() from working
435 * before the scheduler is active -- see should_resched(). 456 * before the scheduler is active -- see should_resched().
436 */ 457 */
437#define INIT_PREEMPT_COUNT (1 + PREEMPT_ACTIVE) 458#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
438 459
439/** 460/**
440 * struct thread_group_cputimer - thread group interval timer counts 461 * struct thread_group_cputimer - thread group interval timer counts
@@ -768,6 +789,7 @@ enum cpu_idle_type {
768#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 789#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
769#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 790#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
770#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 791#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
792#define SD_NUMA 0x4000 /* cross-node balancing */
771 793
772extern int __weak arch_sd_sibiling_asym_packing(void); 794extern int __weak arch_sd_sibiling_asym_packing(void);
773 795
@@ -809,7 +831,9 @@ struct sched_domain {
809 unsigned int balance_interval; /* initialise to 1. units in ms. */ 831 unsigned int balance_interval; /* initialise to 1. units in ms. */
810 unsigned int nr_balance_failed; /* initialise to 0 */ 832 unsigned int nr_balance_failed; /* initialise to 0 */
811 833
812 u64 last_update; 834 /* idle_balance() stats */
835 u64 max_newidle_lb_cost;
836 unsigned long next_decay_max_lb_cost;
813 837
814#ifdef CONFIG_SCHEDSTATS 838#ifdef CONFIG_SCHEDSTATS
815 /* load_balance() stats */ 839 /* load_balance() stats */
@@ -1029,6 +1053,8 @@ struct task_struct {
1029 struct task_struct *last_wakee; 1053 struct task_struct *last_wakee;
1030 unsigned long wakee_flips; 1054 unsigned long wakee_flips;
1031 unsigned long wakee_flip_decay_ts; 1055 unsigned long wakee_flip_decay_ts;
1056
1057 int wake_cpu;
1032#endif 1058#endif
1033 int on_rq; 1059 int on_rq;
1034 1060
@@ -1046,15 +1072,6 @@ struct task_struct {
1046 struct hlist_head preempt_notifiers; 1072 struct hlist_head preempt_notifiers;
1047#endif 1073#endif
1048 1074
1049 /*
1050 * fpu_counter contains the number of consecutive context switches
1051 * that the FPU is used. If this is over a threshold, the lazy fpu
1052 * saving becomes unlazy to save the trap. This is an unsigned char
1053 * so that after 256 times the counter wraps and the behavior turns
1054 * lazy again; this to deal with bursty apps that only use FPU for
1055 * a short time
1056 */
1057 unsigned char fpu_counter;
1058#ifdef CONFIG_BLK_DEV_IO_TRACE 1075#ifdef CONFIG_BLK_DEV_IO_TRACE
1059 unsigned int btrace_seq; 1076 unsigned int btrace_seq;
1060#endif 1077#endif
@@ -1324,10 +1341,41 @@ struct task_struct {
1324#endif 1341#endif
1325#ifdef CONFIG_NUMA_BALANCING 1342#ifdef CONFIG_NUMA_BALANCING
1326 int numa_scan_seq; 1343 int numa_scan_seq;
1327 int numa_migrate_seq;
1328 unsigned int numa_scan_period; 1344 unsigned int numa_scan_period;
1345 unsigned int numa_scan_period_max;
1346 int numa_preferred_nid;
1347 int numa_migrate_deferred;
1348 unsigned long numa_migrate_retry;
1329 u64 node_stamp; /* migration stamp */ 1349 u64 node_stamp; /* migration stamp */
1330 struct callback_head numa_work; 1350 struct callback_head numa_work;
1351
1352 struct list_head numa_entry;
1353 struct numa_group *numa_group;
1354
1355 /*
1356 * Exponential decaying average of faults on a per-node basis.
1357 * Scheduling placement decisions are made based on the these counts.
1358 * The values remain static for the duration of a PTE scan
1359 */
1360 unsigned long *numa_faults;
1361 unsigned long total_numa_faults;
1362
1363 /*
1364 * numa_faults_buffer records faults per node during the current
1365 * scan window. When the scan completes, the counts in numa_faults
1366 * decay and these values are copied.
1367 */
1368 unsigned long *numa_faults_buffer;
1369
1370 /*
1371 * numa_faults_locality tracks if faults recorded during the last
1372 * scan window were remote/local. The task scan period is adapted
1373 * based on the locality of the faults with different weights
1374 * depending on whether they were shared or private faults
1375 */
1376 unsigned long numa_faults_locality[2];
1377
1378 unsigned long numa_pages_migrated;
1331#endif /* CONFIG_NUMA_BALANCING */ 1379#endif /* CONFIG_NUMA_BALANCING */
1332 1380
1333 struct rcu_head rcu; 1381 struct rcu_head rcu;
@@ -1393,6 +1441,12 @@ struct task_struct {
1393 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1441 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1394 } memcg_batch; 1442 } memcg_batch;
1395 unsigned int memcg_kmem_skip_account; 1443 unsigned int memcg_kmem_skip_account;
1444 struct memcg_oom_info {
1445 struct mem_cgroup *memcg;
1446 gfp_t gfp_mask;
1447 int order;
1448 unsigned int may_oom:1;
1449 } memcg_oom;
1396#endif 1450#endif
1397#ifdef CONFIG_UPROBES 1451#ifdef CONFIG_UPROBES
1398 struct uprobe_task *utask; 1452 struct uprobe_task *utask;
@@ -1406,16 +1460,33 @@ struct task_struct {
1406/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1460/* Future-safe accessor for struct task_struct's cpus_allowed. */
1407#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1461#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1408 1462
1463#define TNF_MIGRATED 0x01
1464#define TNF_NO_GROUP 0x02
1465#define TNF_SHARED 0x04
1466#define TNF_FAULT_LOCAL 0x08
1467
1409#ifdef CONFIG_NUMA_BALANCING 1468#ifdef CONFIG_NUMA_BALANCING
1410extern void task_numa_fault(int node, int pages, bool migrated); 1469extern void task_numa_fault(int last_node, int node, int pages, int flags);
1470extern pid_t task_numa_group_id(struct task_struct *p);
1411extern void set_numabalancing_state(bool enabled); 1471extern void set_numabalancing_state(bool enabled);
1472extern void task_numa_free(struct task_struct *p);
1473
1474extern unsigned int sysctl_numa_balancing_migrate_deferred;
1412#else 1475#else
1413static inline void task_numa_fault(int node, int pages, bool migrated) 1476static inline void task_numa_fault(int last_node, int node, int pages,
1477 int flags)
1414{ 1478{
1415} 1479}
1480static inline pid_t task_numa_group_id(struct task_struct *p)
1481{
1482 return 0;
1483}
1416static inline void set_numabalancing_state(bool enabled) 1484static inline void set_numabalancing_state(bool enabled)
1417{ 1485{
1418} 1486}
1487static inline void task_numa_free(struct task_struct *p)
1488{
1489}
1419#endif 1490#endif
1420 1491
1421static inline struct pid *task_pid(struct task_struct *task) 1492static inline struct pid *task_pid(struct task_struct *task)
@@ -1968,7 +2039,7 @@ extern void wake_up_new_task(struct task_struct *tsk);
1968#else 2039#else
1969 static inline void kick_process(struct task_struct *tsk) { } 2040 static inline void kick_process(struct task_struct *tsk) { }
1970#endif 2041#endif
1971extern void sched_fork(struct task_struct *p); 2042extern void sched_fork(unsigned long clone_flags, struct task_struct *p);
1972extern void sched_dead(struct task_struct *p); 2043extern void sched_dead(struct task_struct *p);
1973 2044
1974extern void proc_caches_init(void); 2045extern void proc_caches_init(void);
@@ -2169,15 +2240,15 @@ static inline bool thread_group_leader(struct task_struct *p)
2169 * all we care about is that we have a task with the appropriate 2240 * all we care about is that we have a task with the appropriate
2170 * pid, we don't actually care if we have the right task. 2241 * pid, we don't actually care if we have the right task.
2171 */ 2242 */
2172static inline int has_group_leader_pid(struct task_struct *p) 2243static inline bool has_group_leader_pid(struct task_struct *p)
2173{ 2244{
2174 return p->pid == p->tgid; 2245 return task_pid(p) == p->signal->leader_pid;
2175} 2246}
2176 2247
2177static inline 2248static inline
2178int same_thread_group(struct task_struct *p1, struct task_struct *p2) 2249bool same_thread_group(struct task_struct *p1, struct task_struct *p2)
2179{ 2250{
2180 return p1->tgid == p2->tgid; 2251 return p1->signal == p2->signal;
2181} 2252}
2182 2253
2183static inline struct task_struct *next_thread(const struct task_struct *p) 2254static inline struct task_struct *next_thread(const struct task_struct *p)
@@ -2395,11 +2466,6 @@ static inline int signal_pending_state(long state, struct task_struct *p)
2395 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); 2466 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
2396} 2467}
2397 2468
2398static inline int need_resched(void)
2399{
2400 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
2401}
2402
2403/* 2469/*
2404 * cond_resched() and cond_resched_lock(): latency reduction via 2470 * cond_resched() and cond_resched_lock(): latency reduction via
2405 * explicit rescheduling in places that are safe. The return 2471 * explicit rescheduling in places that are safe. The return
@@ -2468,36 +2534,105 @@ static inline int tsk_is_polling(struct task_struct *p)
2468{ 2534{
2469 return task_thread_info(p)->status & TS_POLLING; 2535 return task_thread_info(p)->status & TS_POLLING;
2470} 2536}
2471static inline void current_set_polling(void) 2537static inline void __current_set_polling(void)
2472{ 2538{
2473 current_thread_info()->status |= TS_POLLING; 2539 current_thread_info()->status |= TS_POLLING;
2474} 2540}
2475 2541
2476static inline void current_clr_polling(void) 2542static inline bool __must_check current_set_polling_and_test(void)
2543{
2544 __current_set_polling();
2545
2546 /*
2547 * Polling state must be visible before we test NEED_RESCHED,
2548 * paired by resched_task()
2549 */
2550 smp_mb();
2551
2552 return unlikely(tif_need_resched());
2553}
2554
2555static inline void __current_clr_polling(void)
2477{ 2556{
2478 current_thread_info()->status &= ~TS_POLLING; 2557 current_thread_info()->status &= ~TS_POLLING;
2479 smp_mb__after_clear_bit(); 2558}
2559
2560static inline bool __must_check current_clr_polling_and_test(void)
2561{
2562 __current_clr_polling();
2563
2564 /*
2565 * Polling state must be visible before we test NEED_RESCHED,
2566 * paired by resched_task()
2567 */
2568 smp_mb();
2569
2570 return unlikely(tif_need_resched());
2480} 2571}
2481#elif defined(TIF_POLLING_NRFLAG) 2572#elif defined(TIF_POLLING_NRFLAG)
2482static inline int tsk_is_polling(struct task_struct *p) 2573static inline int tsk_is_polling(struct task_struct *p)
2483{ 2574{
2484 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); 2575 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
2485} 2576}
2486static inline void current_set_polling(void) 2577
2578static inline void __current_set_polling(void)
2487{ 2579{
2488 set_thread_flag(TIF_POLLING_NRFLAG); 2580 set_thread_flag(TIF_POLLING_NRFLAG);
2489} 2581}
2490 2582
2491static inline void current_clr_polling(void) 2583static inline bool __must_check current_set_polling_and_test(void)
2584{
2585 __current_set_polling();
2586
2587 /*
2588 * Polling state must be visible before we test NEED_RESCHED,
2589 * paired by resched_task()
2590 *
2591 * XXX: assumes set/clear bit are identical barrier wise.
2592 */
2593 smp_mb__after_clear_bit();
2594
2595 return unlikely(tif_need_resched());
2596}
2597
2598static inline void __current_clr_polling(void)
2492{ 2599{
2493 clear_thread_flag(TIF_POLLING_NRFLAG); 2600 clear_thread_flag(TIF_POLLING_NRFLAG);
2494} 2601}
2602
2603static inline bool __must_check current_clr_polling_and_test(void)
2604{
2605 __current_clr_polling();
2606
2607 /*
2608 * Polling state must be visible before we test NEED_RESCHED,
2609 * paired by resched_task()
2610 */
2611 smp_mb__after_clear_bit();
2612
2613 return unlikely(tif_need_resched());
2614}
2615
2495#else 2616#else
2496static inline int tsk_is_polling(struct task_struct *p) { return 0; } 2617static inline int tsk_is_polling(struct task_struct *p) { return 0; }
2497static inline void current_set_polling(void) { } 2618static inline void __current_set_polling(void) { }
2498static inline void current_clr_polling(void) { } 2619static inline void __current_clr_polling(void) { }
2620
2621static inline bool __must_check current_set_polling_and_test(void)
2622{
2623 return unlikely(tif_need_resched());
2624}
2625static inline bool __must_check current_clr_polling_and_test(void)
2626{
2627 return unlikely(tif_need_resched());
2628}
2499#endif 2629#endif
2500 2630
2631static __always_inline bool need_resched(void)
2632{
2633 return unlikely(tif_need_resched());
2634}
2635
2501/* 2636/*
2502 * Thread group CPU time accounting. 2637 * Thread group CPU time accounting.
2503 */ 2638 */
@@ -2539,6 +2674,11 @@ static inline unsigned int task_cpu(const struct task_struct *p)
2539 return task_thread_info(p)->cpu; 2674 return task_thread_info(p)->cpu;
2540} 2675}
2541 2676
2677static inline int task_node(const struct task_struct *p)
2678{
2679 return cpu_to_node(task_cpu(p));
2680}
2681
2542extern void set_task_cpu(struct task_struct *p, unsigned int cpu); 2682extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
2543 2683
2544#else 2684#else
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index bf8086b2506e..41467f8ff8ec 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -2,8 +2,8 @@
2#define _SCHED_SYSCTL_H 2#define _SCHED_SYSCTL_H
3 3
4#ifdef CONFIG_DETECT_HUNG_TASK 4#ifdef CONFIG_DETECT_HUNG_TASK
5extern int sysctl_hung_task_check_count;
5extern unsigned int sysctl_hung_task_panic; 6extern unsigned int sysctl_hung_task_panic;
6extern unsigned long sysctl_hung_task_check_count;
7extern unsigned long sysctl_hung_task_timeout_secs; 7extern unsigned long sysctl_hung_task_timeout_secs;
8extern unsigned long sysctl_hung_task_warnings; 8extern unsigned long sysctl_hung_task_warnings;
9extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 9extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
@@ -47,7 +47,6 @@ extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
47extern unsigned int sysctl_numa_balancing_scan_delay; 47extern unsigned int sysctl_numa_balancing_scan_delay;
48extern unsigned int sysctl_numa_balancing_scan_period_min; 48extern unsigned int sysctl_numa_balancing_scan_period_min;
49extern unsigned int sysctl_numa_balancing_scan_period_max; 49extern unsigned int sysctl_numa_balancing_scan_period_max;
50extern unsigned int sysctl_numa_balancing_scan_period_reset;
51extern unsigned int sysctl_numa_balancing_scan_size; 50extern unsigned int sysctl_numa_balancing_scan_size;
52extern unsigned int sysctl_numa_balancing_settle_count; 51extern unsigned int sysctl_numa_balancing_settle_count;
53 52
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
index fa7922c80a41..cddf0c2940b6 100644
--- a/include/linux/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -15,7 +15,7 @@ static inline void sched_clock_postinit(void) { }
15#endif 15#endif
16 16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); 17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18 18extern void sched_clock_register(u64 (*read)(void), int bits,
19extern unsigned long long (*sched_clock_func)(void); 19 unsigned long rate);
20 20
21#endif 21#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index 7ce53ae1266b..5623a7f965b7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1052,17 +1052,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1052 * @xfrm_policy_delete_security: 1052 * @xfrm_policy_delete_security:
1053 * @ctx contains the xfrm_sec_ctx. 1053 * @ctx contains the xfrm_sec_ctx.
1054 * Authorize deletion of xp->security. 1054 * Authorize deletion of xp->security.
1055 * @xfrm_state_alloc_security: 1055 * @xfrm_state_alloc:
1056 * @x contains the xfrm_state being added to the Security Association 1056 * @x contains the xfrm_state being added to the Security Association
1057 * Database by the XFRM system. 1057 * Database by the XFRM system.
1058 * @sec_ctx contains the security context information being provided by 1058 * @sec_ctx contains the security context information being provided by
1059 * the user-level SA generation program (e.g., setkey or racoon). 1059 * the user-level SA generation program (e.g., setkey or racoon).
1060 * @secid contains the secid from which to take the mls portion of the context.
1061 * Allocate a security structure to the x->security field; the security 1060 * Allocate a security structure to the x->security field; the security
1062 * field is initialized to NULL when the xfrm_state is allocated. Set the 1061 * field is initialized to NULL when the xfrm_state is allocated. Set the
1063 * context to correspond to either sec_ctx or polsec, with the mls portion 1062 * context to correspond to sec_ctx. Return 0 if operation was successful
1064 * taken from secid in the latter case. 1063 * (memory to allocate, legal context).
1065 * Return 0 if operation was successful (memory to allocate, legal context). 1064 * @xfrm_state_alloc_acquire:
1065 * @x contains the xfrm_state being added to the Security Association
1066 * Database by the XFRM system.
1067 * @polsec contains the policy's security context.
1068 * @secid contains the secid from which to take the mls portion of the
1069 * context.
1070 * Allocate a security structure to the x->security field; the security
1071 * field is initialized to NULL when the xfrm_state is allocated. Set the
1072 * context to correspond to secid. Return 0 if operation was successful
1073 * (memory to allocate, legal context).
1066 * @xfrm_state_free_security: 1074 * @xfrm_state_free_security:
1067 * @x contains the xfrm_state. 1075 * @x contains the xfrm_state.
1068 * Deallocate x->security. 1076 * Deallocate x->security.
@@ -1492,7 +1500,7 @@ struct security_operations {
1492 int (*inode_alloc_security) (struct inode *inode); 1500 int (*inode_alloc_security) (struct inode *inode);
1493 void (*inode_free_security) (struct inode *inode); 1501 void (*inode_free_security) (struct inode *inode);
1494 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1502 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1495 const struct qstr *qstr, char **name, 1503 const struct qstr *qstr, const char **name,
1496 void **value, size_t *len); 1504 void **value, size_t *len);
1497 int (*inode_create) (struct inode *dir, 1505 int (*inode_create) (struct inode *dir,
1498 struct dentry *dentry, umode_t mode); 1506 struct dentry *dentry, umode_t mode);
@@ -1679,9 +1687,11 @@ struct security_operations {
1679 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); 1687 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1680 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); 1688 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1681 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); 1689 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1682 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1690 int (*xfrm_state_alloc) (struct xfrm_state *x,
1683 struct xfrm_user_sec_ctx *sec_ctx, 1691 struct xfrm_user_sec_ctx *sec_ctx);
1684 u32 secid); 1692 int (*xfrm_state_alloc_acquire) (struct xfrm_state *x,
1693 struct xfrm_sec_ctx *polsec,
1694 u32 secid);
1685 void (*xfrm_state_free_security) (struct xfrm_state *x); 1695 void (*xfrm_state_free_security) (struct xfrm_state *x);
1686 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1696 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1687 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1697 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
@@ -1770,7 +1780,7 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1770 const struct qstr *qstr, 1780 const struct qstr *qstr,
1771 initxattrs initxattrs, void *fs_data); 1781 initxattrs initxattrs, void *fs_data);
1772int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1782int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1773 const struct qstr *qstr, char **name, 1783 const struct qstr *qstr, const char **name,
1774 void **value, size_t *len); 1784 void **value, size_t *len);
1775int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); 1785int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1776int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1786int security_inode_link(struct dentry *old_dentry, struct inode *dir,
@@ -2094,8 +2104,8 @@ static inline int security_inode_init_security(struct inode *inode,
2094static inline int security_old_inode_init_security(struct inode *inode, 2104static inline int security_old_inode_init_security(struct inode *inode,
2095 struct inode *dir, 2105 struct inode *dir,
2096 const struct qstr *qstr, 2106 const struct qstr *qstr,
2097 char **name, void **value, 2107 const char **name,
2098 size_t *len) 2108 void **value, size_t *len)
2099{ 2109{
2100 return -EOPNOTSUPP; 2110 return -EOPNOTSUPP;
2101} 2111}
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 4e32edc8f506..52e0097f61f0 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -20,6 +20,7 @@ struct seq_file {
20 size_t size; 20 size_t size;
21 size_t from; 21 size_t from;
22 size_t count; 22 size_t count;
23 size_t pad_until;
23 loff_t index; 24 loff_t index;
24 loff_t read_pos; 25 loff_t read_pos;
25 u64 version; 26 u64 version;
@@ -79,6 +80,20 @@ static inline void seq_commit(struct seq_file *m, int num)
79 } 80 }
80} 81}
81 82
83/**
84 * seq_setwidth - set padding width
85 * @m: the seq_file handle
86 * @size: the max number of bytes to pad.
87 *
88 * Call seq_setwidth() for setting max width, then call seq_printf() etc. and
89 * finally call seq_pad() to pad the remaining bytes.
90 */
91static inline void seq_setwidth(struct seq_file *m, size_t size)
92{
93 m->pad_until = m->count + size;
94}
95void seq_pad(struct seq_file *m, char c);
96
82char *mangle_path(char *s, const char *p, const char *esc); 97char *mangle_path(char *s, const char *p, const char *esc);
83int seq_open(struct file *, const struct seq_operations *); 98int seq_open(struct file *, const struct seq_operations *);
84ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 99ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 18299057402f..cf87a24c0f92 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -3,15 +3,21 @@
3/* 3/*
4 * Reader/writer consistent mechanism without starving writers. This type of 4 * Reader/writer consistent mechanism without starving writers. This type of
5 * lock for data where the reader wants a consistent set of information 5 * lock for data where the reader wants a consistent set of information
6 * and is willing to retry if the information changes. Readers never 6 * and is willing to retry if the information changes. There are two types
7 * block but they may have to retry if a writer is in 7 * of readers:
8 * progress. Writers do not wait for readers. 8 * 1. Sequence readers which never block a writer but they may have to retry
9 * if a writer is in progress by detecting change in sequence number.
10 * Writers do not wait for a sequence reader.
11 * 2. Locking readers which will wait if a writer or another locking reader
12 * is in progress. A locking reader in progress will also block a writer
13 * from going forward. Unlike the regular rwlock, the read lock here is
14 * exclusive so that only one locking reader can get it.
9 * 15 *
10 * This is not as cache friendly as brlock. Also, this will not work 16 * This is not as cache friendly as brlock. Also, this may not work well
11 * for data that contains pointers, because any writer could 17 * for data that contains pointers, because any writer could
12 * invalidate a pointer that a reader was following. 18 * invalidate a pointer that a reader was following.
13 * 19 *
14 * Expected reader usage: 20 * Expected non-blocking reader usage:
15 * do { 21 * do {
16 * seq = read_seqbegin(&foo); 22 * seq = read_seqbegin(&foo);
17 * ... 23 * ...
@@ -28,6 +34,7 @@
28 34
29#include <linux/spinlock.h> 35#include <linux/spinlock.h>
30#include <linux/preempt.h> 36#include <linux/preempt.h>
37#include <linux/lockdep.h>
31#include <asm/processor.h> 38#include <asm/processor.h>
32 39
33/* 40/*
@@ -38,10 +45,50 @@
38 */ 45 */
39typedef struct seqcount { 46typedef struct seqcount {
40 unsigned sequence; 47 unsigned sequence;
48#ifdef CONFIG_DEBUG_LOCK_ALLOC
49 struct lockdep_map dep_map;
50#endif
41} seqcount_t; 51} seqcount_t;
42 52
43#define SEQCNT_ZERO { 0 } 53static inline void __seqcount_init(seqcount_t *s, const char *name,
44#define seqcount_init(x) do { *(x) = (seqcount_t) SEQCNT_ZERO; } while (0) 54 struct lock_class_key *key)
55{
56 /*
57 * Make sure we are not reinitializing a held lock:
58 */
59 lockdep_init_map(&s->dep_map, name, key, 0);
60 s->sequence = 0;
61}
62
63#ifdef CONFIG_DEBUG_LOCK_ALLOC
64# define SEQCOUNT_DEP_MAP_INIT(lockname) \
65 .dep_map = { .name = #lockname } \
66
67# define seqcount_init(s) \
68 do { \
69 static struct lock_class_key __key; \
70 __seqcount_init((s), #s, &__key); \
71 } while (0)
72
73static inline void seqcount_lockdep_reader_access(const seqcount_t *s)
74{
75 seqcount_t *l = (seqcount_t *)s;
76 unsigned long flags;
77
78 local_irq_save(flags);
79 seqcount_acquire_read(&l->dep_map, 0, 0, _RET_IP_);
80 seqcount_release(&l->dep_map, 1, _RET_IP_);
81 local_irq_restore(flags);
82}
83
84#else
85# define SEQCOUNT_DEP_MAP_INIT(lockname)
86# define seqcount_init(s) __seqcount_init(s, NULL, NULL)
87# define seqcount_lockdep_reader_access(x)
88#endif
89
90#define SEQCNT_ZERO(lockname) { .sequence = 0, SEQCOUNT_DEP_MAP_INIT(lockname)}
91
45 92
46/** 93/**
47 * __read_seqcount_begin - begin a seq-read critical section (without barrier) 94 * __read_seqcount_begin - begin a seq-read critical section (without barrier)
@@ -70,6 +117,22 @@ repeat:
70} 117}
71 118
72/** 119/**
120 * read_seqcount_begin_no_lockdep - start seq-read critical section w/o lockdep
121 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry
123 *
124 * read_seqcount_begin_no_lockdep opens a read critical section of the given
125 * seqcount, but without any lockdep checking. Validity of the critical
126 * section is tested by checking read_seqcount_retry function.
127 */
128static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s)
129{
130 unsigned ret = __read_seqcount_begin(s);
131 smp_rmb();
132 return ret;
133}
134
135/**
73 * read_seqcount_begin - begin a seq-read critical section 136 * read_seqcount_begin - begin a seq-read critical section
74 * @s: pointer to seqcount_t 137 * @s: pointer to seqcount_t
75 * Returns: count to be passed to read_seqcount_retry 138 * Returns: count to be passed to read_seqcount_retry
@@ -80,9 +143,8 @@ repeat:
80 */ 143 */
81static inline unsigned read_seqcount_begin(const seqcount_t *s) 144static inline unsigned read_seqcount_begin(const seqcount_t *s)
82{ 145{
83 unsigned ret = __read_seqcount_begin(s); 146 seqcount_lockdep_reader_access(s);
84 smp_rmb(); 147 return read_seqcount_begin_no_lockdep(s);
85 return ret;
86} 148}
87 149
88/** 150/**
@@ -102,6 +164,8 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
102static inline unsigned raw_seqcount_begin(const seqcount_t *s) 164static inline unsigned raw_seqcount_begin(const seqcount_t *s)
103{ 165{
104 unsigned ret = ACCESS_ONCE(s->sequence); 166 unsigned ret = ACCESS_ONCE(s->sequence);
167
168 seqcount_lockdep_reader_access(s);
105 smp_rmb(); 169 smp_rmb();
106 return ret & ~1; 170 return ret & ~1;
107} 171}
@@ -146,14 +210,21 @@ static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
146 * Sequence counter only version assumes that callers are using their 210 * Sequence counter only version assumes that callers are using their
147 * own mutexing. 211 * own mutexing.
148 */ 212 */
149static inline void write_seqcount_begin(seqcount_t *s) 213static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass)
150{ 214{
151 s->sequence++; 215 s->sequence++;
152 smp_wmb(); 216 smp_wmb();
217 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_);
218}
219
220static inline void write_seqcount_begin(seqcount_t *s)
221{
222 write_seqcount_begin_nested(s, 0);
153} 223}
154 224
155static inline void write_seqcount_end(seqcount_t *s) 225static inline void write_seqcount_end(seqcount_t *s)
156{ 226{
227 seqcount_release(&s->dep_map, 1, _RET_IP_);
157 smp_wmb(); 228 smp_wmb();
158 s->sequence++; 229 s->sequence++;
159} 230}
@@ -182,7 +253,7 @@ typedef struct {
182 */ 253 */
183#define __SEQLOCK_UNLOCKED(lockname) \ 254#define __SEQLOCK_UNLOCKED(lockname) \
184 { \ 255 { \
185 .seqcount = SEQCNT_ZERO, \ 256 .seqcount = SEQCNT_ZERO(lockname), \
186 .lock = __SPIN_LOCK_UNLOCKED(lockname) \ 257 .lock = __SPIN_LOCK_UNLOCKED(lockname) \
187 } 258 }
188 259
@@ -268,4 +339,85 @@ write_sequnlock_irqrestore(seqlock_t *sl, unsigned long flags)
268 spin_unlock_irqrestore(&sl->lock, flags); 339 spin_unlock_irqrestore(&sl->lock, flags);
269} 340}
270 341
342/*
343 * A locking reader exclusively locks out other writers and locking readers,
344 * but doesn't update the sequence number. Acts like a normal spin_lock/unlock.
345 * Don't need preempt_disable() because that is in the spin_lock already.
346 */
347static inline void read_seqlock_excl(seqlock_t *sl)
348{
349 spin_lock(&sl->lock);
350}
351
352static inline void read_sequnlock_excl(seqlock_t *sl)
353{
354 spin_unlock(&sl->lock);
355}
356
357/**
358 * read_seqbegin_or_lock - begin a sequence number check or locking block
359 * @lock: sequence lock
360 * @seq : sequence number to be checked
361 *
362 * First try it once optimistically without taking the lock. If that fails,
363 * take the lock. The sequence number is also used as a marker for deciding
364 * whether to be a reader (even) or writer (odd).
365 * N.B. seq must be initialized to an even number to begin with.
366 */
367static inline void read_seqbegin_or_lock(seqlock_t *lock, int *seq)
368{
369 if (!(*seq & 1)) /* Even */
370 *seq = read_seqbegin(lock);
371 else /* Odd */
372 read_seqlock_excl(lock);
373}
374
375static inline int need_seqretry(seqlock_t *lock, int seq)
376{
377 return !(seq & 1) && read_seqretry(lock, seq);
378}
379
380static inline void done_seqretry(seqlock_t *lock, int seq)
381{
382 if (seq & 1)
383 read_sequnlock_excl(lock);
384}
385
386static inline void read_seqlock_excl_bh(seqlock_t *sl)
387{
388 spin_lock_bh(&sl->lock);
389}
390
391static inline void read_sequnlock_excl_bh(seqlock_t *sl)
392{
393 spin_unlock_bh(&sl->lock);
394}
395
396static inline void read_seqlock_excl_irq(seqlock_t *sl)
397{
398 spin_lock_irq(&sl->lock);
399}
400
401static inline void read_sequnlock_excl_irq(seqlock_t *sl)
402{
403 spin_unlock_irq(&sl->lock);
404}
405
406static inline unsigned long __read_seqlock_excl_irqsave(seqlock_t *sl)
407{
408 unsigned long flags;
409
410 spin_lock_irqsave(&sl->lock, flags);
411 return flags;
412}
413
414#define read_seqlock_excl_irqsave(lock, flags) \
415 do { flags = __read_seqlock_excl_irqsave(lock); } while (0)
416
417static inline void
418read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
419{
420 spin_unlock_irqrestore(&sl->lock, flags);
421}
422
271#endif /* __LINUX_SEQLOCK_H */ 423#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b98291ac7f14..f729be981da0 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -66,7 +66,6 @@ struct uart_ops {
66 void (*set_ldisc)(struct uart_port *, int new); 66 void (*set_ldisc)(struct uart_port *, int new);
67 void (*pm)(struct uart_port *, unsigned int state, 67 void (*pm)(struct uart_port *, unsigned int state,
68 unsigned int oldstate); 68 unsigned int oldstate);
69 int (*set_wake)(struct uart_port *, unsigned int state);
70 69
71 /* 70 /*
72 * Return a string describing the type of the port 71 * Return a string describing the type of the port
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index d34049712a4d..50fe651da965 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -5,7 +5,7 @@
5#include <linux/sh_dma.h> 5#include <linux/sh_dma.h>
6 6
7/* 7/*
8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index fe817918b30e..d9b436f09925 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -59,6 +59,9 @@
59#ifndef _LINUX_SFI_H 59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H 60#define _LINUX_SFI_H
61 61
62#include <linux/init.h>
63#include <linux/types.h>
64
62/* Table signatures reserved by the SFI specification */ 65/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST" 66#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ" 67#define SFI_SIG_FREQ "FREQ"
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index 4e83f3e034f3..b7b43b82231e 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -33,13 +33,44 @@ struct sh_dmae_slave_config {
33 char mid_rid; 33 char mid_rid;
34}; 34};
35 35
36/**
37 * struct sh_dmae_channel - DMAC channel platform data
38 * @offset: register offset within the main IOMEM resource
39 * @dmars: channel DMARS register offset
40 * @chclr_offset: channel CHCLR register offset
41 * @dmars_bit: channel DMARS field offset within the register
42 * @chclr_bit: bit position, to be set to reset the channel
43 */
36struct sh_dmae_channel { 44struct sh_dmae_channel {
37 unsigned int offset; 45 unsigned int offset;
38 unsigned int dmars; 46 unsigned int dmars;
39 unsigned int dmars_bit;
40 unsigned int chclr_offset; 47 unsigned int chclr_offset;
48 unsigned char dmars_bit;
49 unsigned char chclr_bit;
41}; 50};
42 51
52/**
53 * struct sh_dmae_pdata - DMAC platform data
54 * @slave: array of slaves
55 * @slave_num: number of slaves in the above array
56 * @channel: array of DMA channels
57 * @channel_num: number of channels in the above array
58 * @ts_low_shift: shift of the low part of the TS field
59 * @ts_low_mask: low TS field mask
60 * @ts_high_shift: additional shift of the high part of the TS field
61 * @ts_high_mask: high TS field mask
62 * @ts_shift: array of Transfer Size shifts, indexed by TS value
63 * @ts_shift_num: number of shifts in the above array
64 * @dmaor_init: DMAOR initialisation value
65 * @chcr_offset: CHCR address offset
66 * @chcr_ie_bit: CHCR Interrupt Enable bit
67 * @dmaor_is_32bit: DMAOR is a 32-bit register
68 * @needs_tend_set: the TEND register has to be set
69 * @no_dmars: DMAC has no DMARS registers
70 * @chclr_present: DMAC has one or several CHCLR registers
71 * @chclr_bitwise: channel CHCLR registers are bitwise
72 * @slave_only: DMAC cannot be used for MEMCPY
73 */
43struct sh_dmae_pdata { 74struct sh_dmae_pdata {
44 const struct sh_dmae_slave_config *slave; 75 const struct sh_dmae_slave_config *slave;
45 int slave_num; 76 int slave_num;
@@ -59,42 +90,22 @@ struct sh_dmae_pdata {
59 unsigned int needs_tend_set:1; 90 unsigned int needs_tend_set:1;
60 unsigned int no_dmars:1; 91 unsigned int no_dmars:1;
61 unsigned int chclr_present:1; 92 unsigned int chclr_present:1;
93 unsigned int chclr_bitwise:1;
62 unsigned int slave_only:1; 94 unsigned int slave_only:1;
63}; 95};
64 96
65/* DMA register */
66#define SAR 0x00
67#define DAR 0x04
68#define TCR 0x08
69#define CHCR 0x0C
70#define DMAOR 0x40
71
72#define TEND 0x18 /* USB-DMAC */
73
74/* DMAOR definitions */ 97/* DMAOR definitions */
75#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001
78 101
79/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000 103#define DM_INC 0x00004000
89#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000 106#define SM_INC 0x00001000
92#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001 109#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002 110#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004 111#define CHCR_IE 0x00000004
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index 5b1c9848124c..f92c0a43c54c 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -96,7 +96,7 @@ struct shdma_ops {
96 dma_addr_t (*slave_addr)(struct shdma_chan *); 96 dma_addr_t (*slave_addr)(struct shdma_chan *);
97 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *, 97 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *,
98 dma_addr_t, dma_addr_t, size_t *); 98 dma_addr_t, dma_addr_t, size_t *);
99 int (*set_slave)(struct shdma_chan *, int, bool); 99 int (*set_slave)(struct shdma_chan *, int, dma_addr_t, bool);
100 void (*setup_xfer)(struct shdma_chan *, int); 100 void (*setup_xfer)(struct shdma_chan *, int);
101 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *); 101 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *);
102 struct shdma_desc *(*embedded_desc)(void *, int); 102 struct shdma_desc *(*embedded_desc)(void *, int);
@@ -116,7 +116,6 @@ struct shdma_dev {
116 116
117int shdma_request_irq(struct shdma_chan *, int, 117int shdma_request_irq(struct shdma_chan *, int,
118 unsigned long, const char *); 118 unsigned long, const char *);
119void shdma_free_irq(struct shdma_chan *);
120bool shdma_reset(struct shdma_dev *sdev); 119bool shdma_reset(struct shdma_dev *sdev);
121void shdma_chan_probe(struct shdma_dev *sdev, 120void shdma_chan_probe(struct shdma_dev *sdev,
122 struct shdma_chan *schan, int id); 121 struct shdma_chan *schan, int id);
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 30aa0dc60d75..9d55438bc4ad 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -47,6 +47,8 @@ extern int shmem_init(void);
47extern int shmem_fill_super(struct super_block *sb, void *data, int silent); 47extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
48extern struct file *shmem_file_setup(const char *name, 48extern struct file *shmem_file_setup(const char *name,
49 loff_t size, unsigned long flags); 49 loff_t size, unsigned long flags);
50extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
51 unsigned long flags);
50extern int shmem_zero_setup(struct vm_area_struct *); 52extern int shmem_zero_setup(struct vm_area_struct *);
51extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 53extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
52extern void shmem_unlock_mapping(struct address_space *mapping); 54extern void shmem_unlock_mapping(struct address_space *mapping);
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index ac6b8ee07825..68c097077ef0 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -4,39 +4,67 @@
4/* 4/*
5 * This struct is used to pass information from page reclaim to the shrinkers. 5 * This struct is used to pass information from page reclaim to the shrinkers.
6 * We consolidate the values for easier extention later. 6 * We consolidate the values for easier extention later.
7 *
8 * The 'gfpmask' refers to the allocation we are currently trying to
9 * fulfil.
7 */ 10 */
8struct shrink_control { 11struct shrink_control {
9 gfp_t gfp_mask; 12 gfp_t gfp_mask;
10 13
11 /* How many slab objects shrinker() should scan and try to reclaim */ 14 /*
15 * How many objects scan_objects should scan and try to reclaim.
16 * This is reset before every call, so it is safe for callees
17 * to modify.
18 */
12 unsigned long nr_to_scan; 19 unsigned long nr_to_scan;
20
21 /* shrink from these nodes */
22 nodemask_t nodes_to_scan;
23 /* current node being shrunk (for NUMA aware shrinkers) */
24 int nid;
13}; 25};
14 26
27#define SHRINK_STOP (~0UL)
15/* 28/*
16 * A callback you can register to apply pressure to ageable caches. 29 * A callback you can register to apply pressure to ageable caches.
17 * 30 *
18 * 'sc' is passed shrink_control which includes a count 'nr_to_scan' 31 * @count_objects should return the number of freeable items in the cache. If
19 * and a 'gfpmask'. It should look through the least-recently-used 32 * there are no objects to free or the number of freeable items cannot be
20 * 'nr_to_scan' entries and attempt to free them up. It should return 33 * determined, it should return 0. No deadlock checks should be done during the
21 * the number of objects which remain in the cache. If it returns -1, it means 34 * count callback - the shrinker relies on aggregating scan counts that couldn't
22 * it cannot do any scanning at this time (eg. there is a risk of deadlock). 35 * be executed due to potential deadlocks to be run at a later call when the
36 * deadlock condition is no longer pending.
23 * 37 *
24 * The 'gfpmask' refers to the allocation we are currently trying to 38 * @scan_objects will only be called if @count_objects returned a non-zero
25 * fulfil. 39 * value for the number of freeable objects. The callout should scan the cache
40 * and attempt to free items from the cache. It should then return the number
41 * of objects freed during the scan, or SHRINK_STOP if progress cannot be made
42 * due to potential deadlocks. If SHRINK_STOP is returned, then no further
43 * attempts to call the @scan_objects will be made from the current reclaim
44 * context.
26 * 45 *
27 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is 46 * @flags determine the shrinker abilities, like numa awareness
28 * querying the cache size, so a fastpath for that case is appropriate.
29 */ 47 */
30struct shrinker { 48struct shrinker {
31 int (*shrink)(struct shrinker *, struct shrink_control *sc); 49 unsigned long (*count_objects)(struct shrinker *,
50 struct shrink_control *sc);
51 unsigned long (*scan_objects)(struct shrinker *,
52 struct shrink_control *sc);
53
32 int seeks; /* seeks to recreate an obj */ 54 int seeks; /* seeks to recreate an obj */
33 long batch; /* reclaim batch size, 0 = default */ 55 long batch; /* reclaim batch size, 0 = default */
56 unsigned long flags;
34 57
35 /* These are for internal use */ 58 /* These are for internal use */
36 struct list_head list; 59 struct list_head list;
37 atomic_long_t nr_in_batch; /* objs pending delete */ 60 /* objs pending delete, per node */
61 atomic_long_t *nr_deferred;
38}; 62};
39#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ 63#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
40extern void register_shrinker(struct shrinker *); 64
65/* Flags */
66#define SHRINKER_NUMA_AWARE (1 << 0)
67
68extern int register_shrinker(struct shrinker *);
41extern void unregister_shrinker(struct shrinker *); 69extern void unregister_shrinker(struct shrinker *);
42#endif 70#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2ddb48d9312c..215b5ea1cb30 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -318,9 +318,13 @@ enum {
318 318
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_IPIP = 1 << 7,
322 322
323 SKB_GSO_MPLS = 1 << 8, 323 SKB_GSO_SIT = 1 << 8,
324
325 SKB_GSO_UDP_TUNNEL = 1 << 9,
326
327 SKB_GSO_MPLS = 1 << 10,
324}; 328};
325 329
326#if BITS_PER_LONG > 32 330#if BITS_PER_LONG > 32
@@ -333,11 +337,6 @@ typedef unsigned int sk_buff_data_t;
333typedef unsigned char *sk_buff_data_t; 337typedef unsigned char *sk_buff_data_t;
334#endif 338#endif
335 339
336#if defined(CONFIG_NF_DEFRAG_IPV4) || defined(CONFIG_NF_DEFRAG_IPV4_MODULE) || \
337 defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
338#define NET_SKBUFF_NF_DEFRAG_NEEDED 1
339#endif
340
341/** 340/**
342 * struct sk_buff - socket buffer 341 * struct sk_buff - socket buffer
343 * @next: Next buffer in list 342 * @next: Next buffer in list
@@ -370,7 +369,6 @@ typedef unsigned char *sk_buff_data_t;
370 * @protocol: Packet protocol from driver 369 * @protocol: Packet protocol from driver
371 * @destructor: Destruct function 370 * @destructor: Destruct function
372 * @nfct: Associated connection, if any 371 * @nfct: Associated connection, if any
373 * @nfct_reasm: netfilter conntrack re-assembly pointer
374 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 372 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
375 * @skb_iif: ifindex of device we arrived on 373 * @skb_iif: ifindex of device we arrived on
376 * @tc_index: Traffic control index 374 * @tc_index: Traffic control index
@@ -459,9 +457,6 @@ struct sk_buff {
459#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 457#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
460 struct nf_conntrack *nfct; 458 struct nf_conntrack *nfct;
461#endif 459#endif
462#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
463 struct sk_buff *nfct_reasm;
464#endif
465#ifdef CONFIG_BRIDGE_NETFILTER 460#ifdef CONFIG_BRIDGE_NETFILTER
466 struct nf_bridge_info *nf_bridge; 461 struct nf_bridge_info *nf_bridge;
467#endif 462#endif
@@ -498,7 +493,7 @@ struct sk_buff {
498 * headers if needed 493 * headers if needed
499 */ 494 */
500 __u8 encapsulation:1; 495 __u8 encapsulation:1;
501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 496 /* 6/8 bit hole (depending on ndisc_nodetype presence) */
502 kmemcheck_bitfield_end(flags2); 497 kmemcheck_bitfield_end(flags2);
503 498
504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 499#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -585,8 +580,8 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
585 skb->_skb_refdst = (unsigned long)dst; 580 skb->_skb_refdst = (unsigned long)dst;
586} 581}
587 582
588extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, 583void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
589 bool force); 584 bool force);
590 585
591/** 586/**
592 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference 587 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference
@@ -634,20 +629,20 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
634 return (struct rtable *)skb_dst(skb); 629 return (struct rtable *)skb_dst(skb);
635} 630}
636 631
637extern void kfree_skb(struct sk_buff *skb); 632void kfree_skb(struct sk_buff *skb);
638extern void kfree_skb_list(struct sk_buff *segs); 633void kfree_skb_list(struct sk_buff *segs);
639extern void skb_tx_error(struct sk_buff *skb); 634void skb_tx_error(struct sk_buff *skb);
640extern void consume_skb(struct sk_buff *skb); 635void consume_skb(struct sk_buff *skb);
641extern void __kfree_skb(struct sk_buff *skb); 636void __kfree_skb(struct sk_buff *skb);
642extern struct kmem_cache *skbuff_head_cache; 637extern struct kmem_cache *skbuff_head_cache;
643 638
644extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); 639void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
645extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, 640bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
646 bool *fragstolen, int *delta_truesize); 641 bool *fragstolen, int *delta_truesize);
647 642
648extern struct sk_buff *__alloc_skb(unsigned int size, 643struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
649 gfp_t priority, int flags, int node); 644 int node);
650extern struct sk_buff *build_skb(void *data, unsigned int frag_size); 645struct sk_buff *build_skb(void *data, unsigned int frag_size);
651static inline struct sk_buff *alloc_skb(unsigned int size, 646static inline struct sk_buff *alloc_skb(unsigned int size,
652 gfp_t priority) 647 gfp_t priority)
653{ 648{
@@ -660,41 +655,33 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
660 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); 655 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
661} 656}
662 657
663extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node); 658struct sk_buff *__alloc_skb_head(gfp_t priority, int node);
664static inline struct sk_buff *alloc_skb_head(gfp_t priority) 659static inline struct sk_buff *alloc_skb_head(gfp_t priority)
665{ 660{
666 return __alloc_skb_head(priority, -1); 661 return __alloc_skb_head(priority, -1);
667} 662}
668 663
669extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 664struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
670extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 665int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
671extern struct sk_buff *skb_clone(struct sk_buff *skb, 666struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
672 gfp_t priority); 667struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
673extern struct sk_buff *skb_copy(const struct sk_buff *skb, 668struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask);
674 gfp_t priority); 669
675extern struct sk_buff *__pskb_copy(struct sk_buff *skb, 670int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
676 int headroom, gfp_t gfp_mask); 671struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
677 672 unsigned int headroom);
678extern int pskb_expand_head(struct sk_buff *skb, 673struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
679 int nhead, int ntail, 674 int newtailroom, gfp_t priority);
680 gfp_t gfp_mask); 675int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
681extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 676 int len);
682 unsigned int headroom); 677int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
683extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 678int skb_pad(struct sk_buff *skb, int pad);
684 int newheadroom, int newtailroom,
685 gfp_t priority);
686extern int skb_to_sgvec(struct sk_buff *skb,
687 struct scatterlist *sg, int offset,
688 int len);
689extern int skb_cow_data(struct sk_buff *skb, int tailbits,
690 struct sk_buff **trailer);
691extern int skb_pad(struct sk_buff *skb, int pad);
692#define dev_kfree_skb(a) consume_skb(a) 679#define dev_kfree_skb(a) consume_skb(a)
693 680
694extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 681int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
695 int getfrag(void *from, char *to, int offset, 682 int getfrag(void *from, char *to, int offset,
696 int len,int odd, struct sk_buff *skb), 683 int len, int odd, struct sk_buff *skb),
697 void *from, int length); 684 void *from, int length);
698 685
699struct skb_seq_state { 686struct skb_seq_state {
700 __u32 lower_offset; 687 __u32 lower_offset;
@@ -706,18 +693,17 @@ struct skb_seq_state {
706 __u8 *frag_data; 693 __u8 *frag_data;
707}; 694};
708 695
709extern void skb_prepare_seq_read(struct sk_buff *skb, 696void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
710 unsigned int from, unsigned int to, 697 unsigned int to, struct skb_seq_state *st);
711 struct skb_seq_state *st); 698unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
712extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data, 699 struct skb_seq_state *st);
713 struct skb_seq_state *st); 700void skb_abort_seq_read(struct skb_seq_state *st);
714extern void skb_abort_seq_read(struct skb_seq_state *st);
715 701
716extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, 702unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
717 unsigned int to, struct ts_config *config, 703 unsigned int to, struct ts_config *config,
718 struct ts_state *state); 704 struct ts_state *state);
719 705
720extern void __skb_get_rxhash(struct sk_buff *skb); 706void __skb_get_rxhash(struct sk_buff *skb);
721static inline __u32 skb_get_rxhash(struct sk_buff *skb) 707static inline __u32 skb_get_rxhash(struct sk_buff *skb)
722{ 708{
723 if (!skb->l4_rxhash) 709 if (!skb->l4_rxhash)
@@ -1095,7 +1081,8 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
1095 * The "__skb_xxxx()" functions are the non-atomic ones that 1081 * The "__skb_xxxx()" functions are the non-atomic ones that
1096 * can only be called with interrupts disabled. 1082 * can only be called with interrupts disabled.
1097 */ 1083 */
1098extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); 1084void skb_insert(struct sk_buff *old, struct sk_buff *newsk,
1085 struct sk_buff_head *list);
1099static inline void __skb_insert(struct sk_buff *newsk, 1086static inline void __skb_insert(struct sk_buff *newsk,
1100 struct sk_buff *prev, struct sk_buff *next, 1087 struct sk_buff *prev, struct sk_buff *next,
1101 struct sk_buff_head *list) 1088 struct sk_buff_head *list)
@@ -1201,8 +1188,8 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
1201 __skb_insert(newsk, prev, prev->next, list); 1188 __skb_insert(newsk, prev, prev->next, list);
1202} 1189}
1203 1190
1204extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, 1191void skb_append(struct sk_buff *old, struct sk_buff *newsk,
1205 struct sk_buff_head *list); 1192 struct sk_buff_head *list);
1206 1193
1207static inline void __skb_queue_before(struct sk_buff_head *list, 1194static inline void __skb_queue_before(struct sk_buff_head *list,
1208 struct sk_buff *next, 1195 struct sk_buff *next,
@@ -1221,7 +1208,7 @@ static inline void __skb_queue_before(struct sk_buff_head *list,
1221 * 1208 *
1222 * A buffer cannot be placed on two lists at the same time. 1209 * A buffer cannot be placed on two lists at the same time.
1223 */ 1210 */
1224extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); 1211void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
1225static inline void __skb_queue_head(struct sk_buff_head *list, 1212static inline void __skb_queue_head(struct sk_buff_head *list,
1226 struct sk_buff *newsk) 1213 struct sk_buff *newsk)
1227{ 1214{
@@ -1238,7 +1225,7 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
1238 * 1225 *
1239 * A buffer cannot be placed on two lists at the same time. 1226 * A buffer cannot be placed on two lists at the same time.
1240 */ 1227 */
1241extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk); 1228void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
1242static inline void __skb_queue_tail(struct sk_buff_head *list, 1229static inline void __skb_queue_tail(struct sk_buff_head *list,
1243 struct sk_buff *newsk) 1230 struct sk_buff *newsk)
1244{ 1231{
@@ -1249,7 +1236,7 @@ static inline void __skb_queue_tail(struct sk_buff_head *list,
1249 * remove sk_buff from list. _Must_ be called atomically, and with 1236 * remove sk_buff from list. _Must_ be called atomically, and with
1250 * the list known.. 1237 * the list known..
1251 */ 1238 */
1252extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list); 1239void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
1253static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) 1240static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
1254{ 1241{
1255 struct sk_buff *next, *prev; 1242 struct sk_buff *next, *prev;
@@ -1270,7 +1257,7 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
1270 * so must be used with appropriate locks held only. The head item is 1257 * so must be used with appropriate locks held only. The head item is
1271 * returned or %NULL if the list is empty. 1258 * returned or %NULL if the list is empty.
1272 */ 1259 */
1273extern struct sk_buff *skb_dequeue(struct sk_buff_head *list); 1260struct sk_buff *skb_dequeue(struct sk_buff_head *list);
1274static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) 1261static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
1275{ 1262{
1276 struct sk_buff *skb = skb_peek(list); 1263 struct sk_buff *skb = skb_peek(list);
@@ -1287,7 +1274,7 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
1287 * so must be used with appropriate locks held only. The tail item is 1274 * so must be used with appropriate locks held only. The tail item is
1288 * returned or %NULL if the list is empty. 1275 * returned or %NULL if the list is empty.
1289 */ 1276 */
1290extern struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list); 1277struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
1291static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) 1278static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
1292{ 1279{
1293 struct sk_buff *skb = skb_peek_tail(list); 1280 struct sk_buff *skb = skb_peek_tail(list);
@@ -1361,7 +1348,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
1361 * @size: the length of the data 1348 * @size: the length of the data
1362 * 1349 *
1363 * As per __skb_fill_page_desc() -- initialises the @i'th fragment of 1350 * As per __skb_fill_page_desc() -- initialises the @i'th fragment of
1364 * @skb to point to &size bytes at offset @off within @page. In 1351 * @skb to point to @size bytes at offset @off within @page. In
1365 * addition updates @skb such that @i is the last fragment. 1352 * addition updates @skb such that @i is the last fragment.
1366 * 1353 *
1367 * Does not take any additional reference on the fragment. 1354 * Does not take any additional reference on the fragment.
@@ -1373,8 +1360,11 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
1373 skb_shinfo(skb)->nr_frags = i + 1; 1360 skb_shinfo(skb)->nr_frags = i + 1;
1374} 1361}
1375 1362
1376extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, 1363void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
1377 int off, int size, unsigned int truesize); 1364 int size, unsigned int truesize);
1365
1366void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
1367 unsigned int truesize);
1378 1368
1379#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1369#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1380#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) 1370#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb))
@@ -1418,7 +1408,8 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1418/* 1408/*
1419 * Add data to an sk_buff 1409 * Add data to an sk_buff
1420 */ 1410 */
1421extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len); 1411unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
1412unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
1422static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 1413static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
1423{ 1414{
1424 unsigned char *tmp = skb_tail_pointer(skb); 1415 unsigned char *tmp = skb_tail_pointer(skb);
@@ -1428,7 +1419,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
1428 return tmp; 1419 return tmp;
1429} 1420}
1430 1421
1431extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len); 1422unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
1432static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 1423static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
1433{ 1424{
1434 skb->data -= len; 1425 skb->data -= len;
@@ -1436,7 +1427,7 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
1436 return skb->data; 1427 return skb->data;
1437} 1428}
1438 1429
1439extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); 1430unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
1440static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 1431static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
1441{ 1432{
1442 skb->len -= len; 1433 skb->len -= len;
@@ -1449,7 +1440,7 @@ static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int l
1449 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); 1440 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1450} 1441}
1451 1442
1452extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1443unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1453 1444
1454static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1445static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
1455{ 1446{
@@ -1753,7 +1744,7 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1753#define NET_SKB_PAD max(32, L1_CACHE_BYTES) 1744#define NET_SKB_PAD max(32, L1_CACHE_BYTES)
1754#endif 1745#endif
1755 1746
1756extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1747int ___pskb_trim(struct sk_buff *skb, unsigned int len);
1757 1748
1758static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 1749static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1759{ 1750{
@@ -1765,7 +1756,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1765 skb_set_tail_pointer(skb, len); 1756 skb_set_tail_pointer(skb, len);
1766} 1757}
1767 1758
1768extern void skb_trim(struct sk_buff *skb, unsigned int len); 1759void skb_trim(struct sk_buff *skb, unsigned int len);
1769 1760
1770static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1761static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
1771{ 1762{
@@ -1838,7 +1829,7 @@ static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
1838 * the list and one reference dropped. This function does not take the 1829 * the list and one reference dropped. This function does not take the
1839 * list lock and the caller must hold the relevant locks to use it. 1830 * list lock and the caller must hold the relevant locks to use it.
1840 */ 1831 */
1841extern void skb_queue_purge(struct sk_buff_head *list); 1832void skb_queue_purge(struct sk_buff_head *list);
1842static inline void __skb_queue_purge(struct sk_buff_head *list) 1833static inline void __skb_queue_purge(struct sk_buff_head *list)
1843{ 1834{
1844 struct sk_buff *skb; 1835 struct sk_buff *skb;
@@ -1850,11 +1841,10 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1850#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER) 1841#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
1851#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE 1842#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE
1852 1843
1853extern void *netdev_alloc_frag(unsigned int fragsz); 1844void *netdev_alloc_frag(unsigned int fragsz);
1854 1845
1855extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1846struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length,
1856 unsigned int length, 1847 gfp_t gfp_mask);
1857 gfp_t gfp_mask);
1858 1848
1859/** 1849/**
1860 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1850 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -2071,6 +2061,8 @@ static inline void skb_frag_set_page(struct sk_buff *skb, int f,
2071 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); 2061 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page);
2072} 2062}
2073 2063
2064bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio);
2065
2074/** 2066/**
2075 * skb_frag_dma_map - maps a paged fragment via the DMA API 2067 * skb_frag_dma_map - maps a paged fragment via the DMA API
2076 * @dev: the device to map the fragment to 2068 * @dev: the device to map the fragment to
@@ -2342,60 +2334,49 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
2342#define skb_walk_frags(skb, iter) \ 2334#define skb_walk_frags(skb, iter) \
2343 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2335 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2344 2336
2345extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2337struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2346 int *peeked, int *off, int *err); 2338 int *peeked, int *off, int *err);
2347extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 2339struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
2348 int noblock, int *err); 2340 int *err);
2349extern unsigned int datagram_poll(struct file *file, struct socket *sock, 2341unsigned int datagram_poll(struct file *file, struct socket *sock,
2350 struct poll_table_struct *wait); 2342 struct poll_table_struct *wait);
2351extern int skb_copy_datagram_iovec(const struct sk_buff *from, 2343int skb_copy_datagram_iovec(const struct sk_buff *from, int offset,
2352 int offset, struct iovec *to, 2344 struct iovec *to, int size);
2353 int size); 2345int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen,
2354extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, 2346 struct iovec *iov);
2355 int hlen, 2347int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset,
2356 struct iovec *iov); 2348 const struct iovec *from, int from_offset,
2357extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 2349 int len);
2358 int offset, 2350int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *frm,
2359 const struct iovec *from, 2351 int offset, size_t count);
2360 int from_offset, 2352int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset,
2361 int len); 2353 const struct iovec *to, int to_offset,
2362extern int zerocopy_sg_from_iovec(struct sk_buff *skb, 2354 int size);
2363 const struct iovec *frm, 2355void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2364 int offset, 2356void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2365 size_t count); 2357int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
2366extern int skb_copy_datagram_const_iovec(const struct sk_buff *from, 2358int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
2367 int offset, 2359int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
2368 const struct iovec *to, 2360__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
2369 int to_offset, 2361 int len, __wsum csum);
2370 int size); 2362int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
2371extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 2363 struct pipe_inode_info *pipe, unsigned int len,
2372extern void skb_free_datagram_locked(struct sock *sk, 2364 unsigned int flags);
2373 struct sk_buff *skb); 2365void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2374extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 2366void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2375 unsigned int flags); 2367int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2376extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 2368void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2377 int len, __wsum csum); 2369struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2378extern int skb_copy_bits(const struct sk_buff *skb, int offset, 2370
2379 void *to, int len); 2371struct skb_checksum_ops {
2380extern int skb_store_bits(struct sk_buff *skb, int offset, 2372 __wsum (*update)(const void *mem, int len, __wsum wsum);
2381 const void *from, int len); 2373 __wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
2382extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 2374};
2383 int offset, u8 *to, int len, 2375
2384 __wsum csum); 2376__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2385extern int skb_splice_bits(struct sk_buff *skb, 2377 __wsum csum, const struct skb_checksum_ops *ops);
2386 unsigned int offset, 2378__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2387 struct pipe_inode_info *pipe, 2379 __wsum csum);
2388 unsigned int len,
2389 unsigned int flags);
2390extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2391extern void skb_split(struct sk_buff *skb,
2392 struct sk_buff *skb1, const u32 len);
2393extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2394 int shiftlen);
2395extern void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2396
2397extern struct sk_buff *skb_segment(struct sk_buff *skb,
2398 netdev_features_t features);
2399 2380
2400static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2381static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2401 int len, void *buffer) 2382 int len, void *buffer)
@@ -2440,7 +2421,7 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
2440 memcpy(skb->data + offset, from, len); 2421 memcpy(skb->data + offset, from, len);
2441} 2422}
2442 2423
2443extern void skb_init(void); 2424void skb_init(void);
2444 2425
2445static inline ktime_t skb_get_ktime(const struct sk_buff *skb) 2426static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
2446{ 2427{
@@ -2483,12 +2464,12 @@ static inline ktime_t net_invalid_timestamp(void)
2483 return ktime_set(0, 0); 2464 return ktime_set(0, 0);
2484} 2465}
2485 2466
2486extern void skb_timestamping_init(void); 2467void skb_timestamping_init(void);
2487 2468
2488#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2469#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2489 2470
2490extern void skb_clone_tx_timestamp(struct sk_buff *skb); 2471void skb_clone_tx_timestamp(struct sk_buff *skb);
2491extern bool skb_defer_rx_timestamp(struct sk_buff *skb); 2472bool skb_defer_rx_timestamp(struct sk_buff *skb);
2492 2473
2493#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ 2474#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
2494 2475
@@ -2529,8 +2510,8 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
2529 * generates a software time stamp (otherwise), then queues the clone 2510 * generates a software time stamp (otherwise), then queues the clone
2530 * to the error queue of the socket. Errors are silently ignored. 2511 * to the error queue of the socket. Errors are silently ignored.
2531 */ 2512 */
2532extern void skb_tstamp_tx(struct sk_buff *orig_skb, 2513void skb_tstamp_tx(struct sk_buff *orig_skb,
2533 struct skb_shared_hwtstamps *hwtstamps); 2514 struct skb_shared_hwtstamps *hwtstamps);
2534 2515
2535static inline void sw_tx_timestamp(struct sk_buff *skb) 2516static inline void sw_tx_timestamp(struct sk_buff *skb)
2536{ 2517{
@@ -2562,8 +2543,8 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2562 */ 2543 */
2563void skb_complete_wifi_ack(struct sk_buff *skb, bool acked); 2544void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2564 2545
2565extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2546__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2566extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2547__sum16 __skb_checksum_complete(struct sk_buff *skb);
2567 2548
2568static inline int skb_csum_unnecessary(const struct sk_buff *skb) 2549static inline int skb_csum_unnecessary(const struct sk_buff *skb)
2569{ 2550{
@@ -2593,7 +2574,7 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2593} 2574}
2594 2575
2595#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2576#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2596extern void nf_conntrack_destroy(struct nf_conntrack *nfct); 2577void nf_conntrack_destroy(struct nf_conntrack *nfct);
2597static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2578static inline void nf_conntrack_put(struct nf_conntrack *nfct)
2598{ 2579{
2599 if (nfct && atomic_dec_and_test(&nfct->use)) 2580 if (nfct && atomic_dec_and_test(&nfct->use))
@@ -2605,18 +2586,6 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2605 atomic_inc(&nfct->use); 2586 atomic_inc(&nfct->use);
2606} 2587}
2607#endif 2588#endif
2608#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2609static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
2610{
2611 if (skb)
2612 atomic_inc(&skb->users);
2613}
2614static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
2615{
2616 if (skb)
2617 kfree_skb(skb);
2618}
2619#endif
2620#ifdef CONFIG_BRIDGE_NETFILTER 2589#ifdef CONFIG_BRIDGE_NETFILTER
2621static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 2590static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2622{ 2591{
@@ -2635,10 +2604,6 @@ static inline void nf_reset(struct sk_buff *skb)
2635 nf_conntrack_put(skb->nfct); 2604 nf_conntrack_put(skb->nfct);
2636 skb->nfct = NULL; 2605 skb->nfct = NULL;
2637#endif 2606#endif
2638#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2639 nf_conntrack_put_reasm(skb->nfct_reasm);
2640 skb->nfct_reasm = NULL;
2641#endif
2642#ifdef CONFIG_BRIDGE_NETFILTER 2607#ifdef CONFIG_BRIDGE_NETFILTER
2643 nf_bridge_put(skb->nf_bridge); 2608 nf_bridge_put(skb->nf_bridge);
2644 skb->nf_bridge = NULL; 2609 skb->nf_bridge = NULL;
@@ -2660,10 +2625,6 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2660 nf_conntrack_get(src->nfct); 2625 nf_conntrack_get(src->nfct);
2661 dst->nfctinfo = src->nfctinfo; 2626 dst->nfctinfo = src->nfctinfo;
2662#endif 2627#endif
2663#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2664 dst->nfct_reasm = src->nfct_reasm;
2665 nf_conntrack_get_reasm(src->nfct_reasm);
2666#endif
2667#ifdef CONFIG_BRIDGE_NETFILTER 2628#ifdef CONFIG_BRIDGE_NETFILTER
2668 dst->nf_bridge = src->nf_bridge; 2629 dst->nf_bridge = src->nf_bridge;
2669 nf_bridge_get(src->nf_bridge); 2630 nf_bridge_get(src->nf_bridge);
@@ -2675,9 +2636,6 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2675#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2636#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2676 nf_conntrack_put(dst->nfct); 2637 nf_conntrack_put(dst->nfct);
2677#endif 2638#endif
2678#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2679 nf_conntrack_put_reasm(dst->nfct_reasm);
2680#endif
2681#ifdef CONFIG_BRIDGE_NETFILTER 2639#ifdef CONFIG_BRIDGE_NETFILTER
2682 nf_bridge_put(dst->nf_bridge); 2640 nf_bridge_put(dst->nf_bridge);
2683#endif 2641#endif
@@ -2732,28 +2690,27 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
2732 return skb->queue_mapping != 0; 2690 return skb->queue_mapping != 0;
2733} 2691}
2734 2692
2735extern u16 __skb_tx_hash(const struct net_device *dev, 2693u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb,
2736 const struct sk_buff *skb, 2694 unsigned int num_tx_queues);
2737 unsigned int num_tx_queues);
2738 2695
2739#ifdef CONFIG_XFRM
2740static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2696static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2741{ 2697{
2698#ifdef CONFIG_XFRM
2742 return skb->sp; 2699 return skb->sp;
2743}
2744#else 2700#else
2745static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2746{
2747 return NULL; 2701 return NULL;
2748}
2749#endif 2702#endif
2703}
2750 2704
2751/* Keeps track of mac header offset relative to skb->head. 2705/* Keeps track of mac header offset relative to skb->head.
2752 * It is useful for TSO of Tunneling protocol. e.g. GRE. 2706 * It is useful for TSO of Tunneling protocol. e.g. GRE.
2753 * For non-tunnel skb it points to skb_mac_header() and for 2707 * For non-tunnel skb it points to skb_mac_header() and for
2754 * tunnel skb it points to outer mac header. */ 2708 * tunnel skb it points to outer mac header.
2709 * Keeps track of level of encapsulation of network headers.
2710 */
2755struct skb_gso_cb { 2711struct skb_gso_cb {
2756 int mac_offset; 2712 int mac_offset;
2713 int encap_level;
2757}; 2714};
2758#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) 2715#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2759 2716
@@ -2783,12 +2740,13 @@ static inline bool skb_is_gso(const struct sk_buff *skb)
2783 return skb_shinfo(skb)->gso_size; 2740 return skb_shinfo(skb)->gso_size;
2784} 2741}
2785 2742
2743/* Note: Should be called only if skb_is_gso(skb) is true */
2786static inline bool skb_is_gso_v6(const struct sk_buff *skb) 2744static inline bool skb_is_gso_v6(const struct sk_buff *skb)
2787{ 2745{
2788 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 2746 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
2789} 2747}
2790 2748
2791extern void __skb_warn_lro_forwarding(const struct sk_buff *skb); 2749void __skb_warn_lro_forwarding(const struct sk_buff *skb);
2792 2750
2793static inline bool skb_warn_if_lro(const struct sk_buff *skb) 2751static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2794{ 2752{
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 6c5cc0ea8713..1e2f4fe12773 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -4,6 +4,8 @@
4 * (C) SGI 2006, Christoph Lameter 4 * (C) SGI 2006, Christoph Lameter
5 * Cleaned up and restructured to ease the addition of alternative 5 * Cleaned up and restructured to ease the addition of alternative
6 * implementations of SLAB allocators. 6 * implementations of SLAB allocators.
7 * (C) Linux Foundation 2008-2013
8 * Unified interface for all slab allocators
7 */ 9 */
8 10
9#ifndef _LINUX_SLAB_H 11#ifndef _LINUX_SLAB_H
@@ -51,7 +53,14 @@
51 * } 53 * }
52 * rcu_read_unlock(); 54 * rcu_read_unlock();
53 * 55 *
54 * See also the comment on struct slab_rcu in mm/slab.c. 56 * This is useful if we need to approach a kernel structure obliquely,
57 * from its address obtained without the usual locking. We can lock
58 * the structure to stabilize it and check it's still at the given address,
59 * only if we can be sure that the memory has not been meanwhile reused
60 * for some other kind of object (which our subsystem's lock might corrupt).
61 *
62 * rcu_read_lock before reading the address, then rcu_read_unlock after
63 * taking the spinlock within the structure expected at that address.
55 */ 64 */
56#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ 65#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */
57#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 66#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
@@ -94,6 +103,7 @@
94#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 103#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
95 (unsigned long)ZERO_SIZE_PTR) 104 (unsigned long)ZERO_SIZE_PTR)
96 105
106#include <linux/kmemleak.h>
97 107
98struct mem_cgroup; 108struct mem_cgroup;
99/* 109/*
@@ -289,6 +299,57 @@ static __always_inline int kmalloc_index(size_t size)
289} 299}
290#endif /* !CONFIG_SLOB */ 300#endif /* !CONFIG_SLOB */
291 301
302void *__kmalloc(size_t size, gfp_t flags);
303void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags);
304
305#ifdef CONFIG_NUMA
306void *__kmalloc_node(size_t size, gfp_t flags, int node);
307void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
308#else
309static __always_inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
310{
311 return __kmalloc(size, flags);
312}
313
314static __always_inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node)
315{
316 return kmem_cache_alloc(s, flags);
317}
318#endif
319
320#ifdef CONFIG_TRACING
321extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
322
323#ifdef CONFIG_NUMA
324extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
325 gfp_t gfpflags,
326 int node, size_t size);
327#else
328static __always_inline void *
329kmem_cache_alloc_node_trace(struct kmem_cache *s,
330 gfp_t gfpflags,
331 int node, size_t size)
332{
333 return kmem_cache_alloc_trace(s, gfpflags, size);
334}
335#endif /* CONFIG_NUMA */
336
337#else /* CONFIG_TRACING */
338static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s,
339 gfp_t flags, size_t size)
340{
341 return kmem_cache_alloc(s, flags);
342}
343
344static __always_inline void *
345kmem_cache_alloc_node_trace(struct kmem_cache *s,
346 gfp_t gfpflags,
347 int node, size_t size)
348{
349 return kmem_cache_alloc_node(s, gfpflags, node);
350}
351#endif /* CONFIG_TRACING */
352
292#ifdef CONFIG_SLAB 353#ifdef CONFIG_SLAB
293#include <linux/slab_def.h> 354#include <linux/slab_def.h>
294#endif 355#endif
@@ -297,9 +358,105 @@ static __always_inline int kmalloc_index(size_t size)
297#include <linux/slub_def.h> 358#include <linux/slub_def.h>
298#endif 359#endif
299 360
300#ifdef CONFIG_SLOB 361static __always_inline void *
301#include <linux/slob_def.h> 362kmalloc_order(size_t size, gfp_t flags, unsigned int order)
363{
364 void *ret;
365
366 flags |= (__GFP_COMP | __GFP_KMEMCG);
367 ret = (void *) __get_free_pages(flags, order);
368 kmemleak_alloc(ret, size, 1, flags);
369 return ret;
370}
371
372#ifdef CONFIG_TRACING
373extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
374#else
375static __always_inline void *
376kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
377{
378 return kmalloc_order(size, flags, order);
379}
380#endif
381
382static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
383{
384 unsigned int order = get_order(size);
385 return kmalloc_order_trace(size, flags, order);
386}
387
388/**
389 * kmalloc - allocate memory
390 * @size: how many bytes of memory are required.
391 * @flags: the type of memory to allocate.
392 *
393 * kmalloc is the normal method of allocating memory
394 * for objects smaller than page size in the kernel.
395 *
396 * The @flags argument may be one of:
397 *
398 * %GFP_USER - Allocate memory on behalf of user. May sleep.
399 *
400 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
401 *
402 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
403 * For example, use this inside interrupt handlers.
404 *
405 * %GFP_HIGHUSER - Allocate pages from high memory.
406 *
407 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
408 *
409 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
410 *
411 * %GFP_NOWAIT - Allocation will not sleep.
412 *
413 * %GFP_THISNODE - Allocate node-local memory only.
414 *
415 * %GFP_DMA - Allocation suitable for DMA.
416 * Should only be used for kmalloc() caches. Otherwise, use a
417 * slab created with SLAB_DMA.
418 *
419 * Also it is possible to set different flags by OR'ing
420 * in one or more of the following additional @flags:
421 *
422 * %__GFP_COLD - Request cache-cold pages instead of
423 * trying to return cache-warm pages.
424 *
425 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
426 *
427 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
428 * (think twice before using).
429 *
430 * %__GFP_NORETRY - If memory is not immediately available,
431 * then give up at once.
432 *
433 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
434 *
435 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
436 *
437 * There are other flags available as well, but these are not intended
438 * for general use, and so are not documented here. For a full list of
439 * potential flags, always refer to linux/gfp.h.
440 */
441static __always_inline void *kmalloc(size_t size, gfp_t flags)
442{
443 if (__builtin_constant_p(size)) {
444 if (size > KMALLOC_MAX_CACHE_SIZE)
445 return kmalloc_large(size, flags);
446#ifndef CONFIG_SLOB
447 if (!(flags & GFP_DMA)) {
448 int index = kmalloc_index(size);
449
450 if (!index)
451 return ZERO_SIZE_PTR;
452
453 return kmem_cache_alloc_trace(kmalloc_caches[index],
454 flags, size);
455 }
302#endif 456#endif
457 }
458 return __kmalloc(size, flags);
459}
303 460
304/* 461/*
305 * Determine size used for the nth kmalloc cache. 462 * Determine size used for the nth kmalloc cache.
@@ -321,6 +478,23 @@ static __always_inline int kmalloc_size(int n)
321 return 0; 478 return 0;
322} 479}
323 480
481static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
482{
483#ifndef CONFIG_SLOB
484 if (__builtin_constant_p(size) &&
485 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
486 int i = kmalloc_index(size);
487
488 if (!i)
489 return ZERO_SIZE_PTR;
490
491 return kmem_cache_alloc_node_trace(kmalloc_caches[i],
492 flags, node, size);
493 }
494#endif
495 return __kmalloc_node(size, flags, node);
496}
497
324/* 498/*
325 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 499 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
326 * Intended for arches that get misalignment faults even for 64 bit integer 500 * Intended for arches that get misalignment faults even for 64 bit integer
@@ -373,61 +547,6 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
373void print_slabinfo_header(struct seq_file *m); 547void print_slabinfo_header(struct seq_file *m);
374 548
375/** 549/**
376 * kmalloc - allocate memory
377 * @size: how many bytes of memory are required.
378 * @flags: the type of memory to allocate.
379 *
380 * The @flags argument may be one of:
381 *
382 * %GFP_USER - Allocate memory on behalf of user. May sleep.
383 *
384 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
385 *
386 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
387 * For example, use this inside interrupt handlers.
388 *
389 * %GFP_HIGHUSER - Allocate pages from high memory.
390 *
391 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
392 *
393 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
394 *
395 * %GFP_NOWAIT - Allocation will not sleep.
396 *
397 * %GFP_THISNODE - Allocate node-local memory only.
398 *
399 * %GFP_DMA - Allocation suitable for DMA.
400 * Should only be used for kmalloc() caches. Otherwise, use a
401 * slab created with SLAB_DMA.
402 *
403 * Also it is possible to set different flags by OR'ing
404 * in one or more of the following additional @flags:
405 *
406 * %__GFP_COLD - Request cache-cold pages instead of
407 * trying to return cache-warm pages.
408 *
409 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
410 *
411 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
412 * (think twice before using).
413 *
414 * %__GFP_NORETRY - If memory is not immediately available,
415 * then give up at once.
416 *
417 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
418 *
419 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
420 *
421 * There are other flags available as well, but these are not intended
422 * for general use, and so are not documented here. For a full list of
423 * potential flags, always refer to linux/gfp.h.
424 *
425 * kmalloc is the normal method of allocating memory
426 * in the kernel.
427 */
428static __always_inline void *kmalloc(size_t size, gfp_t flags);
429
430/**
431 * kmalloc_array - allocate memory for an array. 550 * kmalloc_array - allocate memory for an array.
432 * @n: number of elements. 551 * @n: number of elements.
433 * @size: element size. 552 * @size: element size.
@@ -451,36 +570,6 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
451 return kmalloc_array(n, size, flags | __GFP_ZERO); 570 return kmalloc_array(n, size, flags | __GFP_ZERO);
452} 571}
453 572
454#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
455/**
456 * kmalloc_node - allocate memory from a specific node
457 * @size: how many bytes of memory are required.
458 * @flags: the type of memory to allocate (see kmalloc).
459 * @node: node to allocate from.
460 *
461 * kmalloc() for non-local nodes, used to allocate from a specific node
462 * if available. Equivalent to kmalloc() in the non-NUMA single-node
463 * case.
464 */
465static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
466{
467 return kmalloc(size, flags);
468}
469
470static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
471{
472 return __kmalloc(size, flags);
473}
474
475void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
476
477static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
478 gfp_t flags, int node)
479{
480 return kmem_cache_alloc(cachep, flags);
481}
482#endif /* !CONFIG_NUMA && !CONFIG_SLOB */
483
484/* 573/*
485 * kmalloc_track_caller is a special version of kmalloc that records the 574 * kmalloc_track_caller is a special version of kmalloc that records the
486 * calling function of the routine calling it for slab leak tracking instead 575 * calling function of the routine calling it for slab leak tracking instead
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index cd401580bdd3..09bfffb08a56 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -3,20 +3,6 @@
3 3
4/* 4/*
5 * Definitions unique to the original Linux SLAB allocator. 5 * Definitions unique to the original Linux SLAB allocator.
6 *
7 * What we provide here is a way to optimize the frequent kmalloc
8 * calls in the kernel by selecting the appropriate general cache
9 * if kmalloc was called with a size that can be established at
10 * compile time.
11 */
12
13#include <linux/init.h>
14#include <linux/compiler.h>
15
16/*
17 * struct kmem_cache
18 *
19 * manages a cache.
20 */ 6 */
21 7
22struct kmem_cache { 8struct kmem_cache {
@@ -41,8 +27,8 @@ struct kmem_cache {
41 27
42 size_t colour; /* cache colouring range */ 28 size_t colour; /* cache colouring range */
43 unsigned int colour_off; /* colour offset */ 29 unsigned int colour_off; /* colour offset */
44 struct kmem_cache *slabp_cache; 30 struct kmem_cache *freelist_cache;
45 unsigned int slab_size; 31 unsigned int freelist_size;
46 32
47 /* constructor func */ 33 /* constructor func */
48 void (*ctor)(void *obj); 34 void (*ctor)(void *obj);
@@ -102,96 +88,4 @@ struct kmem_cache {
102 */ 88 */
103}; 89};
104 90
105void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
106void *__kmalloc(size_t size, gfp_t flags);
107
108#ifdef CONFIG_TRACING
109extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
110#else
111static __always_inline void *
112kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
113{
114 return kmem_cache_alloc(cachep, flags);
115}
116#endif
117
118static __always_inline void *kmalloc(size_t size, gfp_t flags)
119{
120 struct kmem_cache *cachep;
121 void *ret;
122
123 if (__builtin_constant_p(size)) {
124 int i;
125
126 if (!size)
127 return ZERO_SIZE_PTR;
128
129 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
130 return NULL;
131
132 i = kmalloc_index(size);
133
134#ifdef CONFIG_ZONE_DMA
135 if (flags & GFP_DMA)
136 cachep = kmalloc_dma_caches[i];
137 else
138#endif
139 cachep = kmalloc_caches[i];
140
141 ret = kmem_cache_alloc_trace(cachep, flags, size);
142
143 return ret;
144 }
145 return __kmalloc(size, flags);
146}
147
148#ifdef CONFIG_NUMA
149extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
150extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
151
152#ifdef CONFIG_TRACING
153extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
154 gfp_t flags,
155 int nodeid,
156 size_t size);
157#else
158static __always_inline void *
159kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
160 gfp_t flags,
161 int nodeid,
162 size_t size)
163{
164 return kmem_cache_alloc_node(cachep, flags, nodeid);
165}
166#endif
167
168static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
169{
170 struct kmem_cache *cachep;
171
172 if (__builtin_constant_p(size)) {
173 int i;
174
175 if (!size)
176 return ZERO_SIZE_PTR;
177
178 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
179 return NULL;
180
181 i = kmalloc_index(size);
182
183#ifdef CONFIG_ZONE_DMA
184 if (flags & GFP_DMA)
185 cachep = kmalloc_dma_caches[i];
186 else
187#endif
188 cachep = kmalloc_caches[i];
189
190 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
191 }
192 return __kmalloc_node(size, flags, node);
193}
194
195#endif /* CONFIG_NUMA */
196
197#endif /* _LINUX_SLAB_DEF_H */ 91#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
deleted file mode 100644
index 095a5a4a8516..000000000000
--- a/include/linux/slob_def.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H
3
4#include <linux/numa.h>
5
6void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
7
8static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
9 gfp_t flags)
10{
11 return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
12}
13
14void *__kmalloc_node(size_t size, gfp_t flags, int node);
15
16static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
17{
18 return __kmalloc_node(size, flags, node);
19}
20
21static __always_inline void *kmalloc(size_t size, gfp_t flags)
22{
23 return __kmalloc_node(size, flags, NUMA_NO_NODE);
24}
25
26static __always_inline void *__kmalloc(size_t size, gfp_t flags)
27{
28 return kmalloc(size, flags);
29}
30
31#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 027276fa8713..f56bfa9e4526 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -6,18 +6,12 @@
6 * 6 *
7 * (C) 2007 SGI, Christoph Lameter 7 * (C) 2007 SGI, Christoph Lameter
8 */ 8 */
9#include <linux/types.h>
10#include <linux/gfp.h>
11#include <linux/bug.h>
12#include <linux/workqueue.h>
13#include <linux/kobject.h> 9#include <linux/kobject.h>
14 10
15#include <linux/kmemleak.h>
16
17enum stat_item { 11enum stat_item {
18 ALLOC_FASTPATH, /* Allocation from cpu slab */ 12 ALLOC_FASTPATH, /* Allocation from cpu slab */
19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 13 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
20 FREE_FASTPATH, /* Free to cpu slub */ 14 FREE_FASTPATH, /* Free to cpu slab */
21 FREE_SLOWPATH, /* Freeing not to cpu slab */ 15 FREE_SLOWPATH, /* Freeing not to cpu slab */
22 FREE_FROZEN, /* Freeing to frozen slab */ 16 FREE_FROZEN, /* Freeing to frozen slab */
23 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ 17 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */
@@ -104,108 +98,4 @@ struct kmem_cache {
104 struct kmem_cache_node *node[MAX_NUMNODES]; 98 struct kmem_cache_node *node[MAX_NUMNODES];
105}; 99};
106 100
107void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
108void *__kmalloc(size_t size, gfp_t flags);
109
110static __always_inline void *
111kmalloc_order(size_t size, gfp_t flags, unsigned int order)
112{
113 void *ret;
114
115 flags |= (__GFP_COMP | __GFP_KMEMCG);
116 ret = (void *) __get_free_pages(flags, order);
117 kmemleak_alloc(ret, size, 1, flags);
118 return ret;
119}
120
121/**
122 * Calling this on allocated memory will check that the memory
123 * is expected to be in use, and print warnings if not.
124 */
125#ifdef CONFIG_SLUB_DEBUG
126extern bool verify_mem_not_deleted(const void *x);
127#else
128static inline bool verify_mem_not_deleted(const void *x)
129{
130 return true;
131}
132#endif
133
134#ifdef CONFIG_TRACING
135extern void *
136kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size);
137extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
138#else
139static __always_inline void *
140kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size)
141{
142 return kmem_cache_alloc(s, gfpflags);
143}
144
145static __always_inline void *
146kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
147{
148 return kmalloc_order(size, flags, order);
149}
150#endif
151
152static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
153{
154 unsigned int order = get_order(size);
155 return kmalloc_order_trace(size, flags, order);
156}
157
158static __always_inline void *kmalloc(size_t size, gfp_t flags)
159{
160 if (__builtin_constant_p(size)) {
161 if (size > KMALLOC_MAX_CACHE_SIZE)
162 return kmalloc_large(size, flags);
163
164 if (!(flags & GFP_DMA)) {
165 int index = kmalloc_index(size);
166
167 if (!index)
168 return ZERO_SIZE_PTR;
169
170 return kmem_cache_alloc_trace(kmalloc_caches[index],
171 flags, size);
172 }
173 }
174 return __kmalloc(size, flags);
175}
176
177#ifdef CONFIG_NUMA
178void *__kmalloc_node(size_t size, gfp_t flags, int node);
179void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
180
181#ifdef CONFIG_TRACING
182extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
183 gfp_t gfpflags,
184 int node, size_t size);
185#else
186static __always_inline void *
187kmem_cache_alloc_node_trace(struct kmem_cache *s,
188 gfp_t gfpflags,
189 int node, size_t size)
190{
191 return kmem_cache_alloc_node(s, gfpflags, node);
192}
193#endif
194
195static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
196{
197 if (__builtin_constant_p(size) &&
198 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
199 int index = kmalloc_index(size);
200
201 if (!index)
202 return ZERO_SIZE_PTR;
203
204 return kmem_cache_alloc_node_trace(kmalloc_caches[index],
205 flags, node, size);
206 }
207 return __kmalloc_node(size, flags, node);
208}
209#endif
210
211#endif /* _LINUX_SLUB_DEF_H */ 101#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c181399f2c20..5da22ee42e16 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -28,6 +28,30 @@ extern unsigned int total_cpus;
28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, 28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
29 int wait); 29 int wait);
30 30
31/*
32 * Call a function on all processors
33 */
34int on_each_cpu(smp_call_func_t func, void *info, int wait);
35
36/*
37 * Call a function on processors specified by mask, which might include
38 * the local one.
39 */
40void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
41 void *info, bool wait);
42
43/*
44 * Call a function on each processor for which the supplied function
45 * cond_func returns a positive value. This may include the local
46 * processor.
47 */
48void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
49 smp_call_func_t func, void *info, bool wait,
50 gfp_t gfp_flags);
51
52void __smp_call_function_single(int cpuid, struct call_single_data *data,
53 int wait);
54
31#ifdef CONFIG_SMP 55#ifdef CONFIG_SMP
32 56
33#include <linux/preempt.h> 57#include <linux/preempt.h>
@@ -74,9 +98,6 @@ int smp_call_function(smp_call_func_t func, void *info, int wait);
74void smp_call_function_many(const struct cpumask *mask, 98void smp_call_function_many(const struct cpumask *mask,
75 smp_call_func_t func, void *info, bool wait); 99 smp_call_func_t func, void *info, bool wait);
76 100
77void __smp_call_function_single(int cpuid, struct call_single_data *data,
78 int wait);
79
80int smp_call_function_any(const struct cpumask *mask, 101int smp_call_function_any(const struct cpumask *mask,
81 smp_call_func_t func, void *info, int wait); 102 smp_call_func_t func, void *info, int wait);
82 103
@@ -85,35 +106,10 @@ void kick_all_cpus_sync(void);
85/* 106/*
86 * Generic and arch helpers 107 * Generic and arch helpers
87 */ 108 */
88#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
89void __init call_function_init(void); 109void __init call_function_init(void);
90void generic_smp_call_function_single_interrupt(void); 110void generic_smp_call_function_single_interrupt(void);
91#define generic_smp_call_function_interrupt \ 111#define generic_smp_call_function_interrupt \
92 generic_smp_call_function_single_interrupt 112 generic_smp_call_function_single_interrupt
93#else
94static inline void call_function_init(void) { }
95#endif
96
97/*
98 * Call a function on all processors
99 */
100int on_each_cpu(smp_call_func_t func, void *info, int wait);
101
102/*
103 * Call a function on processors specified by mask, which might include
104 * the local one.
105 */
106void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
107 void *info, bool wait);
108
109/*
110 * Call a function on each processor for which the supplied function
111 * cond_func returns a positive value. This may include the local
112 * processor.
113 */
114void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
115 smp_call_func_t func, void *info, bool wait,
116 gfp_t gfp_flags);
117 113
118/* 114/*
119 * Mark the boot cpu "online" so that it can call console drivers in 115 * Mark the boot cpu "online" so that it can call console drivers in
@@ -139,43 +135,6 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
139} 135}
140#define smp_call_function(func, info, wait) \ 136#define smp_call_function(func, info, wait) \
141 (up_smp_call_function(func, info)) 137 (up_smp_call_function(func, info))
142#define on_each_cpu(func, info, wait) \
143 ({ \
144 unsigned long __flags; \
145 local_irq_save(__flags); \
146 func(info); \
147 local_irq_restore(__flags); \
148 0; \
149 })
150/*
151 * Note we still need to test the mask even for UP
152 * because we actually can get an empty mask from
153 * code that on SMP might call us without the local
154 * CPU in the mask.
155 */
156#define on_each_cpu_mask(mask, func, info, wait) \
157 do { \
158 if (cpumask_test_cpu(0, (mask))) { \
159 local_irq_disable(); \
160 (func)(info); \
161 local_irq_enable(); \
162 } \
163 } while (0)
164/*
165 * Preemption is disabled here to make sure the cond_func is called under the
166 * same condtions in UP and SMP.
167 */
168#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\
169 do { \
170 void *__info = (info); \
171 preempt_disable(); \
172 if ((cond_func)(0, __info)) { \
173 local_irq_disable(); \
174 (func)(__info); \
175 local_irq_enable(); \
176 } \
177 preempt_enable(); \
178 } while (0)
179 138
180static inline void smp_send_reschedule(int cpu) { } 139static inline void smp_send_reschedule(int cpu) { }
181#define smp_prepare_boot_cpu() do {} while (0) 140#define smp_prepare_boot_cpu() do {} while (0)
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 32be8dbdf191..274bc0fa00af 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -7,6 +7,11 @@
7struct device; 7struct device;
8struct mmc_host; 8struct mmc_host;
9 9
10#define MMC_SPI_USE_CD_GPIO (1 << 0)
11#define MMC_SPI_USE_RO_GPIO (1 << 1)
12#define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2)
13#define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3)
14
10/* Put this in platform_data of a device being used to manage an MMC/SD 15/* Put this in platform_data of a device being used to manage an MMC/SD
11 * card slot. (Modeled after PXA mmc glue; see that for usage examples.) 16 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
12 * 17 *
@@ -21,17 +26,19 @@ struct mmc_spi_platform_data {
21 void *); 26 void *);
22 void (*exit)(struct device *, void *); 27 void (*exit)(struct device *, void *);
23 28
24 /* sense switch on sd cards */
25 int (*get_ro)(struct device *);
26
27 /* 29 /*
28 * If board does not use CD interrupts, driver can optimize polling 30 * Card Detect and Read Only GPIOs. To enable debouncing on the card
29 * using this function. 31 * detect GPIO, set the cd_debounce to the debounce time in
32 * microseconds.
30 */ 33 */
31 int (*get_cd)(struct device *); 34 unsigned int flags;
35 unsigned int cd_gpio;
36 unsigned int cd_debounce;
37 unsigned int ro_gpio;
32 38
33 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ 39 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
34 unsigned long caps; 40 unsigned long caps;
41 unsigned long caps2;
35 42
36 /* how long to debounce card detect, in msecs */ 43 /* how long to debounce card detect, in msecs */
37 u16 detect_delay; 44 u16 detect_delay;
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
index 900f0e328235..a25bd6f65e7f 100644
--- a/include/linux/spi/rspi.h
+++ b/include/linux/spi/rspi.h
@@ -26,6 +26,8 @@ struct rspi_plat_data {
26 unsigned int dma_rx_id; 26 unsigned int dma_rx_id;
27 27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */ 28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29
30 u16 num_chipselect;
29}; 31};
30 32
31#endif 33#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 887116dbce2c..8c62ba74dd91 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -23,6 +23,7 @@
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/completion.h>
26 27
27/* 28/*
28 * INTERFACES between SPI master-side drivers and SPI infrastructure. 29 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -150,8 +151,7 @@ static inline void *spi_get_drvdata(struct spi_device *spi)
150} 151}
151 152
152struct spi_message; 153struct spi_message;
153 154struct spi_transfer;
154
155 155
156/** 156/**
157 * struct spi_driver - Host side "protocol" driver 157 * struct spi_driver - Host side "protocol" driver
@@ -257,6 +257,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
257 * @queue_lock: spinlock to syncronise access to message queue 257 * @queue_lock: spinlock to syncronise access to message queue
258 * @queue: message queue 258 * @queue: message queue
259 * @cur_msg: the currently in-flight message 259 * @cur_msg: the currently in-flight message
260 * @cur_msg_prepared: spi_prepare_message was called for the currently
261 * in-flight message
262 * @xfer_completion: used by core tranfer_one_message()
260 * @busy: message pump is busy 263 * @busy: message pump is busy
261 * @running: message pump is running 264 * @running: message pump is running
262 * @rt: whether this queue is set to run as a realtime task 265 * @rt: whether this queue is set to run as a realtime task
@@ -274,6 +277,16 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
274 * @unprepare_transfer_hardware: there are currently no more messages on the 277 * @unprepare_transfer_hardware: there are currently no more messages on the
275 * queue so the subsystem notifies the driver that it may relax the 278 * queue so the subsystem notifies the driver that it may relax the
276 * hardware by issuing this call 279 * hardware by issuing this call
280 * @set_cs: assert or deassert chip select, true to assert. May be called
281 * from interrupt context.
282 * @prepare_message: set up the controller to transfer a single message,
283 * for example doing DMA mapping. Called from threaded
284 * context.
285 * @transfer_one: transfer a single spi_transfer. When the
286 * driver is finished with this transfer it must call
287 * spi_finalize_current_transfer() so the subsystem can issue
288 * the next transfer
289 * @unprepare_message: undo any work done by prepare_message().
277 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 290 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
278 * number. Any individual value may be -ENOENT for CS lines that 291 * number. Any individual value may be -ENOENT for CS lines that
279 * are not GPIOs (driven by the SPI controller itself). 292 * are not GPIOs (driven by the SPI controller itself).
@@ -388,11 +401,25 @@ struct spi_master {
388 bool running; 401 bool running;
389 bool rt; 402 bool rt;
390 bool auto_runtime_pm; 403 bool auto_runtime_pm;
404 bool cur_msg_prepared;
405 struct completion xfer_completion;
391 406
392 int (*prepare_transfer_hardware)(struct spi_master *master); 407 int (*prepare_transfer_hardware)(struct spi_master *master);
393 int (*transfer_one_message)(struct spi_master *master, 408 int (*transfer_one_message)(struct spi_master *master,
394 struct spi_message *mesg); 409 struct spi_message *mesg);
395 int (*unprepare_transfer_hardware)(struct spi_master *master); 410 int (*unprepare_transfer_hardware)(struct spi_master *master);
411 int (*prepare_message)(struct spi_master *master,
412 struct spi_message *message);
413 int (*unprepare_message)(struct spi_master *master,
414 struct spi_message *message);
415
416 /*
417 * These hooks are for drivers that use a generic implementation
418 * of transfer_one_message() provied by the core.
419 */
420 void (*set_cs)(struct spi_device *spi, bool enable);
421 int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
422 struct spi_transfer *transfer);
396 423
397 /* gpio chip select */ 424 /* gpio chip select */
398 int *cs_gpios; 425 int *cs_gpios;
@@ -428,12 +455,15 @@ extern int spi_master_resume(struct spi_master *master);
428/* Calls the driver make to interact with the message queue */ 455/* Calls the driver make to interact with the message queue */
429extern struct spi_message *spi_get_next_queued_message(struct spi_master *master); 456extern struct spi_message *spi_get_next_queued_message(struct spi_master *master);
430extern void spi_finalize_current_message(struct spi_master *master); 457extern void spi_finalize_current_message(struct spi_master *master);
458extern void spi_finalize_current_transfer(struct spi_master *master);
431 459
432/* the spi driver core manages memory for the spi_master classdev */ 460/* the spi driver core manages memory for the spi_master classdev */
433extern struct spi_master * 461extern struct spi_master *
434spi_alloc_master(struct device *host, unsigned size); 462spi_alloc_master(struct device *host, unsigned size);
435 463
436extern int spi_register_master(struct spi_master *master); 464extern int spi_register_master(struct spi_master *master);
465extern int devm_spi_register_master(struct device *dev,
466 struct spi_master *master);
437extern void spi_unregister_master(struct spi_master *master); 467extern void spi_unregister_master(struct spi_master *master);
438 468
439extern struct spi_master *spi_busnum_to_master(u16 busnum); 469extern struct spi_master *spi_busnum_to_master(u16 busnum);
@@ -823,6 +853,33 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
823 return (status < 0) ? status : result; 853 return (status < 0) ? status : result;
824} 854}
825 855
856/**
857 * spi_w8r16be - SPI synchronous 8 bit write followed by 16 bit big-endian read
858 * @spi: device with which data will be exchanged
859 * @cmd: command to be written before data is read back
860 * Context: can sleep
861 *
862 * This returns the (unsigned) sixteen bit number returned by the device in cpu
863 * endianness, or else a negative error code. Callable only from contexts that
864 * can sleep.
865 *
866 * This function is similar to spi_w8r16, with the exception that it will
867 * convert the read 16 bit data word from big-endian to native endianness.
868 *
869 */
870static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)
871
872{
873 ssize_t status;
874 __be16 result;
875
876 status = spi_write_then_read(spi, &cmd, 1, &result, 2);
877 if (status < 0)
878 return status;
879
880 return be16_to_cpu(result);
881}
882
826/*---------------------------------------------------------------------------*/ 883/*---------------------------------------------------------------------------*/
827 884
828/* 885/*
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index c114614ed172..9b058eecd403 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -237,4 +237,18 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
237 __srcu_read_unlock(sp, idx); 237 __srcu_read_unlock(sp, idx);
238} 238}
239 239
240/**
241 * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock
242 *
243 * Converts the preceding srcu_read_unlock into a two-way memory barrier.
244 *
245 * Call this after srcu_read_unlock, to guarantee that all memory operations
246 * that occur after smp_mb__after_srcu_read_unlock will appear to happen after
247 * the preceding srcu_read_unlock.
248 */
249static inline void smp_mb__after_srcu_read_unlock(void)
250{
251 /* __srcu_read_unlock has smp_mb() internally so nothing to do here. */
252}
253
240#endif 254#endif
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 86a12b0cb239..0688472500bb 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -108,6 +108,16 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
108 return 0; 108 return 0;
109} 109}
110 110
111/* Get the device phy address */
112static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
113{
114 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
115 if (!dev)
116 return -ENODEV;
117
118 return dev->dev->bus->sprom.et0phyaddr;
119}
120
111extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 121extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
112 struct pci_dev *pdev); 122 struct pci_dev *pdev);
113extern int ssb_gige_map_irq(struct ssb_device *sdev, 123extern int ssb_gige_map_irq(struct ssb_device *sdev,
@@ -174,6 +184,10 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
174{ 184{
175 return -ENODEV; 185 return -ENODEV;
176} 186}
187static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
188{
189 return -ENODEV;
190}
177 191
178#endif /* CONFIG_SSB_DRIVER_GIGE */ 192#endif /* CONFIG_SSB_DRIVER_GIGE */
179#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ 193#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 3b5e910d14ca..d2abbdb8c6aa 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -28,6 +28,7 @@ struct cpu_stop_work {
28}; 28};
29 29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); 30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, 32void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf); 33 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); 34int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 0dd00f4f6810..790be1472792 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -24,12 +24,21 @@
24 24
25struct rpcsec_gss_info; 25struct rpcsec_gss_info;
26 26
27/* auth_cred ac_flags bits */
28enum {
29 RPC_CRED_NO_CRKEY_TIMEOUT = 0, /* underlying cred has no key timeout */
30 RPC_CRED_KEY_EXPIRE_SOON = 1, /* underlying cred key will expire soon */
31 RPC_CRED_NOTIFY_TIMEOUT = 2, /* nofity generic cred when underlying
32 key will expire soon */
33};
34
27/* Work around the lack of a VFS credential */ 35/* Work around the lack of a VFS credential */
28struct auth_cred { 36struct auth_cred {
29 kuid_t uid; 37 kuid_t uid;
30 kgid_t gid; 38 kgid_t gid;
31 struct group_info *group_info; 39 struct group_info *group_info;
32 const char *principal; 40 const char *principal;
41 unsigned long ac_flags;
33 unsigned char machine_cred : 1; 42 unsigned char machine_cred : 1;
34}; 43};
35 44
@@ -87,6 +96,11 @@ struct rpc_auth {
87 /* per-flavor data */ 96 /* per-flavor data */
88}; 97};
89 98
99struct rpc_auth_create_args {
100 rpc_authflavor_t pseudoflavor;
101 const char *target_name;
102};
103
90/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
91#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
92 106
@@ -97,17 +111,17 @@ struct rpc_authops {
97 struct module *owner; 111 struct module *owner;
98 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ 112 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
99 char * au_name; 113 char * au_name;
100 struct rpc_auth * (*create)(struct rpc_clnt *, rpc_authflavor_t); 114 struct rpc_auth * (*create)(struct rpc_auth_create_args *, struct rpc_clnt *);
101 void (*destroy)(struct rpc_auth *); 115 void (*destroy)(struct rpc_auth *);
102 116
103 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); 117 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
104 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); 118 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
105 int (*pipes_create)(struct rpc_auth *);
106 void (*pipes_destroy)(struct rpc_auth *);
107 int (*list_pseudoflavors)(rpc_authflavor_t *, int); 119 int (*list_pseudoflavors)(rpc_authflavor_t *, int);
108 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *); 120 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
109 int (*flavor2info)(rpc_authflavor_t, 121 int (*flavor2info)(rpc_authflavor_t,
110 struct rpcsec_gss_info *); 122 struct rpcsec_gss_info *);
123 int (*key_timeout)(struct rpc_auth *,
124 struct rpc_cred *);
111}; 125};
112 126
113struct rpc_credops { 127struct rpc_credops {
@@ -124,6 +138,8 @@ struct rpc_credops {
124 void *, __be32 *, void *); 138 void *, __be32 *, void *);
125 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t, 139 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t,
126 void *, __be32 *, void *); 140 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *);
127}; 143};
128 144
129extern const struct rpc_authops authunix_ops; 145extern const struct rpc_authops authunix_ops;
@@ -140,7 +156,8 @@ struct rpc_cred * rpc_lookup_cred(void);
140struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
141int rpcauth_register(const struct rpc_authops *); 157int rpcauth_register(const struct rpc_authops *);
142int rpcauth_unregister(const struct rpc_authops *); 158int rpcauth_unregister(const struct rpc_authops *);
143struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 159struct rpc_auth * rpcauth_create(struct rpc_auth_create_args *,
160 struct rpc_clnt *);
144void rpcauth_release(struct rpc_auth *); 161void rpcauth_release(struct rpc_auth *);
145rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, 162rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
146 struct rpcsec_gss_info *); 163 struct rpcsec_gss_info *);
@@ -162,6 +179,9 @@ int rpcauth_uptodatecred(struct rpc_task *);
162int rpcauth_init_credcache(struct rpc_auth *); 179int rpcauth_init_credcache(struct rpc_auth *);
163void rpcauth_destroy_credcache(struct rpc_auth *); 180void rpcauth_destroy_credcache(struct rpc_auth *);
164void rpcauth_clear_credcache(struct rpc_cred_cache *); 181void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *);
165 185
166static inline 186static inline
167struct rpc_cred * get_rpccred(struct rpc_cred *cred) 187struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6ce690de447f..437ddb6c4aef 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -264,12 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint)
264 return 0; 264 return 0;
265} 265}
266 266
267static inline int get_time(char **bpp, time_t *time)
268{
269 char buf[50];
270 long long ll;
271 int len = qword_get(bpp, buf, sizeof(buf));
272
273 if (len < 0)
274 return -EINVAL;
275 if (len == 0)
276 return -ENOENT;
277
278 if (kstrtoll(buf, 0, &ll))
279 return -EINVAL;
280
281 *time = (time_t)ll;
282 return 0;
283}
284
267static inline time_t get_expiry(char **bpp) 285static inline time_t get_expiry(char **bpp)
268{ 286{
269 int rv; 287 time_t rv;
270 struct timespec boot; 288 struct timespec boot;
271 289
272 if (get_int(bpp, &rv)) 290 if (get_time(bpp, &rv))
273 return 0; 291 return 0;
274 if (rv < 0) 292 if (rv < 0)
275 return 0; 293 return 0;
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index bfe11be81f6f..8af2804bab16 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -21,6 +21,7 @@
21#include <linux/sunrpc/stats.h> 21#include <linux/sunrpc/stats.h>
22#include <linux/sunrpc/xdr.h> 22#include <linux/sunrpc/xdr.h>
23#include <linux/sunrpc/timer.h> 23#include <linux/sunrpc/timer.h>
24#include <linux/sunrpc/rpc_pipe_fs.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25#include <linux/path.h> 26#include <linux/path.h>
26#include <net/ipv6.h> 27#include <net/ipv6.h>
@@ -32,6 +33,7 @@ struct rpc_inode;
32 */ 33 */
33struct rpc_clnt { 34struct rpc_clnt {
34 atomic_t cl_count; /* Number of references */ 35 atomic_t cl_count; /* Number of references */
36 unsigned int cl_clid; /* client id */
35 struct list_head cl_clients; /* Global list of clients */ 37 struct list_head cl_clients; /* Global list of clients */
36 struct list_head cl_tasks; /* List of tasks */ 38 struct list_head cl_tasks; /* List of tasks */
37 spinlock_t cl_lock; /* spinlock */ 39 spinlock_t cl_lock; /* spinlock */
@@ -41,13 +43,13 @@ struct rpc_clnt {
41 cl_vers, /* RPC version number */ 43 cl_vers, /* RPC version number */
42 cl_maxproc; /* max procedure number */ 44 cl_maxproc; /* max procedure number */
43 45
44 const char * cl_protname; /* protocol name */
45 struct rpc_auth * cl_auth; /* authenticator */ 46 struct rpc_auth * cl_auth; /* authenticator */
46 struct rpc_stat * cl_stats; /* per-program statistics */ 47 struct rpc_stat * cl_stats; /* per-program statistics */
47 struct rpc_iostats * cl_metrics; /* per-client statistics */ 48 struct rpc_iostats * cl_metrics; /* per-client statistics */
48 49
49 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
50 cl_discrtry : 1,/* disconnect before retry */ 51 cl_discrtry : 1,/* disconnect before retry */
52 cl_noretranstimeo: 1,/* No retransmit timeouts */
51 cl_autobind : 1,/* use getport() */ 53 cl_autobind : 1,/* use getport() */
52 cl_chatty : 1;/* be verbose */ 54 cl_chatty : 1;/* be verbose */
53 55
@@ -56,12 +58,11 @@ struct rpc_clnt {
56 58
57 int cl_nodelen; /* nodename length */ 59 int cl_nodelen; /* nodename length */
58 char cl_nodename[UNX_MAXNODENAME]; 60 char cl_nodename[UNX_MAXNODENAME];
59 struct dentry * cl_dentry; 61 struct rpc_pipe_dir_head cl_pipedir_objects;
60 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 62 struct rpc_clnt * cl_parent; /* Points to parent of clones */
61 struct rpc_rtt cl_rtt_default; 63 struct rpc_rtt cl_rtt_default;
62 struct rpc_timeout cl_timeout_default; 64 struct rpc_timeout cl_timeout_default;
63 const struct rpc_program *cl_program; 65 const struct rpc_program *cl_program;
64 char *cl_principal; /* target to authenticate to */
65}; 66};
66 67
67/* 68/*
@@ -126,6 +127,7 @@ struct rpc_create_args {
126#define RPC_CLNT_CREATE_QUIET (1UL << 6) 127#define RPC_CLNT_CREATE_QUIET (1UL << 6)
127#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) 128#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7)
128#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) 129#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)
130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
129 131
130struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132struct rpc_clnt *rpc_create(struct rpc_create_args *args);
131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 133struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
@@ -134,6 +136,10 @@ void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
134struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 136struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
135struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, 137struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *,
136 rpc_authflavor_t); 138 rpc_authflavor_t);
139int rpc_switch_client_transport(struct rpc_clnt *,
140 struct xprt_create *,
141 const struct rpc_timeout *);
142
137void rpc_shutdown_client(struct rpc_clnt *); 143void rpc_shutdown_client(struct rpc_clnt *);
138void rpc_release_client(struct rpc_clnt *); 144void rpc_release_client(struct rpc_clnt *);
139void rpc_task_release_client(struct rpc_task *); 145void rpc_task_release_client(struct rpc_task *);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index aa5b582cc471..a353e0300b54 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -5,6 +5,26 @@
5 5
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7 7
8struct rpc_pipe_dir_head {
9 struct list_head pdh_entries;
10 struct dentry *pdh_dentry;
11};
12
13struct rpc_pipe_dir_object_ops;
14struct rpc_pipe_dir_object {
15 struct list_head pdo_head;
16 const struct rpc_pipe_dir_object_ops *pdo_ops;
17
18 void *pdo_data;
19};
20
21struct rpc_pipe_dir_object_ops {
22 int (*create)(struct dentry *dir,
23 struct rpc_pipe_dir_object *pdo);
24 void (*destroy)(struct dentry *dir,
25 struct rpc_pipe_dir_object *pdo);
26};
27
8struct rpc_pipe_msg { 28struct rpc_pipe_msg {
9 struct list_head list; 29 struct list_head list;
10 void *data; 30 void *data;
@@ -74,7 +94,24 @@ extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 94
75struct rpc_clnt; 95struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *); 96extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 97extern int rpc_remove_client_dir(struct rpc_clnt *);
98
99extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
100extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
101 const struct rpc_pipe_dir_object_ops *pdo_ops,
102 void *pdo_data);
103extern int rpc_add_pipe_dir_object(struct net *net,
104 struct rpc_pipe_dir_head *pdh,
105 struct rpc_pipe_dir_object *pdo);
106extern void rpc_remove_pipe_dir_object(struct net *net,
107 struct rpc_pipe_dir_head *pdh,
108 struct rpc_pipe_dir_object *pdo);
109extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object(
110 struct net *net,
111 struct rpc_pipe_dir_head *pdh,
112 int (*match)(struct rpc_pipe_dir_object *, void *),
113 struct rpc_pipe_dir_object *(*alloc)(void *),
114 void *data);
78 115
79struct cache_detail; 116struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 117extern struct dentry *rpc_create_cache_dir(struct dentry *,
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 1821445708d6..3a847de83fab 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -79,7 +79,7 @@ struct rpc_task {
79 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */ 80 unsigned short tk_timeouts; /* maj timeouts */
81 81
82#ifdef RPC_DEBUG 82#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
83 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
84#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */ 85 unsigned char tk_priority : 2,/* Task priority */
@@ -122,6 +122,7 @@ struct rpc_task_setup {
122#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ 124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
125#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
125 126
126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 127#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 128#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1f0216b9a6c9..6eecfc2e4f98 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -243,7 +243,6 @@ struct svc_rqst {
243 struct xdr_buf rq_res; 243 struct xdr_buf rq_res;
244 struct page * rq_pages[RPCSVC_MAXPAGES]; 244 struct page * rq_pages[RPCSVC_MAXPAGES];
245 struct page * *rq_respages; /* points into rq_pages */ 245 struct page * *rq_respages; /* points into rq_pages */
246 int rq_resused; /* number of pages used for result */
247 struct page * *rq_next_page; /* next reply page to use */ 246 struct page * *rq_next_page; /* next reply page to use */
248 247
249 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cec7b9b5e1bf..8097b9df6773 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -288,7 +288,7 @@ int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
291int xprt_prepare_transmit(struct rpc_task *task); 291bool xprt_prepare_transmit(struct rpc_task *task);
292void xprt_transmit(struct rpc_task *task); 292void xprt_transmit(struct rpc_task *task);
293void xprt_end_transmit(struct rpc_task *task); 293void xprt_end_transmit(struct rpc_task *task);
294int xprt_adjust_timeout(struct rpc_rqst *req); 294int xprt_adjust_timeout(struct rpc_rqst *req);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d95cde5e257d..46ba0c6c219f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -182,6 +182,33 @@ enum {
182#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ 182#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */
183 183
184/* 184/*
185 * We use this to track usage of a cluster. A cluster is a block of swap disk
186 * space with SWAPFILE_CLUSTER pages long and naturally aligns in disk. All
187 * free clusters are organized into a list. We fetch an entry from the list to
188 * get a free cluster.
189 *
190 * The data field stores next cluster if the cluster is free or cluster usage
191 * counter otherwise. The flags field determines if a cluster is free. This is
192 * protected by swap_info_struct.lock.
193 */
194struct swap_cluster_info {
195 unsigned int data:24;
196 unsigned int flags:8;
197};
198#define CLUSTER_FLAG_FREE 1 /* This cluster is free */
199#define CLUSTER_FLAG_NEXT_NULL 2 /* This cluster has no next cluster */
200
201/*
202 * We assign a cluster to each CPU, so each CPU can allocate swap entry from
203 * its own cluster and swapout sequentially. The purpose is to optimize swapout
204 * throughput.
205 */
206struct percpu_cluster {
207 struct swap_cluster_info index; /* Current cluster index */
208 unsigned int next; /* Likely next allocation offset */
209};
210
211/*
185 * The in-memory structure used to track swap areas. 212 * The in-memory structure used to track swap areas.
186 */ 213 */
187struct swap_info_struct { 214struct swap_info_struct {
@@ -191,14 +218,16 @@ struct swap_info_struct {
191 signed char next; /* next type on the swap list */ 218 signed char next; /* next type on the swap list */
192 unsigned int max; /* extent of the swap_map */ 219 unsigned int max; /* extent of the swap_map */
193 unsigned char *swap_map; /* vmalloc'ed array of usage counts */ 220 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
221 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
222 struct swap_cluster_info free_cluster_head; /* free cluster list head */
223 struct swap_cluster_info free_cluster_tail; /* free cluster list tail */
194 unsigned int lowest_bit; /* index of first free in swap_map */ 224 unsigned int lowest_bit; /* index of first free in swap_map */
195 unsigned int highest_bit; /* index of last free in swap_map */ 225 unsigned int highest_bit; /* index of last free in swap_map */
196 unsigned int pages; /* total of usable pages of swap */ 226 unsigned int pages; /* total of usable pages of swap */
197 unsigned int inuse_pages; /* number of those currently in use */ 227 unsigned int inuse_pages; /* number of those currently in use */
198 unsigned int cluster_next; /* likely index for next allocation */ 228 unsigned int cluster_next; /* likely index for next allocation */
199 unsigned int cluster_nr; /* countdown to next cluster search */ 229 unsigned int cluster_nr; /* countdown to next cluster search */
200 unsigned int lowest_alloc; /* while preparing discard cluster */ 230 struct percpu_cluster __percpu *percpu_cluster; /* per cpu's swap location */
201 unsigned int highest_alloc; /* while preparing discard cluster */
202 struct swap_extent *curr_swap_extent; 231 struct swap_extent *curr_swap_extent;
203 struct swap_extent first_swap_extent; 232 struct swap_extent first_swap_extent;
204 struct block_device *bdev; /* swap device or bdev of swap file */ 233 struct block_device *bdev; /* swap device or bdev of swap file */
@@ -212,14 +241,18 @@ struct swap_info_struct {
212 * protect map scan related fields like 241 * protect map scan related fields like
213 * swap_map, lowest_bit, highest_bit, 242 * swap_map, lowest_bit, highest_bit,
214 * inuse_pages, cluster_next, 243 * inuse_pages, cluster_next,
215 * cluster_nr, lowest_alloc and 244 * cluster_nr, lowest_alloc,
216 * highest_alloc. other fields are only 245 * highest_alloc, free/discard cluster
217 * changed at swapon/swapoff, so are 246 * list. other fields are only changed
218 * protected by swap_lock. changing 247 * at swapon/swapoff, so are protected
219 * flags need hold this lock and 248 * by swap_lock. changing flags need
220 * swap_lock. If both locks need hold, 249 * hold this lock and swap_lock. If
221 * hold swap_lock first. 250 * both locks need hold, hold swap_lock
251 * first.
222 */ 252 */
253 struct work_struct discard_work; /* discard worker */
254 struct swap_cluster_info discard_cluster_head; /* list head of discard clusters */
255 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */
223}; 256};
224 257
225struct swap_list_t { 258struct swap_list_t {
@@ -247,7 +280,7 @@ extern void activate_page(struct page *);
247extern void mark_page_accessed(struct page *); 280extern void mark_page_accessed(struct page *);
248extern void lru_add_drain(void); 281extern void lru_add_drain(void);
249extern void lru_add_drain_cpu(int cpu); 282extern void lru_add_drain_cpu(int cpu);
250extern int lru_add_drain_all(void); 283extern void lru_add_drain_all(void);
251extern void rotate_reclaimable_page(struct page *page); 284extern void rotate_reclaimable_page(struct page *page);
252extern void deactivate_page(struct page *page); 285extern void deactivate_page(struct page *page);
253extern void swap_setup(void); 286extern void swap_setup(void);
@@ -414,6 +447,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
414 447
415#else /* CONFIG_SWAP */ 448#else /* CONFIG_SWAP */
416 449
450#define swap_address_space(entry) (NULL)
417#define get_nr_swap_pages() 0L 451#define get_nr_swap_pages() 0L
418#define total_swap_pages 0L 452#define total_swap_pages 0L
419#define total_swapcache_pages() 0UL 453#define total_swapcache_pages() 0UL
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 8d4fa82bfb91..c0f75261a728 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -139,7 +139,8 @@ static inline void make_migration_entry_read(swp_entry_t *entry)
139 139
140extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 140extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
141 unsigned long address); 141 unsigned long address);
142extern void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte); 142extern void migration_entry_wait_huge(struct vm_area_struct *vma,
143 struct mm_struct *mm, pte_t *pte);
143#else 144#else
144 145
145#define make_migration_entry(page, write) swp_entry(0, 0) 146#define make_migration_entry(page, write) swp_entry(0, 0)
@@ -151,8 +152,8 @@ static inline int is_migration_entry(swp_entry_t swp)
151static inline void make_migration_entry_read(swp_entry_t *entryp) { } 152static inline void make_migration_entry_read(swp_entry_t *entryp) { }
152static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 153static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
153 unsigned long address) { } 154 unsigned long address) { }
154static inline void migration_entry_wait_huge(struct mm_struct *mm, 155static inline void migration_entry_wait_huge(struct vm_area_struct *vma,
155 pte_t *pte) { } 156 struct mm_struct *mm, pte_t *pte) { }
156static inline int is_write_migration_entry(swp_entry_t entry) 157static inline int is_write_migration_entry(swp_entry_t entry)
157{ 158{
158 return 0; 159 return 0;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 84662ecc7b51..94273bbe6050 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -120,7 +120,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
120 .class = &event_class_syscall_enter, \ 120 .class = &event_class_syscall_enter, \
121 .event.funcs = &enter_syscall_print_funcs, \ 121 .event.funcs = &enter_syscall_print_funcs, \
122 .data = (void *)&__syscall_meta_##sname,\ 122 .data = (void *)&__syscall_meta_##sname,\
123 .flags = TRACE_EVENT_FL_CAP_ANY, \ 123 .flags = TRACE_EVENT_FL_CAP_ANY, \
124 }; \ 124 }; \
125 static struct ftrace_event_call __used \ 125 static struct ftrace_event_call __used \
126 __attribute__((section("_ftrace_events"))) \ 126 __attribute__((section("_ftrace_events"))) \
@@ -134,7 +134,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
134 .class = &event_class_syscall_exit, \ 134 .class = &event_class_syscall_exit, \
135 .event.funcs = &exit_syscall_print_funcs, \ 135 .event.funcs = &exit_syscall_print_funcs, \
136 .data = (void *)&__syscall_meta_##sname,\ 136 .data = (void *)&__syscall_meta_##sname,\
137 .flags = TRACE_EVENT_FL_CAP_ANY, \ 137 .flags = TRACE_EVENT_FL_CAP_ANY, \
138 }; \ 138 }; \
139 static struct ftrace_event_call __used \ 139 static struct ftrace_event_call __used \
140 __attribute__((section("_ftrace_events"))) \ 140 __attribute__((section("_ftrace_events"))) \
@@ -184,8 +184,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
184 184
185#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) 185#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
186#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \
187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
188 __attribute__((alias(__stringify(SyS##name)))); \
188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 189 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
190 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 191 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
190 { \ 192 { \
191 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ 193 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
@@ -193,7 +195,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
193 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ 195 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
194 return ret; \ 196 return ret; \
195 } \ 197 } \
196 SYSCALL_ALIAS(sys##name, SyS##name); \
197 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 198 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
198 199
199asmlinkage long sys_time(time_t __user *tloc); 200asmlinkage long sys_time(time_t __user *tloc);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 11baec7c9b26..6695040a0317 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -173,7 +173,6 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
173struct sysfs_ops { 173struct sysfs_ops {
174 ssize_t (*show)(struct kobject *, struct attribute *, char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
176 const void *(*namespace)(struct kobject *, const struct attribute *);
177}; 176};
178 177
179struct sysfs_dirent; 178struct sysfs_dirent;
@@ -183,19 +182,23 @@ struct sysfs_dirent;
183int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 182int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
184 void *data, struct module *owner); 183 void *data, struct module *owner);
185 184
186int __must_check sysfs_create_dir(struct kobject *kobj); 185int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
187void sysfs_remove_dir(struct kobject *kobj); 186void sysfs_remove_dir(struct kobject *kobj);
188int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); 187int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
189int __must_check sysfs_move_dir(struct kobject *kobj, 188 const void *new_ns);
190 struct kobject *new_parent_kobj); 189int __must_check sysfs_move_dir_ns(struct kobject *kobj,
191 190 struct kobject *new_parent_kobj,
192int __must_check sysfs_create_file(struct kobject *kobj, 191 const void *new_ns);
193 const struct attribute *attr); 192
193int __must_check sysfs_create_file_ns(struct kobject *kobj,
194 const struct attribute *attr,
195 const void *ns);
194int __must_check sysfs_create_files(struct kobject *kobj, 196int __must_check sysfs_create_files(struct kobject *kobj,
195 const struct attribute **attr); 197 const struct attribute **attr);
196int __must_check sysfs_chmod_file(struct kobject *kobj, 198int __must_check sysfs_chmod_file(struct kobject *kobj,
197 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
198void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
201 const void *ns);
199void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 202void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
200 203
201int __must_check sysfs_create_bin_file(struct kobject *kobj, 204int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -210,8 +213,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
210 const char *name); 213 const char *name);
211void sysfs_remove_link(struct kobject *kobj, const char *name); 214void sysfs_remove_link(struct kobject *kobj, const char *name);
212 215
213int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 216int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
214 const char *old_name, const char *new_name); 217 const char *old_name, const char *new_name,
218 const void *new_ns);
215 219
216void sysfs_delete_link(struct kobject *dir, struct kobject *targ, 220void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
217 const char *name); 221 const char *name);
@@ -241,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
241 245
242void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
243void sysfs_notify_dirent(struct sysfs_dirent *sd); 247void sysfs_notify_dirent(struct sysfs_dirent *sd);
244struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 248struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
245 const void *ns, 249 const unsigned char *name,
246 const unsigned char *name); 250 const void *ns);
247struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
248void sysfs_put(struct sysfs_dirent *sd); 252void sysfs_put(struct sysfs_dirent *sd);
249 253
@@ -257,7 +261,7 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
257 return -ENOSYS; 261 return -ENOSYS;
258} 262}
259 263
260static inline int sysfs_create_dir(struct kobject *kobj) 264static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
261{ 265{
262 return 0; 266 return 0;
263} 267}
@@ -266,19 +270,22 @@ static inline void sysfs_remove_dir(struct kobject *kobj)
266{ 270{
267} 271}
268 272
269static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 273static inline int sysfs_rename_dir_ns(struct kobject *kobj,
274 const char *new_name, const void *new_ns)
270{ 275{
271 return 0; 276 return 0;
272} 277}
273 278
274static inline int sysfs_move_dir(struct kobject *kobj, 279static inline int sysfs_move_dir_ns(struct kobject *kobj,
275 struct kobject *new_parent_kobj) 280 struct kobject *new_parent_kobj,
281 const void *new_ns)
276{ 282{
277 return 0; 283 return 0;
278} 284}
279 285
280static inline int sysfs_create_file(struct kobject *kobj, 286static inline int sysfs_create_file_ns(struct kobject *kobj,
281 const struct attribute *attr) 287 const struct attribute *attr,
288 const void *ns)
282{ 289{
283 return 0; 290 return 0;
284} 291}
@@ -295,8 +302,9 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
295 return 0; 302 return 0;
296} 303}
297 304
298static inline void sysfs_remove_file(struct kobject *kobj, 305static inline void sysfs_remove_file_ns(struct kobject *kobj,
299 const struct attribute *attr) 306 const struct attribute *attr,
307 const void *ns)
300{ 308{
301} 309}
302 310
@@ -333,8 +341,9 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
333{ 341{
334} 342}
335 343
336static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, 344static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t,
337 const char *old_name, const char *new_name) 345 const char *old_name,
346 const char *new_name, const void *ns)
338{ 347{
339 return 0; 348 return 0;
340} 349}
@@ -413,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
413static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) 422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
414{ 423{
415} 424}
416static inline 425static inline struct sysfs_dirent *
417struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 426sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
418 const void *ns, 427 const void *ns)
419 const unsigned char *name)
420{ 428{
421 return NULL; 429 return NULL;
422} 430}
@@ -435,4 +443,28 @@ static inline int __must_check sysfs_init(void)
435 443
436#endif /* CONFIG_SYSFS */ 444#endif /* CONFIG_SYSFS */
437 445
446static inline int __must_check sysfs_create_file(struct kobject *kobj,
447 const struct attribute *attr)
448{
449 return sysfs_create_file_ns(kobj, attr, NULL);
450}
451
452static inline void sysfs_remove_file(struct kobject *kobj,
453 const struct attribute *attr)
454{
455 return sysfs_remove_file_ns(kobj, attr, NULL);
456}
457
458static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
459 const char *old_name, const char *new_name)
460{
461 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
462}
463
464static inline struct sysfs_dirent *
465sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
466{
467 return sysfs_get_dirent_ns(parent_sd, name, NULL);
468}
469
438#endif /* _SYSFS_H_ */ 470#endif /* _SYSFS_H_ */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 7faf933cced7..387fa7d05c98 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -17,9 +17,6 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
21#define SYSRQ_DEFAULT_ENABLE 1
22
23/* Possible values of bitmask for enabling sysrq functions */ 20/* Possible values of bitmask for enabling sysrq functions */
24/* 0x0001 is reserved for enable everything */ 21/* 0x0001 is reserved for enable everything */
25#define SYSRQ_ENABLE_LOG 0x0002 22#define SYSRQ_ENABLE_LOG 0x0002
diff --git a/include/linux/tegra-cpuidle.h b/include/linux/tegra-cpuidle.h
new file mode 100644
index 000000000000..9c6286bbf662
--- /dev/null
+++ b/include/linux/tegra-cpuidle.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef __LINUX_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__
16
17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void);
19#else
20static inline void tegra_cpuidle_pcie_irqs_in_use(void)
21{
22}
23#endif
24
25#endif
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
index 55c29a8d5015..fd4498329c7c 100644
--- a/include/linux/tegra-powergate.h
+++ b/include/linux/tegra-powergate.h
@@ -34,10 +34,18 @@ struct clk;
34#define TEGRA_POWERGATE_CPU3 11 34#define TEGRA_POWERGATE_CPU3 11
35#define TEGRA_POWERGATE_CELP 12 35#define TEGRA_POWERGATE_CELP 12
36#define TEGRA_POWERGATE_3D1 13 36#define TEGRA_POWERGATE_3D1 13
37#define TEGRA_POWERGATE_CPU0 14
38#define TEGRA_POWERGATE_C0NC 15
39#define TEGRA_POWERGATE_C1NC 16
40#define TEGRA_POWERGATE_DIS 18
41#define TEGRA_POWERGATE_DISB 19
42#define TEGRA_POWERGATE_XUSBA 20
43#define TEGRA_POWERGATE_XUSBB 21
44#define TEGRA_POWERGATE_XUSBC 22
37 45
38#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
39#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 46#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
40 47
48#ifdef CONFIG_ARCH_TEGRA
41int tegra_powergate_is_powered(int id); 49int tegra_powergate_is_powered(int id);
42int tegra_powergate_power_on(int id); 50int tegra_powergate_power_on(int id);
43int tegra_powergate_power_off(int id); 51int tegra_powergate_power_off(int id);
@@ -45,5 +53,31 @@ int tegra_powergate_remove_clamping(int id);
45 53
46/* Must be called with clk disabled, and returns with clk enabled */ 54/* Must be called with clk disabled, and returns with clk enabled */
47int tegra_powergate_sequence_power_up(int id, struct clk *clk); 55int tegra_powergate_sequence_power_up(int id, struct clk *clk);
56#else
57static inline int tegra_powergate_is_powered(int id)
58{
59 return -ENOSYS;
60}
61
62static inline int tegra_powergate_power_on(int id)
63{
64 return -ENOSYS;
65}
66
67static inline int tegra_powergate_power_off(int id)
68{
69 return -ENOSYS;
70}
71
72static inline int tegra_powergate_remove_clamping(int id)
73{
74 return -ENOSYS;
75}
76
77static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk)
78{
79 return -ENOSYS;
80}
81#endif
48 82
49#endif /* _MACH_TEGRA_POWERGATE_H_ */ 83#endif /* _MACH_TEGRA_POWERGATE_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index a386a1cbb6e1..b268d3cf7ae3 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -207,6 +207,16 @@ struct thermal_bind_params {
207 * See Documentation/thermal/sysfs-api.txt for more information. 207 * See Documentation/thermal/sysfs-api.txt for more information.
208 */ 208 */
209 int trip_mask; 209 int trip_mask;
210
211 /*
212 * This is an array of cooling state limits. Must have exactly
213 * 2 * thermal_zone.number_of_trip_points. It is an array consisting
214 * of tuples <lower-state upper-state> of state limits. Each trip
215 * will be associated with one state limit tuple when binding.
216 * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
217 * on all trips.
218 */
219 unsigned long *binding_limits;
210 int (*match) (struct thermal_zone_device *tz, 220 int (*match) (struct thermal_zone_device *tz,
211 struct thermal_cooling_device *cdev); 221 struct thermal_cooling_device *cdev);
212}; 222};
@@ -214,6 +224,14 @@ struct thermal_bind_params {
214/* Structure to define Thermal Zone parameters */ 224/* Structure to define Thermal Zone parameters */
215struct thermal_zone_params { 225struct thermal_zone_params {
216 char governor_name[THERMAL_NAME_LENGTH]; 226 char governor_name[THERMAL_NAME_LENGTH];
227
228 /*
229 * a boolean to indicate if the thermal to hwmon sysfs interface
230 * is required. when no_hwmon == false, a hwmon sysfs interface
231 * will be created. when no_hwmon == true, nothing will be done
232 */
233 bool no_hwmon;
234
217 int num_tbps; /* Number of tbp entries */ 235 int num_tbps; /* Number of tbp entries */
218 struct thermal_bind_params *tbp; 236 struct thermal_bind_params *tbp;
219}; 237};
diff --git a/include/linux/thinkpad_acpi.h b/include/linux/thinkpad_acpi.h
new file mode 100644
index 000000000000..361de59a2285
--- /dev/null
+++ b/include/linux/thinkpad_acpi.h
@@ -0,0 +1,15 @@
1#ifndef __THINKPAD_ACPI_H__
2#define __THINKPAD_ACPI_H__
3
4/* These two functions return 0 if success, or negative error code
5 (e g -ENODEV if no led present) */
6
7enum {
8 TPACPI_LED_MUTE,
9 TPACPI_LED_MICMUTE,
10 TPACPI_LED_MAX,
11};
12
13int tpacpi_led_set(int whichled, bool on);
14
15#endif
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index e7e04736802f..fddbe2023a5d 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -104,8 +104,21 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
104#define test_thread_flag(flag) \ 104#define test_thread_flag(flag) \
105 test_ti_thread_flag(current_thread_info(), flag) 105 test_ti_thread_flag(current_thread_info(), flag)
106 106
107#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 107static inline __deprecated void set_need_resched(void)
108#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 108{
109 /*
110 * Use of this function in deprecated.
111 *
112 * As of this writing there are only a few users in the DRM tree left
113 * all of which are wrong and can be removed without causing too much
114 * grief.
115 *
116 * The DRM people are aware and are working on removing the last few
117 * instances.
118 */
119}
120
121#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
109 122
110#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK 123#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
111/* 124/*
diff --git a/include/linux/time-armada-370-xp.h b/include/linux/time-armada-370-xp.h
deleted file mode 100644
index dfdfdc03115b..000000000000
--- a/include/linux/time-armada-370-xp.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Marvell Armada 370/XP SoC timer handling.
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Lior Amsalem <alior@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 */
11#ifndef __TIME_ARMADA_370_XPPRCMU_H
12#define __TIME_ARMADA_370_XPPRCMU_H
13
14#include <linux/init.h>
15
16void __init armada_370_xp_timer_init(void);
17
18#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b3726e61368e..9d3f1a5b6178 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -64,6 +64,20 @@
64 64
65#include <asm/timex.h> 65#include <asm/timex.h>
66 66
67#ifndef random_get_entropy
68/*
69 * The random_get_entropy() function is used by the /dev/random driver
70 * in order to extract entropy via the relative unpredictability of
71 * when an interrupt takes places versus a high speed, fine-grained
72 * timing source or cycle counter. Since it will be occurred on every
73 * single interrupt, it must have a very low cost/overhead.
74 *
75 * By default we use get_cycles() for this purpose, but individual
76 * architectures may override this in their asm/timex.h header file.
77 */
78#define random_get_entropy() get_cycles()
79#endif
80
67/* 81/*
68 * SHIFT_PLL is used as a dampening factor to define how much we 82 * SHIFT_PLL is used as a dampening factor to define how much we
69 * adjust the frequency correction for a given offset in PLL mode. 83 * adjust the frequency correction for a given offset in PLL mode.
@@ -141,6 +155,7 @@ extern int do_adjtimex(struct timex *);
141extern void hardpps(const struct timespec *, const struct timespec *); 155extern void hardpps(const struct timespec *, const struct timespec *);
142 156
143int read_current_timer(unsigned long *timer_val); 157int read_current_timer(unsigned long *timer_val);
158void ntp_notify_cmos_timer(void);
144 159
145/* The clock frequency of the i8253/i8254 PIT */ 160/* The clock frequency of the i8253/i8254 PIT */
146#define PIT_TICK_RATE 1193182ul 161#define PIT_TICK_RATE 1193182ul
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d3cf0d6e7712..12ae6ce997d6 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -106,6 +106,8 @@ int arch_update_cpu_topology(void);
106 .last_balance = jiffies, \ 106 .last_balance = jiffies, \
107 .balance_interval = 1, \ 107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \ 108 .smt_gain = 1178, /* 15% */ \
109 .max_newidle_lb_cost = 0, \
110 .next_decay_max_lb_cost = jiffies, \
109} 111}
110#endif 112#endif
111#endif /* CONFIG_SCHED_SMT */ 113#endif /* CONFIG_SCHED_SMT */
@@ -135,6 +137,8 @@ int arch_update_cpu_topology(void);
135 , \ 137 , \
136 .last_balance = jiffies, \ 138 .last_balance = jiffies, \
137 .balance_interval = 1, \ 139 .balance_interval = 1, \
140 .max_newidle_lb_cost = 0, \
141 .next_decay_max_lb_cost = jiffies, \
138} 142}
139#endif 143#endif
140#endif /* CONFIG_SCHED_MC */ 144#endif /* CONFIG_SCHED_MC */
@@ -166,6 +170,8 @@ int arch_update_cpu_topology(void);
166 , \ 170 , \
167 .last_balance = jiffies, \ 171 .last_balance = jiffies, \
168 .balance_interval = 1, \ 172 .balance_interval = 1, \
173 .max_newidle_lb_cost = 0, \
174 .next_decay_max_lb_cost = jiffies, \
169} 175}
170#endif 176#endif
171 177
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f0c3e4cb45a8..accc497f8d72 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -267,6 +267,8 @@ static inline void tracepoint_synchronize_unregister(void)
267 267
268#define TRACE_EVENT_FLAGS(event, flag) 268#define TRACE_EVENT_FLAGS(event, flag)
269 269
270#define TRACE_EVENT_PERF_PERM(event, expr...)
271
270#endif /* DECLARE_TRACE */ 272#endif /* DECLARE_TRACE */
271 273
272#ifndef TRACE_EVENT 274#ifndef TRACE_EVENT
@@ -399,4 +401,6 @@ static inline void tracepoint_synchronize_unregister(void)
399 401
400#define TRACE_EVENT_FLAGS(event, flag) 402#define TRACE_EVENT_FLAGS(event, flag)
401 403
404#define TRACE_EVENT_PERF_PERM(event, expr...)
405
402#endif /* ifdef TRACE_EVENT (see note above) */ 406#endif /* ifdef TRACE_EVENT (see note above) */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 64f864651d86..97d660ed70c1 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -180,7 +180,6 @@ struct tty_port_operations {
180 IFF the port was initialized. Do not use to free resources. Called 180 IFF the port was initialized. Do not use to free resources. Called
181 under the port mutex to serialize against activate/shutdowns */ 181 under the port mutex to serialize against activate/shutdowns */
182 void (*shutdown)(struct tty_port *port); 182 void (*shutdown)(struct tty_port *port);
183 void (*drop)(struct tty_port *port);
184 /* Called under the port mutex from tty_port_open, serialized using 183 /* Called under the port mutex from tty_port_open, serialized using
185 the port mutex */ 184 the port mutex */
186 /* FIXME: long term getting the tty argument *out* of this would be 185 /* FIXME: long term getting the tty argument *out* of this would be
@@ -672,31 +671,17 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
672#define wait_event_interruptible_tty(tty, wq, condition) \ 671#define wait_event_interruptible_tty(tty, wq, condition) \
673({ \ 672({ \
674 int __ret = 0; \ 673 int __ret = 0; \
675 if (!(condition)) { \ 674 if (!(condition)) \
676 __wait_event_interruptible_tty(tty, wq, condition, __ret); \ 675 __ret = __wait_event_interruptible_tty(tty, wq, \
677 } \ 676 condition); \
678 __ret; \ 677 __ret; \
679}) 678})
680 679
681#define __wait_event_interruptible_tty(tty, wq, condition, ret) \ 680#define __wait_event_interruptible_tty(tty, wq, condition) \
682do { \ 681 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
683 DEFINE_WAIT(__wait); \ 682 tty_unlock(tty); \
684 \
685 for (;;) { \
686 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
687 if (condition) \
688 break; \
689 if (!signal_pending(current)) { \
690 tty_unlock(tty); \
691 schedule(); \ 683 schedule(); \
692 tty_lock(tty); \ 684 tty_lock(tty))
693 continue; \
694 } \
695 ret = -ERESTARTSYS; \
696 break; \
697 } \
698 finish_wait(&wq, &__wait); \
699} while (0)
700 685
701#ifdef CONFIG_PROC_FS 686#ifdef CONFIG_PROC_FS
702extern void proc_tty_register_driver(struct tty_driver *); 687extern void proc_tty_register_driver(struct tty_driver *);
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index 8da8c4e87da3..7bfabd20204c 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -67,6 +67,13 @@ struct u64_stats_sync {
67#endif 67#endif
68}; 68};
69 69
70
71#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
72# define u64_stats_init(syncp) seqcount_init(syncp.seq)
73#else
74# define u64_stats_init(syncp) do { } while (0)
75#endif
76
70static inline void u64_stats_update_begin(struct u64_stats_sync *syncp) 77static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
71{ 78{
72#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 79#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 5ca0951e1855..9d8cf056e661 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -15,7 +15,7 @@
15 */ 15 */
16static inline void pagefault_disable(void) 16static inline void pagefault_disable(void)
17{ 17{
18 inc_preempt_count(); 18 preempt_count_inc();
19 /* 19 /*
20 * make sure to have issued the store before a pagefault 20 * make sure to have issued the store before a pagefault
21 * can hit. 21 * can hit.
@@ -30,11 +30,7 @@ static inline void pagefault_enable(void)
30 * the pagefault handler again. 30 * the pagefault handler again.
31 */ 31 */
32 barrier(); 32 barrier();
33 dec_preempt_count(); 33 preempt_count_dec();
34 /*
35 * make sure we do..
36 */
37 barrier();
38 preempt_check_resched(); 34 preempt_check_resched();
39} 35}
40 36
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 06f28beed7c2..319eae70fe84 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -30,6 +30,7 @@
30struct vm_area_struct; 30struct vm_area_struct;
31struct mm_struct; 31struct mm_struct;
32struct inode; 32struct inode;
33struct notifier_block;
33 34
34#ifdef CONFIG_ARCH_SUPPORTS_UPROBES 35#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
35# include <asm/uprobes.h> 36# include <asm/uprobes.h>
@@ -108,6 +109,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
108extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 109extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
109extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 110extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
110extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 111extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
112extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
111extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 113extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
112extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 114extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
113extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 115extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -117,14 +119,21 @@ extern void uprobe_start_dup_mmap(void);
117extern void uprobe_end_dup_mmap(void); 119extern void uprobe_end_dup_mmap(void);
118extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 120extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
119extern void uprobe_free_utask(struct task_struct *t); 121extern void uprobe_free_utask(struct task_struct *t);
120extern void uprobe_copy_process(struct task_struct *t); 122extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
121extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 123extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
122extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 124extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
123extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 125extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
124extern void uprobe_notify_resume(struct pt_regs *regs); 126extern void uprobe_notify_resume(struct pt_regs *regs);
125extern bool uprobe_deny_signal(void); 127extern bool uprobe_deny_signal(void);
126extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs); 128extern bool arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
127extern void uprobe_clear_state(struct mm_struct *mm); 129extern void uprobe_clear_state(struct mm_struct *mm);
130extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
131extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
132extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
133extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
134extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
135extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
136extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
128#else /* !CONFIG_UPROBES */ 137#else /* !CONFIG_UPROBES */
129struct uprobes_state { 138struct uprobes_state {
130}; 139};
@@ -174,7 +183,7 @@ static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
174static inline void uprobe_free_utask(struct task_struct *t) 183static inline void uprobe_free_utask(struct task_struct *t)
175{ 184{
176} 185}
177static inline void uprobe_copy_process(struct task_struct *t) 186static inline void uprobe_copy_process(struct task_struct *t, unsigned long flags)
178{ 187{
179} 188}
180static inline void uprobe_clear_state(struct mm_struct *mm) 189static inline void uprobe_clear_state(struct mm_struct *mm)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 001629cd1a97..512ab162832c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -475,7 +475,8 @@ struct usb3_lpm_parameters {
475 * @lpm_capable: device supports LPM 475 * @lpm_capable: device supports LPM
476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM 477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
478 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 478 * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled
479 * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled
479 * @usb3_lpm_enabled: USB3 hardware LPM enabled 480 * @usb3_lpm_enabled: USB3 hardware LPM enabled
480 * @string_langid: language ID for strings 481 * @string_langid: language ID for strings
481 * @product: iProduct string, if present (static) 482 * @product: iProduct string, if present (static)
@@ -548,6 +549,7 @@ struct usb_device {
548 unsigned usb2_hw_lpm_capable:1; 549 unsigned usb2_hw_lpm_capable:1;
549 unsigned usb2_hw_lpm_besl_capable:1; 550 unsigned usb2_hw_lpm_besl_capable:1;
550 unsigned usb2_hw_lpm_enabled:1; 551 unsigned usb2_hw_lpm_enabled:1;
552 unsigned usb2_hw_lpm_allowed:1;
551 unsigned usb3_lpm_enabled:1; 553 unsigned usb3_lpm_enabled:1;
552 int string_langid; 554 int string_langid;
553 555
@@ -702,7 +704,7 @@ extern int usb_alloc_streams(struct usb_interface *interface,
702 unsigned int num_streams, gfp_t mem_flags); 704 unsigned int num_streams, gfp_t mem_flags);
703 705
704/* Reverts a group of bulk endpoints back to not using stream IDs. */ 706/* Reverts a group of bulk endpoints back to not using stream IDs. */
705extern void usb_free_streams(struct usb_interface *interface, 707extern int usb_free_streams(struct usb_interface *interface,
706 struct usb_host_endpoint **eps, unsigned int num_eps, 708 struct usb_host_endpoint **eps, unsigned int num_eps,
707 gfp_t mem_flags); 709 gfp_t mem_flags);
708 710
@@ -1209,11 +1211,13 @@ struct usb_anchor {
1209 struct list_head urb_list; 1211 struct list_head urb_list;
1210 wait_queue_head_t wait; 1212 wait_queue_head_t wait;
1211 spinlock_t lock; 1213 spinlock_t lock;
1214 atomic_t suspend_wakeups;
1212 unsigned int poisoned:1; 1215 unsigned int poisoned:1;
1213}; 1216};
1214 1217
1215static inline void init_usb_anchor(struct usb_anchor *anchor) 1218static inline void init_usb_anchor(struct usb_anchor *anchor)
1216{ 1219{
1220 memset(anchor, 0, sizeof(*anchor));
1217 INIT_LIST_HEAD(&anchor->urb_list); 1221 INIT_LIST_HEAD(&anchor->urb_list);
1218 init_waitqueue_head(&anchor->wait); 1222 init_waitqueue_head(&anchor->wait);
1219 spin_lock_init(&anchor->lock); 1223 spin_lock_init(&anchor->lock);
@@ -1260,6 +1264,8 @@ typedef void (*usb_complete_t)(struct urb *);
1260 * @sg: scatter gather buffer list, the buffer size of each element in 1264 * @sg: scatter gather buffer list, the buffer size of each element in
1261 * the list (except the last) must be divisible by the endpoint's 1265 * the list (except the last) must be divisible by the endpoint's
1262 * max packet size if no_sg_constraint isn't set in 'struct usb_bus' 1266 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1267 * (FIXME: scatter-gather under xHCI is broken for periodic transfers.
1268 * Do not use urb->sg for interrupt endpoints for now, only bulk.)
1263 * @num_mapped_sgs: (internal) number of mapped sg entries 1269 * @num_mapped_sgs: (internal) number of mapped sg entries
1264 * @num_sgs: number of entries in the sg list 1270 * @num_sgs: number of entries in the sg list
1265 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1271 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
@@ -1574,6 +1580,8 @@ extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1574extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1580extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1575extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1581extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1576extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1582extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1583extern void usb_anchor_suspend_wakeups(struct usb_anchor *anchor);
1584extern void usb_anchor_resume_wakeups(struct usb_anchor *anchor);
1577extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1585extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1578extern void usb_unanchor_urb(struct urb *urb); 1586extern void usb_unanchor_urb(struct urb *urb);
1579extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1587extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index cc25b70af33c..c3fa80745996 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -36,6 +36,9 @@
36 * SUCH DAMAGE. 36 * SUCH DAMAGE.
37 */ 37 */
38 38
39#ifndef __LINUX_USB_CDC_NCM_H
40#define __LINUX_USB_CDC_NCM_H
41
39#define CDC_NCM_COMM_ALTSETTING_NCM 0 42#define CDC_NCM_COMM_ALTSETTING_NCM 0
40#define CDC_NCM_COMM_ALTSETTING_MBIM 1 43#define CDC_NCM_COMM_ALTSETTING_MBIM 1
41 44
@@ -85,22 +88,13 @@
85#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) 88#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB)
86 89
87struct cdc_ncm_ctx { 90struct cdc_ncm_ctx {
88 struct usb_cdc_ncm_ntb_parameters ncm_parm;
89 struct hrtimer tx_timer; 91 struct hrtimer tx_timer;
90 struct tasklet_struct bh; 92 struct tasklet_struct bh;
91 93
92 const struct usb_cdc_ncm_desc *func_desc; 94 const struct usb_cdc_ncm_desc *func_desc;
93 const struct usb_cdc_mbim_desc *mbim_desc; 95 const struct usb_cdc_mbim_desc *mbim_desc;
94 const struct usb_cdc_header_desc *header_desc;
95 const struct usb_cdc_union_desc *union_desc;
96 const struct usb_cdc_ether_desc *ether_desc; 96 const struct usb_cdc_ether_desc *ether_desc;
97 97
98 struct net_device *netdev;
99 struct usb_device *udev;
100 struct usb_host_endpoint *in_ep;
101 struct usb_host_endpoint *out_ep;
102 struct usb_host_endpoint *status_ep;
103 struct usb_interface *intf;
104 struct usb_interface *control; 98 struct usb_interface *control;
105 struct usb_interface *data; 99 struct usb_interface *data;
106 100
@@ -113,8 +107,6 @@ struct cdc_ncm_ctx {
113 107
114 u32 tx_timer_pending; 108 u32 tx_timer_pending;
115 u32 tx_curr_frame_num; 109 u32 tx_curr_frame_num;
116 u32 rx_speed;
117 u32 tx_speed;
118 u32 rx_max; 110 u32 rx_max;
119 u32 tx_max; 111 u32 tx_max;
120 u32 max_datagram_size; 112 u32 max_datagram_size;
@@ -127,9 +119,14 @@ struct cdc_ncm_ctx {
127 u16 connected; 119 u16 connected;
128}; 120};
129 121
130extern u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); 122u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf);
131extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 123int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
132extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 124void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
133extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); 125struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
134extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); 126int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
135extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset); 127int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
128struct sk_buff *
129cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
130int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);
131
132#endif /* __LINUX_USB_CDC_NCM_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 75efc45eaa2f..b8aba196f7f1 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -73,6 +73,7 @@ struct giveback_urb_bh {
73 spinlock_t lock; 73 spinlock_t lock;
74 struct list_head head; 74 struct list_head head;
75 struct tasklet_struct bh; 75 struct tasklet_struct bh;
76 struct usb_host_endpoint *completing_ep;
76}; 77};
77 78
78struct usb_hcd { 79struct usb_hcd {
@@ -140,6 +141,7 @@ struct usb_hcd {
140 unsigned wireless:1; /* Wireless USB HCD */ 141 unsigned wireless:1; /* Wireless USB HCD */
141 unsigned authorized_default:1; 142 unsigned authorized_default:1;
142 unsigned has_tt:1; /* Integrated TT in root hub */ 143 unsigned has_tt:1; /* Integrated TT in root hub */
144 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
143 145
144 unsigned int irq; /* irq allocated */ 146 unsigned int irq; /* irq allocated */
145 void __iomem *regs; /* device memory/io */ 147 void __iomem *regs; /* device memory/io */
@@ -378,6 +380,12 @@ static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
378 return hcd->driver->flags & HCD_BH; 380 return hcd->driver->flags & HCD_BH;
379} 381}
380 382
383static inline bool hcd_periodic_completion_in_progress(struct usb_hcd *hcd,
384 struct usb_host_endpoint *ep)
385{
386 return hcd->high_prio_bh.completing_ep == ep;
387}
388
381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 389extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 390extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
383 int status); 391 int status);
@@ -428,6 +436,8 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
428extern void usb_hcd_pci_remove(struct pci_dev *dev); 436extern void usb_hcd_pci_remove(struct pci_dev *dev);
429extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 437extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
430 438
439extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
440
431#ifdef CONFIG_PM 441#ifdef CONFIG_PM
432extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 442extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
433#endif 443#endif
@@ -496,6 +506,7 @@ struct usb_tt {
496 struct usb_device *hub; /* upstream highspeed hub */ 506 struct usb_device *hub; /* upstream highspeed hub */
497 int multi; /* true means one TT per port */ 507 int multi; /* true means one TT per port */
498 unsigned think_time; /* think time in ns */ 508 unsigned think_time; /* think time in ns */
509 void *hcpriv; /* HCD private data */
499 510
500 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ 511 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
501 spinlock_t lock; 512 spinlock_t lock;
@@ -554,9 +565,8 @@ extern void usb_ep0_reinit(struct usb_device *);
554 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ 565 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
555 /* bytecount = data payload byte count */ 566 /* bytecount = data payload byte count */
556 567
557#define NS_TO_US(ns) ((ns + 500L) / 1000L) 568#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L)
558 /* convert & round nanoseconds to microseconds */ 569 /* convert nanoseconds to microseconds, rounding up */
559
560 570
561/* 571/*
562 * Full/low speed bandwidth allocation constants/support. 572 * Full/low speed bandwidth allocation constants/support.
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
deleted file mode 100644
index 756cf5543ffd..000000000000
--- a/include/linux/usb/intel_mid_otg.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * Intel MID (Langwell/Penwell) USB OTG Transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __INTEL_MID_OTG_H
21#define __INTEL_MID_OTG_H
22
23#include <linux/pm.h>
24#include <linux/usb/otg.h>
25#include <linux/notifier.h>
26
27struct intel_mid_otg_xceiv;
28
29/* This is a common data structure for Intel MID platform to
30 * save values of the OTG state machine */
31struct otg_hsm {
32 /* Input */
33 int a_bus_resume;
34 int a_bus_suspend;
35 int a_conn;
36 int a_sess_vld;
37 int a_srp_det;
38 int a_vbus_vld;
39 int b_bus_resume;
40 int b_bus_suspend;
41 int b_conn;
42 int b_se0_srp;
43 int b_ssend_srp;
44 int b_sess_end;
45 int b_sess_vld;
46 int id;
47/* id values */
48#define ID_B 0x05
49#define ID_A 0x04
50#define ID_ACA_C 0x03
51#define ID_ACA_B 0x02
52#define ID_ACA_A 0x01
53 int power_up;
54 int adp_change;
55 int test_device;
56
57 /* Internal variables */
58 int a_set_b_hnp_en;
59 int b_srp_done;
60 int b_hnp_enable;
61 int hnp_poll_enable;
62
63 /* Timeout indicator for timers */
64 int a_wait_vrise_tmout;
65 int a_wait_bcon_tmout;
66 int a_aidl_bdis_tmout;
67 int a_bidl_adis_tmout;
68 int a_bidl_adis_tmr;
69 int a_wait_vfall_tmout;
70 int b_ase0_brst_tmout;
71 int b_bus_suspend_tmout;
72 int b_srp_init_tmout;
73 int b_srp_fail_tmout;
74 int b_srp_fail_tmr;
75 int b_adp_sense_tmout;
76
77 /* Informative variables */
78 int a_bus_drop;
79 int a_bus_req;
80 int a_clr_err;
81 int b_bus_req;
82 int a_suspend_req;
83 int b_bus_suspend_vld;
84
85 /* Output */
86 int drv_vbus;
87 int loc_conn;
88 int loc_sof;
89
90 /* Others */
91 int vbus_srp_up;
92};
93
94/* must provide ULPI access function to read/write registers implemented in
95 * ULPI address space */
96struct iotg_ulpi_access_ops {
97 int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val);
98 int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val);
99};
100
101#define OTG_A_DEVICE 0x0
102#define OTG_B_DEVICE 0x1
103
104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on usb_phy data structure for this
108 * purpose.
109 */
110struct intel_mid_otg_xceiv {
111 struct usb_phy otg;
112 struct otg_hsm hsm;
113
114 /* base address */
115 void __iomem *base;
116
117 /* ops to access ulpi */
118 struct iotg_ulpi_access_ops ulpi_ops;
119
120 /* atomic notifier for interrupt context */
121 struct atomic_notifier_head iotg_notifier;
122
123 /* start/stop USB Host function */
124 int (*start_host)(struct intel_mid_otg_xceiv *iotg);
125 int (*stop_host)(struct intel_mid_otg_xceiv *iotg);
126
127 /* start/stop USB Peripheral function */
128 int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg);
129 int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg);
130
131 /* start/stop ADP sense/probe function */
132 int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg,
133 bool enabled, int dev);
134 int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg,
135 bool enabled);
136
137#ifdef CONFIG_PM
138 /* suspend/resume USB host function */
139 int (*suspend_host)(struct intel_mid_otg_xceiv *iotg,
140 pm_message_t message);
141 int (*resume_host)(struct intel_mid_otg_xceiv *iotg);
142
143 int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg,
144 pm_message_t message);
145 int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg);
146#endif
147
148};
149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153}
154
155#define MID_OTG_NOTIFY_CONNECT 0x0001
156#define MID_OTG_NOTIFY_DISCONN 0x0002
157#define MID_OTG_NOTIFY_HSUSPEND 0x0003
158#define MID_OTG_NOTIFY_HRESUME 0x0004
159#define MID_OTG_NOTIFY_CSUSPEND 0x0005
160#define MID_OTG_NOTIFY_CRESUME 0x0006
161#define MID_OTG_NOTIFY_HOSTADD 0x0007
162#define MID_OTG_NOTIFY_HOSTREMOVE 0x0008
163#define MID_OTG_NOTIFY_CLIENTADD 0x0009
164#define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a
165
166static inline int
167intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg,
168 struct notifier_block *nb)
169{
170 return atomic_notifier_chain_register(&iotg->iotg_notifier, nb);
171}
172
173static inline void
174intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg,
175 struct notifier_block *nb)
176{
177 atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb);
178}
179
180#endif /* __INTEL_MID_OTG_H */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 053c26841cc3..eb505250940a 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,8 +99,6 @@ struct musb_hdrc_platform_data {
99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ 99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
100 u8 mode; 100 u8 mode;
101 101
102 u8 has_mailbox:1;
103
104 /* for clk_get() */ 102 /* for clk_get() */
105 const char *clock; 103 const char *clock;
106 104
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c931b0..596b01918813 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -19,20 +19,23 @@
19#ifndef __OMAP_CONTROL_USB_H__ 19#ifndef __OMAP_CONTROL_USB_H__
20#define __OMAP_CONTROL_USB_H__ 20#define __OMAP_CONTROL_USB_H__
21 21
22enum omap_control_usb_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27};
28
22struct omap_control_usb { 29struct omap_control_usb {
23 struct device *dev; 30 struct device *dev;
24 31
25 u32 __iomem *dev_conf;
26 u32 __iomem *otghs_control; 32 u32 __iomem *otghs_control;
27 u32 __iomem *phy_power; 33 u32 __iomem *power;
34 u32 __iomem *power_aux;
28 35
29 struct clk *sys_clk; 36 struct clk *sys_clk;
30 37
31 u32 type; 38 enum omap_control_usb_type type;
32};
33
34struct omap_control_usb_platform_data {
35 u8 type;
36}; 39};
37 40
38enum omap_control_usb_mode { 41enum omap_control_usb_mode {
@@ -42,10 +45,6 @@ enum omap_control_usb_mode {
42 USB_MODE_DISCONNECT, 45 USB_MODE_DISCONNECT,
43}; 46};
44 47
45/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
46#define OMAP_CTRL_DEV_TYPE1 0x1
47#define OMAP_CTRL_DEV_TYPE2 0x2
48
49#define OMAP_CTRL_DEV_PHY_PD BIT(0) 48#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50 49
51#define OMAP_CTRL_DEV_AVALID BIT(0) 50#define OMAP_CTRL_DEV_AVALID BIT(0)
@@ -63,26 +62,18 @@ enum omap_control_usb_mode {
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 62#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 63#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
65 64
65#define OMAP_CTRL_USB2_PHY_PD BIT(28)
66
66#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 67#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
67extern struct device *omap_get_control_dev(void);
68extern void omap_control_usb_phy_power(struct device *dev, int on); 68extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb3_phy_power(struct device *dev, bool on);
70extern void omap_control_usb_set_mode(struct device *dev, 69extern void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode); 70 enum omap_control_usb_mode mode);
72#else 71#else
73static inline struct device *omap_get_control_dev(void)
74{
75 return ERR_PTR(-ENODEV);
76}
77 72
78static inline void omap_control_usb_phy_power(struct device *dev, int on) 73static inline void omap_control_usb_phy_power(struct device *dev, int on)
79{ 74{
80} 75}
81 76
82static inline void omap_control_usb3_phy_power(struct device *dev, int on)
83{
84}
85
86static inline void omap_control_usb_set_mode(struct device *dev, 77static inline void omap_control_usb_set_mode(struct device *dev,
87 enum omap_control_usb_mode mode) 78 enum omap_control_usb_mode mode)
88{ 79{
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index d528b8045150..704a1ab8240c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -320,6 +320,8 @@ extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
320extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
321extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
322 struct usb_serial_port *port); 322 struct usb_serial_port *port);
323extern int usb_serial_generic_write_start(struct usb_serial_port *port,
324 gfp_t mem_flags);
323extern int usb_serial_generic_write(struct tty_struct *tty, 325extern int usb_serial_generic_write(struct tty_struct *tty,
324 struct usb_serial_port *port, const unsigned char *buf, int count); 326 struct usb_serial_port *port, const unsigned char *buf, int count);
325extern void usb_serial_generic_close(struct usb_serial_port *port); 327extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index f9a7e7bc925b..cc8d818a83be 100644
--- a/include/linux/usb/usb_phy_gen_xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -9,10 +9,11 @@ struct usb_phy_gen_xceiv_platform_data {
9 9
10 /* if set fails with -EPROBE_DEFER if can't get regulator */ 10 /* if set fails with -EPROBE_DEFER if can't get regulator */
11 unsigned int needs_vcc:1; 11 unsigned int needs_vcc:1;
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1; /* deprecated */
13 int gpio_reset;
13}; 14};
14 15
15#if IS_ENABLED(CONFIG_NOP_USB_XCEIV) 16#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
16/* sometimes transceivers are accessed only through e.g. ULPI */ 17/* sometimes transceivers are accessed only through e.g. ULPI */
17extern void usb_nop_xceiv_register(void); 18extern void usb_nop_xceiv_register(void);
18extern void usb_nop_xceiv_unregister(void); 19extern void usb_nop_xceiv_unregister(void);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 9cb2fe8ca944..e303eef94dd5 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -42,6 +42,7 @@ struct usbnet {
42 struct usb_host_endpoint *status; 42 struct usb_host_endpoint *status;
43 unsigned maxpacket; 43 unsigned maxpacket;
44 struct timer_list delay; 44 struct timer_list delay;
45 const char *padding_pkt;
45 46
46 /* protocol/interface state */ 47 /* protocol/interface state */
47 struct net_device *net; 48 struct net_device *net;
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index 4ff744e2b678..c1257130769b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -142,7 +142,7 @@ enum wa_notif_type {
142struct wa_notif_hdr { 142struct wa_notif_hdr {
143 u8 bLength; 143 u8 bLength;
144 u8 bNotifyType; /* enum wa_notif_type */ 144 u8 bNotifyType; /* enum wa_notif_type */
145} __attribute__((packed)); 145} __packed;
146 146
147/** 147/**
148 * HWA DN Received notification [(WUSB] section 8.5.4.2) 148 * HWA DN Received notification [(WUSB] section 8.5.4.2)
@@ -158,7 +158,7 @@ struct hwa_notif_dn {
158 u8 bSourceDeviceAddr; /* from errata 2005/07 */ 158 u8 bSourceDeviceAddr; /* from errata 2005/07 */
159 u8 bmAttributes; 159 u8 bmAttributes;
160 struct wusb_dn_hdr dndata[]; 160 struct wusb_dn_hdr dndata[];
161} __attribute__((packed)); 161} __packed;
162 162
163/* [WUSB] section 8.3.3 */ 163/* [WUSB] section 8.3.3 */
164enum wa_xfer_type { 164enum wa_xfer_type {
@@ -167,6 +167,8 @@ enum wa_xfer_type {
167 WA_XFER_TYPE_ISO = 0x82, 167 WA_XFER_TYPE_ISO = 0x82,
168 WA_XFER_RESULT = 0x83, 168 WA_XFER_RESULT = 0x83,
169 WA_XFER_ABORT = 0x84, 169 WA_XFER_ABORT = 0x84,
170 WA_XFER_ISO_PACKET_INFO = 0xA0,
171 WA_XFER_ISO_PACKET_STATUS = 0xA1,
170}; 172};
171 173
172/* [WUSB] section 8.3.3 */ 174/* [WUSB] section 8.3.3 */
@@ -177,28 +179,47 @@ struct wa_xfer_hdr {
177 __le32 dwTransferID; /* Host-assigned ID */ 179 __le32 dwTransferID; /* Host-assigned ID */
178 __le32 dwTransferLength; /* Length of data to xfer */ 180 __le32 dwTransferLength; /* Length of data to xfer */
179 u8 bTransferSegment; 181 u8 bTransferSegment;
180} __attribute__((packed)); 182} __packed;
181 183
182struct wa_xfer_ctl { 184struct wa_xfer_ctl {
183 struct wa_xfer_hdr hdr; 185 struct wa_xfer_hdr hdr;
184 u8 bmAttribute; 186 u8 bmAttribute;
185 __le16 wReserved; 187 __le16 wReserved;
186 struct usb_ctrlrequest baSetupData; 188 struct usb_ctrlrequest baSetupData;
187} __attribute__((packed)); 189} __packed;
188 190
189struct wa_xfer_bi { 191struct wa_xfer_bi {
190 struct wa_xfer_hdr hdr; 192 struct wa_xfer_hdr hdr;
191 u8 bReserved; 193 u8 bReserved;
192 __le16 wReserved; 194 __le16 wReserved;
193} __attribute__((packed)); 195} __packed;
194 196
197/* [WUSB] section 8.5.5 */
195struct wa_xfer_hwaiso { 198struct wa_xfer_hwaiso {
196 struct wa_xfer_hdr hdr; 199 struct wa_xfer_hdr hdr;
197 u8 bReserved; 200 u8 bReserved;
198 __le16 wPresentationTime; 201 __le16 wPresentationTime;
199 __le32 dwNumOfPackets; 202 __le32 dwNumOfPackets;
200 /* FIXME: u8 pktdata[]? */ 203} __packed;
201} __attribute__((packed)); 204
205struct wa_xfer_packet_info_hwaiso {
206 __le16 wLength;
207 u8 bPacketType;
208 u8 bReserved;
209 __le16 PacketLength[0];
210} __packed;
211
212struct wa_xfer_packet_status_len_hwaiso {
213 __le16 PacketLength;
214 __le16 PacketStatus;
215} __packed;
216
217struct wa_xfer_packet_status_hwaiso {
218 __le16 wLength;
219 u8 bPacketType;
220 u8 bReserved;
221 struct wa_xfer_packet_status_len_hwaiso PacketStatus[0];
222} __packed;
202 223
203/* [WUSB] section 8.3.3.5 */ 224/* [WUSB] section 8.3.3.5 */
204struct wa_xfer_abort { 225struct wa_xfer_abort {
@@ -206,7 +227,7 @@ struct wa_xfer_abort {
206 u8 bRequestType; 227 u8 bRequestType;
207 __le16 wRPipe; /* RPipe index */ 228 __le16 wRPipe; /* RPipe index */
208 __le32 dwTransferID; /* Host-assigned ID */ 229 __le32 dwTransferID; /* Host-assigned ID */
209} __attribute__((packed)); 230} __packed;
210 231
211/** 232/**
212 * WA Transfer Complete notification ([WUSB] section 8.3.3.3) 233 * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
@@ -216,7 +237,7 @@ struct wa_notif_xfer {
216 struct wa_notif_hdr hdr; 237 struct wa_notif_hdr hdr;
217 u8 bEndpoint; 238 u8 bEndpoint;
218 u8 Reserved; 239 u8 Reserved;
219} __attribute__((packed)); 240} __packed;
220 241
221/** Transfer result basic codes [WUSB] table 8-15 */ 242/** Transfer result basic codes [WUSB] table 8-15 */
222enum { 243enum {
@@ -243,7 +264,7 @@ struct wa_xfer_result {
243 u8 bTransferSegment; 264 u8 bTransferSegment;
244 u8 bTransferStatus; 265 u8 bTransferStatus;
245 __le32 dwNumOfPackets; 266 __le32 dwNumOfPackets;
246} __attribute__((packed)); 267} __packed;
247 268
248/** 269/**
249 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). 270 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
@@ -258,16 +279,16 @@ struct wa_xfer_result {
258struct usb_wa_descriptor { 279struct usb_wa_descriptor {
259 u8 bLength; 280 u8 bLength;
260 u8 bDescriptorType; 281 u8 bDescriptorType;
261 u16 bcdWAVersion; 282 __le16 bcdWAVersion;
262 u8 bNumPorts; /* don't use!! */ 283 u8 bNumPorts; /* don't use!! */
263 u8 bmAttributes; /* Reserved == 0 */ 284 u8 bmAttributes; /* Reserved == 0 */
264 u16 wNumRPipes; 285 __le16 wNumRPipes;
265 u16 wRPipeMaxBlock; 286 __le16 wRPipeMaxBlock;
266 u8 bRPipeBlockSize; 287 u8 bRPipeBlockSize;
267 u8 bPwrOn2PwrGood; 288 u8 bPwrOn2PwrGood;
268 u8 bNumMMCIEs; 289 u8 bNumMMCIEs;
269 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ 290 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
270} __attribute__((packed)); 291} __packed;
271 292
272/** 293/**
273 * HWA Device Information Buffer (WUSB1.0[T8.54]) 294 * HWA Device Information Buffer (WUSB1.0[T8.54])
@@ -277,6 +298,6 @@ struct hwa_dev_info {
277 u8 bDeviceAddress; 298 u8 bDeviceAddress;
278 __le16 wPHYRates; 299 __le16 wPHYRates;
279 u8 bmDeviceAttribute; 300 u8 bmDeviceAttribute;
280} __attribute__((packed)); 301} __packed;
281 302
282#endif /* #ifndef __LINUX_USB_WUSB_WA_H */ 303#endif /* #ifndef __LINUX_USB_WUSB_WA_H */
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 0c4d4ca370ec..eeb28329fa3c 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -271,6 +271,8 @@ static inline u8 wusb_key_index(int index, int type, int originator)
271#define WUSB_KEY_INDEX_TYPE_GTK 2 271#define WUSB_KEY_INDEX_TYPE_GTK 2
272#define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 272#define WUSB_KEY_INDEX_ORIGINATOR_HOST 0
273#define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 273#define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1
274/* bits 0-3 used for the key index. */
275#define WUSB_KEY_INDEX_MAX 15
274 276
275/* A CCM Nonce, defined in WUSB1.0[6.4.1] */ 277/* A CCM Nonce, defined in WUSB1.0[6.4.1] */
276struct aes_ccm_nonce { 278struct aes_ccm_nonce {
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index bf99cd01be20..630356866030 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -66,7 +66,9 @@
66 US_FLAG(INITIAL_READ10, 0x00100000) \ 66 US_FLAG(INITIAL_READ10, 0x00100000) \
67 /* Initial READ(10) (and others) must be retried */ \ 67 /* Initial READ(10) (and others) must be retried */ \
68 US_FLAG(WRITE_CACHE, 0x00200000) \ 68 US_FLAG(WRITE_CACHE, 0x00200000) \
69 /* Write Cache status is not available */ 69 /* Write Cache status is not available */ \
70 US_FLAG(NEEDS_CAP16, 0x00400000)
71 /* cannot handle READ_CAPACITY_10 */
70 72
71#define US_FLAG(name, value) US_FL_##name = value , 73#define US_FLAG(name, value) US_FL_##name = value ,
72enum { US_DO_ALL_FLAGS }; 74enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 14105c26a836..4836ba3c1cd8 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -27,8 +27,12 @@ struct user_namespace {
27 kuid_t owner; 27 kuid_t owner;
28 kgid_t group; 28 kgid_t group;
29 unsigned int proc_inum; 29 unsigned int proc_inum;
30 bool may_mount_sysfs; 30
31 bool may_mount_proc; 31 /* Register of per-UID persistent keyrings for this namespace */
32#ifdef CONFIG_PERSISTENT_KEYRINGS
33 struct key *persistent_keyring_register;
34 struct rw_semaphore persistent_keyring_register_sem;
35#endif
32}; 36};
33 37
34extern struct user_namespace init_user_ns; 38extern struct user_namespace init_user_ns;
@@ -85,6 +89,4 @@ static inline void put_user_ns(struct user_namespace *ns)
85 89
86#endif 90#endif
87 91
88void update_mnt_policy(struct user_namespace *userns);
89
90#endif /* _LINUX_USER_H */ 92#endif /* _LINUX_USER_H */
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ac8d488e4372..24579a0312a0 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -90,4 +90,11 @@ extern void vfio_unregister_iommu_driver(
90 TYPE tmp; \ 90 TYPE tmp; \
91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \ 91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
92 92
93/*
94 * External user API
95 */
96extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
97extern void vfio_group_put_external_user(struct vfio_group *group);
98extern int vfio_external_user_iommu_id(struct vfio_group *group);
99
93#endif /* VFIO_H */ 100#endif /* VFIO_H */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 36d36cc89329..e4abb84199be 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -51,11 +51,11 @@ int virtqueue_add_sgs(struct virtqueue *vq,
51 void *data, 51 void *data,
52 gfp_t gfp); 52 gfp_t gfp);
53 53
54void virtqueue_kick(struct virtqueue *vq); 54bool virtqueue_kick(struct virtqueue *vq);
55 55
56bool virtqueue_kick_prepare(struct virtqueue *vq); 56bool virtqueue_kick_prepare(struct virtqueue *vq);
57 57
58void virtqueue_notify(struct virtqueue *vq); 58bool virtqueue_notify(struct virtqueue *vq);
59 59
60void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 60void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
61 61
@@ -73,6 +73,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
73 73
74unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 74unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
75 75
76bool virtqueue_is_broken(struct virtqueue *vq);
77
76/** 78/**
77 * virtio_device - representation of a device using virtio 79 * virtio_device - representation of a device using virtio
78 * @index: unique position on the virtio bus 80 * @index: unique position on the virtio bus
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 29b9104232b4..e8f8f71e843c 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -96,33 +96,6 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
96 return test_bit(fbit, vdev->features); 96 return test_bit(fbit, vdev->features);
97} 97}
98 98
99/**
100 * virtio_config_val - look for a feature and get a virtio config entry.
101 * @vdev: the virtio device
102 * @fbit: the feature bit
103 * @offset: the type to search for.
104 * @v: a pointer to the value to fill in.
105 *
106 * The return value is -ENOENT if the feature doesn't exist. Otherwise
107 * the config value is copied into whatever is pointed to by v. */
108#define virtio_config_val(vdev, fbit, offset, v) \
109 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(*v))
110
111#define virtio_config_val_len(vdev, fbit, offset, v, len) \
112 virtio_config_buf((vdev), (fbit), (offset), (v), (len))
113
114static inline int virtio_config_buf(struct virtio_device *vdev,
115 unsigned int fbit,
116 unsigned int offset,
117 void *buf, unsigned len)
118{
119 if (!virtio_has_feature(vdev, fbit))
120 return -ENOENT;
121
122 vdev->config->get(vdev, offset, buf, len);
123 return 0;
124}
125
126static inline 99static inline
127struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev, 100struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
128 vq_callback_t *c, const char *n) 101 vq_callback_t *c, const char *n)
@@ -162,5 +135,139 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
162 return 0; 135 return 0;
163} 136}
164 137
138/* Config space accessors. */
139#define virtio_cread(vdev, structname, member, ptr) \
140 do { \
141 /* Must match the member's type, and be integer */ \
142 if (!typecheck(typeof((((structname*)0)->member)), *(ptr))) \
143 (*ptr) = 1; \
144 \
145 switch (sizeof(*ptr)) { \
146 case 1: \
147 *(ptr) = virtio_cread8(vdev, \
148 offsetof(structname, member)); \
149 break; \
150 case 2: \
151 *(ptr) = virtio_cread16(vdev, \
152 offsetof(structname, member)); \
153 break; \
154 case 4: \
155 *(ptr) = virtio_cread32(vdev, \
156 offsetof(structname, member)); \
157 break; \
158 case 8: \
159 *(ptr) = virtio_cread64(vdev, \
160 offsetof(structname, member)); \
161 break; \
162 default: \
163 BUG(); \
164 } \
165 } while(0)
166
167/* Config space accessors. */
168#define virtio_cwrite(vdev, structname, member, ptr) \
169 do { \
170 /* Must match the member's type, and be integer */ \
171 if (!typecheck(typeof((((structname*)0)->member)), *(ptr))) \
172 BUG_ON((*ptr) == 1); \
173 \
174 switch (sizeof(*ptr)) { \
175 case 1: \
176 virtio_cwrite8(vdev, \
177 offsetof(structname, member), \
178 *(ptr)); \
179 break; \
180 case 2: \
181 virtio_cwrite16(vdev, \
182 offsetof(structname, member), \
183 *(ptr)); \
184 break; \
185 case 4: \
186 virtio_cwrite32(vdev, \
187 offsetof(structname, member), \
188 *(ptr)); \
189 break; \
190 case 8: \
191 virtio_cwrite64(vdev, \
192 offsetof(structname, member), \
193 *(ptr)); \
194 break; \
195 default: \
196 BUG(); \
197 } \
198 } while(0)
199
200static inline u8 virtio_cread8(struct virtio_device *vdev, unsigned int offset)
201{
202 u8 ret;
203 vdev->config->get(vdev, offset, &ret, sizeof(ret));
204 return ret;
205}
206
207static inline void virtio_cread_bytes(struct virtio_device *vdev,
208 unsigned int offset,
209 void *buf, size_t len)
210{
211 vdev->config->get(vdev, offset, buf, len);
212}
213
214static inline void virtio_cwrite8(struct virtio_device *vdev,
215 unsigned int offset, u8 val)
216{
217 vdev->config->set(vdev, offset, &val, sizeof(val));
218}
219
220static inline u16 virtio_cread16(struct virtio_device *vdev,
221 unsigned int offset)
222{
223 u16 ret;
224 vdev->config->get(vdev, offset, &ret, sizeof(ret));
225 return ret;
226}
227
228static inline void virtio_cwrite16(struct virtio_device *vdev,
229 unsigned int offset, u16 val)
230{
231 vdev->config->set(vdev, offset, &val, sizeof(val));
232}
233
234static inline u32 virtio_cread32(struct virtio_device *vdev,
235 unsigned int offset)
236{
237 u32 ret;
238 vdev->config->get(vdev, offset, &ret, sizeof(ret));
239 return ret;
240}
241
242static inline void virtio_cwrite32(struct virtio_device *vdev,
243 unsigned int offset, u32 val)
244{
245 vdev->config->set(vdev, offset, &val, sizeof(val));
246}
247
248static inline u64 virtio_cread64(struct virtio_device *vdev,
249 unsigned int offset)
250{
251 u64 ret;
252 vdev->config->get(vdev, offset, &ret, sizeof(ret));
253 return ret;
254}
255
256static inline void virtio_cwrite64(struct virtio_device *vdev,
257 unsigned int offset, u64 val)
258{
259 vdev->config->set(vdev, offset, &val, sizeof(val));
260}
261
262/* Conditional config space accessors. */
263#define virtio_cread_feature(vdev, fbit, structname, member, ptr) \
264 ({ \
265 int _r = 0; \
266 if (!virtio_has_feature(vdev, fbit)) \
267 _r = -ENOENT; \
268 else \
269 virtio_cread((vdev), structname, member, ptr); \
270 _r; \
271 })
165 272
166#endif /* _LINUX_VIRTIO_CONFIG_H */ 273#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index b300787af8e0..67e06fe18c03 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -71,7 +71,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
71 struct virtio_device *vdev, 71 struct virtio_device *vdev,
72 bool weak_barriers, 72 bool weak_barriers,
73 void *pages, 73 void *pages,
74 void (*notify)(struct virtqueue *vq), 74 bool (*notify)(struct virtqueue *vq),
75 void (*callback)(struct virtqueue *vq), 75 void (*callback)(struct virtqueue *vq),
76 const char *name); 76 const char *name);
77void vring_del_virtqueue(struct virtqueue *vq); 77void vring_del_virtqueue(struct virtqueue *vq);
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index bd6cf61142be..c557c6d096de 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -39,6 +39,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 39 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
40#ifdef CONFIG_NUMA_BALANCING 40#ifdef CONFIG_NUMA_BALANCING
41 NUMA_PTE_UPDATES, 41 NUMA_PTE_UPDATES,
42 NUMA_HUGE_PTE_UPDATES,
42 NUMA_HINT_FAULTS, 43 NUMA_HINT_FAULTS,
43 NUMA_HINT_FAULTS_LOCAL, 44 NUMA_HINT_FAULTS_LOCAL,
44 NUMA_PAGE_MIGRATE, 45 NUMA_PAGE_MIGRATE,
@@ -70,6 +71,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
70 THP_ZERO_PAGE_ALLOC, 71 THP_ZERO_PAGE_ALLOC,
71 THP_ZERO_PAGE_ALLOC_FAILED, 72 THP_ZERO_PAGE_ALLOC_FAILED,
72#endif 73#endif
74#ifdef CONFIG_SMP
75 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
76 NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
77#endif
78 NR_TLB_LOCAL_FLUSH_ALL,
79 NR_TLB_LOCAL_FLUSH_ONE,
73 NR_VM_EVENT_ITEMS 80 NR_VM_EVENT_ITEMS
74}; 81};
75 82
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index c586679b6fef..e4b948080d20 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -143,7 +143,6 @@ static inline unsigned long zone_page_state_snapshot(struct zone *zone,
143} 143}
144 144
145extern unsigned long global_reclaimable_pages(void); 145extern unsigned long global_reclaimable_pages(void);
146extern unsigned long zone_reclaimable_pages(struct zone *zone);
147 146
148#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
149/* 148/*
@@ -198,7 +197,7 @@ extern void __inc_zone_state(struct zone *, enum zone_stat_item);
198extern void dec_zone_state(struct zone *, enum zone_stat_item); 197extern void dec_zone_state(struct zone *, enum zone_stat_item);
199extern void __dec_zone_state(struct zone *, enum zone_stat_item); 198extern void __dec_zone_state(struct zone *, enum zone_stat_item);
200 199
201void refresh_cpu_vm_stats(int); 200void cpu_vm_stats_fold(int cpu);
202void refresh_zone_stat_thresholds(void); 201void refresh_zone_stat_thresholds(void);
203 202
204void drain_zonestat(struct zone *zone, struct per_cpu_pageset *); 203void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
@@ -255,6 +254,7 @@ static inline void __dec_zone_page_state(struct page *page,
255 254
256static inline void refresh_cpu_vm_stats(int cpu) { } 255static inline void refresh_cpu_vm_stats(int cpu) { }
257static inline void refresh_zone_stat_thresholds(void) { } 256static inline void refresh_zone_stat_thresholds(void) { }
257static inline void cpu_vm_stats_fold(int cpu) { }
258 258
259static inline void drain_zonestat(struct zone *zone, 259static inline void drain_zonestat(struct zone *zone,
260 struct per_cpu_pageset *pset) { } 260 struct per_cpu_pageset *pset) { }
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a67fc1635592..eaa00b10abaa 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_WAIT_H 1#ifndef _LINUX_WAIT_H
2#define _LINUX_WAIT_H 2#define _LINUX_WAIT_H
3 3/*
4 4 * Linux wait queue related types and methods
5 */
5#include <linux/list.h> 6#include <linux/list.h>
6#include <linux/stddef.h> 7#include <linux/stddef.h>
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
@@ -13,27 +14,27 @@ typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, v
13int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); 14int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
14 15
15struct __wait_queue { 16struct __wait_queue {
16 unsigned int flags; 17 unsigned int flags;
17#define WQ_FLAG_EXCLUSIVE 0x01 18#define WQ_FLAG_EXCLUSIVE 0x01
18 void *private; 19 void *private;
19 wait_queue_func_t func; 20 wait_queue_func_t func;
20 struct list_head task_list; 21 struct list_head task_list;
21}; 22};
22 23
23struct wait_bit_key { 24struct wait_bit_key {
24 void *flags; 25 void *flags;
25 int bit_nr; 26 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
27}; 28};
28 29
29struct wait_bit_queue { 30struct wait_bit_queue {
30 struct wait_bit_key key; 31 struct wait_bit_key key;
31 wait_queue_t wait; 32 wait_queue_t wait;
32}; 33};
33 34
34struct __wait_queue_head { 35struct __wait_queue_head {
35 spinlock_t lock; 36 spinlock_t lock;
36 struct list_head task_list; 37 struct list_head task_list;
37}; 38};
38typedef struct __wait_queue_head wait_queue_head_t; 39typedef struct __wait_queue_head wait_queue_head_t;
39 40
@@ -84,17 +85,17 @@ extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct
84 85
85static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
86{ 87{
87 q->flags = 0; 88 q->flags = 0;
88 q->private = p; 89 q->private = p;
89 q->func = default_wake_function; 90 q->func = default_wake_function;
90} 91}
91 92
92static inline void init_waitqueue_func_entry(wait_queue_t *q, 93static inline void
93 wait_queue_func_t func) 94init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func)
94{ 95{
95 q->flags = 0; 96 q->flags = 0;
96 q->private = NULL; 97 q->private = NULL;
97 q->func = func; 98 q->func = func;
98} 99}
99 100
100static inline int waitqueue_active(wait_queue_head_t *q) 101static inline int waitqueue_active(wait_queue_head_t *q)
@@ -114,8 +115,8 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
114/* 115/*
115 * Used for wake-one threads: 116 * Used for wake-one threads:
116 */ 117 */
117static inline void __add_wait_queue_exclusive(wait_queue_head_t *q, 118static inline void
118 wait_queue_t *wait) 119__add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
119{ 120{
120 wait->flags |= WQ_FLAG_EXCLUSIVE; 121 wait->flags |= WQ_FLAG_EXCLUSIVE;
121 __add_wait_queue(q, wait); 122 __add_wait_queue(q, wait);
@@ -127,23 +128,22 @@ static inline void __add_wait_queue_tail(wait_queue_head_t *head,
127 list_add_tail(&new->task_list, &head->task_list); 128 list_add_tail(&new->task_list, &head->task_list);
128} 129}
129 130
130static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q, 131static inline void
131 wait_queue_t *wait) 132__add_wait_queue_tail_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
132{ 133{
133 wait->flags |= WQ_FLAG_EXCLUSIVE; 134 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue_tail(q, wait); 135 __add_wait_queue_tail(q, wait);
135} 136}
136 137
137static inline void __remove_wait_queue(wait_queue_head_t *head, 138static inline void
138 wait_queue_t *old) 139__remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
139{ 140{
140 list_del(&old->task_list); 141 list_del(&old->task_list);
141} 142}
142 143
143void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
144void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
145void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
146 void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 149void __wake_up_bit(wait_queue_head_t *, void *, int);
@@ -170,27 +170,64 @@ wait_queue_head_t *bit_waitqueue(void *, int);
170/* 170/*
171 * Wakeup macros to be used to report events to the targets. 171 * Wakeup macros to be used to report events to the targets.
172 */ 172 */
173#define wake_up_poll(x, m) \ 173#define wake_up_poll(x, m) \
174 __wake_up(x, TASK_NORMAL, 1, (void *) (m)) 174 __wake_up(x, TASK_NORMAL, 1, (void *) (m))
175#define wake_up_locked_poll(x, m) \ 175#define wake_up_locked_poll(x, m) \
176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) 176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
177#define wake_up_interruptible_poll(x, m) \ 177#define wake_up_interruptible_poll(x, m) \
178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) 178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
179#define wake_up_interruptible_sync_poll(x, m) \ 179#define wake_up_interruptible_sync_poll(x, m) \
180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) 180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
181 181
182#define __wait_event(wq, condition) \ 182#define ___wait_cond_timeout(condition) \
183do { \ 183({ \
184 DEFINE_WAIT(__wait); \ 184 bool __cond = (condition); \
185 if (__cond && !__ret) \
186 __ret = 1; \
187 __cond || !__ret; \
188})
189
190#define ___wait_is_interruptible(state) \
191 (!__builtin_constant_p(state) || \
192 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
193
194#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
195({ \
196 __label__ __out; \
197 wait_queue_t __wait; \
198 long __ret = ret; \
199 \
200 INIT_LIST_HEAD(&__wait.task_list); \
201 if (exclusive) \
202 __wait.flags = WQ_FLAG_EXCLUSIVE; \
203 else \
204 __wait.flags = 0; \
185 \ 205 \
186 for (;;) { \ 206 for (;;) { \
187 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 207 long __int = prepare_to_wait_event(&wq, &__wait, state);\
208 \
188 if (condition) \ 209 if (condition) \
189 break; \ 210 break; \
190 schedule(); \ 211 \
212 if (___wait_is_interruptible(state) && __int) { \
213 __ret = __int; \
214 if (exclusive) { \
215 abort_exclusive_wait(&wq, &__wait, \
216 state, NULL); \
217 goto __out; \
218 } \
219 break; \
220 } \
221 \
222 cmd; \
191 } \ 223 } \
192 finish_wait(&wq, &__wait); \ 224 finish_wait(&wq, &__wait); \
193} while (0) 225__out: __ret; \
226})
227
228#define __wait_event(wq, condition) \
229 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
230 schedule())
194 231
195/** 232/**
196 * wait_event - sleep until a condition gets true 233 * wait_event - sleep until a condition gets true
@@ -204,29 +241,17 @@ do { \
204 * wake_up() has to be called after changing any variable that could 241 * wake_up() has to be called after changing any variable that could
205 * change the result of the wait condition. 242 * change the result of the wait condition.
206 */ 243 */
207#define wait_event(wq, condition) \ 244#define wait_event(wq, condition) \
208do { \ 245do { \
209 if (condition) \ 246 if (condition) \
210 break; \ 247 break; \
211 __wait_event(wq, condition); \ 248 __wait_event(wq, condition); \
212} while (0) 249} while (0)
213 250
214#define __wait_event_timeout(wq, condition, ret) \ 251#define __wait_event_timeout(wq, condition, timeout) \
215do { \ 252 ___wait_event(wq, ___wait_cond_timeout(condition), \
216 DEFINE_WAIT(__wait); \ 253 TASK_UNINTERRUPTIBLE, 0, timeout, \
217 \ 254 __ret = schedule_timeout(__ret))
218 for (;;) { \
219 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
220 if (condition) \
221 break; \
222 ret = schedule_timeout(ret); \
223 if (!ret) \
224 break; \
225 } \
226 if (!ret && (condition)) \
227 ret = 1; \
228 finish_wait(&wq, &__wait); \
229} while (0)
230 255
231/** 256/**
232 * wait_event_timeout - sleep until a condition gets true or a timeout elapses 257 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
@@ -248,29 +273,40 @@ do { \
248#define wait_event_timeout(wq, condition, timeout) \ 273#define wait_event_timeout(wq, condition, timeout) \
249({ \ 274({ \
250 long __ret = timeout; \ 275 long __ret = timeout; \
251 if (!(condition)) \ 276 if (!___wait_cond_timeout(condition)) \
252 __wait_event_timeout(wq, condition, __ret); \ 277 __ret = __wait_event_timeout(wq, condition, timeout); \
253 __ret; \ 278 __ret; \
254}) 279})
255 280
256#define __wait_event_interruptible(wq, condition, ret) \ 281#define __wait_event_cmd(wq, condition, cmd1, cmd2) \
282 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
283 cmd1; schedule(); cmd2)
284
285/**
286 * wait_event_cmd - sleep until a condition gets true
287 * @wq: the waitqueue to wait on
288 * @condition: a C expression for the event to wait for
289 * cmd1: the command will be executed before sleep
290 * cmd2: the command will be executed after sleep
291 *
292 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
293 * @condition evaluates to true. The @condition is checked each time
294 * the waitqueue @wq is woken up.
295 *
296 * wake_up() has to be called after changing any variable that could
297 * change the result of the wait condition.
298 */
299#define wait_event_cmd(wq, condition, cmd1, cmd2) \
257do { \ 300do { \
258 DEFINE_WAIT(__wait); \ 301 if (condition) \
259 \
260 for (;;) { \
261 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
262 if (condition) \
263 break; \
264 if (!signal_pending(current)) { \
265 schedule(); \
266 continue; \
267 } \
268 ret = -ERESTARTSYS; \
269 break; \ 302 break; \
270 } \ 303 __wait_event_cmd(wq, condition, cmd1, cmd2); \
271 finish_wait(&wq, &__wait); \
272} while (0) 304} while (0)
273 305
306#define __wait_event_interruptible(wq, condition) \
307 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
308 schedule())
309
274/** 310/**
275 * wait_event_interruptible - sleep until a condition gets true 311 * wait_event_interruptible - sleep until a condition gets true
276 * @wq: the waitqueue to wait on 312 * @wq: the waitqueue to wait on
@@ -290,31 +326,14 @@ do { \
290({ \ 326({ \
291 int __ret = 0; \ 327 int __ret = 0; \
292 if (!(condition)) \ 328 if (!(condition)) \
293 __wait_event_interruptible(wq, condition, __ret); \ 329 __ret = __wait_event_interruptible(wq, condition); \
294 __ret; \ 330 __ret; \
295}) 331})
296 332
297#define __wait_event_interruptible_timeout(wq, condition, ret) \ 333#define __wait_event_interruptible_timeout(wq, condition, timeout) \
298do { \ 334 ___wait_event(wq, ___wait_cond_timeout(condition), \
299 DEFINE_WAIT(__wait); \ 335 TASK_INTERRUPTIBLE, 0, timeout, \
300 \ 336 __ret = schedule_timeout(__ret))
301 for (;;) { \
302 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
303 if (condition) \
304 break; \
305 if (!signal_pending(current)) { \
306 ret = schedule_timeout(ret); \
307 if (!ret) \
308 break; \
309 continue; \
310 } \
311 ret = -ERESTARTSYS; \
312 break; \
313 } \
314 if (!ret && (condition)) \
315 ret = 1; \
316 finish_wait(&wq, &__wait); \
317} while (0)
318 337
319/** 338/**
320 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses 339 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
@@ -337,15 +356,15 @@ do { \
337#define wait_event_interruptible_timeout(wq, condition, timeout) \ 356#define wait_event_interruptible_timeout(wq, condition, timeout) \
338({ \ 357({ \
339 long __ret = timeout; \ 358 long __ret = timeout; \
340 if (!(condition)) \ 359 if (!___wait_cond_timeout(condition)) \
341 __wait_event_interruptible_timeout(wq, condition, __ret); \ 360 __ret = __wait_event_interruptible_timeout(wq, \
361 condition, timeout); \
342 __ret; \ 362 __ret; \
343}) 363})
344 364
345#define __wait_event_hrtimeout(wq, condition, timeout, state) \ 365#define __wait_event_hrtimeout(wq, condition, timeout, state) \
346({ \ 366({ \
347 int __ret = 0; \ 367 int __ret = 0; \
348 DEFINE_WAIT(__wait); \
349 struct hrtimer_sleeper __t; \ 368 struct hrtimer_sleeper __t; \
350 \ 369 \
351 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \ 370 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \
@@ -356,25 +375,15 @@ do { \
356 current->timer_slack_ns, \ 375 current->timer_slack_ns, \
357 HRTIMER_MODE_REL); \ 376 HRTIMER_MODE_REL); \
358 \ 377 \
359 for (;;) { \ 378 __ret = ___wait_event(wq, condition, state, 0, 0, \
360 prepare_to_wait(&wq, &__wait, state); \
361 if (condition) \
362 break; \
363 if (state == TASK_INTERRUPTIBLE && \
364 signal_pending(current)) { \
365 __ret = -ERESTARTSYS; \
366 break; \
367 } \
368 if (!__t.task) { \ 379 if (!__t.task) { \
369 __ret = -ETIME; \ 380 __ret = -ETIME; \
370 break; \ 381 break; \
371 } \ 382 } \
372 schedule(); \ 383 schedule()); \
373 } \
374 \ 384 \
375 hrtimer_cancel(&__t.timer); \ 385 hrtimer_cancel(&__t.timer); \
376 destroy_hrtimer_on_stack(&__t.timer); \ 386 destroy_hrtimer_on_stack(&__t.timer); \
377 finish_wait(&wq, &__wait); \
378 __ret; \ 387 __ret; \
379}) 388})
380 389
@@ -428,33 +437,15 @@ do { \
428 __ret; \ 437 __ret; \
429}) 438})
430 439
431#define __wait_event_interruptible_exclusive(wq, condition, ret) \ 440#define __wait_event_interruptible_exclusive(wq, condition) \
432do { \ 441 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
433 DEFINE_WAIT(__wait); \ 442 schedule())
434 \
435 for (;;) { \
436 prepare_to_wait_exclusive(&wq, &__wait, \
437 TASK_INTERRUPTIBLE); \
438 if (condition) { \
439 finish_wait(&wq, &__wait); \
440 break; \
441 } \
442 if (!signal_pending(current)) { \
443 schedule(); \
444 continue; \
445 } \
446 ret = -ERESTARTSYS; \
447 abort_exclusive_wait(&wq, &__wait, \
448 TASK_INTERRUPTIBLE, NULL); \
449 break; \
450 } \
451} while (0)
452 443
453#define wait_event_interruptible_exclusive(wq, condition) \ 444#define wait_event_interruptible_exclusive(wq, condition) \
454({ \ 445({ \
455 int __ret = 0; \ 446 int __ret = 0; \
456 if (!(condition)) \ 447 if (!(condition)) \
457 __wait_event_interruptible_exclusive(wq, condition, __ret);\ 448 __ret = __wait_event_interruptible_exclusive(wq, condition);\
458 __ret; \ 449 __ret; \
459}) 450})
460 451
@@ -606,24 +597,8 @@ do { \
606 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) 597 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
607 598
608 599
609 600#define __wait_event_killable(wq, condition) \
610#define __wait_event_killable(wq, condition, ret) \ 601 ___wait_event(wq, condition, TASK_KILLABLE, 0, 0, schedule())
611do { \
612 DEFINE_WAIT(__wait); \
613 \
614 for (;;) { \
615 prepare_to_wait(&wq, &__wait, TASK_KILLABLE); \
616 if (condition) \
617 break; \
618 if (!fatal_signal_pending(current)) { \
619 schedule(); \
620 continue; \
621 } \
622 ret = -ERESTARTSYS; \
623 break; \
624 } \
625 finish_wait(&wq, &__wait); \
626} while (0)
627 602
628/** 603/**
629 * wait_event_killable - sleep until a condition gets true 604 * wait_event_killable - sleep until a condition gets true
@@ -644,26 +619,17 @@ do { \
644({ \ 619({ \
645 int __ret = 0; \ 620 int __ret = 0; \
646 if (!(condition)) \ 621 if (!(condition)) \
647 __wait_event_killable(wq, condition, __ret); \ 622 __ret = __wait_event_killable(wq, condition); \
648 __ret; \ 623 __ret; \
649}) 624})
650 625
651 626
652#define __wait_event_lock_irq(wq, condition, lock, cmd) \ 627#define __wait_event_lock_irq(wq, condition, lock, cmd) \
653do { \ 628 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
654 DEFINE_WAIT(__wait); \ 629 spin_unlock_irq(&lock); \
655 \ 630 cmd; \
656 for (;;) { \ 631 schedule(); \
657 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 632 spin_lock_irq(&lock))
658 if (condition) \
659 break; \
660 spin_unlock_irq(&lock); \
661 cmd; \
662 schedule(); \
663 spin_lock_irq(&lock); \
664 } \
665 finish_wait(&wq, &__wait); \
666} while (0)
667 633
668/** 634/**
669 * wait_event_lock_irq_cmd - sleep until a condition gets true. The 635 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
@@ -723,26 +689,12 @@ do { \
723} while (0) 689} while (0)
724 690
725 691
726#define __wait_event_interruptible_lock_irq(wq, condition, \ 692#define __wait_event_interruptible_lock_irq(wq, condition, lock, cmd) \
727 lock, ret, cmd) \ 693 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
728do { \ 694 spin_unlock_irq(&lock); \
729 DEFINE_WAIT(__wait); \ 695 cmd; \
730 \ 696 schedule(); \
731 for (;;) { \ 697 spin_lock_irq(&lock))
732 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
733 if (condition) \
734 break; \
735 if (signal_pending(current)) { \
736 ret = -ERESTARTSYS; \
737 break; \
738 } \
739 spin_unlock_irq(&lock); \
740 cmd; \
741 schedule(); \
742 spin_lock_irq(&lock); \
743 } \
744 finish_wait(&wq, &__wait); \
745} while (0)
746 698
747/** 699/**
748 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true. 700 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
@@ -772,10 +724,9 @@ do { \
772#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \ 724#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
773({ \ 725({ \
774 int __ret = 0; \ 726 int __ret = 0; \
775 \
776 if (!(condition)) \ 727 if (!(condition)) \
777 __wait_event_interruptible_lock_irq(wq, condition, \ 728 __ret = __wait_event_interruptible_lock_irq(wq, \
778 lock, __ret, cmd); \ 729 condition, lock, cmd); \
779 __ret; \ 730 __ret; \
780}) 731})
781 732
@@ -804,39 +755,24 @@ do { \
804#define wait_event_interruptible_lock_irq(wq, condition, lock) \ 755#define wait_event_interruptible_lock_irq(wq, condition, lock) \
805({ \ 756({ \
806 int __ret = 0; \ 757 int __ret = 0; \
807 \
808 if (!(condition)) \ 758 if (!(condition)) \
809 __wait_event_interruptible_lock_irq(wq, condition, \ 759 __ret = __wait_event_interruptible_lock_irq(wq, \
810 lock, __ret, ); \ 760 condition, lock,); \
811 __ret; \ 761 __ret; \
812}) 762})
813 763
814#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \ 764#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815 lock, ret) \ 765 lock, timeout) \
816do { \ 766 ___wait_event(wq, ___wait_cond_timeout(condition), \
817 DEFINE_WAIT(__wait); \ 767 TASK_INTERRUPTIBLE, 0, timeout, \
818 \ 768 spin_unlock_irq(&lock); \
819 for (;;) { \ 769 __ret = schedule_timeout(__ret); \
820 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ 770 spin_lock_irq(&lock));
821 if (condition) \
822 break; \
823 if (signal_pending(current)) { \
824 ret = -ERESTARTSYS; \
825 break; \
826 } \
827 spin_unlock_irq(&lock); \
828 ret = schedule_timeout(ret); \
829 spin_lock_irq(&lock); \
830 if (!ret) \
831 break; \
832 } \
833 finish_wait(&wq, &__wait); \
834} while (0)
835 771
836/** 772/**
837 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses. 773 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
838 * The condition is checked under the lock. This is expected 774 * true or a timeout elapses. The condition is checked under
839 * to be called with the lock taken. 775 * the lock. This is expected to be called with the lock taken.
840 * @wq: the waitqueue to wait on 776 * @wq: the waitqueue to wait on
841 * @condition: a C expression for the event to wait for 777 * @condition: a C expression for the event to wait for
842 * @lock: a locked spinlock_t, which will be released before schedule() 778 * @lock: a locked spinlock_t, which will be released before schedule()
@@ -860,11 +796,10 @@ do { \
860#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \ 796#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861 timeout) \ 797 timeout) \
862({ \ 798({ \
863 int __ret = timeout; \ 799 long __ret = timeout; \
864 \ 800 if (!___wait_cond_timeout(condition)) \
865 if (!(condition)) \ 801 __ret = __wait_event_interruptible_lock_irq_timeout( \
866 __wait_event_interruptible_lock_irq_timeout( \ 802 wq, condition, lock, timeout); \
867 wq, condition, lock, __ret); \
868 __ret; \ 803 __ret; \
869}) 804})
870 805
@@ -875,20 +810,18 @@ do { \
875 * We plan to remove these interfaces. 810 * We plan to remove these interfaces.
876 */ 811 */
877extern void sleep_on(wait_queue_head_t *q); 812extern void sleep_on(wait_queue_head_t *q);
878extern long sleep_on_timeout(wait_queue_head_t *q, 813extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
879 signed long timeout);
880extern void interruptible_sleep_on(wait_queue_head_t *q); 814extern void interruptible_sleep_on(wait_queue_head_t *q);
881extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, 815extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
882 signed long timeout);
883 816
884/* 817/*
885 * Waitqueues which are removed from the waitqueue_head at wakeup time 818 * Waitqueues which are removed from the waitqueue_head at wakeup time
886 */ 819 */
887void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); 820void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
888void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); 821void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
822long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state);
889void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); 823void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
890void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, 824void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key);
891 unsigned int mode, void *key);
892int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 825int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
893int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 826int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
894 827
@@ -934,8 +867,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
934 * One uses wait_on_bit() where one is waiting for the bit to clear, 867 * One uses wait_on_bit() where one is waiting for the bit to clear,
935 * but has no intention of setting it. 868 * but has no intention of setting it.
936 */ 869 */
937static inline int wait_on_bit(void *word, int bit, 870static inline int
938 int (*action)(void *), unsigned mode) 871wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
939{ 872{
940 if (!test_bit(bit, word)) 873 if (!test_bit(bit, word))
941 return 0; 874 return 0;
@@ -958,8 +891,8 @@ static inline int wait_on_bit(void *word, int bit,
958 * One uses wait_on_bit_lock() where one is waiting for the bit to 891 * One uses wait_on_bit_lock() where one is waiting for the bit to
959 * clear with the intention of setting it, and when done, clearing it. 892 * clear with the intention of setting it, and when done, clearing it.
960 */ 893 */
961static inline int wait_on_bit_lock(void *word, int bit, 894static inline int
962 int (*action)(void *), unsigned mode) 895wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode)
963{ 896{
964 if (!test_and_set_bit(bit, word)) 897 if (!test_and_set_bit(bit, word))
965 return 0; 898 return 0;
@@ -983,5 +916,5 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
983 return 0; 916 return 0;
984 return out_of_line_wait_on_atomic_t(val, action, mode); 917 return out_of_line_wait_on_atomic_t(val, action, mode);
985} 918}
986 919
987#endif 920#endif /* _LINUX_WAIT_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 4e198ca1f685..fc0e4320aa6d 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -97,9 +97,7 @@ void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
97int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); 97int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason);
98int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 98int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
99 enum wb_reason reason); 99 enum wb_reason reason);
100void sync_inodes_sb(struct super_block *); 100void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this);
101long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
102 enum wb_reason reason);
103void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 101void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
104void inode_wait_for_writeback(struct inode *inode); 102void inode_wait_for_writeback(struct inode *inode);
105 103
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fdbafc6841cf..91b0a68d38dc 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -31,7 +31,7 @@ struct xattr_handler {
31}; 31};
32 32
33struct xattr { 33struct xattr {
34 char *name; 34 const char *name;
35 void *value; 35 void *value;
36 size_t value_len; 36 size_t value_len;
37}; 37};
diff --git a/include/linux/yam.h b/include/linux/yam.h
index 7fe28228b274..512cdc2fb80f 100644
--- a/include/linux/yam.h
+++ b/include/linux/yam.h
@@ -77,6 +77,6 @@ struct yamdrv_ioctl_cfg {
77 77
78struct yamdrv_ioctl_mcs { 78struct yamdrv_ioctl_mcs {
79 int cmd; 79 int cmd;
80 int bitrate; 80 unsigned int bitrate;
81 unsigned char bits[YAM_FPGA_SIZE]; 81 unsigned char bits[YAM_FPGA_SIZE];
82}; 82};
diff --git a/include/media/lm3560.h b/include/media/lm3560.h
new file mode 100644
index 000000000000..46670706d6f8
--- /dev/null
+++ b/include/media/lm3560.h
@@ -0,0 +1,97 @@
1/*
2 * include/media/lm3560.h
3 *
4 * Copyright (C) 2013 Texas Instruments
5 *
6 * Contact: Daniel Jeong <gshark.jeong@gmail.com>
7 * Ldd-Mlp <ldd-mlp@list.ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * 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., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __LM3560_H__
26#define __LM3560_H__
27
28#include <media/v4l2-subdev.h>
29
30#define LM3560_NAME "lm3560"
31#define LM3560_I2C_ADDR (0x53)
32
33/* FLASH Brightness
34 * min 62500uA, step 62500uA, max 1000000uA
35 */
36#define LM3560_FLASH_BRT_MIN 62500
37#define LM3560_FLASH_BRT_STEP 62500
38#define LM3560_FLASH_BRT_MAX 1000000
39#define LM3560_FLASH_BRT_uA_TO_REG(a) \
40 ((a) < LM3560_FLASH_BRT_MIN ? 0 : \
41 (((a) - LM3560_FLASH_BRT_MIN) / LM3560_FLASH_BRT_STEP))
42#define LM3560_FLASH_BRT_REG_TO_uA(a) \
43 ((a) * LM3560_FLASH_BRT_STEP + LM3560_FLASH_BRT_MIN)
44
45/* FLASH TIMEOUT DURATION
46 * min 32ms, step 32ms, max 1024ms
47 */
48#define LM3560_FLASH_TOUT_MIN 32
49#define LM3560_FLASH_TOUT_STEP 32
50#define LM3560_FLASH_TOUT_MAX 1024
51#define LM3560_FLASH_TOUT_ms_TO_REG(a) \
52 ((a) < LM3560_FLASH_TOUT_MIN ? 0 : \
53 (((a) - LM3560_FLASH_TOUT_MIN) / LM3560_FLASH_TOUT_STEP))
54#define LM3560_FLASH_TOUT_REG_TO_ms(a) \
55 ((a) * LM3560_FLASH_TOUT_STEP + LM3560_FLASH_TOUT_MIN)
56
57/* TORCH BRT
58 * min 31250uA, step 31250uA, max 250000uA
59 */
60#define LM3560_TORCH_BRT_MIN 31250
61#define LM3560_TORCH_BRT_STEP 31250
62#define LM3560_TORCH_BRT_MAX 250000
63#define LM3560_TORCH_BRT_uA_TO_REG(a) \
64 ((a) < LM3560_TORCH_BRT_MIN ? 0 : \
65 (((a) - LM3560_TORCH_BRT_MIN) / LM3560_TORCH_BRT_STEP))
66#define LM3560_TORCH_BRT_REG_TO_uA(a) \
67 ((a) * LM3560_TORCH_BRT_STEP + LM3560_TORCH_BRT_MIN)
68
69enum lm3560_led_id {
70 LM3560_LED0 = 0,
71 LM3560_LED1,
72 LM3560_LED_MAX
73};
74
75enum lm3560_peak_current {
76 LM3560_PEAK_1600mA = 0x00,
77 LM3560_PEAK_2300mA = 0x20,
78 LM3560_PEAK_3000mA = 0x40,
79 LM3560_PEAK_3600mA = 0x60
80};
81
82/* struct lm3560_platform_data
83 *
84 * @peak : peak current
85 * @max_flash_timeout: flash timeout
86 * @max_flash_brt: flash mode led brightness
87 * @max_torch_brt: torch mode led brightness
88 */
89struct lm3560_platform_data {
90 enum lm3560_peak_current peak;
91
92 u32 max_flash_timeout;
93 u32 max_flash_brt[LM3560_LED_MAX];
94 u32 max_torch_brt[LM3560_LED_MAX];
95};
96
97#endif /* __LM3560_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 34d2414f2b8c..865246b00127 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -146,9 +146,14 @@ struct soc_camera_subdev_desc {
146 /* sensor driver private platform data */ 146 /* sensor driver private platform data */
147 void *drv_priv; 147 void *drv_priv;
148 148
149 /* Optional regulators that have to be managed on power on/off events */ 149 /*
150 struct regulator_bulk_data *regulators; 150 * Set unbalanced_power to true to deal with legacy drivers, failing to
151 int num_regulators; 151 * balance their calls to subdevice's .s_power() method. clock_state is
152 * then used internally by helper functions, it shouldn't be touched by
153 * drivers or the platform code.
154 */
155 bool unbalanced_power;
156 unsigned long clock_state;
152 157
153 /* Optional callbacks to power on or off and reset the sensor */ 158 /* Optional callbacks to power on or off and reset the sensor */
154 int (*power)(struct device *, int); 159 int (*power)(struct device *, int);
@@ -162,6 +167,9 @@ struct soc_camera_subdev_desc {
162 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags); 167 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags);
163 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *); 168 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *);
164 void (*free_bus)(struct soc_camera_subdev_desc *); 169 void (*free_bus)(struct soc_camera_subdev_desc *);
170
171 /* Optional regulators that have to be managed on power on/off events */
172 struct v4l2_subdev_platform_data sd_pdata;
165}; 173};
166 174
167struct soc_camera_host_desc { 175struct soc_camera_host_desc {
@@ -202,9 +210,10 @@ struct soc_camera_link {
202 210
203 void *priv; 211 void *priv;
204 212
205 /* Optional regulators that have to be managed on power on/off events */ 213 /* Set by platforms to handle misbehaving drivers */
206 struct regulator_bulk_data *regulators; 214 bool unbalanced_power;
207 int num_regulators; 215 /* Used by soc-camera helper functions */
216 unsigned long clock_state;
208 217
209 /* Optional callbacks to power on or off and reset the sensor */ 218 /* Optional callbacks to power on or off and reset the sensor */
210 int (*power)(struct device *, int); 219 int (*power)(struct device *, int);
@@ -218,6 +227,12 @@ struct soc_camera_link {
218 unsigned long (*query_bus_param)(struct soc_camera_link *); 227 unsigned long (*query_bus_param)(struct soc_camera_link *);
219 void (*free_bus)(struct soc_camera_link *); 228 void (*free_bus)(struct soc_camera_link *);
220 229
230 /* Optional regulators that have to be managed on power on/off events */
231 struct regulator_bulk_data *regulators;
232 int num_regulators;
233
234 void *host_priv;
235
221 /* 236 /*
222 * Host part - keep at bottom and compatible to 237 * Host part - keep at bottom and compatible to
223 * struct soc_camera_host_desc 238 * struct soc_camera_host_desc
diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
index 0503a90b48bb..0b36cc138304 100644
--- a/include/media/v4l2-clk.h
+++ b/include/media/v4l2-clk.h
@@ -15,6 +15,7 @@
15#define MEDIA_V4L2_CLK_H 15#define MEDIA_V4L2_CLK_H
16 16
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18#include <linux/export.h>
18#include <linux/list.h> 19#include <linux/list.h>
19#include <linux/mutex.h> 20#include <linux/mutex.h>
20 21
@@ -51,4 +52,20 @@ void v4l2_clk_disable(struct v4l2_clk *clk);
51unsigned long v4l2_clk_get_rate(struct v4l2_clk *clk); 52unsigned long v4l2_clk_get_rate(struct v4l2_clk *clk);
52int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate); 53int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate);
53 54
55struct module;
56
57struct v4l2_clk *__v4l2_clk_register_fixed(const char *dev_id,
58 const char *id, unsigned long rate, struct module *owner);
59void v4l2_clk_unregister_fixed(struct v4l2_clk *clk);
60
61static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id,
62 const char *id,
63 unsigned long rate)
64{
65 return __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE);
66}
67
68#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
69 "%d-%04x", adap, client)
70
54#endif 71#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 16550c439008..48f974866f13 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -35,7 +35,7 @@
35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg) 35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
36 36
37#define v4l_client_printk(level, client, fmt, arg...) \ 37#define v4l_client_printk(level, client, fmt, arg...) \
38 v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \ 38 v4l_printk(level, (client)->dev.driver->name, (client)->adapter, \
39 (client)->addr, fmt , ## arg) 39 (client)->addr, fmt , ## arg)
40 40
41#define v4l_err(client, fmt, arg...) \ 41#define v4l_err(client, fmt, arg...) \
@@ -86,7 +86,7 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
86 const char * const *menu_items); 86 const char * const *menu_items);
87const char *v4l2_ctrl_get_name(u32 id); 87const char *v4l2_ctrl_get_name(u32 id);
88const char * const *v4l2_ctrl_get_menu(u32 id); 88const char * const *v4l2_ctrl_get_menu(u32 id);
89const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len); 89const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
90int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 90int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
91int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 91int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
92 struct v4l2_queryctrl *qctrl, const char * const *menu_items); 92 struct v4l2_queryctrl *qctrl, const char * const *menu_items);
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 47ada23345a1..16f7f2606516 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -571,7 +571,7 @@ static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
571 mutex_lock(ctrl->handler->lock); 571 mutex_lock(ctrl->handler->lock);
572} 572}
573 573
574/** v4l2_ctrl_lock() - Helper function to unlock the handler 574/** v4l2_ctrl_unlock() - Helper function to unlock the handler
575 * associated with the control. 575 * associated with the control.
576 * @ctrl: The control to unlock. 576 * @ctrl: The control to unlock.
577 */ 577 */
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index a62ee18cb7b7..528cdaf622e1 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -26,7 +26,9 @@
26#ifndef V4L2_FH_H 26#ifndef V4L2_FH_H
27#define V4L2_FH_H 27#define V4L2_FH_H
28 28
29#include <linux/fs.h>
29#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/videodev2.h>
30 32
31struct video_device; 33struct video_device;
32struct v4l2_ctrl_handler; 34struct v4l2_ctrl_handler;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index bfda0fe9aeb0..d67210a37ef3 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -559,6 +559,17 @@ struct v4l2_subdev_internal_ops {
559/* Set this flag if this subdev generates events. */ 559/* Set this flag if this subdev generates events. */
560#define V4L2_SUBDEV_FL_HAS_EVENTS (1U << 3) 560#define V4L2_SUBDEV_FL_HAS_EVENTS (1U << 3)
561 561
562struct regulator_bulk_data;
563
564struct v4l2_subdev_platform_data {
565 /* Optional regulators uset to power on/off the subdevice */
566 struct regulator_bulk_data *regulators;
567 int num_regulators;
568
569 /* Per-subdevice data, specific for a certain video host device */
570 void *host_priv;
571};
572
562/* Each instance of a subdev driver should create this struct, either 573/* Each instance of a subdev driver should create this struct, either
563 stand-alone or embedded in a larger struct. 574 stand-alone or embedded in a larger struct.
564 */ 575 */
@@ -592,6 +603,8 @@ struct v4l2_subdev {
592 struct v4l2_async_subdev *asd; 603 struct v4l2_async_subdev *asd;
593 /* Pointer to the managing notifier. */ 604 /* Pointer to the managing notifier. */
594 struct v4l2_async_notifier *notifier; 605 struct v4l2_async_notifier *notifier;
606 /* common part of subdevice platform data */
607 struct v4l2_subdev_platform_data *pdata;
595}; 608};
596 609
597#define media_entity_to_v4l2_subdev(ent) \ 610#define media_entity_to_v4l2_subdev(ent) \
@@ -622,13 +635,13 @@ struct v4l2_subdev_fh {
622 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ 635 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \
623 unsigned int pad) \ 636 unsigned int pad) \
624 { \ 637 { \
625 BUG_ON(unlikely(pad >= vdev_to_v4l2_subdev( \ 638 BUG_ON(pad >= vdev_to_v4l2_subdev( \
626 fh->vfh.vdev)->entity.num_pads)); \ 639 fh->vfh.vdev)->entity.num_pads); \
627 return &fh->pad[pad].field_name; \ 640 return &fh->pad[pad].field_name; \
628 } 641 }
629 642
630__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) 643__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt)
631__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_compose) 644__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_crop)
632__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose) 645__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose)
633#endif 646#endif
634 647
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 6781258d0b67..941055e9d125 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -83,7 +83,7 @@ struct vb2_fileio_data;
83struct vb2_mem_ops { 83struct vb2_mem_ops {
84 void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags); 84 void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags);
85 void (*put)(void *buf_priv); 85 void (*put)(void *buf_priv);
86 struct dma_buf *(*get_dmabuf)(void *buf_priv); 86 struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags);
87 87
88 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, 88 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
89 unsigned long size, int write); 89 unsigned long size, int write);
@@ -391,7 +391,7 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
391unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait); 391unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait);
392size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, 392size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
393 loff_t *ppos, int nonblock); 393 loff_t *ppos, int nonblock);
394size_t vb2_write(struct vb2_queue *q, char __user *data, size_t count, 394size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count,
395 loff_t *ppos, int nonblock); 395 loff_t *ppos, int nonblock);
396 396
397/** 397/**
@@ -491,7 +491,7 @@ int vb2_ioctl_expbuf(struct file *file, void *priv,
491 491
492int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma); 492int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma);
493int vb2_fop_release(struct file *file); 493int vb2_fop_release(struct file *file);
494ssize_t vb2_fop_write(struct file *file, char __user *buf, 494ssize_t vb2_fop_write(struct file *file, const char __user *buf,
495 size_t count, loff_t *ppos); 495 size_t count, loff_t *ppos);
496ssize_t vb2_fop_read(struct file *file, char __user *buf, 496ssize_t vb2_fop_read(struct file *file, char __user *buf,
497 size_t count, loff_t *ppos); 497 size_t count, loff_t *ppos);
diff --git a/include/media/videobuf2-dma-sg.h b/include/media/videobuf2-dma-sg.h
index 0038526b8ef7..7b89852779af 100644
--- a/include/media/videobuf2-dma-sg.h
+++ b/include/media/videobuf2-dma-sg.h
@@ -15,16 +15,10 @@
15 15
16#include <media/videobuf2-core.h> 16#include <media/videobuf2-core.h>
17 17
18struct vb2_dma_sg_desc { 18static inline struct sg_table *vb2_dma_sg_plane_desc(
19 unsigned long size;
20 unsigned int num_pages;
21 struct scatterlist *sglist;
22};
23
24static inline struct vb2_dma_sg_desc *vb2_dma_sg_plane_desc(
25 struct vb2_buffer *vb, unsigned int plane_no) 19 struct vb2_buffer *vb, unsigned int plane_no)
26{ 20{
27 return (struct vb2_dma_sg_desc *)vb2_plane_cookie(vb, plane_no); 21 return (struct sg_table *)vb2_plane_cookie(vb, plane_no);
28} 22}
29 23
30extern const struct vb2_mem_ops vb2_dma_sg_memops; 24extern const struct vb2_mem_ops vb2_dma_sg_memops;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4c7c01a73911..c38a005bd0cf 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -26,6 +26,8 @@
26#ifndef NET_9P_CLIENT_H 26#ifndef NET_9P_CLIENT_H
27#define NET_9P_CLIENT_H 27#define NET_9P_CLIENT_H
28 28
29#include <linux/utsname.h>
30
29/* Number of requests per row */ 31/* Number of requests per row */
30#define P9_ROW_MAXTAG 255 32#define P9_ROW_MAXTAG 255
31 33
@@ -134,6 +136,7 @@ struct p9_req_t {
134 * @tagpool - transaction id accounting for session 136 * @tagpool - transaction id accounting for session
135 * @reqs - 2D array of requests 137 * @reqs - 2D array of requests
136 * @max_tag - current maximum tag id allocated 138 * @max_tag - current maximum tag id allocated
139 * @name - node name used as client id
137 * 140 *
138 * The client structure is used to keep track of various per-client 141 * The client structure is used to keep track of various per-client
139 * state that has been instantiated. 142 * state that has been instantiated.
@@ -164,6 +167,8 @@ struct p9_client {
164 struct p9_idpool *tagpool; 167 struct p9_idpool *tagpool;
165 struct p9_req_t *reqs[P9_ROW_MAXTAG]; 168 struct p9_req_t *reqs[P9_ROW_MAXTAG];
166 int max_tag; 169 int max_tag;
170
171 char name[__NEW_UTS_LEN + 1];
167}; 172};
168 173
169/** 174/**
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index fb314de2b61b..86505bfa5d2c 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -67,6 +67,10 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
67int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr); 67int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr);
68#endif 68#endif
69 69
70bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
71 const unsigned int prefix_len,
72 struct net_device *dev);
73
70int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev); 74int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev);
71 75
72struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 76struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
deleted file mode 100644
index 487b54c1308f..000000000000
--- a/include/net/bluetooth/a2mp.h
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
18#include <net/bluetooth/l2cap.h>
19
20#define A2MP_FEAT_EXT 0x8000
21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26 WRITE_REMOTE_AMP_ASSOC,
27};
28
29struct amp_mgr {
30 struct list_head list;
31 struct l2cap_conn *l2cap_conn;
32 struct l2cap_chan *a2mp_chan;
33 struct l2cap_chan *bredr_chan;
34 struct kref kref;
35 __u8 ident;
36 __u8 handle;
37 unsigned long state;
38 unsigned long flags;
39
40 struct list_head amp_ctrls;
41 struct mutex amp_ctrls_lock;
42};
43
44struct a2mp_cmd {
45 __u8 code;
46 __u8 ident;
47 __le16 len;
48 __u8 data[0];
49} __packed;
50
51/* A2MP command codes */
52#define A2MP_COMMAND_REJ 0x01
53struct a2mp_cmd_rej {
54 __le16 reason;
55 __u8 data[0];
56} __packed;
57
58#define A2MP_DISCOVER_REQ 0x02
59struct a2mp_discov_req {
60 __le16 mtu;
61 __le16 ext_feat;
62} __packed;
63
64struct a2mp_cl {
65 __u8 id;
66 __u8 type;
67 __u8 status;
68} __packed;
69
70#define A2MP_DISCOVER_RSP 0x03
71struct a2mp_discov_rsp {
72 __le16 mtu;
73 __le16 ext_feat;
74 struct a2mp_cl cl[0];
75} __packed;
76
77#define A2MP_CHANGE_NOTIFY 0x04
78#define A2MP_CHANGE_RSP 0x05
79
80#define A2MP_GETINFO_REQ 0x06
81struct a2mp_info_req {
82 __u8 id;
83} __packed;
84
85#define A2MP_GETINFO_RSP 0x07
86struct a2mp_info_rsp {
87 __u8 id;
88 __u8 status;
89 __le32 total_bw;
90 __le32 max_bw;
91 __le32 min_latency;
92 __le16 pal_cap;
93 __le16 assoc_size;
94} __packed;
95
96#define A2MP_GETAMPASSOC_REQ 0x08
97struct a2mp_amp_assoc_req {
98 __u8 id;
99} __packed;
100
101#define A2MP_GETAMPASSOC_RSP 0x09
102struct a2mp_amp_assoc_rsp {
103 __u8 id;
104 __u8 status;
105 __u8 amp_assoc[0];
106} __packed;
107
108#define A2MP_CREATEPHYSLINK_REQ 0x0A
109#define A2MP_DISCONNPHYSLINK_REQ 0x0C
110struct a2mp_physlink_req {
111 __u8 local_id;
112 __u8 remote_id;
113 __u8 amp_assoc[0];
114} __packed;
115
116#define A2MP_CREATEPHYSLINK_RSP 0x0B
117#define A2MP_DISCONNPHYSLINK_RSP 0x0D
118struct a2mp_physlink_rsp {
119 __u8 local_id;
120 __u8 remote_id;
121 __u8 status;
122} __packed;
123
124/* A2MP response status */
125#define A2MP_STATUS_SUCCESS 0x00
126#define A2MP_STATUS_INVALID_CTRL_ID 0x01
127#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
128#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
129#define A2MP_STATUS_COLLISION_OCCURED 0x03
130#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
131#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
132#define A2MP_STATUS_SECURITY_VIOLATION 0x06
133
134extern struct list_head amp_mgr_list;
135extern struct mutex amp_mgr_list_lock;
136
137struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
138int amp_mgr_put(struct amp_mgr *mgr);
139u8 __next_ident(struct amp_mgr *mgr);
140struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
141 struct sk_buff *skb);
142struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
143void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
144void a2mp_discover_amp(struct l2cap_chan *chan);
145void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
146void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
147void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
148void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
149
150#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
deleted file mode 100644
index 7ea3db77ba89..000000000000
--- a/include/net/bluetooth/amp.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
50void amp_create_logical_link(struct l2cap_chan *chan);
51void amp_disconnect_logical_link(struct hci_chan *hchan);
52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
53
54#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 10d43d8c7037..2a628b28249f 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -197,8 +197,8 @@ static inline bool bdaddr_type_is_le(__u8 type)
197 return false; 197 return false;
198} 198}
199 199
200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} }) 200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
201#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 201#define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
202 202
203/* Copy, swap, convert BD Address */ 203/* Copy, swap, convert BD Address */
204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) 204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
@@ -218,11 +218,10 @@ void baswap(bdaddr_t *dst, bdaddr_t *src);
218 218
219struct bt_sock { 219struct bt_sock {
220 struct sock sk; 220 struct sock sk;
221 bdaddr_t src;
222 bdaddr_t dst;
223 struct list_head accept_q; 221 struct list_head accept_q;
224 struct sock *parent; 222 struct sock *parent;
225 unsigned long flags; 223 unsigned long flags;
224 void (*skb_msg_name)(struct sk_buff *, void *, int *);
226}; 225};
227 226
228enum { 227enum {
@@ -249,6 +248,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
249uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); 248uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
250int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 249int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
251int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 250int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
251int bt_sock_wait_ready(struct sock *sk, unsigned long flags);
252 252
253void bt_accept_enqueue(struct sock *parent, struct sock *sk); 253void bt_accept_enqueue(struct sock *parent, struct sock *sk);
254void bt_accept_unlink(struct sock *sk); 254void bt_accept_unlink(struct sock *sk);
@@ -282,8 +282,11 @@ struct bt_skb_cb {
282 __u8 incoming; 282 __u8 incoming;
283 __u16 expect; 283 __u16 expect;
284 __u8 force_active; 284 __u8 force_active;
285 struct l2cap_chan *chan;
285 struct l2cap_ctrl control; 286 struct l2cap_ctrl control;
286 struct hci_req_ctrl req; 287 struct hci_req_ctrl req;
288 bdaddr_t bdaddr;
289 __le16 psm;
287}; 290};
288#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 291#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
289 292
@@ -331,16 +334,16 @@ out:
331 334
332int bt_to_errno(__u16 code); 335int bt_to_errno(__u16 code);
333 336
334extern int hci_sock_init(void); 337int hci_sock_init(void);
335extern void hci_sock_cleanup(void); 338void hci_sock_cleanup(void);
336 339
337extern int bt_sysfs_init(void); 340int bt_sysfs_init(void);
338extern void bt_sysfs_cleanup(void); 341void bt_sysfs_cleanup(void);
339 342
340extern int bt_procfs_init(struct net *net, const char *name, 343int bt_procfs_init(struct net *net, const char *name,
341 struct bt_sock_list* sk_list, 344 struct bt_sock_list *sk_list,
342 int (* seq_show)(struct seq_file *, void *)); 345 int (*seq_show)(struct seq_file *, void *));
343extern void bt_procfs_cleanup(struct net *net, const char *name); 346void bt_procfs_cleanup(struct net *net, const char *name);
344 347
345extern struct dentry *bt_debugfs; 348extern struct dentry *bt_debugfs;
346 349
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaeaf0938ec0..1784c48699f0 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -35,6 +35,8 @@
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672 36#define HCI_MAX_AMP_ASSOC_SIZE 672
37 37
38#define HCI_MAX_CSB_DATA_SIZE 252
39
38/* HCI dev events */ 40/* HCI dev events */
39#define HCI_DEV_REG 1 41#define HCI_DEV_REG 1
40#define HCI_DEV_UNREG 2 42#define HCI_DEV_UNREG 2
@@ -62,16 +64,20 @@
62#define HCI_AMP 0x01 64#define HCI_AMP 0x01
63 65
64/* First BR/EDR Controller shall have ID = 0 */ 66/* First BR/EDR Controller shall have ID = 0 */
65#define HCI_BREDR_ID 0 67#define AMP_ID_BREDR 0x00
68
69/* AMP controller types */
70#define AMP_TYPE_BREDR 0x00
71#define AMP_TYPE_80211 0x01
66 72
67/* AMP controller status */ 73/* AMP controller status */
68#define AMP_CTRL_POWERED_DOWN 0x00 74#define AMP_STATUS_POWERED_DOWN 0x00
69#define AMP_CTRL_BLUETOOTH_ONLY 0x01 75#define AMP_STATUS_BLUETOOTH_ONLY 0x01
70#define AMP_CTRL_NO_CAPACITY 0x02 76#define AMP_STATUS_NO_CAPACITY 0x02
71#define AMP_CTRL_LOW_CAPACITY 0x03 77#define AMP_STATUS_LOW_CAPACITY 0x03
72#define AMP_CTRL_MEDIUM_CAPACITY 0x04 78#define AMP_STATUS_MEDIUM_CAPACITY 0x04
73#define AMP_CTRL_HIGH_CAPACITY 0x05 79#define AMP_STATUS_HIGH_CAPACITY 0x05
74#define AMP_CTRL_FULL_CAPACITY 0x06 80#define AMP_STATUS_FULL_CAPACITY 0x06
75 81
76/* HCI device quirks */ 82/* HCI device quirks */
77enum { 83enum {
@@ -104,22 +110,27 @@ enum {
104enum { 110enum {
105 HCI_SETUP, 111 HCI_SETUP,
106 HCI_AUTO_OFF, 112 HCI_AUTO_OFF,
113 HCI_RFKILLED,
107 HCI_MGMT, 114 HCI_MGMT,
108 HCI_PAIRABLE, 115 HCI_PAIRABLE,
109 HCI_SERVICE_CACHE, 116 HCI_SERVICE_CACHE,
110 HCI_DEBUG_KEYS, 117 HCI_DEBUG_KEYS,
118 HCI_DUT_MODE,
111 HCI_UNREGISTER, 119 HCI_UNREGISTER,
120 HCI_USER_CHANNEL,
112 121
113 HCI_LE_SCAN, 122 HCI_LE_SCAN,
114 HCI_SSP_ENABLED, 123 HCI_SSP_ENABLED,
115 HCI_HS_ENABLED, 124 HCI_HS_ENABLED,
116 HCI_LE_ENABLED, 125 HCI_LE_ENABLED,
117 HCI_LE_PERIPHERAL, 126 HCI_ADVERTISING,
118 HCI_CONNECTABLE, 127 HCI_CONNECTABLE,
119 HCI_DISCOVERABLE, 128 HCI_DISCOVERABLE,
129 HCI_LIMITED_DISCOVERABLE,
120 HCI_LINK_SECURITY, 130 HCI_LINK_SECURITY,
121 HCI_PERIODIC_INQ, 131 HCI_PERIODIC_INQ,
122 HCI_FAST_CONNECTABLE, 132 HCI_FAST_CONNECTABLE,
133 HCI_BREDR_ENABLED,
123}; 134};
124 135
125/* A mask for the flags that are supposed to remain when a reset happens 136/* A mask for the flags that are supposed to remain when a reset happens
@@ -623,6 +634,24 @@ struct hci_rp_logical_link_cancel {
623 __u8 flow_spec_id; 634 __u8 flow_spec_id;
624} __packed; 635} __packed;
625 636
637#define HCI_OP_SET_CSB 0x0441
638struct hci_cp_set_csb {
639 __u8 enable;
640 __u8 lt_addr;
641 __u8 lpo_allowed;
642 __le16 packet_type;
643 __le16 interval_min;
644 __le16 interval_max;
645 __le16 csb_sv_tout;
646} __packed;
647struct hci_rp_set_csb {
648 __u8 status;
649 __u8 lt_addr;
650 __le16 interval;
651} __packed;
652
653#define HCI_OP_START_SYNC_TRAIN 0x0443
654
626#define HCI_OP_SNIFF_MODE 0x0803 655#define HCI_OP_SNIFF_MODE 0x0803
627struct hci_cp_sniff_mode { 656struct hci_cp_sniff_mode {
628 __le16 handle; 657 __le16 handle;
@@ -693,9 +722,6 @@ struct hci_cp_sniff_subrate {
693} __packed; 722} __packed;
694 723
695#define HCI_OP_SET_EVENT_MASK 0x0c01 724#define HCI_OP_SET_EVENT_MASK 0x0c01
696struct hci_cp_set_event_mask {
697 __u8 mask[8];
698} __packed;
699 725
700#define HCI_OP_RESET 0x0c03 726#define HCI_OP_RESET 0x0c03
701 727
@@ -791,6 +817,20 @@ struct hci_cp_host_buffer_size {
791 __le16 sco_max_pkt; 817 __le16 sco_max_pkt;
792} __packed; 818} __packed;
793 819
820#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
821struct hci_rp_read_num_supported_iac {
822 __u8 status;
823 __u8 num_iac;
824} __packed;
825
826#define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39
827
828#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
829struct hci_cp_write_current_iac_lap {
830 __u8 num_iac;
831 __u8 iac_lap[6];
832} __packed;
833
794#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 834#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
795 835
796#define HCI_MAX_EIR_LENGTH 240 836#define HCI_MAX_EIR_LENGTH 240
@@ -825,6 +865,10 @@ struct hci_rp_read_inq_rsp_tx_power {
825 __s8 tx_power; 865 __s8 tx_power;
826} __packed; 866} __packed;
827 867
868#define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63
869
870#define HCI_OP_READ_LOCATION_DATA 0x0c64
871
828#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 872#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
829struct hci_rp_read_flow_control_mode { 873struct hci_rp_read_flow_control_mode {
830 __u8 status; 874 __u8 status;
@@ -837,6 +881,50 @@ struct hci_cp_write_le_host_supported {
837 __u8 simul; 881 __u8 simul;
838} __packed; 882} __packed;
839 883
884#define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74
885struct hci_cp_set_reserved_lt_addr {
886 __u8 lt_addr;
887} __packed;
888struct hci_rp_set_reserved_lt_addr {
889 __u8 status;
890 __u8 lt_addr;
891} __packed;
892
893#define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75
894struct hci_cp_delete_reserved_lt_addr {
895 __u8 lt_addr;
896} __packed;
897struct hci_rp_delete_reserved_lt_addr {
898 __u8 status;
899 __u8 lt_addr;
900} __packed;
901
902#define HCI_OP_SET_CSB_DATA 0x0c76
903struct hci_cp_set_csb_data {
904 __u8 lt_addr;
905 __u8 fragment;
906 __u8 data_length;
907 __u8 data[HCI_MAX_CSB_DATA_SIZE];
908} __packed;
909struct hci_rp_set_csb_data {
910 __u8 status;
911 __u8 lt_addr;
912} __packed;
913
914#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
915
916#define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78
917struct hci_cp_write_sync_train_params {
918 __le16 interval_min;
919 __le16 interval_max;
920 __le32 sync_train_tout;
921 __u8 service_data;
922} __packed;
923struct hci_rp_write_sync_train_params {
924 __u8 status;
925 __le16 sync_train_int;
926} __packed;
927
840#define HCI_OP_READ_LOCAL_VERSION 0x1001 928#define HCI_OP_READ_LOCAL_VERSION 0x1001
841struct hci_rp_read_local_version { 929struct hci_rp_read_local_version {
842 __u8 status; 930 __u8 status;
@@ -956,6 +1044,10 @@ struct hci_rp_write_remote_amp_assoc {
956 __u8 phy_handle; 1044 __u8 phy_handle;
957} __packed; 1045} __packed;
958 1046
1047#define HCI_OP_ENABLE_DUT_MODE 0x1803
1048
1049#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
1050
959#define HCI_OP_LE_SET_EVENT_MASK 0x2001 1051#define HCI_OP_LE_SET_EVENT_MASK 0x2001
960struct hci_cp_le_set_event_mask { 1052struct hci_cp_le_set_event_mask {
961 __u8 mask[8]; 1053 __u8 mask[8];
@@ -974,6 +1066,20 @@ struct hci_rp_le_read_local_features {
974 __u8 features[8]; 1066 __u8 features[8];
975} __packed; 1067} __packed;
976 1068
1069#define HCI_OP_LE_SET_RANDOM_ADDR 0x2005
1070
1071#define HCI_OP_LE_SET_ADV_PARAM 0x2006
1072struct hci_cp_le_set_adv_param {
1073 __le16 min_interval;
1074 __le16 max_interval;
1075 __u8 type;
1076 __u8 own_address_type;
1077 __u8 direct_addr_type;
1078 bdaddr_t direct_addr;
1079 __u8 channel_map;
1080 __u8 filter_policy;
1081} __packed;
1082
977#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1083#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
978struct hci_rp_le_read_adv_tx_power { 1084struct hci_rp_le_read_adv_tx_power {
979 __u8 status; 1085 __u8 status;
@@ -988,6 +1094,12 @@ struct hci_cp_le_set_adv_data {
988 __u8 data[HCI_MAX_AD_LENGTH]; 1094 __u8 data[HCI_MAX_AD_LENGTH];
989} __packed; 1095} __packed;
990 1096
1097#define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009
1098struct hci_cp_le_set_scan_rsp_data {
1099 __u8 length;
1100 __u8 data[HCI_MAX_AD_LENGTH];
1101} __packed;
1102
991#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1103#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
992 1104
993#define LE_SCAN_PASSIVE 0x00 1105#define LE_SCAN_PASSIVE 0x00
@@ -1437,6 +1549,13 @@ struct hci_ev_num_comp_blocks {
1437 struct hci_comp_blocks_info handles[0]; 1549 struct hci_comp_blocks_info handles[0];
1438} __packed; 1550} __packed;
1439 1551
1552#define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F
1553struct hci_ev_sync_train_complete {
1554 __u8 status;
1555} __packed;
1556
1557#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
1558
1440/* Low energy meta events */ 1559/* Low energy meta events */
1441#define LE_CONN_ROLE_MASTER 0x00 1560#define LE_CONN_ROLE_MASTER 0x00
1442 1561
@@ -1461,11 +1580,11 @@ struct hci_ev_le_ltk_req {
1461} __packed; 1580} __packed;
1462 1581
1463/* Advertising report event types */ 1582/* Advertising report event types */
1464#define ADV_IND 0x00 1583#define LE_ADV_IND 0x00
1465#define ADV_DIRECT_IND 0x01 1584#define LE_ADV_DIRECT_IND 0x01
1466#define ADV_SCAN_IND 0x02 1585#define LE_ADV_SCAN_IND 0x02
1467#define ADV_NONCONN_IND 0x03 1586#define LE_ADV_NONCONN_IND 0x03
1468#define ADV_SCAN_RSP 0x04 1587#define LE_ADV_SCAN_RSP 0x04
1469 1588
1470#define ADDR_LE_DEV_PUBLIC 0x00 1589#define ADDR_LE_DEV_PUBLIC 0x00
1471#define ADDR_LE_DEV_RANDOM 0x01 1590#define ADDR_LE_DEV_RANDOM 0x01
@@ -1570,6 +1689,7 @@ struct sockaddr_hci {
1570#define HCI_DEV_NONE 0xffff 1689#define HCI_DEV_NONE 0xffff
1571 1690
1572#define HCI_CHANNEL_RAW 0 1691#define HCI_CHANNEL_RAW 0
1692#define HCI_CHANNEL_USER 1
1573#define HCI_CHANNEL_MONITOR 2 1693#define HCI_CHANNEL_MONITOR 2
1574#define HCI_CHANNEL_CONTROL 3 1694#define HCI_CHANNEL_CONTROL 3
1575 1695
@@ -1672,6 +1792,4 @@ struct hci_inquiry_req {
1672}; 1792};
1673#define IREQ_CACHE_FLUSH 0x0001 1793#define IREQ_CACHE_FLUSH 0x0001
1674 1794
1675extern bool enable_hs;
1676
1677#endif /* __HCI_H */ 1795#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3ede820d328f..f8555ad7b104 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -81,6 +81,7 @@ struct hci_conn_hash {
81struct bdaddr_list { 81struct bdaddr_list {
82 struct list_head list; 82 struct list_head list;
83 bdaddr_t bdaddr; 83 bdaddr_t bdaddr;
84 u8 bdaddr_type;
84}; 85};
85 86
86struct bt_uuid { 87struct bt_uuid {
@@ -140,6 +141,8 @@ struct hci_dev {
140 __u8 bus; 141 __u8 bus;
141 __u8 dev_type; 142 __u8 dev_type;
142 bdaddr_t bdaddr; 143 bdaddr_t bdaddr;
144 bdaddr_t static_addr;
145 __u8 own_addr_type;
143 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 146 __u8 dev_name[HCI_MAX_NAME_LENGTH];
144 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
145 __u8 eir[HCI_MAX_EIR_LENGTH]; 148 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -158,11 +161,17 @@ struct hci_dev {
158 __u16 manufacturer; 161 __u16 manufacturer;
159 __u16 lmp_subver; 162 __u16 lmp_subver;
160 __u16 voice_setting; 163 __u16 voice_setting;
164 __u8 num_iac;
161 __u8 io_capability; 165 __u8 io_capability;
162 __s8 inq_tx_power; 166 __s8 inq_tx_power;
163 __u16 page_scan_interval; 167 __u16 page_scan_interval;
164 __u16 page_scan_window; 168 __u16 page_scan_window;
165 __u8 page_scan_type; 169 __u8 page_scan_type;
170 __u16 le_scan_interval;
171 __u16 le_scan_window;
172 __u16 le_conn_min_interval;
173 __u16 le_conn_max_interval;
174 __u8 ssp_debug_mode;
166 175
167 __u16 devid_source; 176 __u16 devid_source;
168 __u16 devid_vendor; 177 __u16 devid_vendor;
@@ -279,14 +288,15 @@ struct hci_dev {
279 __s8 adv_tx_power; 288 __s8 adv_tx_power;
280 __u8 adv_data[HCI_MAX_AD_LENGTH]; 289 __u8 adv_data[HCI_MAX_AD_LENGTH];
281 __u8 adv_data_len; 290 __u8 adv_data_len;
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len;
282 293
283 int (*open)(struct hci_dev *hdev); 294 int (*open)(struct hci_dev *hdev);
284 int (*close)(struct hci_dev *hdev); 295 int (*close)(struct hci_dev *hdev);
285 int (*flush)(struct hci_dev *hdev); 296 int (*flush)(struct hci_dev *hdev);
286 int (*setup)(struct hci_dev *hdev); 297 int (*setup)(struct hci_dev *hdev);
287 int (*send)(struct sk_buff *skb); 298 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
288 void (*notify)(struct hci_dev *hdev, unsigned int evt); 299 void (*notify)(struct hci_dev *hdev, unsigned int evt);
289 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
290}; 300};
291 301
292#define HCI_PHY_HANDLE(handle) (handle & 0xff) 302#define HCI_PHY_HANDLE(handle) (handle & 0xff)
@@ -298,6 +308,8 @@ struct hci_conn {
298 308
299 bdaddr_t dst; 309 bdaddr_t dst;
300 __u8 dst_type; 310 __u8 dst_type;
311 bdaddr_t src;
312 __u8 src_type;
301 __u16 handle; 313 __u16 handle;
302 __u16 state; 314 __u16 state;
303 __u8 mode; 315 __u8 mode;
@@ -306,7 +318,6 @@ struct hci_conn {
306 __u8 attempt; 318 __u8 attempt;
307 __u8 dev_class[3]; 319 __u8 dev_class[3];
308 __u8 features[HCI_MAX_PAGES][8]; 320 __u8 features[HCI_MAX_PAGES][8];
309 __u16 interval;
310 __u16 pkt_type; 321 __u16 pkt_type;
311 __u16 link_policy; 322 __u16 link_policy;
312 __u32 link_mode; 323 __u32 link_mode;
@@ -334,8 +345,8 @@ struct hci_conn {
334 struct list_head chan_list; 345 struct list_head chan_list;
335 346
336 struct delayed_work disc_work; 347 struct delayed_work disc_work;
337 struct timer_list idle_timer; 348 struct delayed_work auto_accept_work;
338 struct timer_list auto_accept_timer; 349 struct delayed_work idle_work;
339 350
340 struct device dev; 351 struct device dev;
341 352
@@ -367,18 +378,17 @@ extern rwlock_t hci_dev_list_lock;
367extern rwlock_t hci_cb_list_lock; 378extern rwlock_t hci_cb_list_lock;
368 379
369/* ----- HCI interface to upper protocols ----- */ 380/* ----- HCI interface to upper protocols ----- */
370extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 381int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
371extern void l2cap_connect_cfm(struct hci_conn *hcon, u8 status); 382void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
372extern int l2cap_disconn_ind(struct hci_conn *hcon); 383int l2cap_disconn_ind(struct hci_conn *hcon);
373extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 384void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
374extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 385int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
375extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 386int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
376 u16 flags); 387
377 388int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
378extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 389void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
379extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 390void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
380extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 391int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
381extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
382 392
383/* ----- Inquiry cache ----- */ 393/* ----- Inquiry cache ----- */
384#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 394#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
@@ -644,7 +654,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)
644 switch (conn->type) { 654 switch (conn->type) {
645 case ACL_LINK: 655 case ACL_LINK:
646 case LE_LINK: 656 case LE_LINK:
647 del_timer(&conn->idle_timer); 657 cancel_delayed_work(&conn->idle_work);
648 if (conn->state == BT_CONNECTED) { 658 if (conn->state == BT_CONNECTED) {
649 timeo = conn->disc_timeout; 659 timeo = conn->disc_timeout;
650 if (!conn->out) 660 if (!conn->out)
@@ -703,19 +713,6 @@ static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
703 dev_set_drvdata(&hdev->dev, data); 713 dev_set_drvdata(&hdev->dev, data);
704} 714}
705 715
706/* hci_dev_list shall be locked */
707static inline uint8_t __hci_num_ctrl(void)
708{
709 uint8_t count = 0;
710 struct list_head *p;
711
712 list_for_each(p, &hci_dev_list) {
713 count++;
714 }
715
716 return count;
717}
718
719struct hci_dev *hci_dev_get(int index); 716struct hci_dev *hci_dev_get(int index);
720struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src); 717struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src);
721 718
@@ -738,7 +735,7 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
738int hci_inquiry(void __user *arg); 735int hci_inquiry(void __user *arg);
739 736
740struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 737struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
741 bdaddr_t *bdaddr); 738 bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_clear(struct hci_dev *hdev); 739int hci_blacklist_clear(struct hci_dev *hdev);
743int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 740int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
744int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 741int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
@@ -768,13 +765,11 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
768 765
769void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 766void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
770 767
771int hci_recv_frame(struct sk_buff *skb); 768int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
772int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 769int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
773int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 770int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
774 771
775void hci_init_sysfs(struct hci_dev *hdev); 772void hci_init_sysfs(struct hci_dev *hdev);
776int hci_add_sysfs(struct hci_dev *hdev);
777void hci_del_sysfs(struct hci_dev *hdev);
778void hci_conn_init_sysfs(struct hci_conn *conn); 773void hci_conn_init_sysfs(struct hci_conn *conn);
779void hci_conn_add_sysfs(struct hci_conn *conn); 774void hci_conn_add_sysfs(struct hci_conn *conn);
780void hci_conn_del_sysfs(struct hci_conn *conn); 775void hci_conn_del_sysfs(struct hci_conn *conn);
@@ -807,22 +802,6 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
807#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 802#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
808#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 803#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
809 804
810/* returns true if at least one AMP active */
811static inline bool hci_amp_capable(void)
812{
813 struct hci_dev *hdev;
814 bool ret = false;
815
816 read_lock(&hci_dev_list_lock);
817 list_for_each_entry(hdev, &hci_dev_list, list)
818 if (hdev->amp_type == HCI_AMP &&
819 test_bit(HCI_UP, &hdev->flags))
820 ret = true;
821 read_unlock(&hci_dev_list_lock);
822
823 return ret;
824}
825
826/* ----- HCI protocols ----- */ 805/* ----- HCI protocols ----- */
827#define HCI_PROTO_DEFER 0x01 806#define HCI_PROTO_DEFER 0x01
828 807
@@ -1033,34 +1012,6 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1033 return false; 1012 return false;
1034} 1013}
1035 1014
1036static inline size_t eir_get_length(u8 *eir, size_t eir_len)
1037{
1038 size_t parsed = 0;
1039
1040 while (parsed < eir_len) {
1041 u8 field_len = eir[0];
1042
1043 if (field_len == 0)
1044 return parsed;
1045
1046 parsed += field_len + 1;
1047 eir += field_len + 1;
1048 }
1049
1050 return eir_len;
1051}
1052
1053static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
1054 u8 data_len)
1055{
1056 eir[eir_len++] = sizeof(type) + data_len;
1057 eir[eir_len++] = type;
1058 memcpy(&eir[eir_len], data, data_len);
1059 eir_len += data_len;
1060
1061 return eir_len;
1062}
1063
1064int hci_register_cb(struct hci_cb *hcb); 1015int hci_register_cb(struct hci_cb *hcb);
1065int hci_unregister_cb(struct hci_cb *hcb); 1016int hci_unregister_cb(struct hci_cb *hcb);
1066 1017
@@ -1120,29 +1071,30 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1120#define DISCOV_BREDR_INQUIRY_LEN 0x08 1071#define DISCOV_BREDR_INQUIRY_LEN 0x08
1121 1072
1122int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1073int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1123int mgmt_index_added(struct hci_dev *hdev); 1074void mgmt_index_added(struct hci_dev *hdev);
1124int mgmt_index_removed(struct hci_dev *hdev); 1075void mgmt_index_removed(struct hci_dev *hdev);
1125int mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1076void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1126int mgmt_powered(struct hci_dev *hdev, u8 powered); 1077int mgmt_powered(struct hci_dev *hdev, u8 powered);
1127int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1078void mgmt_discoverable_timeout(struct hci_dev *hdev);
1128int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1079void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1129int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1080void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1130int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1081void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1131 bool persistent); 1082void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1132int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1083 bool persistent);
1133 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1084void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1134 u8 *dev_class); 1085 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1135int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1086 u8 *dev_class);
1136 u8 link_type, u8 addr_type, u8 reason); 1087void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1137int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1088 u8 link_type, u8 addr_type, u8 reason);
1138 u8 link_type, u8 addr_type, u8 status); 1089void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1139int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1090 u8 link_type, u8 addr_type, u8 status);
1140 u8 addr_type, u8 status); 1091void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1141int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 1092 u8 addr_type, u8 status);
1142int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1093void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
1143 u8 status); 1094void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1144int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1095 u8 status);
1145 u8 status); 1096void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 status);
1146int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1098int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1147 u8 link_type, u8 addr_type, __le32 value, 1099 u8 link_type, u8 addr_type, __le32 value,
1148 u8 confirm_hint); 1100 u8 confirm_hint);
@@ -1159,26 +1111,25 @@ int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1159int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, 1111int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1160 u8 link_type, u8 addr_type, u32 passkey, 1112 u8 link_type, u8 addr_type, u32 passkey,
1161 u8 entered); 1113 u8 entered);
1162int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1114void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1163 u8 addr_type, u8 status); 1115 u8 addr_type, u8 status);
1164int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1116void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1165int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1117void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1166int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1118void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1167 u8 status); 1119 u8 status);
1168int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1120void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1169int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1121void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
1170 u8 *randomizer, u8 status); 1122 u8 *randomizer, u8 status);
1171int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1123void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1172int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1124 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1173 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1125 u8 ssp, u8 *eir, u16 eir_len);
1174 u8 ssp, u8 *eir, u16 eir_len); 1126void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1175int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1127 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1176 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1128void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1177int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1178int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1129int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1179int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1130int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1180bool mgmt_valid_hdev(struct hci_dev *hdev); 1131void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
1181int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1132void mgmt_reenable_advertising(struct hci_dev *hdev);
1182 1133
1183/* HCI info for socket */ 1134/* HCI info for socket */
1184#define hci_pi(sk) ((struct hci_pinfo *) sk) 1135#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1208,15 +1159,11 @@ struct hci_sec_filter {
1208#define hci_req_lock(d) mutex_lock(&d->req_lock) 1159#define hci_req_lock(d) mutex_lock(&d->req_lock)
1209#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1160#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1210 1161
1211void hci_update_ad(struct hci_request *req);
1212
1213void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1162void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1214 u16 latency, u16 to_multiplier); 1163 u16 latency, u16 to_multiplier);
1215void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1164void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1216 __u8 ltk[16]); 1165 __u8 ltk[16]);
1217 1166
1218u8 bdaddr_to_le(u8 bdaddr_type);
1219
1220#define SCO_AIRMODE_MASK 0x0003 1167#define SCO_AIRMODE_MASK 0x0003
1221#define SCO_AIRMODE_CVSD 0x0000 1168#define SCO_AIRMODE_CVSD 0x0000
1222#define SCO_AIRMODE_TRANSP 0x0003 1169#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7170b4b434e1..c853b16de4ef 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -131,6 +131,7 @@ struct l2cap_conninfo {
131 131
132/* L2CAP fixed channels */ 132/* L2CAP fixed channels */
133#define L2CAP_FC_L2CAP 0x02 133#define L2CAP_FC_L2CAP 0x02
134#define L2CAP_FC_CONNLESS 0x04
134#define L2CAP_FC_A2MP 0x08 135#define L2CAP_FC_A2MP 0x08
135 136
136/* L2CAP Control Field bit masks */ 137/* L2CAP Control Field bit masks */
@@ -237,6 +238,7 @@ struct l2cap_conn_rsp {
237/* protocol/service multiplexer (PSM) */ 238/* protocol/service multiplexer (PSM) */
238#define L2CAP_PSM_SDP 0x0001 239#define L2CAP_PSM_SDP 0x0001
239#define L2CAP_PSM_RFCOMM 0x0003 240#define L2CAP_PSM_RFCOMM 0x0003
241#define L2CAP_PSM_3DSP 0x0021
240 242
241/* channel identifier */ 243/* channel identifier */
242#define L2CAP_CID_SIGNALING 0x0001 244#define L2CAP_CID_SIGNALING 0x0001
@@ -433,8 +435,6 @@ struct l2cap_seq_list {
433#define L2CAP_SEQ_LIST_TAIL 0x8000 435#define L2CAP_SEQ_LIST_TAIL 0x8000
434 436
435struct l2cap_chan { 437struct l2cap_chan {
436 struct sock *sk;
437
438 struct l2cap_conn *conn; 438 struct l2cap_conn *conn;
439 struct hci_conn *hs_hcon; 439 struct hci_conn *hs_hcon;
440 struct hci_chan *hs_hchan; 440 struct hci_chan *hs_hchan;
@@ -442,7 +442,12 @@ struct l2cap_chan {
442 442
443 __u8 state; 443 __u8 state;
444 444
445 bdaddr_t dst;
446 __u8 dst_type;
447 bdaddr_t src;
448 __u8 src_type;
445 __le16 psm; 449 __le16 psm;
450 __le16 sport;
446 __u16 dcid; 451 __u16 dcid;
447 __u16 scid; 452 __u16 scid;
448 453
@@ -453,8 +458,6 @@ struct l2cap_chan {
453 __u8 chan_type; 458 __u8 chan_type;
454 __u8 chan_policy; 459 __u8 chan_policy;
455 460
456 __le16 sport;
457
458 __u8 sec_level; 461 __u8 sec_level;
459 462
460 __u8 ident; 463 __u8 ident;
@@ -546,9 +549,12 @@ struct l2cap_ops {
546 void (*teardown) (struct l2cap_chan *chan, int err); 549 void (*teardown) (struct l2cap_chan *chan, int err);
547 void (*close) (struct l2cap_chan *chan); 550 void (*close) (struct l2cap_chan *chan);
548 void (*state_change) (struct l2cap_chan *chan, 551 void (*state_change) (struct l2cap_chan *chan,
549 int state); 552 int state, int err);
550 void (*ready) (struct l2cap_chan *chan); 553 void (*ready) (struct l2cap_chan *chan);
551 void (*defer) (struct l2cap_chan *chan); 554 void (*defer) (struct l2cap_chan *chan);
555 void (*resume) (struct l2cap_chan *chan);
556 void (*set_shutdown) (struct l2cap_chan *chan);
557 long (*get_sndtimeo) (struct l2cap_chan *chan);
552 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 558 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
553 unsigned long len, int nb); 559 unsigned long len, int nb);
554}; 560};
@@ -557,13 +563,11 @@ struct l2cap_conn {
557 struct hci_conn *hcon; 563 struct hci_conn *hcon;
558 struct hci_chan *hchan; 564 struct hci_chan *hchan;
559 565
560 bdaddr_t *dst;
561 bdaddr_t *src;
562
563 unsigned int mtu; 566 unsigned int mtu;
564 567
565 __u32 feat_mask; 568 __u32 feat_mask;
566 __u8 fixed_chan_mask; 569 __u8 fixed_chan_mask;
570 bool hs_enabled;
567 571
568 __u8 info_state; 572 __u8 info_state;
569 __u8 info_ident; 573 __u8 info_ident;
@@ -649,6 +653,7 @@ enum {
649 FLAG_FLUSHABLE, 653 FLAG_FLUSHABLE,
650 FLAG_EXT_CTRL, 654 FLAG_EXT_CTRL,
651 FLAG_EFS_ENABLE, 655 FLAG_EFS_ENABLE,
656 FLAG_DEFER_SETUP,
652}; 657};
653 658
654enum { 659enum {
@@ -790,6 +795,19 @@ static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
790{ 795{
791} 796}
792 797
798static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
799{
800}
801
802static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
803{
804}
805
806static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
807{
808 return 0;
809}
810
793extern bool disable_ertm; 811extern bool disable_ertm;
794 812
795int l2cap_init_sockets(void); 813int l2cap_init_sockets(void);
@@ -797,7 +815,6 @@ void l2cap_cleanup_sockets(void);
797bool l2cap_is_socket(struct socket *sock); 815bool l2cap_is_socket(struct socket *sock);
798 816
799void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 817void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
800int __l2cap_wait_ack(struct sock *sk);
801 818
802int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 819int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
803int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 820int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 9944c3e68c5d..518c5c84e39a 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -93,6 +93,7 @@ struct mgmt_rp_read_index_list {
93#define MGMT_SETTING_BREDR 0x00000080 93#define MGMT_SETTING_BREDR 0x00000080
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400
96 97
97#define MGMT_OP_READ_INFO 0x0004 98#define MGMT_OP_READ_INFO 0x0004
98#define MGMT_READ_INFO_SIZE 0 99#define MGMT_READ_INFO_SIZE 0
@@ -351,6 +352,23 @@ struct mgmt_cp_set_device_id {
351} __packed; 352} __packed;
352#define MGMT_SET_DEVICE_ID_SIZE 8 353#define MGMT_SET_DEVICE_ID_SIZE 8
353 354
355#define MGMT_OP_SET_ADVERTISING 0x0029
356
357#define MGMT_OP_SET_BREDR 0x002A
358
359#define MGMT_OP_SET_STATIC_ADDRESS 0x002B
360struct mgmt_cp_set_static_address {
361 bdaddr_t bdaddr;
362} __packed;
363#define MGMT_SET_STATIC_ADDRESS_SIZE 6
364
365#define MGMT_OP_SET_SCAN_PARAMS 0x002C
366struct mgmt_cp_set_scan_params {
367 __le16 interval;
368 __le16 window;
369} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4
371
354#define MGMT_EV_CMD_COMPLETE 0x0001 372#define MGMT_EV_CMD_COMPLETE 0x0001
355struct mgmt_ev_cmd_complete { 373struct mgmt_ev_cmd_complete {
356 __le16 opcode; 374 __le16 opcode;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 7afd4199d6b6..486213a1aed8 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -256,8 +256,8 @@ static inline void rfcomm_dlc_put(struct rfcomm_dlc *d)
256 rfcomm_dlc_free(d); 256 rfcomm_dlc_free(d);
257} 257}
258 258
259extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); 259void __rfcomm_dlc_throttle(struct rfcomm_dlc *d);
260extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); 260void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d);
261 261
262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) 262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d)
263{ 263{
@@ -300,6 +300,8 @@ struct rfcomm_conninfo {
300 300
301struct rfcomm_pinfo { 301struct rfcomm_pinfo {
302 struct bt_sock bt; 302 struct bt_sock bt;
303 bdaddr_t src;
304 bdaddr_t dst;
303 struct rfcomm_dlc *dlc; 305 struct rfcomm_dlc *dlc;
304 u8 channel; 306 u8 channel;
305 u8 sec_level; 307 u8 sec_level;
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index e252a31ee6b6..2019d1a0996a 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -55,9 +55,6 @@ struct sco_conninfo {
55struct sco_conn { 55struct sco_conn {
56 struct hci_conn *hcon; 56 struct hci_conn *hcon;
57 57
58 bdaddr_t *dst;
59 bdaddr_t *src;
60
61 spinlock_t lock; 58 spinlock_t lock;
62 struct sock *sk; 59 struct sock *sk;
63 60
@@ -72,6 +69,8 @@ struct sco_conn {
72 69
73struct sco_pinfo { 70struct sco_pinfo {
74 struct bt_sock bt; 71 struct bt_sock bt;
72 bdaddr_t src;
73 bdaddr_t dst;
75 __u32 flags; 74 __u32 flags;
76 __u16 setting; 75 __u16 setting;
77 struct sco_conn *conn; 76 struct sco_conn *conn;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
deleted file mode 100644
index f8ba07f3e5fa..000000000000
--- a/include/net/bluetooth/smp.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation;
8
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
23#ifndef __SMP_H
24#define __SMP_H
25
26struct smp_command_hdr {
27 __u8 code;
28} __packed;
29
30#define SMP_CMD_PAIRING_REQ 0x01
31#define SMP_CMD_PAIRING_RSP 0x02
32struct smp_cmd_pairing {
33 __u8 io_capability;
34 __u8 oob_flag;
35 __u8 auth_req;
36 __u8 max_key_size;
37 __u8 init_key_dist;
38 __u8 resp_key_dist;
39} __packed;
40
41#define SMP_IO_DISPLAY_ONLY 0x00
42#define SMP_IO_DISPLAY_YESNO 0x01
43#define SMP_IO_KEYBOARD_ONLY 0x02
44#define SMP_IO_NO_INPUT_OUTPUT 0x03
45#define SMP_IO_KEYBOARD_DISPLAY 0x04
46
47#define SMP_OOB_NOT_PRESENT 0x00
48#define SMP_OOB_PRESENT 0x01
49
50#define SMP_DIST_ENC_KEY 0x01
51#define SMP_DIST_ID_KEY 0x02
52#define SMP_DIST_SIGN 0x04
53
54#define SMP_AUTH_NONE 0x00
55#define SMP_AUTH_BONDING 0x01
56#define SMP_AUTH_MITM 0x04
57
58#define SMP_CMD_PAIRING_CONFIRM 0x03
59struct smp_cmd_pairing_confirm {
60 __u8 confirm_val[16];
61} __packed;
62
63#define SMP_CMD_PAIRING_RANDOM 0x04
64struct smp_cmd_pairing_random {
65 __u8 rand_val[16];
66} __packed;
67
68#define SMP_CMD_PAIRING_FAIL 0x05
69struct smp_cmd_pairing_fail {
70 __u8 reason;
71} __packed;
72
73#define SMP_CMD_ENCRYPT_INFO 0x06
74struct smp_cmd_encrypt_info {
75 __u8 ltk[16];
76} __packed;
77
78#define SMP_CMD_MASTER_IDENT 0x07
79struct smp_cmd_master_ident {
80 __le16 ediv;
81 __u8 rand[8];
82} __packed;
83
84#define SMP_CMD_IDENT_INFO 0x08
85struct smp_cmd_ident_info {
86 __u8 irk[16];
87} __packed;
88
89#define SMP_CMD_IDENT_ADDR_INFO 0x09
90struct smp_cmd_ident_addr_info {
91 __u8 addr_type;
92 bdaddr_t bdaddr;
93} __packed;
94
95#define SMP_CMD_SIGN_INFO 0x0a
96struct smp_cmd_sign_info {
97 __u8 csrk[16];
98} __packed;
99
100#define SMP_CMD_SECURITY_REQ 0x0b
101struct smp_cmd_security_req {
102 __u8 auth_req;
103} __packed;
104
105#define SMP_PASSKEY_ENTRY_FAILED 0x01
106#define SMP_OOB_NOT_AVAIL 0x02
107#define SMP_AUTH_REQUIREMENTS 0x03
108#define SMP_CONFIRM_FAILED 0x04
109#define SMP_PAIRING_NOTSUPP 0x05
110#define SMP_ENC_KEY_SIZE 0x06
111#define SMP_CMD_NOTSUPP 0x07
112#define SMP_UNSPECIFIED 0x08
113#define SMP_REPEATED_ATTEMPTS 0x09
114
115#define SMP_MIN_ENC_KEY_SIZE 7
116#define SMP_MAX_ENC_KEY_SIZE 16
117
118#define SMP_FLAG_TK_VALID 1
119#define SMP_FLAG_CFM_PENDING 2
120#define SMP_FLAG_MITM_AUTH 3
121
122struct smp_chan {
123 struct l2cap_conn *conn;
124 u8 preq[7]; /* SMP Pairing Request */
125 u8 prsp[7]; /* SMP Pairing Response */
126 u8 prnd[16]; /* SMP Pairing Random (local) */
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */
130 u8 enc_key_size;
131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm;
134 struct work_struct random;
135
136};
137
138/* SMP Commands */
139int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
143
144void smp_chan_destroy(struct l2cap_conn *conn);
145
146#endif /* __SMP_H */
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 4795e817afe5..097f69cfaa75 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -195,6 +195,6 @@ enum ifla_caif_hsi {
195 __IFLA_CAIF_HSI_MAX 195 __IFLA_CAIF_HSI_MAX
196}; 196};
197 197
198extern struct cfhsi_ops *cfhsi_get_ops(void); 198struct cfhsi_ops *cfhsi_get_ops(void);
199 199
200#endif /* CAIF_HSI_H_ */ 200#endif /* CAIF_HSI_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cb710913d5c8..3eae46cb1acf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -437,6 +437,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
437 u32 prohibited_flags); 437 u32 prohibited_flags);
438 438
439/** 439/**
440 * cfg80211_chandef_dfs_required - checks if radar detection is required
441 * @wiphy: the wiphy to validate against
442 * @chandef: the channel definition to check
443 * Return: 1 if radar detection is required, 0 if it is not, < 0 on error
444 */
445int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
446 const struct cfg80211_chan_def *chandef);
447
448/**
440 * ieee80211_chandef_rate_flags - returns rate flags for a channel 449 * ieee80211_chandef_rate_flags - returns rate flags for a channel
441 * 450 *
442 * In some channel types, not all rates may be used - for example CCK 451 * In some channel types, not all rates may be used - for example CCK
@@ -735,6 +744,10 @@ enum station_parameters_apply_mask {
735 * @capability: station capability 744 * @capability: station capability
736 * @ext_capab: extended capabilities of the station 745 * @ext_capab: extended capabilities of the station
737 * @ext_capab_len: number of extended capabilities 746 * @ext_capab_len: number of extended capabilities
747 * @supported_channels: supported channels in IEEE 802.11 format
748 * @supported_channels_len: number of supported channels
749 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
750 * @supported_oper_classes_len: number of supported operating classes
738 */ 751 */
739struct station_parameters { 752struct station_parameters {
740 const u8 *supported_rates; 753 const u8 *supported_rates;
@@ -754,6 +767,10 @@ struct station_parameters {
754 u16 capability; 767 u16 capability;
755 const u8 *ext_capab; 768 const u8 *ext_capab;
756 u8 ext_capab_len; 769 u8 ext_capab_len;
770 const u8 *supported_channels;
771 u8 supported_channels_len;
772 const u8 *supported_oper_classes;
773 u8 supported_oper_classes_len;
757}; 774};
758 775
759/** 776/**
@@ -1647,6 +1664,9 @@ struct cfg80211_disassoc_request {
1647 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1664 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1648 * required to assume that the port is unauthorized until authorized by 1665 * required to assume that the port is unauthorized until authorized by
1649 * user space. Otherwise, port is marked authorized by default. 1666 * user space. Otherwise, port is marked authorized by default.
1667 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1668 * changes the channel when a radar is detected. This is required
1669 * to operate on DFS channels.
1650 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1670 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1651 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1671 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1652 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1672 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
@@ -1664,6 +1684,7 @@ struct cfg80211_ibss_params {
1664 bool channel_fixed; 1684 bool channel_fixed;
1665 bool privacy; 1685 bool privacy;
1666 bool control_port; 1686 bool control_port;
1687 bool userspace_handles_dfs;
1667 int mcast_rate[IEEE80211_NUM_BANDS]; 1688 int mcast_rate[IEEE80211_NUM_BANDS];
1668 struct ieee80211_ht_cap ht_capa; 1689 struct ieee80211_ht_cap ht_capa;
1669 struct ieee80211_ht_cap ht_capa_mask; 1690 struct ieee80211_ht_cap ht_capa_mask;
@@ -3044,6 +3065,7 @@ struct cfg80211_cached_keys;
3044 * @conn: (private) cfg80211 software SME connection state machine data 3065 * @conn: (private) cfg80211 software SME connection state machine data
3045 * @connect_keys: (private) keys to set after connection is established 3066 * @connect_keys: (private) keys to set after connection is established
3046 * @ibss_fixed: (private) IBSS is using fixed BSSID 3067 * @ibss_fixed: (private) IBSS is using fixed BSSID
3068 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3047 * @event_list: (private) list for internal event processing 3069 * @event_list: (private) list for internal event processing
3048 * @event_lock: (private) lock for event list 3070 * @event_lock: (private) lock for event list
3049 */ 3071 */
@@ -3082,6 +3104,7 @@ struct wireless_dev {
3082 struct ieee80211_channel *channel; 3104 struct ieee80211_channel *channel;
3083 3105
3084 bool ibss_fixed; 3106 bool ibss_fixed;
3107 bool ibss_dfs_possible;
3085 3108
3086 bool ps; 3109 bool ps;
3087 int ps_timeout; 3110 int ps_timeout;
@@ -3474,6 +3497,15 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3474const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3497const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3475 u32 center_freq); 3498 u32 center_freq);
3476 3499
3500/**
3501 * reg_initiator_name - map regulatory request initiator enum to name
3502 * @initiator: the regulatory request initiator
3503 *
3504 * You can use this to map the regulatory request initiator enum to a
3505 * proper string representation.
3506 */
3507const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3508
3477/* 3509/*
3478 * callbacks for asynchronous cfg80211 methods, notification 3510 * callbacks for asynchronous cfg80211 methods, notification
3479 * functions and BSS handling helpers 3511 * functions and BSS handling helpers
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 8f59ca50477c..37a0e24adbe7 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -79,6 +79,12 @@ csum_block_add(__wsum csum, __wsum csum2, int offset)
79} 79}
80 80
81static inline __wsum 81static inline __wsum
82csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
83{
84 return csum_block_add(csum, csum2, offset);
85}
86
87static inline __wsum
82csum_block_sub(__wsum csum, __wsum csum2, int offset) 88csum_block_sub(__wsum csum, __wsum csum2, int offset)
83{ 89{
84 u32 sum = (__force u32)csum2; 90 u32 sum = (__force u32)csum2;
@@ -92,6 +98,11 @@ static inline __wsum csum_unfold(__sum16 n)
92 return (__force __wsum)n; 98 return (__force __wsum)n;
93} 99}
94 100
101static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
102{
103 return csum_partial(buff, len, sum);
104}
105
95#define CSUM_MANGLED_0 ((__force __sum16)0xffff) 106#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
96 107
97static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 108static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a7a683e30b64..a8c2ef6d3b93 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -290,6 +290,7 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
290 unsigned char err_offset = 0; 290 unsigned char err_offset = 0;
291 u8 opt_len = opt[1]; 291 u8 opt_len = opt[1];
292 u8 opt_iter; 292 u8 opt_iter;
293 u8 tag_len;
293 294
294 if (opt_len < 8) { 295 if (opt_len < 8) {
295 err_offset = 1; 296 err_offset = 1;
@@ -302,11 +303,12 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
302 } 303 }
303 304
304 for (opt_iter = 6; opt_iter < opt_len;) { 305 for (opt_iter = 6; opt_iter < opt_len;) {
305 if (opt[opt_iter + 1] > (opt_len - opt_iter)) { 306 tag_len = opt[opt_iter + 1];
307 if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) {
306 err_offset = opt_iter + 1; 308 err_offset = opt_iter + 1;
307 goto out; 309 goto out;
308 } 310 }
309 opt_iter += opt[opt_iter + 1]; 311 opt_iter += tag_len;
310 } 312 }
311 313
312out: 314out:
diff --git a/include/net/codel.h b/include/net/codel.h
index 389cf621161d..3b04ff5f6f8d 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -72,10 +72,21 @@ static inline codel_time_t codel_get_time(void)
72 return ns >> CODEL_SHIFT; 72 return ns >> CODEL_SHIFT;
73} 73}
74 74
75#define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0) 75/* Dealing with timer wrapping, according to RFC 1982, as desc in wikipedia:
76#define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0) 76 * https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
77#define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0) 77 * codel_time_after(a,b) returns true if the time a is after time b.
78#define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0) 78 */
79#define codel_time_after(a, b) \
80 (typecheck(codel_time_t, a) && \
81 typecheck(codel_time_t, b) && \
82 ((s32)((a) - (b)) > 0))
83#define codel_time_before(a, b) codel_time_after(b, a)
84
85#define codel_time_after_eq(a, b) \
86 (typecheck(codel_time_t, a) && \
87 typecheck(codel_time_t, b) && \
88 ((s32)((a) - (b)) >= 0))
89#define codel_time_before_eq(a, b) codel_time_after_eq(b, a)
79 90
80/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */ 91/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */
81struct codel_skb_cb { 92struct codel_skb_cb {
diff --git a/include/net/compat.h b/include/net/compat.h
index 6e9565324989..3b603b199c01 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -29,8 +29,8 @@ struct compat_cmsghdr {
29 compat_int_t cmsg_type; 29 compat_int_t cmsg_type;
30}; 30};
31 31
32extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 32int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
33extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); 33int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
34 34
35#else /* defined(CONFIG_COMPAT) */ 35#else /* defined(CONFIG_COMPAT) */
36/* 36/*
@@ -40,24 +40,30 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
40#define compat_mmsghdr mmsghdr 40#define compat_mmsghdr mmsghdr
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); 44int verify_compat_iovec(struct msghdr *, struct iovec *,
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned int); 45 struct sockaddr_storage *, int);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
47 unsigned int, unsigned int); 47 unsigned int);
48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned int); 48asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 49 unsigned int, unsigned int);
50 unsigned int, unsigned int, 50asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
51 struct compat_timespec __user *); 51 unsigned int);
52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 52asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 53 unsigned int, unsigned int,
54 54 struct compat_timespec __user *);
55extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 55asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
56 56 int __user *);
57extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int, 57int put_cmsg_compat(struct msghdr*, int, int, int, void *);
58 int (*)(struct sock *, int, int, char __user *, unsigned int)); 58
59extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 59int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
60 int __user *, int (*)(struct sock *, int, int, char __user *, 60 unsigned char *, int);
61 int __user *)); 61
62int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
63 int (*)(struct sock *, int, int, char __user *,
64 unsigned int));
65int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
66 int (*)(struct sock *, int, int, char __user *,
67 int __user *));
62 68
63#endif /* NET_COMPAT_H */ 69#endif /* NET_COMPAT_H */
diff --git a/include/net/dcbevent.h b/include/net/dcbevent.h
index 443626ed4cbc..d2f3041c0dfa 100644
--- a/include/net/dcbevent.h
+++ b/include/net/dcbevent.h
@@ -25,9 +25,9 @@ enum dcbevent_notif_type {
25}; 25};
26 26
27#ifdef CONFIG_DCB 27#ifdef CONFIG_DCB
28extern int register_dcbevent_notifier(struct notifier_block *nb); 28int register_dcbevent_notifier(struct notifier_block *nb);
29extern int unregister_dcbevent_notifier(struct notifier_block *nb); 29int unregister_dcbevent_notifier(struct notifier_block *nb);
30extern int call_dcbevent_notifiers(unsigned long val, void *v); 30int call_dcbevent_notifiers(unsigned long val, void *v);
31#else 31#else
32static inline int 32static inline int
33register_dcbevent_notifier(struct notifier_block *nb) 33register_dcbevent_notifier(struct notifier_block *nb)
diff --git a/include/net/dn.h b/include/net/dn.h
index c88bf4ebd330..ccc15588d108 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,24 +199,26 @@ static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
199 fld->fld_dport = scp->addrrem; 199 fld->fld_dport = scp->addrrem;
200} 200}
201 201
202extern unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu); 202unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu);
203 203
204#define DN_MENUVER_ACC 0x01 204#define DN_MENUVER_ACC 0x01
205#define DN_MENUVER_USR 0x02 205#define DN_MENUVER_USR 0x02
206#define DN_MENUVER_PRX 0x04 206#define DN_MENUVER_PRX 0x04
207#define DN_MENUVER_UIC 0x08 207#define DN_MENUVER_UIC 0x08
208 208
209extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); 209struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
210extern struct sock *dn_find_by_skb(struct sk_buff *skb); 210struct sock *dn_find_by_skb(struct sk_buff *skb);
211#define DN_ASCBUF_LEN 9 211#define DN_ASCBUF_LEN 9
212extern char *dn_addr2asc(__u16, char *); 212char *dn_addr2asc(__u16, char *);
213extern int dn_destroy_timer(struct sock *sk); 213int dn_destroy_timer(struct sock *sk);
214 214
215extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); 215int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf,
216extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr, unsigned char *type); 216 unsigned char type);
217int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr,
218 unsigned char *type);
217 219
218extern void dn_start_slow_timer(struct sock *sk); 220void dn_start_slow_timer(struct sock *sk);
219extern void dn_stop_slow_timer(struct sock *sk); 221void dn_stop_slow_timer(struct sock *sk);
220 222
221extern __le16 decnet_address; 223extern __le16 decnet_address;
222extern int decnet_debug_level; 224extern int decnet_debug_level;
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index b9e32db03f20..20b5ab06032d 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -148,27 +148,27 @@ struct rtnode_hello_message {
148} __packed; 148} __packed;
149 149
150 150
151extern void dn_dev_init(void); 151void dn_dev_init(void);
152extern void dn_dev_cleanup(void); 152void dn_dev_cleanup(void);
153 153
154extern int dn_dev_ioctl(unsigned int cmd, void __user *arg); 154int dn_dev_ioctl(unsigned int cmd, void __user *arg);
155 155
156extern void dn_dev_devices_off(void); 156void dn_dev_devices_off(void);
157extern void dn_dev_devices_on(void); 157void dn_dev_devices_on(void);
158 158
159extern void dn_dev_init_pkt(struct sk_buff *skb); 159void dn_dev_init_pkt(struct sk_buff *skb);
160extern void dn_dev_veri_pkt(struct sk_buff *skb); 160void dn_dev_veri_pkt(struct sk_buff *skb);
161extern void dn_dev_hello(struct sk_buff *skb); 161void dn_dev_hello(struct sk_buff *skb);
162 162
163extern void dn_dev_up(struct net_device *); 163void dn_dev_up(struct net_device *);
164extern void dn_dev_down(struct net_device *); 164void dn_dev_down(struct net_device *);
165 165
166extern int dn_dev_set_default(struct net_device *dev, int force); 166int dn_dev_set_default(struct net_device *dev, int force);
167extern struct net_device *dn_dev_get_default(void); 167struct net_device *dn_dev_get_default(void);
168extern int dn_dev_bind_default(__le16 *addr); 168int dn_dev_bind_default(__le16 *addr);
169 169
170extern int register_dnaddr_notifier(struct notifier_block *nb); 170int register_dnaddr_notifier(struct notifier_block *nb);
171extern int unregister_dnaddr_notifier(struct notifier_block *nb); 171int unregister_dnaddr_notifier(struct notifier_block *nb);
172 172
173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr) 173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
174{ 174{
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 74004af31c48..f2ca135ddcc9 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -95,41 +95,38 @@ struct dn_fib_table {
95/* 95/*
96 * dn_fib.c 96 * dn_fib.c
97 */ 97 */
98extern void dn_fib_init(void); 98void dn_fib_init(void);
99extern void dn_fib_cleanup(void); 99void dn_fib_cleanup(void);
100 100
101extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, 101int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
102 unsigned long arg); 102struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
103extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, 103 struct nlattr *attrs[],
104 struct nlattr *attrs[], 104 const struct nlmsghdr *nlh, int *errp);
105 const struct nlmsghdr *nlh, int *errp); 105int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
106extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 106 const struct flowidn *fld, struct dn_fib_res *res);
107 const struct flowidn *fld, 107void dn_fib_release_info(struct dn_fib_info *fi);
108 struct dn_fib_res *res); 108void dn_fib_flush(void);
109extern void dn_fib_release_info(struct dn_fib_info *fi); 109void dn_fib_select_multipath(const struct flowidn *fld, struct dn_fib_res *res);
110extern void dn_fib_flush(void);
111extern void dn_fib_select_multipath(const struct flowidn *fld,
112 struct dn_fib_res *res);
113 110
114/* 111/*
115 * dn_tables.c 112 * dn_tables.c
116 */ 113 */
117extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); 114struct dn_fib_table *dn_fib_get_table(u32 n, int creat);
118extern struct dn_fib_table *dn_fib_empty_table(void); 115struct dn_fib_table *dn_fib_empty_table(void);
119extern void dn_fib_table_init(void); 116void dn_fib_table_init(void);
120extern void dn_fib_table_cleanup(void); 117void dn_fib_table_cleanup(void);
121 118
122/* 119/*
123 * dn_rules.c 120 * dn_rules.c
124 */ 121 */
125extern void dn_fib_rules_init(void); 122void dn_fib_rules_init(void);
126extern void dn_fib_rules_cleanup(void); 123void dn_fib_rules_cleanup(void);
127extern unsigned int dnet_addr_type(__le16 addr); 124unsigned int dnet_addr_type(__le16 addr);
128extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); 125int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
129 126
130extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 127int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
131 128
132extern void dn_fib_free_info(struct dn_fib_info *fi); 129void dn_fib_free_info(struct dn_fib_info *fi);
133 130
134static inline void dn_fib_info_put(struct dn_fib_info *fi) 131static inline void dn_fib_info_put(struct dn_fib_info *fi)
135{ 132{
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index 4cb4ae7fb81f..fac4e3f4a6d3 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -16,12 +16,12 @@ struct dn_neigh {
16 __u8 priority; 16 __u8 priority;
17}; 17};
18 18
19extern void dn_neigh_init(void); 19void dn_neigh_init(void);
20extern void dn_neigh_cleanup(void); 20void dn_neigh_cleanup(void);
21extern int dn_neigh_router_hello(struct sk_buff *skb); 21int dn_neigh_router_hello(struct sk_buff *skb);
22extern int dn_neigh_endnode_hello(struct sk_buff *skb); 22int dn_neigh_endnode_hello(struct sk_buff *skb);
23extern void dn_neigh_pointopoint_hello(struct sk_buff *skb); 23void dn_neigh_pointopoint_hello(struct sk_buff *skb);
24extern int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); 24int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
25 25
26extern struct neigh_table dn_neigh_table; 26extern struct neigh_table dn_neigh_table;
27 27
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index e43a2893f132..3a3e33d18456 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -15,29 +15,32 @@
15*******************************************************************************/ 15*******************************************************************************/
16/* dn_nsp.c functions prototyping */ 16/* dn_nsp.c functions prototyping */
17 17
18extern void dn_nsp_send_data_ack(struct sock *sk); 18void dn_nsp_send_data_ack(struct sock *sk);
19extern void dn_nsp_send_oth_ack(struct sock *sk); 19void dn_nsp_send_oth_ack(struct sock *sk);
20extern void dn_nsp_delayed_ack(struct sock *sk); 20void dn_nsp_delayed_ack(struct sock *sk);
21extern void dn_send_conn_ack(struct sock *sk); 21void dn_send_conn_ack(struct sock *sk);
22extern void dn_send_conn_conf(struct sock *sk, gfp_t gfp); 22void dn_send_conn_conf(struct sock *sk, gfp_t gfp);
23extern void dn_nsp_send_disc(struct sock *sk, unsigned char type, 23void dn_nsp_send_disc(struct sock *sk, unsigned char type,
24 unsigned short reason, gfp_t gfp); 24 unsigned short reason, gfp_t gfp);
25extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type, 25void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type,
26 unsigned short reason); 26 unsigned short reason);
27extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval); 27void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval);
28extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags); 28void dn_nsp_send_conninit(struct sock *sk, unsigned char flags);
29 29
30extern void dn_nsp_output(struct sock *sk); 30void dn_nsp_output(struct sock *sk);
31extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); 31int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb,
32extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oob); 32 struct sk_buff_head *q, unsigned short acknum);
33extern unsigned long dn_nsp_persist(struct sock *sk); 33void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp,
34extern int dn_nsp_xmit_timeout(struct sock *sk); 34 int oob);
35 35unsigned long dn_nsp_persist(struct sock *sk);
36extern int dn_nsp_rx(struct sk_buff *); 36int dn_nsp_xmit_timeout(struct sock *sk);
37extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 37
38 38int dn_nsp_rx(struct sk_buff *);
39extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 39int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
40extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err); 40
41struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
42struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock,
43 long timeo, int *err);
41 44
42#define NSP_REASON_OK 0 /* No error */ 45#define NSP_REASON_OK 0 /* No error */
43#define NSP_REASON_NR 1 /* No resources */ 46#define NSP_REASON_NR 1 /* No resources */
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 2e9d317c82dc..b409ad6b8d7a 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -15,10 +15,11 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *, struct sock *sk, int flags); 19int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *,
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20 struct sock *sk, int flags);
21extern void dn_rt_cache_flush(int delay); 21int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
22void dn_rt_cache_flush(int delay);
22 23
23/* Masks for flags field */ 24/* Masks for flags field */
24#define DN_RT_F_PID 0x07 /* Mask for packet type */ 25#define DN_RT_F_PID 0x07 /* Mask for packet type */
@@ -92,8 +93,8 @@ static inline bool dn_is_output_route(struct dn_route *rt)
92 return rt->fld.flowidn_iif == 0; 93 return rt->fld.flowidn_iif == 0;
93} 94}
94 95
95extern void dn_route_init(void); 96void dn_route_init(void);
96extern void dn_route_cleanup(void); 97void dn_route_cleanup(void);
97 98
98#include <net/sock.h> 99#include <net/sock.h>
99#include <linux/if_arp.h> 100#include <linux/if_arp.h>
diff --git a/include/net/dst.h b/include/net/dst.h
index 3bc4865f8267..44995c13e941 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -106,7 +106,7 @@ struct dst_entry {
106 }; 106 };
107}; 107};
108 108
109extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 110extern const u32 dst_default_metrics[];
111 111
112#define DST_METRICS_READ_ONLY 0x1UL 112#define DST_METRICS_READ_ONLY 0x1UL
@@ -119,7 +119,7 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 119 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 120}
121 121
122extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 123
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 124static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
125{ 125{
@@ -262,7 +262,7 @@ static inline struct dst_entry *dst_clone(struct dst_entry *dst)
262 return dst; 262 return dst;
263} 263}
264 264
265extern void dst_release(struct dst_entry *dst); 265void dst_release(struct dst_entry *dst);
266 266
267static inline void refdst_drop(unsigned long refdst) 267static inline void refdst_drop(unsigned long refdst)
268{ 268{
@@ -362,12 +362,11 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
362 return child; 362 return child;
363} 363}
364 364
365extern int dst_discard(struct sk_buff *skb); 365int dst_discard(struct sk_buff *skb);
366extern void *dst_alloc(struct dst_ops *ops, struct net_device *dev, 366void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
367 int initial_ref, int initial_obsolete, 367 int initial_obsolete, unsigned short flags);
368 unsigned short flags); 368void __dst_free(struct dst_entry *dst);
369extern void __dst_free(struct dst_entry *dst); 369struct dst_entry *dst_destroy(struct dst_entry *dst);
370extern struct dst_entry *dst_destroy(struct dst_entry *dst);
371 370
372static inline void dst_free(struct dst_entry *dst) 371static inline void dst_free(struct dst_entry *dst)
373{ 372{
@@ -463,7 +462,7 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
463 return dst; 462 return dst;
464} 463}
465 464
466extern void dst_init(void); 465void dst_init(void);
467 466
468/* Flags for xfrm_lookup flags argument. */ 467/* Flags for xfrm_lookup flags argument. */
469enum { 468enum {
@@ -479,10 +478,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net,
479{ 478{
480 return dst_orig; 479 return dst_orig;
481} 480}
481
482static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
483{
484 return NULL;
485}
486
482#else 487#else
483extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, 488struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
484 const struct flowi *fl, struct sock *sk, 489 const struct flowi *fl, struct sock *sk,
485 int flags); 490 int flags);
491
492/* skb attached with this dst needs transformation if dst->xfrm is valid */
493static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
494{
495 return dst->xfrm;
496}
486#endif 497#endif
487 498
488#endif /* _NET_DST_H */ 499#endif /* _NET_DST_H */
diff --git a/include/net/esp.h b/include/net/esp.h
index d58451331dbd..a43be85aedc4 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -3,18 +3,6 @@
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5 5
6struct crypto_aead;
7
8struct esp_data {
9 /* 0..255 */
10 int padlen;
11
12 /* Confidentiality & Integrity */
13 struct crypto_aead *aead;
14};
15
16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
17
18struct ip_esp_hdr; 6struct ip_esp_hdr;
19 7
20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) 8static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 4b2b557fb0e8..e584de16e4c3 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -115,14 +115,13 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
115 return frh->table; 115 return frh->table;
116} 116}
117 117
118extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); 118struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *,
119extern void fib_rules_unregister(struct fib_rules_ops *); 119 struct net *);
120void fib_rules_unregister(struct fib_rules_ops *);
120 121
121extern int fib_rules_lookup(struct fib_rules_ops *, 122int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags,
122 struct flowi *, int flags, 123 struct fib_lookup_arg *);
123 struct fib_lookup_arg *); 124int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table,
124extern int fib_default_rule_add(struct fib_rules_ops *, 125 u32 flags);
125 u32 pref, u32 table, 126u32 fib_default_rule_pref(struct fib_rules_ops *ops);
126 u32 flags);
127extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
128#endif 127#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 628e11b98c58..65ce471d2ab5 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -215,12 +215,13 @@ typedef struct flow_cache_object *(*flow_resolve_t)(
215 struct net *net, const struct flowi *key, u16 family, 215 struct net *net, const struct flowi *key, u16 family,
216 u8 dir, struct flow_cache_object *oldobj, void *ctx); 216 u8 dir, struct flow_cache_object *oldobj, void *ctx);
217 217
218extern struct flow_cache_object *flow_cache_lookup( 218struct flow_cache_object *flow_cache_lookup(struct net *net,
219 struct net *net, const struct flowi *key, u16 family, 219 const struct flowi *key, u16 family,
220 u8 dir, flow_resolve_t resolver, void *ctx); 220 u8 dir, flow_resolve_t resolver,
221 void *ctx);
221 222
222extern void flow_cache_flush(void); 223void flow_cache_flush(void);
223extern void flow_cache_flush_deferred(void); 224void flow_cache_flush_deferred(void);
224extern atomic_t flow_cache_genid; 225extern atomic_t flow_cache_genid;
225 226
226#endif 227#endif
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index bb8271d487b7..7e64bd8bbda9 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -13,5 +13,6 @@ struct flow_keys {
13 u8 ip_proto; 13 u8 ip_proto;
14}; 14};
15 15
16extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 16bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
17__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
17#endif 18#endif
diff --git a/include/net/garp.h b/include/net/garp.h
index 834d8add9e5f..abf33bbd2e6a 100644
--- a/include/net/garp.h
+++ b/include/net/garp.h
@@ -112,19 +112,18 @@ struct garp_port {
112 struct rcu_head rcu; 112 struct rcu_head rcu;
113}; 113};
114 114
115extern int garp_register_application(struct garp_application *app); 115int garp_register_application(struct garp_application *app);
116extern void garp_unregister_application(struct garp_application *app); 116void garp_unregister_application(struct garp_application *app);
117 117
118extern int garp_init_applicant(struct net_device *dev, 118int garp_init_applicant(struct net_device *dev, struct garp_application *app);
119 struct garp_application *app); 119void garp_uninit_applicant(struct net_device *dev,
120extern void garp_uninit_applicant(struct net_device *dev, 120 struct garp_application *app);
121 struct garp_application *app); 121
122 122int garp_request_join(const struct net_device *dev,
123extern int garp_request_join(const struct net_device *dev, 123 const struct garp_application *app, const void *data,
124 const struct garp_application *app, 124 u8 len, u8 type);
125 const void *data, u8 len, u8 type); 125void garp_request_leave(const struct net_device *dev,
126extern void garp_request_leave(const struct net_device *dev, 126 const struct garp_application *app,
127 const struct garp_application *app, 127 const void *data, u8 len, u8 type);
128 const void *data, u8 len, u8 type);
129 128
130#endif /* _NET_GARP_H */ 129#endif /* _NET_GARP_H */
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index cf8439ba4d11..ea4271dceff0 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -19,32 +19,31 @@ struct gnet_dump {
19 struct tc_stats tc_stats; 19 struct tc_stats tc_stats;
20}; 20};
21 21
22extern int gnet_stats_start_copy(struct sk_buff *skb, int type, 22int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
23 struct gnet_dump *d);
24
25int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
26 int tc_stats_type, int xstats_type,
23 spinlock_t *lock, struct gnet_dump *d); 27 spinlock_t *lock, struct gnet_dump *d);
24 28
25extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, 29int gnet_stats_copy_basic(struct gnet_dump *d,
26 int tc_stats_type,int xstats_type, 30 struct gnet_stats_basic_packed *b);
27 spinlock_t *lock, struct gnet_dump *d); 31int gnet_stats_copy_rate_est(struct gnet_dump *d,
28 32 const struct gnet_stats_basic_packed *b,
29extern int gnet_stats_copy_basic(struct gnet_dump *d, 33 struct gnet_stats_rate_est64 *r);
30 struct gnet_stats_basic_packed *b); 34int gnet_stats_copy_queue(struct gnet_dump *d, struct gnet_stats_queue *q);
31extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 35int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
32 const struct gnet_stats_basic_packed *b, 36
33 struct gnet_stats_rate_est64 *r); 37int gnet_stats_finish_copy(struct gnet_dump *d);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 38
35 struct gnet_stats_queue *q); 39int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 40 struct gnet_stats_rate_est64 *rate_est,
37 41 spinlock_t *stats_lock, struct nlattr *opt);
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 42void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
39 43 struct gnet_stats_rate_est64 *rate_est);
40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 44int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est64 *rate_est, 45 struct gnet_stats_rate_est64 *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 46 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 47bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est64 *rate_est); 48 const struct gnet_stats_rate_est64 *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est64 *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est64 *rate_est);
50#endif 49#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8e0b6c856a13..1b177ed803b7 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -10,16 +10,9 @@
10/** 10/**
11 * struct genl_multicast_group - generic netlink multicast group 11 * struct genl_multicast_group - generic netlink multicast group
12 * @name: name of the multicast group, names are per-family 12 * @name: name of the multicast group, names are per-family
13 * @id: multicast group ID, assigned by the core, to use with
14 * genlmsg_multicast().
15 * @list: list entry for linking
16 * @family: pointer to family, need not be set before registering
17 */ 13 */
18struct genl_multicast_group { 14struct genl_multicast_group {
19 struct genl_family *family; /* private */
20 struct list_head list; /* private */
21 char name[GENL_NAMSIZ]; 15 char name[GENL_NAMSIZ];
22 u32 id;
23}; 16};
24 17
25struct genl_ops; 18struct genl_ops;
@@ -39,9 +32,12 @@ struct genl_info;
39 * @post_doit: called after an operation's doit callback, it may 32 * @post_doit: called after an operation's doit callback, it may
40 * undo operations done by pre_doit, for example release locks 33 * undo operations done by pre_doit, for example release locks
41 * @attrbuf: buffer to store parsed attributes 34 * @attrbuf: buffer to store parsed attributes
42 * @ops_list: list of all assigned operations
43 * @family_list: family list 35 * @family_list: family list
44 * @mcast_groups: multicast groups list 36 * @mcgrps: multicast groups used by this family (private)
37 * @n_mcgrps: number of multicast groups (private)
38 * @mcgrp_offset: starting number of multicast group IDs in this family
39 * @ops: the operations supported by this family (private)
40 * @n_ops: number of operations supported by this family (private)
45 */ 41 */
46struct genl_family { 42struct genl_family {
47 unsigned int id; 43 unsigned int id;
@@ -51,16 +47,19 @@ struct genl_family {
51 unsigned int maxattr; 47 unsigned int maxattr;
52 bool netnsok; 48 bool netnsok;
53 bool parallel_ops; 49 bool parallel_ops;
54 int (*pre_doit)(struct genl_ops *ops, 50 int (*pre_doit)(const struct genl_ops *ops,
55 struct sk_buff *skb, 51 struct sk_buff *skb,
56 struct genl_info *info); 52 struct genl_info *info);
57 void (*post_doit)(struct genl_ops *ops, 53 void (*post_doit)(const struct genl_ops *ops,
58 struct sk_buff *skb, 54 struct sk_buff *skb,
59 struct genl_info *info); 55 struct genl_info *info);
60 struct nlattr ** attrbuf; /* private */ 56 struct nlattr ** attrbuf; /* private */
61 struct list_head ops_list; /* private */ 57 const struct genl_ops * ops; /* private */
58 const struct genl_multicast_group *mcgrps; /* private */
59 unsigned int n_ops; /* private */
60 unsigned int n_mcgrps; /* private */
61 unsigned int mcgrp_offset; /* private */
62 struct list_head family_list; /* private */ 62 struct list_head family_list; /* private */
63 struct list_head mcast_groups; /* private */
64 struct module *module; 63 struct module *module;
65}; 64};
66 65
@@ -110,19 +109,18 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
110 * @ops_list: operations list 109 * @ops_list: operations list
111 */ 110 */
112struct genl_ops { 111struct genl_ops {
113 u8 cmd;
114 u8 internal_flags;
115 unsigned int flags;
116 const struct nla_policy *policy; 112 const struct nla_policy *policy;
117 int (*doit)(struct sk_buff *skb, 113 int (*doit)(struct sk_buff *skb,
118 struct genl_info *info); 114 struct genl_info *info);
119 int (*dumpit)(struct sk_buff *skb, 115 int (*dumpit)(struct sk_buff *skb,
120 struct netlink_callback *cb); 116 struct netlink_callback *cb);
121 int (*done)(struct netlink_callback *cb); 117 int (*done)(struct netlink_callback *cb);
122 struct list_head ops_list; 118 u8 cmd;
119 u8 internal_flags;
120 u8 flags;
123}; 121};
124 122
125extern int __genl_register_family(struct genl_family *family); 123int __genl_register_family(struct genl_family *family);
126 124
127static inline int genl_register_family(struct genl_family *family) 125static inline int genl_register_family(struct genl_family *family)
128{ 126{
@@ -130,28 +128,57 @@ static inline int genl_register_family(struct genl_family *family)
130 return __genl_register_family(family); 128 return __genl_register_family(family);
131} 129}
132 130
133extern int __genl_register_family_with_ops(struct genl_family *family, 131/**
134 struct genl_ops *ops, size_t n_ops); 132 * genl_register_family_with_ops - register a generic netlink family with ops
135 133 * @family: generic netlink family
136static inline int genl_register_family_with_ops(struct genl_family *family, 134 * @ops: operations to be registered
137 struct genl_ops *ops, size_t n_ops) 135 * @n_ops: number of elements to register
136 *
137 * Registers the specified family and operations from the specified table.
138 * Only one family may be registered with the same family name or identifier.
139 *
140 * The family id may equal GENL_ID_GENERATE causing an unique id to
141 * be automatically generated and assigned.
142 *
143 * Either a doit or dumpit callback must be specified for every registered
144 * operation or the function will fail. Only one operation structure per
145 * command identifier may be registered.
146 *
147 * See include/net/genetlink.h for more documenation on the operations
148 * structure.
149 *
150 * Return 0 on success or a negative error code.
151 */
152static inline int
153_genl_register_family_with_ops_grps(struct genl_family *family,
154 const struct genl_ops *ops, size_t n_ops,
155 const struct genl_multicast_group *mcgrps,
156 size_t n_mcgrps)
138{ 157{
139 family->module = THIS_MODULE; 158 family->module = THIS_MODULE;
140 return __genl_register_family_with_ops(family, ops, n_ops); 159 family->ops = ops;
160 family->n_ops = n_ops;
161 family->mcgrps = mcgrps;
162 family->n_mcgrps = n_mcgrps;
163 return __genl_register_family(family);
141} 164}
142 165
143extern int genl_unregister_family(struct genl_family *family); 166#define genl_register_family_with_ops(family, ops) \
144extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 167 _genl_register_family_with_ops_grps((family), \
145extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 168 (ops), ARRAY_SIZE(ops), \
146extern int genl_register_mc_group(struct genl_family *family, 169 NULL, 0)
147 struct genl_multicast_group *grp); 170#define genl_register_family_with_ops_groups(family, ops, grps) \
148extern void genl_unregister_mc_group(struct genl_family *family, 171 _genl_register_family_with_ops_grps((family), \
149 struct genl_multicast_group *grp); 172 (ops), ARRAY_SIZE(ops), \
150extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, 173 (grps), ARRAY_SIZE(grps))
151 u32 group, struct nlmsghdr *nlh, gfp_t flags); 174
175int genl_unregister_family(struct genl_family *family);
176void genl_notify(struct genl_family *family,
177 struct sk_buff *skb, struct net *net, u32 portid,
178 u32 group, struct nlmsghdr *nlh, gfp_t flags);
152 179
153void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 180void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
154 struct genl_family *family, int flags, u8 cmd); 181 struct genl_family *family, int flags, u8 cmd);
155 182
156/** 183/**
157 * genlmsg_nlhdr - Obtain netlink header from user specified header 184 * genlmsg_nlhdr - Obtain netlink header from user specified header
@@ -227,41 +254,51 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
227 254
228/** 255/**
229 * genlmsg_multicast_netns - multicast a netlink message to a specific netns 256 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
257 * @family: the generic netlink family
230 * @net: the net namespace 258 * @net: the net namespace
231 * @skb: netlink message as socket buffer 259 * @skb: netlink message as socket buffer
232 * @portid: own netlink portid to avoid sending to yourself 260 * @portid: own netlink portid to avoid sending to yourself
233 * @group: multicast group id 261 * @group: offset of multicast group in groups array
234 * @flags: allocation flags 262 * @flags: allocation flags
235 */ 263 */
236static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, 264static inline int genlmsg_multicast_netns(struct genl_family *family,
265 struct net *net, struct sk_buff *skb,
237 u32 portid, unsigned int group, gfp_t flags) 266 u32 portid, unsigned int group, gfp_t flags)
238{ 267{
268 if (WARN_ON_ONCE(group >= family->n_mcgrps))
269 return -EINVAL;
270 group = family->mcgrp_offset + group;
239 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags); 271 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
240} 272}
241 273
242/** 274/**
243 * genlmsg_multicast - multicast a netlink message to the default netns 275 * genlmsg_multicast - multicast a netlink message to the default netns
276 * @family: the generic netlink family
244 * @skb: netlink message as socket buffer 277 * @skb: netlink message as socket buffer
245 * @portid: own netlink portid to avoid sending to yourself 278 * @portid: own netlink portid to avoid sending to yourself
246 * @group: multicast group id 279 * @group: offset of multicast group in groups array
247 * @flags: allocation flags 280 * @flags: allocation flags
248 */ 281 */
249static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid, 282static inline int genlmsg_multicast(struct genl_family *family,
283 struct sk_buff *skb, u32 portid,
250 unsigned int group, gfp_t flags) 284 unsigned int group, gfp_t flags)
251{ 285{
252 return genlmsg_multicast_netns(&init_net, skb, portid, group, flags); 286 return genlmsg_multicast_netns(family, &init_net, skb,
287 portid, group, flags);
253} 288}
254 289
255/** 290/**
256 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 291 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
292 * @family: the generic netlink family
257 * @skb: netlink message as socket buffer 293 * @skb: netlink message as socket buffer
258 * @portid: own netlink portid to avoid sending to yourself 294 * @portid: own netlink portid to avoid sending to yourself
259 * @group: multicast group id 295 * @group: offset of multicast group in groups array
260 * @flags: allocation flags 296 * @flags: allocation flags
261 * 297 *
262 * This function must hold the RTNL or rcu_read_lock(). 298 * This function must hold the RTNL or rcu_read_lock().
263 */ 299 */
264int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid, 300int genlmsg_multicast_allns(struct genl_family *family,
301 struct sk_buff *skb, u32 portid,
265 unsigned int group, gfp_t flags); 302 unsigned int group, gfp_t flags);
266 303
267/** 304/**
@@ -332,5 +369,25 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
332 return nlmsg_new(genlmsg_total_size(payload), flags); 369 return nlmsg_new(genlmsg_total_size(payload), flags);
333} 370}
334 371
372/**
373 * genl_set_err - report error to genetlink broadcast listeners
374 * @family: the generic netlink family
375 * @net: the network namespace to report the error to
376 * @portid: the PORTID of a process that we want to skip (if any)
377 * @group: the broadcast group that will notice the error
378 * (this is the offset of the multicast group in the groups array)
379 * @code: error code, must be negative (as usual in kernelspace)
380 *
381 * This function returns the number of broadcast listeners that have set the
382 * NETLINK_RECV_NO_ENOBUFS socket option.
383 */
384static inline int genl_set_err(struct genl_family *family, struct net *net,
385 u32 portid, u32 group, int code)
386{
387 if (WARN_ON_ONCE(group >= family->n_mcgrps))
388 return -EINVAL;
389 group = family->mcgrp_offset + group;
390 return netlink_set_err(net->genl_sock, portid, group, code);
391}
335 392
336#endif /* __NET_GENERIC_NETLINK_H */ 393#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/gre.h b/include/net/gre.h
index 57e4afdf7879..dcd9ae3270d3 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -38,7 +38,13 @@ void gre_offload_exit(void);
38 38
39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, 39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
40 int hdr_len); 40 int hdr_len);
41struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum); 41
42static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
43 bool gre_csum)
44{
45 return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE);
46}
47
42 48
43static inline int ip_gre_calc_hlen(__be16 o_flags) 49static inline int ip_gre_calc_hlen(__be16 o_flags)
44{ 50{
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 081439fd070e..970028e13382 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -39,10 +39,10 @@ struct net_proto_family;
39struct sk_buff; 39struct sk_buff;
40struct net; 40struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43int icmp_rcv(struct sk_buff *skb);
44extern void icmp_err(struct sk_buff *, u32 info); 44void icmp_err(struct sk_buff *skb, u32 info);
45extern int icmp_init(void); 45int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 46void icmp_out_count(struct net *net, unsigned char type);
47 47
48#endif /* _ICMP_H */ 48#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 02ef7727bb55..76d54270f2e2 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -66,11 +66,10 @@ struct inet6_ifaddr {
66 struct hlist_node addr_lst; 66 struct hlist_node addr_lst;
67 struct list_head if_list; 67 struct list_head if_list;
68 68
69#ifdef CONFIG_IPV6_PRIVACY
70 struct list_head tmp_list; 69 struct list_head tmp_list;
71 struct inet6_ifaddr *ifpub; 70 struct inet6_ifaddr *ifpub;
72 int regen_count; 71 int regen_count;
73#endif 72
74 bool tokenized; 73 bool tokenized;
75 74
76 struct rcu_head rcu; 75 struct rcu_head rcu;
@@ -192,11 +191,9 @@ struct inet6_dev {
192 __u32 if_flags; 191 __u32 if_flags;
193 int dead; 192 int dead;
194 193
195#ifdef CONFIG_IPV6_PRIVACY
196 u8 rndid[8]; 194 u8 rndid[8];
197 struct timer_list regen_timer; 195 struct timer_list regen_timer;
198 struct list_head tempaddr_list; 196 struct list_head tempaddr_list;
199#endif
200 197
201 struct in6_addr token; 198 struct in6_addr token;
202 199
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 04642c920431..f981ba7adeed 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -22,27 +22,25 @@ struct sk_buff;
22struct sock; 22struct sock;
23struct sockaddr; 23struct sockaddr;
24 24
25extern int inet6_csk_bind_conflict(const struct sock *sk, 25int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb, bool relax); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28struct dst_entry *inet6_csk_route_req(struct sock *sk, struct flowi6 *fl6,
29 struct flowi6 *fl6, 29 const struct request_sock *req);
30 const struct request_sock *req);
31 30
32extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 31struct request_sock *inet6_csk_search_req(const struct sock *sk,
33 struct request_sock ***prevp, 32 struct request_sock ***prevp,
34 const __be16 rport, 33 const __be16 rport,
35 const struct in6_addr *raddr, 34 const struct in6_addr *raddr,
36 const struct in6_addr *laddr, 35 const struct in6_addr *laddr,
37 const int iif); 36 const int iif);
38 37
39extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, 38void inet6_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
40 struct request_sock *req, 39 const unsigned long timeout);
41 const unsigned long timeout);
42 40
43extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 41void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
44 42
45extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 43int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl);
46 44
47extern struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); 45struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu);
48#endif /* _INET6_CONNECTION_SOCK_H */ 46#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index fd4ee016ba5c..ae0613544308 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -28,32 +28,17 @@
28 28
29struct inet_hashinfo; 29struct inet_hashinfo;
30 30
31static inline unsigned int inet6_ehashfn(struct net *net, 31static inline unsigned int __inet6_ehashfn(const u32 lhash,
32 const struct in6_addr *laddr, const u16 lport, 32 const u16 lport,
33 const struct in6_addr *faddr, const __be16 fport) 33 const u32 fhash,
34 const __be16 fport,
35 const u32 initval)
34{ 36{
35 u32 ports = (((u32)lport) << 16) | (__force u32)fport; 37 const u32 ports = (((u32)lport) << 16) | (__force u32)fport;
36 38 return jhash_3words(lhash, fhash, ports, initval);
37 return jhash_3words((__force u32)laddr->s6_addr32[3],
38 ipv6_addr_jhash(faddr),
39 ports,
40 inet_ehash_secret + net_hash_mix(net));
41}
42
43static inline int inet6_sk_ehashfn(const struct sock *sk)
44{
45 const struct inet_sock *inet = inet_sk(sk);
46 const struct ipv6_pinfo *np = inet6_sk(sk);
47 const struct in6_addr *laddr = &np->rcv_saddr;
48 const struct in6_addr *faddr = &np->daddr;
49 const __u16 lport = inet->inet_num;
50 const __be16 fport = inet->inet_dport;
51 struct net *net = sock_net(sk);
52
53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
54} 39}
55 40
56extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp); 41int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
57 42
58/* 43/*
59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 44 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -61,21 +46,19 @@ extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
61 * 46 *
62 * The sockhash lock must be held as a reader here. 47 * The sockhash lock must be held as a reader here.
63 */ 48 */
64extern struct sock *__inet6_lookup_established(struct net *net, 49struct sock *__inet6_lookup_established(struct net *net,
65 struct inet_hashinfo *hashinfo, 50 struct inet_hashinfo *hashinfo,
66 const struct in6_addr *saddr, 51 const struct in6_addr *saddr,
67 const __be16 sport, 52 const __be16 sport,
68 const struct in6_addr *daddr, 53 const struct in6_addr *daddr,
69 const u16 hnum, 54 const u16 hnum, const int dif);
70 const int dif); 55
71 56struct sock *inet6_lookup_listener(struct net *net,
72extern struct sock *inet6_lookup_listener(struct net *net, 57 struct inet_hashinfo *hashinfo,
73 struct inet_hashinfo *hashinfo, 58 const struct in6_addr *saddr,
74 const struct in6_addr *saddr, 59 const __be16 sport,
75 const __be16 sport, 60 const struct in6_addr *daddr,
76 const struct in6_addr *daddr, 61 const unsigned short hnum, const int dif);
77 const unsigned short hnum,
78 const int dif);
79 62
80static inline struct sock *__inet6_lookup(struct net *net, 63static inline struct sock *__inet6_lookup(struct net *net,
81 struct inet_hashinfo *hashinfo, 64 struct inet_hashinfo *hashinfo,
@@ -110,9 +93,9 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
110 inet6_iif(skb)); 93 inet6_iif(skb));
111} 94}
112 95
113extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 96struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
114 const struct in6_addr *saddr, const __be16 sport, 97 const struct in6_addr *saddr, const __be16 sport,
115 const struct in6_addr *daddr, const __be16 dport, 98 const struct in6_addr *daddr, const __be16 dport,
116 const int dif); 99 const int dif);
117#endif /* IS_ENABLED(CONFIG_IPV6) */ 100#endif /* IS_ENABLED(CONFIG_IPV6) */
118#endif /* _INET6_HASHTABLES_H */ 101#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 234008782c8c..fe7994c48b75 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -13,30 +13,30 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 17int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
18 int addr_len, int flags); 18 int addr_len, int flags);
19extern int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 19int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
20 int addr_len, int flags); 20 int addr_len, int flags);
21extern int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, 21int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
22 int addr_len, int flags); 22 int addr_len, int flags);
23extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); 23int inet_accept(struct socket *sock, struct socket *newsock, int flags);
24extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock, 24int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
25 struct msghdr *msg, size_t size); 25 size_t size);
26extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, 26ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
27 size_t size, int flags); 27 size_t size, int flags);
28extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock, 28int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
29 struct msghdr *msg, size_t size, int flags); 29 size_t size, int flags);
30extern int inet_shutdown(struct socket *sock, int how); 30int inet_shutdown(struct socket *sock, int how);
31extern int inet_listen(struct socket *sock, int backlog); 31int inet_listen(struct socket *sock, int backlog);
32extern void inet_sock_destruct(struct sock *sk); 32void inet_sock_destruct(struct sock *sk);
33extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); 33int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
34extern int inet_getname(struct socket *sock, struct sockaddr *uaddr, 34int inet_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
35 int *uaddr_len, int peer); 35 int peer);
36extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 36int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
37extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, 37int inet_ctl_sock_create(struct sock **sk, unsigned short family,
38 unsigned short type, unsigned char protocol, 38 unsigned short type, unsigned char protocol,
39 struct net *net); 39 struct net *net);
40 40
41static inline void inet_ctl_sock_destroy(struct sock *sk) 41static inline void inet_ctl_sock_destroy(struct sock *sk)
42{ 42{
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index de2c78529afa..c55aeed41ace 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -146,9 +146,9 @@ static inline void *inet_csk_ca(const struct sock *sk)
146 return (void *)inet_csk(sk)->icsk_ca_priv; 146 return (void *)inet_csk(sk)->icsk_ca_priv;
147} 147}
148 148
149extern struct sock *inet_csk_clone_lock(const struct sock *sk, 149struct sock *inet_csk_clone_lock(const struct sock *sk,
150 const struct request_sock *req, 150 const struct request_sock *req,
151 const gfp_t priority); 151 const gfp_t priority);
152 152
153enum inet_csk_ack_state_t { 153enum inet_csk_ack_state_t {
154 ICSK_ACK_SCHED = 1, 154 ICSK_ACK_SCHED = 1,
@@ -157,11 +157,11 @@ enum inet_csk_ack_state_t {
157 ICSK_ACK_PUSHED2 = 8 157 ICSK_ACK_PUSHED2 = 8
158}; 158};
159 159
160extern void inet_csk_init_xmit_timers(struct sock *sk, 160void inet_csk_init_xmit_timers(struct sock *sk,
161 void (*retransmit_handler)(unsigned long), 161 void (*retransmit_handler)(unsigned long),
162 void (*delack_handler)(unsigned long), 162 void (*delack_handler)(unsigned long),
163 void (*keepalive_handler)(unsigned long)); 163 void (*keepalive_handler)(unsigned long));
164extern void inet_csk_clear_xmit_timers(struct sock *sk); 164void inet_csk_clear_xmit_timers(struct sock *sk);
165 165
166static inline void inet_csk_schedule_ack(struct sock *sk) 166static inline void inet_csk_schedule_ack(struct sock *sk)
167{ 167{
@@ -178,8 +178,8 @@ static inline void inet_csk_delack_init(struct sock *sk)
178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack)); 178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
179} 179}
180 180
181extern void inet_csk_delete_keepalive_timer(struct sock *sk); 181void inet_csk_delete_keepalive_timer(struct sock *sk);
182extern void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 182void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
183 183
184#ifdef INET_CSK_DEBUG 184#ifdef INET_CSK_DEBUG
185extern const char inet_csk_timer_bug_msg[]; 185extern const char inet_csk_timer_bug_msg[];
@@ -241,23 +241,21 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
241#endif 241#endif
242} 242}
243 243
244extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); 244struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
245 245
246extern struct request_sock *inet_csk_search_req(const struct sock *sk, 246struct request_sock *inet_csk_search_req(const struct sock *sk,
247 struct request_sock ***prevp, 247 struct request_sock ***prevp,
248 const __be16 rport, 248 const __be16 rport,
249 const __be32 raddr, 249 const __be32 raddr,
250 const __be32 laddr); 250 const __be32 laddr);
251extern int inet_csk_bind_conflict(const struct sock *sk, 251int inet_csk_bind_conflict(const struct sock *sk,
252 const struct inet_bind_bucket *tb, bool relax); 252 const struct inet_bind_bucket *tb, bool relax);
253extern int inet_csk_get_port(struct sock *sk, unsigned short snum); 253int inet_csk_get_port(struct sock *sk, unsigned short snum);
254 254
255extern struct dst_entry* inet_csk_route_req(struct sock *sk, 255struct dst_entry *inet_csk_route_req(struct sock *sk, struct flowi4 *fl4,
256 struct flowi4 *fl4, 256 const struct request_sock *req);
257struct dst_entry *inet_csk_route_child_sock(struct sock *sk, struct sock *newsk,
257 const struct request_sock *req); 258 const struct request_sock *req);
258extern struct dst_entry* inet_csk_route_child_sock(struct sock *sk,
259 struct sock *newsk,
260 const struct request_sock *req);
261 259
262static inline void inet_csk_reqsk_queue_add(struct sock *sk, 260static inline void inet_csk_reqsk_queue_add(struct sock *sk,
263 struct request_sock *req, 261 struct request_sock *req,
@@ -266,9 +264,8 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
266 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child); 264 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child);
267} 265}
268 266
269extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 267void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
270 struct request_sock *req, 268 unsigned long timeout);
271 unsigned long timeout);
272 269
273static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 270static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
274 struct request_sock *req) 271 struct request_sock *req)
@@ -315,13 +312,13 @@ static inline void inet_csk_reqsk_queue_drop(struct sock *sk,
315 reqsk_free(req); 312 reqsk_free(req);
316} 313}
317 314
318extern void inet_csk_reqsk_queue_prune(struct sock *parent, 315void inet_csk_reqsk_queue_prune(struct sock *parent,
319 const unsigned long interval, 316 const unsigned long interval,
320 const unsigned long timeout, 317 const unsigned long timeout,
321 const unsigned long max_rto); 318 const unsigned long max_rto);
322 319
323extern void inet_csk_destroy_sock(struct sock *sk); 320void inet_csk_destroy_sock(struct sock *sk);
324extern void inet_csk_prepare_forced_close(struct sock *sk); 321void inet_csk_prepare_forced_close(struct sock *sk);
325 322
326/* 323/*
327 * LISTEN is a special case for poll.. 324 * LISTEN is a special case for poll..
@@ -332,15 +329,15 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
332 (POLLIN | POLLRDNORM) : 0; 329 (POLLIN | POLLRDNORM) : 0;
333} 330}
334 331
335extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 332int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
336extern void inet_csk_listen_stop(struct sock *sk); 333void inet_csk_listen_stop(struct sock *sk);
337 334
338extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 335void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
339 336
340extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 337int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
341 char __user *optval, int __user *optlen); 338 char __user *optval, int __user *optlen);
342extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 339int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
343 char __user *optval, unsigned int optlen); 340 char __user *optval, unsigned int optlen);
344 341
345extern struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); 342struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
346#endif /* _INET_CONNECTION_SOCK_H */ 343#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index bfcbc0017950..6f59de98dabd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -64,6 +64,10 @@ struct inet_frags {
64 rwlock_t lock ____cacheline_aligned_in_smp; 64 rwlock_t lock ____cacheline_aligned_in_smp;
65 int secret_interval; 65 int secret_interval;
66 struct timer_list secret_timer; 66 struct timer_list secret_timer;
67
68 /* The first call to hashfn is responsible to initialize
69 * rnd. This is best done with net_get_random_once.
70 */
67 u32 rnd; 71 u32 rnd;
68 int qsize; 72 int qsize;
69 73
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index ef83d9e844b5..1bdb47715def 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -37,12 +37,11 @@
37#include <asm/byteorder.h> 37#include <asm/byteorder.h>
38 38
39/* This is for all connections with a full identity, no wildcards. 39/* This is for all connections with a full identity, no wildcards.
40 * One chain is dedicated to TIME_WAIT sockets. 40 * The 'e' prefix stands for Establish, but we really put all sockets
41 * I'll experiment with dynamic table growth later. 41 * but LISTEN ones.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_nulls_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_nulls_head twchain;
46}; 45};
47 46
48/* There are a few simple rules, which allow for local port reuse by 47/* There are a few simple rules, which allow for local port reuse by
@@ -123,7 +122,6 @@ struct inet_hashinfo {
123 * 122 *
124 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE 123 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
125 * 124 *
126 * TIME_WAIT sockets use a separate chain (twchain).
127 */ 125 */
128 struct inet_ehash_bucket *ehash; 126 struct inet_ehash_bucket *ehash;
129 spinlock_t *ehash_locks; 127 spinlock_t *ehash_locks;
@@ -218,22 +216,21 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
218 } 216 }
219} 217}
220 218
221extern struct inet_bind_bucket * 219struct inet_bind_bucket *
222 inet_bind_bucket_create(struct kmem_cache *cachep, 220inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net,
223 struct net *net, 221 struct inet_bind_hashbucket *head,
224 struct inet_bind_hashbucket *head, 222 const unsigned short snum);
225 const unsigned short snum); 223void inet_bind_bucket_destroy(struct kmem_cache *cachep,
226extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 224 struct inet_bind_bucket *tb);
227 struct inet_bind_bucket *tb);
228 225
229static inline int inet_bhashfn(struct net *net, 226static inline int inet_bhashfn(struct net *net, const __u16 lport,
230 const __u16 lport, const int bhash_size) 227 const int bhash_size)
231{ 228{
232 return (lport + net_hash_mix(net)) & (bhash_size - 1); 229 return (lport + net_hash_mix(net)) & (bhash_size - 1);
233} 230}
234 231
235extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 232void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
236 const unsigned short snum); 233 const unsigned short snum);
237 234
238/* These can have wildcards, don't try too hard. */ 235/* These can have wildcards, don't try too hard. */
239static inline int inet_lhashfn(struct net *net, const unsigned short num) 236static inline int inet_lhashfn(struct net *net, const unsigned short num)
@@ -247,23 +244,22 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
247} 244}
248 245
249/* Caller must disable local BH processing. */ 246/* Caller must disable local BH processing. */
250extern int __inet_inherit_port(struct sock *sk, struct sock *child); 247int __inet_inherit_port(struct sock *sk, struct sock *child);
251 248
252extern void inet_put_port(struct sock *sk); 249void inet_put_port(struct sock *sk);
253 250
254void inet_hashinfo_init(struct inet_hashinfo *h); 251void inet_hashinfo_init(struct inet_hashinfo *h);
255 252
256extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); 253int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
257extern void inet_hash(struct sock *sk); 254void inet_hash(struct sock *sk);
258extern void inet_unhash(struct sock *sk); 255void inet_unhash(struct sock *sk);
259 256
260extern struct sock *__inet_lookup_listener(struct net *net, 257struct sock *__inet_lookup_listener(struct net *net,
261 struct inet_hashinfo *hashinfo, 258 struct inet_hashinfo *hashinfo,
262 const __be32 saddr, 259 const __be32 saddr, const __be16 sport,
263 const __be16 sport, 260 const __be32 daddr,
264 const __be32 daddr, 261 const unsigned short hnum,
265 const unsigned short hnum, 262 const int dif);
266 const int dif);
267 263
268static inline struct sock *inet_lookup_listener(struct net *net, 264static inline struct sock *inet_lookup_listener(struct net *net,
269 struct inet_hashinfo *hashinfo, 265 struct inet_hashinfo *hashinfo,
@@ -304,30 +300,17 @@ static inline struct sock *inet_lookup_listener(struct net *net,
304 ((__force __u64)(__be32)(__saddr))); 300 ((__force __u64)(__be32)(__saddr)));
305#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
306#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
307 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 303 (((__sk)->sk_portpair == (__ports)) && \
308 (inet_sk(__sk)->inet_addrpair == (__cookie)) && \ 304 ((__sk)->sk_addrpair == (__cookie)) && \
309 (!(__sk)->sk_bound_dev_if || \ 305 (!(__sk)->sk_bound_dev_if || \
310 ((__sk)->sk_bound_dev_if == (__dif))) && \ 306 ((__sk)->sk_bound_dev_if == (__dif))) && \
311 net_eq(sock_net(__sk), (__net))) 307 net_eq(sock_net(__sk), (__net)))
312#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif)\
313 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
314 (inet_twsk(__sk)->tw_addrpair == (__cookie)) && \
315 (!(__sk)->sk_bound_dev_if || \
316 ((__sk)->sk_bound_dev_if == (__dif))) && \
317 net_eq(sock_net(__sk), (__net)))
318#else /* 32-bit arch */ 308#else /* 32-bit arch */
319#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 309#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
320#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 310#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
321 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 311 (((__sk)->sk_portpair == (__ports)) && \
322 (inet_sk(__sk)->inet_daddr == (__saddr)) && \ 312 ((__sk)->sk_daddr == (__saddr)) && \
323 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ 313 ((__sk)->sk_rcv_saddr == (__daddr)) && \
324 (!(__sk)->sk_bound_dev_if || \
325 ((__sk)->sk_bound_dev_if == (__dif))) && \
326 net_eq(sock_net(__sk), (__net)))
327#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
328 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
329 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
330 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
331 (!(__sk)->sk_bound_dev_if || \ 314 (!(__sk)->sk_bound_dev_if || \
332 ((__sk)->sk_bound_dev_if == (__dif))) && \ 315 ((__sk)->sk_bound_dev_if == (__dif))) && \
333 net_eq(sock_net(__sk), (__net))) 316 net_eq(sock_net(__sk), (__net)))
@@ -339,10 +322,11 @@ static inline struct sock *inet_lookup_listener(struct net *net,
339 * 322 *
340 * Local BH must be disabled here. 323 * Local BH must be disabled here.
341 */ 324 */
342extern struct sock * __inet_lookup_established(struct net *net, 325struct sock *__inet_lookup_established(struct net *net,
343 struct inet_hashinfo *hashinfo, 326 struct inet_hashinfo *hashinfo,
344 const __be32 saddr, const __be16 sport, 327 const __be32 saddr, const __be16 sport,
345 const __be32 daddr, const u16 hnum, const int dif); 328 const __be32 daddr, const u16 hnum,
329 const int dif);
346 330
347static inline struct sock * 331static inline struct sock *
348 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo, 332 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
@@ -399,13 +383,14 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
399 iph->daddr, dport, inet_iif(skb)); 383 iph->daddr, dport, inet_iif(skb));
400} 384}
401 385
402extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 386int __inet_hash_connect(struct inet_timewait_death_row *death_row,
403 struct sock *sk, 387 struct sock *sk, u32 port_offset,
404 u32 port_offset, 388 int (*check_established)(struct inet_timewait_death_row *,
405 int (*check_established)(struct inet_timewait_death_row *, 389 struct sock *, __u16,
406 struct sock *, __u16, struct inet_timewait_sock **), 390 struct inet_timewait_sock **),
407 int (*hash)(struct sock *sk, struct inet_timewait_sock *twp)); 391 int (*hash)(struct sock *sk,
392 struct inet_timewait_sock *twp));
408 393
409extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 394int inet_hash_connect(struct inet_timewait_death_row *death_row,
410 struct sock *sk); 395 struct sock *sk);
411#endif /* _INET_HASHTABLES_H */ 396#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index b21a7f06d6a4..1833c3f389ee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -70,13 +70,14 @@ struct ip_options_data {
70 70
71struct inet_request_sock { 71struct inet_request_sock {
72 struct request_sock req; 72 struct request_sock req;
73#if IS_ENABLED(CONFIG_IPV6) 73#define ir_loc_addr req.__req_common.skc_rcv_saddr
74 u16 inet6_rsk_offset; 74#define ir_rmt_addr req.__req_common.skc_daddr
75#endif 75#define ir_num req.__req_common.skc_num
76 __be16 loc_port; 76#define ir_rmt_port req.__req_common.skc_dport
77 __be32 loc_addr; 77#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
78 __be32 rmt_addr; 78#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
79 __be16 rmt_port; 79#define ir_iif req.__req_common.skc_bound_dev_if
80
80 kmemcheck_bitfield_begin(flags); 81 kmemcheck_bitfield_begin(flags);
81 u16 snd_wscale : 4, 82 u16 snd_wscale : 4,
82 rcv_wscale : 4, 83 rcv_wscale : 4,
@@ -88,6 +89,7 @@ struct inet_request_sock {
88 no_srccheck: 1; 89 no_srccheck: 1;
89 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
90 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts;
91}; 93};
92 94
93static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -103,6 +105,9 @@ struct inet_cork {
103 int length; /* Total length of all frames */ 105 int length; /* Total length of all frames */
104 struct dst_entry *dst; 106 struct dst_entry *dst;
105 u8 tx_flags; 107 u8 tx_flags;
108 __u8 ttl;
109 __s16 tos;
110 char priority;
106}; 111};
107 112
108struct inet_cork_full { 113struct inet_cork_full {
@@ -143,10 +148,8 @@ struct inet_sock {
143 /* Socket demultiplex comparisons on incoming packets. */ 148 /* Socket demultiplex comparisons on incoming packets. */
144#define inet_daddr sk.__sk_common.skc_daddr 149#define inet_daddr sk.__sk_common.skc_daddr
145#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 150#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
146#define inet_addrpair sk.__sk_common.skc_addrpair
147#define inet_dport sk.__sk_common.skc_dport 151#define inet_dport sk.__sk_common.skc_dport
148#define inet_num sk.__sk_common.skc_num 152#define inet_num sk.__sk_common.skc_num
149#define inet_portpair sk.__sk_common.skc_portpair
150 153
151 __be32 inet_saddr; 154 __be32 inet_saddr;
152 __s16 uc_ttl; 155 __s16 uc_ttl;
@@ -199,32 +202,18 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
199} 202}
200#endif 203#endif
201 204
202extern int inet_sk_rebuild_header(struct sock *sk); 205int inet_sk_rebuild_header(struct sock *sk);
203
204extern u32 inet_ehash_secret;
205extern u32 ipv6_hash_secret;
206extern void build_ehash_secret(void);
207 206
208static inline unsigned int inet_ehashfn(struct net *net, 207static inline unsigned int __inet_ehashfn(const __be32 laddr,
209 const __be32 laddr, const __u16 lport, 208 const __u16 lport,
210 const __be32 faddr, const __be16 fport) 209 const __be32 faddr,
210 const __be16 fport,
211 u32 initval)
211{ 212{
212 return jhash_3words((__force __u32) laddr, 213 return jhash_3words((__force __u32) laddr,
213 (__force __u32) faddr, 214 (__force __u32) faddr,
214 ((__u32) lport) << 16 | (__force __u32)fport, 215 ((__u32) lport) << 16 | (__force __u32)fport,
215 inet_ehash_secret + net_hash_mix(net)); 216 initval);
216}
217
218static inline int inet_sk_ehashfn(const struct sock *sk)
219{
220 const struct inet_sock *inet = inet_sk(sk);
221 const __be32 laddr = inet->inet_rcv_saddr;
222 const __u16 lport = inet->inet_num;
223 const __be32 faddr = inet->inet_daddr;
224 const __be16 fport = inet->inet_dport;
225 struct net *net = sock_net(sk);
226
227 return inet_ehashfn(net, laddr, lport, faddr, fport);
228} 217}
229 218
230static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 219static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f908dfc06505..71c6e264e5b5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -58,6 +58,11 @@ struct inet_hashinfo;
58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) 58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
59#endif 59#endif
60 60
61static inline u32 inet_tw_time_stamp(void)
62{
63 return jiffies;
64}
65
61/* TIME_WAIT reaping mechanism. */ 66/* TIME_WAIT reaping mechanism. */
62#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */ 67#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
63 68
@@ -83,9 +88,9 @@ struct inet_timewait_death_row {
83 int sysctl_max_tw_buckets; 88 int sysctl_max_tw_buckets;
84}; 89};
85 90
86extern void inet_twdr_hangman(unsigned long data); 91void inet_twdr_hangman(unsigned long data);
87extern void inet_twdr_twkill_work(struct work_struct *work); 92void inet_twdr_twkill_work(struct work_struct *work);
88extern void inet_twdr_twcal_tick(unsigned long data); 93void inet_twdr_twcal_tick(unsigned long data);
89 94
90struct inet_bind_bucket; 95struct inet_bind_bucket;
91 96
@@ -111,11 +116,11 @@ struct inet_timewait_sock {
111#define tw_prot __tw_common.skc_prot 116#define tw_prot __tw_common.skc_prot
112#define tw_net __tw_common.skc_net 117#define tw_net __tw_common.skc_net
113#define tw_daddr __tw_common.skc_daddr 118#define tw_daddr __tw_common.skc_daddr
119#define tw_v6_daddr __tw_common.skc_v6_daddr
114#define tw_rcv_saddr __tw_common.skc_rcv_saddr 120#define tw_rcv_saddr __tw_common.skc_rcv_saddr
115#define tw_addrpair __tw_common.skc_addrpair 121#define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr
116#define tw_dport __tw_common.skc_dport 122#define tw_dport __tw_common.skc_dport
117#define tw_num __tw_common.skc_num 123#define tw_num __tw_common.skc_num
118#define tw_portpair __tw_common.skc_portpair
119 124
120 int tw_timeout; 125 int tw_timeout;
121 volatile unsigned char tw_substate; 126 volatile unsigned char tw_substate;
@@ -130,26 +135,14 @@ struct inet_timewait_sock {
130 tw_transparent : 1, 135 tw_transparent : 1,
131 tw_pad : 6, /* 6 bits hole */ 136 tw_pad : 6, /* 6 bits hole */
132 tw_tos : 8, 137 tw_tos : 8,
133 tw_ipv6_offset : 16; 138 tw_pad2 : 16; /* 16 bits hole */
134 kmemcheck_bitfield_end(flags); 139 kmemcheck_bitfield_end(flags);
135 unsigned long tw_ttd; 140 u32 tw_ttd;
136 struct inet_bind_bucket *tw_tb; 141 struct inet_bind_bucket *tw_tb;
137 struct hlist_node tw_death_node; 142 struct hlist_node tw_death_node;
138}; 143};
139#define tw_tclass tw_tos 144#define tw_tclass tw_tos
140 145
141static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
142 struct hlist_nulls_head *list)
143{
144 hlist_nulls_add_head_rcu(&tw->tw_node, list);
145}
146
147static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
148 struct hlist_head *list)
149{
150 hlist_add_head(&tw->tw_bind_node, list);
151}
152
153static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) 146static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
154{ 147{
155 return !hlist_unhashed(&tw->tw_death_node); 148 return !hlist_unhashed(&tw->tw_death_node);
@@ -189,34 +182,28 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
189 return (struct inet_timewait_sock *)sk; 182 return (struct inet_timewait_sock *)sk;
190} 183}
191 184
192static inline __be32 sk_rcv_saddr(const struct sock *sk) 185void inet_twsk_free(struct inet_timewait_sock *tw);
193{ 186void inet_twsk_put(struct inet_timewait_sock *tw);
194/* both inet_sk() and inet_twsk() store rcv_saddr in skc_rcv_saddr */
195 return sk->__sk_common.skc_rcv_saddr;
196}
197
198extern void inet_twsk_put(struct inet_timewait_sock *tw);
199 187
200extern int inet_twsk_unhash(struct inet_timewait_sock *tw); 188int inet_twsk_unhash(struct inet_timewait_sock *tw);
201 189
202extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, 190int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
203 struct inet_hashinfo *hashinfo); 191 struct inet_hashinfo *hashinfo);
204 192
205extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 193struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
206 const int state); 194 const int state);
207 195
208extern void __inet_twsk_hashdance(struct inet_timewait_sock *tw, 196void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
209 struct sock *sk, 197 struct inet_hashinfo *hashinfo);
210 struct inet_hashinfo *hashinfo);
211 198
212extern void inet_twsk_schedule(struct inet_timewait_sock *tw, 199void inet_twsk_schedule(struct inet_timewait_sock *tw,
213 struct inet_timewait_death_row *twdr, 200 struct inet_timewait_death_row *twdr,
214 const int timeo, const int timewait_len); 201 const int timeo, const int timewait_len);
215extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 202void inet_twsk_deschedule(struct inet_timewait_sock *tw,
216 struct inet_timewait_death_row *twdr); 203 struct inet_timewait_death_row *twdr);
217 204
218extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, 205void inet_twsk_purge(struct inet_hashinfo *hashinfo,
219 struct inet_timewait_death_row *twdr, int family); 206 struct inet_timewait_death_row *twdr, int family);
220 207
221static inline 208static inline
222struct net *twsk_net(const struct inet_timewait_sock *twsk) 209struct net *twsk_net(const struct inet_timewait_sock *twsk)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 53f464d7cddc..f4e127af4e17 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -120,9 +120,9 @@ static inline void inetpeer_transfer_peer(unsigned long *to, unsigned long *from
120 } 120 }
121} 121}
122 122
123extern void inet_peer_base_init(struct inet_peer_base *); 123void inet_peer_base_init(struct inet_peer_base *);
124 124
125void inet_initpeers(void) __init; 125void inet_initpeers(void) __init;
126 126
127#define INETPEER_METRICS_NEW (~(u32) 0) 127#define INETPEER_METRICS_NEW (~(u32) 0)
128 128
@@ -159,11 +159,11 @@ static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
159} 159}
160 160
161/* can be called from BH context or outside */ 161/* can be called from BH context or outside */
162extern void inet_putpeer(struct inet_peer *p); 162void inet_putpeer(struct inet_peer *p);
163extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 163bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
164 164
165extern void inetpeer_invalidate_tree(struct inet_peer_base *); 165void inetpeer_invalidate_tree(struct inet_peer_base *);
166extern void inetpeer_invalidate_family(int family); 166void inetpeer_invalidate_family(int family);
167 167
168/* 168/*
169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 48f55979d842..5a25f36fe3a7 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -28,6 +28,7 @@
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29 29
30#include <net/inet_sock.h> 30#include <net/inet_sock.h>
31#include <net/route.h>
31#include <net/snmp.h> 32#include <net/snmp.h>
32#include <net/flow.h> 33#include <net/flow.h>
33 34
@@ -56,6 +57,9 @@ struct ipcm_cookie {
56 int oif; 57 int oif;
57 struct ip_options_rcu *opt; 58 struct ip_options_rcu *opt;
58 __u8 tx_flags; 59 __u8 tx_flags;
60 __u8 ttl;
61 __s16 tos;
62 char priority;
59}; 63};
60 64
61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 65#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
@@ -86,64 +90,71 @@ struct packet_type;
86struct rtable; 90struct rtable;
87struct sockaddr; 91struct sockaddr;
88 92
89extern int igmp_mc_proc_init(void); 93int igmp_mc_proc_init(void);
90 94
91/* 95/*
92 * Functions provided by ip.c 96 * Functions provided by ip.c
93 */ 97 */
94 98
95extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, 99int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
96 __be32 saddr, __be32 daddr, 100 __be32 saddr, __be32 daddr,
97 struct ip_options_rcu *opt); 101 struct ip_options_rcu *opt);
98extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, 102int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
99 struct packet_type *pt, struct net_device *orig_dev); 103 struct net_device *orig_dev);
100extern int ip_local_deliver(struct sk_buff *skb); 104int ip_local_deliver(struct sk_buff *skb);
101extern int ip_mr_input(struct sk_buff *skb); 105int ip_mr_input(struct sk_buff *skb);
102extern int ip_output(struct sk_buff *skb); 106int ip_output(struct sk_buff *skb);
103extern int ip_mc_output(struct sk_buff *skb); 107int ip_mc_output(struct sk_buff *skb);
104extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 108int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
105extern int ip_do_nat(struct sk_buff *skb); 109int ip_do_nat(struct sk_buff *skb);
106extern void ip_send_check(struct iphdr *ip); 110void ip_send_check(struct iphdr *ip);
107extern int __ip_local_out(struct sk_buff *skb); 111int __ip_local_out(struct sk_buff *skb);
108extern int ip_local_out(struct sk_buff *skb); 112int ip_local_out(struct sk_buff *skb);
109extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); 113int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
110extern void ip_init(void); 114void ip_init(void);
111extern int ip_append_data(struct sock *sk, struct flowi4 *fl4, 115int ip_append_data(struct sock *sk, struct flowi4 *fl4,
112 int getfrag(void *from, char *to, int offset, int len, 116 int getfrag(void *from, char *to, int offset, int len,
113 int odd, struct sk_buff *skb), 117 int odd, struct sk_buff *skb),
114 void *from, int len, int protolen, 118 void *from, int len, int protolen,
115 struct ipcm_cookie *ipc, 119 struct ipcm_cookie *ipc,
116 struct rtable **rt, 120 struct rtable **rt,
117 unsigned int flags); 121 unsigned int flags);
118extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 122int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd,
119extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, 123 struct sk_buff *skb);
120 int offset, size_t size, int flags); 124ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
121extern struct sk_buff *__ip_make_skb(struct sock *sk, 125 int offset, size_t size, int flags);
122 struct flowi4 *fl4, 126struct sk_buff *__ip_make_skb(struct sock *sk, struct flowi4 *fl4,
123 struct sk_buff_head *queue, 127 struct sk_buff_head *queue,
124 struct inet_cork *cork); 128 struct inet_cork *cork);
125extern int ip_send_skb(struct net *net, struct sk_buff *skb); 129int ip_send_skb(struct net *net, struct sk_buff *skb);
126extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4); 130int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
127extern void ip_flush_pending_frames(struct sock *sk); 131void ip_flush_pending_frames(struct sock *sk);
128extern struct sk_buff *ip_make_skb(struct sock *sk, 132struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
129 struct flowi4 *fl4, 133 int getfrag(void *from, char *to, int offset,
130 int getfrag(void *from, char *to, int offset, int len, 134 int len, int odd, struct sk_buff *skb),
131 int odd, struct sk_buff *skb), 135 void *from, int length, int transhdrlen,
132 void *from, int length, int transhdrlen, 136 struct ipcm_cookie *ipc, struct rtable **rtp,
133 struct ipcm_cookie *ipc, 137 unsigned int flags);
134 struct rtable **rtp,
135 unsigned int flags);
136 138
137static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) 139static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
138{ 140{
139 return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base); 141 return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
140} 142}
141 143
144static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
145{
146 return (ipc->tos != -1) ? RT_TOS(ipc->tos) : RT_TOS(inet->tos);
147}
148
149static inline __u8 get_rtconn_flags(struct ipcm_cookie* ipc, struct sock* sk)
150{
151 return (ipc->tos != -1) ? RT_CONN_FLAGS_TOS(sk, ipc->tos) : RT_CONN_FLAGS(sk);
152}
153
142/* datagram.c */ 154/* datagram.c */
143extern int ip4_datagram_connect(struct sock *sk, 155int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
144 struct sockaddr *uaddr, int addr_len);
145 156
146extern void ip4_datagram_release_cb(struct sock *sk); 157void ip4_datagram_release_cb(struct sock *sk);
147 158
148struct ip_reply_arg { 159struct ip_reply_arg {
149 struct kvec iov[1]; 160 struct kvec iov[1];
@@ -184,16 +195,16 @@ extern struct ipv4_config ipv4_config;
184#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 195#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
185#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 196#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
186 197
187extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); 198unsigned long snmp_fold_field(void __percpu *mib[], int offt);
188#if BITS_PER_LONG==32 199#if BITS_PER_LONG==32
189extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); 200u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
190#else 201#else
191static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) 202static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off)
192{ 203{
193 return snmp_fold_field(mib, offt); 204 return snmp_fold_field(mib, offt);
194} 205}
195#endif 206#endif
196extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); 207int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
197 208
198static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) 209static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
199{ 210{
@@ -206,11 +217,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
206 } 217 }
207} 218}
208 219
209extern struct local_ports { 220void inet_get_local_port_range(struct net *net, int *low, int *high);
210 seqlock_t lock;
211 int range[2];
212} sysctl_local_ports;
213extern void inet_get_local_port_range(int *low, int *high);
214 221
215extern unsigned long *sysctl_local_reserved_ports; 222extern unsigned long *sysctl_local_reserved_ports;
216static inline int inet_is_reserved_local_port(int port) 223static inline int inet_is_reserved_local_port(int port)
@@ -231,9 +238,9 @@ extern int sysctl_ip_early_demux;
231/* From ip_output.c */ 238/* From ip_output.c */
232extern int sysctl_ip_dynaddr; 239extern int sysctl_ip_dynaddr;
233 240
234extern void ipfrag_init(void); 241void ipfrag_init(void);
235 242
236extern void ip_static_sysctl_init(void); 243void ip_static_sysctl_init(void);
237 244
238static inline bool ip_is_fragment(const struct iphdr *iph) 245static inline bool ip_is_fragment(const struct iphdr *iph)
239{ 246{
@@ -262,11 +269,13 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
262 !(dst_metric_locked(dst, RTAX_MTU))); 269 !(dst_metric_locked(dst, RTAX_MTU)));
263} 270}
264 271
265extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); 272void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
266 273
267static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, struct sock *sk) 274static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
268{ 275{
269 if (iph->frag_off & htons(IP_DF)) { 276 struct iphdr *iph = ip_hdr(skb);
277
278 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) {
270 /* This is only to work around buggy Windows95/2000 279 /* This is only to work around buggy Windows95/2000
271 * VJ compression implementations. If the ID field 280 * VJ compression implementations. If the ID field
272 * does not change, they drop every other packet in 281 * does not change, they drop every other packet in
@@ -278,9 +287,11 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
278 __ip_select_ident(iph, dst, 0); 287 __ip_select_ident(iph, dst, 0);
279} 288}
280 289
281static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) 290static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more)
282{ 291{
283 if (iph->frag_off & htons(IP_DF)) { 292 struct iphdr *iph = ip_hdr(skb);
293
294 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) {
284 if (sk && inet_sk(sk)->inet_daddr) { 295 if (sk && inet_sk(sk)->inet_daddr) {
285 iph->id = htons(inet_sk(sk)->inet_id); 296 iph->id = htons(inet_sk(sk)->inet_id);
286 inet_sk(sk)->inet_id += 1 + more; 297 inet_sk(sk)->inet_id += 1 + more;
@@ -363,7 +374,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
363 struct ipv6_pinfo *np = inet6_sk(sk); 374 struct ipv6_pinfo *np = inet6_sk(sk);
364 375
365 memset(&np->saddr, 0, sizeof(np->saddr)); 376 memset(&np->saddr, 0, sizeof(np->saddr));
366 memset(&np->rcv_saddr, 0, sizeof(np->rcv_saddr)); 377 memset(&sk->sk_v6_rcv_saddr, 0, sizeof(sk->sk_v6_rcv_saddr));
367 } 378 }
368#endif 379#endif
369} 380}
@@ -386,7 +397,7 @@ static inline int sk_mc_loop(struct sock *sk)
386 return 1; 397 return 1;
387} 398}
388 399
389extern bool ip_call_ra_chain(struct sk_buff *skb); 400bool ip_call_ra_chain(struct sk_buff *skb);
390 401
391/* 402/*
392 * Functions provided by ip_fragment.c 403 * Functions provided by ip_fragment.c
@@ -424,50 +435,52 @@ int ip_frag_nqueues(struct net *net);
424 * Functions provided by ip_forward.c 435 * Functions provided by ip_forward.c
425 */ 436 */
426 437
427extern int ip_forward(struct sk_buff *skb); 438int ip_forward(struct sk_buff *skb);
428 439
429/* 440/*
430 * Functions provided by ip_options.c 441 * Functions provided by ip_options.c
431 */ 442 */
432 443
433extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, 444void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
434 __be32 daddr, struct rtable *rt, int is_frag); 445 __be32 daddr, struct rtable *rt, int is_frag);
435extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 446int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
436extern void ip_options_fragment(struct sk_buff *skb); 447void ip_options_fragment(struct sk_buff *skb);
437extern int ip_options_compile(struct net *net, 448int ip_options_compile(struct net *net, struct ip_options *opt,
438 struct ip_options *opt, struct sk_buff *skb); 449 struct sk_buff *skb);
439extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, 450int ip_options_get(struct net *net, struct ip_options_rcu **optp,
440 unsigned char *data, int optlen); 451 unsigned char *data, int optlen);
441extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, 452int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
442 unsigned char __user *data, int optlen); 453 unsigned char __user *data, int optlen);
443extern void ip_options_undo(struct ip_options * opt); 454void ip_options_undo(struct ip_options *opt);
444extern void ip_forward_options(struct sk_buff *skb); 455void ip_forward_options(struct sk_buff *skb);
445extern int ip_options_rcv_srr(struct sk_buff *skb); 456int ip_options_rcv_srr(struct sk_buff *skb);
446 457
447/* 458/*
448 * Functions provided by ip_sockglue.c 459 * Functions provided by ip_sockglue.c
449 */ 460 */
450 461
451extern void ipv4_pktinfo_prepare(struct sk_buff *skb); 462void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
452extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 463void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
453extern int ip_cmsg_send(struct net *net, 464int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc);
454 struct msghdr *msg, struct ipcm_cookie *ipc); 465int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
455extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); 466 unsigned int optlen);
456extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 467int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
457extern int compat_ip_setsockopt(struct sock *sk, int level, 468 int __user *optlen);
458 int optname, char __user *optval, unsigned int optlen); 469int compat_ip_setsockopt(struct sock *sk, int level, int optname,
459extern int compat_ip_getsockopt(struct sock *sk, int level, 470 char __user *optval, unsigned int optlen);
460 int optname, char __user *optval, int __user *optlen); 471int compat_ip_getsockopt(struct sock *sk, int level, int optname,
461extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 472 char __user *optval, int __user *optlen);
462 473int ip_ra_control(struct sock *sk, unsigned char on,
463extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 474 void (*destructor)(struct sock *));
464extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 475
465 __be16 port, u32 info, u8 *payload); 476int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len);
466extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, 477void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
467 u32 info); 478 u32 info, u8 *payload);
479void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
480 u32 info);
468 481
469#ifdef CONFIG_PROC_FS 482#ifdef CONFIG_PROC_FS
470extern int ip_misc_proc_init(void); 483int ip_misc_proc_init(void);
471#endif 484#endif
472 485
473#endif /* _IP_H */ 486#endif /* _IP_H */
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 7686e3f5033d..9e3c540c1b11 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
66 } 66 }
67} 67}
68 68
69#if IS_ENABLED(CONFIG_IPV6)
69static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 70static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
70{ 71{
71 struct ipv6_pinfo *np = inet6_sk(sk); 72 struct ipv6_pinfo *np = inet6_sk(sk);
72 73
73 __tcp_v6_send_check(skb, &np->saddr, &np->daddr); 74 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
74} 75}
76#endif
75 77
76int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
77#endif 79#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 48ec25a7fcb6..2182525e4d74 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
165static inline void rt6_clean_expires(struct rt6_info *rt) 165static inline void rt6_clean_expires(struct rt6_info *rt)
166{ 166{
167 rt->rt6i_flags &= ~RTF_EXPIRES; 167 rt->rt6i_flags &= ~RTF_EXPIRES;
168 rt->dst.expires = 0;
168} 169}
169 170
170static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 171static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
@@ -267,48 +268,39 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
267 * exported functions 268 * exported functions
268 */ 269 */
269 270
270extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 271struct fib6_table *fib6_get_table(struct net *net, u32 id);
271extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 272struct fib6_table *fib6_new_table(struct net *net, u32 id);
272extern struct dst_entry *fib6_rule_lookup(struct net *net, 273struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
273 struct flowi6 *fl6, int flags, 274 int flags, pol_lookup_t lookup);
274 pol_lookup_t lookup);
275 275
276extern struct fib6_node *fib6_lookup(struct fib6_node *root, 276struct fib6_node *fib6_lookup(struct fib6_node *root,
277 const struct in6_addr *daddr, 277 const struct in6_addr *daddr,
278 const struct in6_addr *saddr); 278 const struct in6_addr *saddr);
279 279
280struct fib6_node *fib6_locate(struct fib6_node *root, 280struct fib6_node *fib6_locate(struct fib6_node *root,
281 const struct in6_addr *daddr, int dst_len, 281 const struct in6_addr *daddr, int dst_len,
282 const struct in6_addr *saddr, int src_len); 282 const struct in6_addr *saddr, int src_len);
283 283
284extern void fib6_clean_all_ro(struct net *net, 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 int (*func)(struct rt6_info *, void *arg), 285 int prune, void *arg);
286 int prune, void *arg);
287 286
288extern void fib6_clean_all(struct net *net, 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info);
289 int (*func)(struct rt6_info *, void *arg),
290 int prune, void *arg);
291 288
292extern int fib6_add(struct fib6_node *root, 289int fib6_del(struct rt6_info *rt, struct nl_info *info);
293 struct rt6_info *rt,
294 struct nl_info *info);
295 290
296extern int fib6_del(struct rt6_info *rt, 291void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info);
297 struct nl_info *info);
298 292
299extern void inet6_rt_notify(int event, struct rt6_info *rt, 293void fib6_run_gc(unsigned long expires, struct net *net, bool force);
300 struct nl_info *info);
301 294
302extern void fib6_run_gc(unsigned long expires, 295void fib6_gc_cleanup(void);
303 struct net *net, bool force);
304 296
305extern void fib6_gc_cleanup(void); 297int fib6_init(void);
306 298
307extern int fib6_init(void); 299int ipv6_route_open(struct inode *inode, struct file *file);
308 300
309#ifdef CONFIG_IPV6_MULTIPLE_TABLES 301#ifdef CONFIG_IPV6_MULTIPLE_TABLES
310extern int fib6_rules_init(void); 302int fib6_rules_init(void);
311extern void fib6_rules_cleanup(void); 303void fib6_rules_cleanup(void);
312#else 304#else
313static inline int fib6_rules_init(void) 305static inline int fib6_rules_init(void)
314{ 306{
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f525e7038cca..733747ce163c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,7 +51,7 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 51 return (flags >> 3) & 7;
52} 52}
53 53
54extern void rt6_bind_peer(struct rt6_info *rt, int create); 54void rt6_bind_peer(struct rt6_info *rt, int create);
55 55
56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create) 56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
57{ 57{
@@ -72,70 +72,58 @@ static inline struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
72 return __rt6_get_peer(rt, 1); 72 return __rt6_get_peer(rt, 1);
73} 73}
74 74
75extern void ip6_route_input(struct sk_buff *skb); 75void ip6_route_input(struct sk_buff *skb);
76 76
77extern struct dst_entry * ip6_route_output(struct net *net, 77struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
78 const struct sock *sk, 78 struct flowi6 *fl6);
79 struct flowi6 *fl6); 79struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
80extern struct dst_entry * ip6_route_lookup(struct net *net, 80 int flags);
81 struct flowi6 *fl6, int flags);
82 81
83extern int ip6_route_init(void); 82int ip6_route_init(void);
84extern void ip6_route_cleanup(void); 83void ip6_route_cleanup(void);
85 84
86extern int ipv6_route_ioctl(struct net *net, 85int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
87 unsigned int cmd,
88 void __user *arg);
89 86
90extern int ip6_route_add(struct fib6_config *cfg); 87int ip6_route_add(struct fib6_config *cfg);
91extern int ip6_ins_rt(struct rt6_info *); 88int ip6_ins_rt(struct rt6_info *);
92extern int ip6_del_rt(struct rt6_info *); 89int ip6_del_rt(struct rt6_info *);
93 90
94extern int ip6_route_get_saddr(struct net *net, 91int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
95 struct rt6_info *rt, 92 const struct in6_addr *daddr, unsigned int prefs,
96 const struct in6_addr *daddr, 93 struct in6_addr *saddr);
97 unsigned int prefs,
98 struct in6_addr *saddr);
99 94
100extern struct rt6_info *rt6_lookup(struct net *net, 95struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
101 const struct in6_addr *daddr, 96 const struct in6_addr *saddr, int oif, int flags);
102 const struct in6_addr *saddr,
103 int oif, int flags);
104 97
105extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 98struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
106 struct flowi6 *fl6); 99int icmp6_dst_gc(void);
107extern int icmp6_dst_gc(void);
108 100
109extern void fib6_force_start_gc(struct net *net); 101void fib6_force_start_gc(struct net *net);
110 102
111extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 103struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
112 const struct in6_addr *addr, 104 const struct in6_addr *addr, bool anycast);
113 bool anycast);
114 105
115/* 106/*
116 * support functions for ND 107 * support functions for ND
117 * 108 *
118 */ 109 */
119extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr, 110struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr,
120 struct net_device *dev); 111 struct net_device *dev);
121extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr, 112struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr,
122 struct net_device *dev, 113 struct net_device *dev, unsigned int pref);
123 unsigned int pref); 114
124 115void rt6_purge_dflt_routers(struct net *net);
125extern void rt6_purge_dflt_routers(struct net *net); 116
126 117int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
127extern int rt6_route_rcv(struct net_device *dev, 118 const struct in6_addr *gwaddr);
128 u8 *opt, int len, 119
129 const struct in6_addr *gwaddr); 120void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
130 121 u32 mark);
131extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, 122void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
132 int oif, u32 mark); 123void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
133extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, 124void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
134 __be32 mtu); 125 u32 mark);
135extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark); 126void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
136extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
137 u32 mark);
138extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
139 127
140struct netlink_callback; 128struct netlink_callback;
141 129
@@ -145,10 +133,10 @@ struct rt6_rtnl_dump_arg {
145 struct net *net; 133 struct net *net;
146}; 134};
147 135
148extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 136int rt6_dump_route(struct rt6_info *rt, void *p_arg);
149extern void rt6_ifdown(struct net *net, struct net_device *dev); 137void rt6_ifdown(struct net *net, struct net_device *dev);
150extern void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 138void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
151extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 139void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
152 140
153 141
154/* 142/*
@@ -194,11 +182,9 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
194 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 182 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
195} 183}
196 184
197static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest) 185static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
198{ 186{
199 if (rt->rt6i_flags & RTF_GATEWAY) 187 return &rt->rt6i_gateway;
200 return &rt->rt6i_gateway;
201 return dest;
202} 188}
203 189
204#endif 190#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index cbf2be37c91a..9922093f575e 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -165,7 +165,7 @@ struct fib_result_nl {
165#define FIB_TABLE_HASHSZ 2 165#define FIB_TABLE_HASHSZ 2
166#endif 166#endif
167 167
168extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); 168__be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
169 169
170#define FIB_RES_SADDR(net, res) \ 170#define FIB_RES_SADDR(net, res) \
171 ((FIB_RES_NH(res).nh_saddr_genid == \ 171 ((FIB_RES_NH(res).nh_saddr_genid == \
@@ -187,14 +187,14 @@ struct fib_table {
187 unsigned long tb_data[0]; 187 unsigned long tb_data[0];
188}; 188};
189 189
190extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 190int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
191 struct fib_result *res, int fib_flags); 191 struct fib_result *res, int fib_flags);
192extern int fib_table_insert(struct fib_table *, struct fib_config *); 192int fib_table_insert(struct fib_table *, struct fib_config *);
193extern int fib_table_delete(struct fib_table *, struct fib_config *); 193int fib_table_delete(struct fib_table *, struct fib_config *);
194extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 194int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
195 struct netlink_callback *cb); 195 struct netlink_callback *cb);
196extern int fib_table_flush(struct fib_table *table); 196int fib_table_flush(struct fib_table *table);
197extern void fib_free_table(struct fib_table *tb); 197void fib_free_table(struct fib_table *tb);
198 198
199 199
200 200
@@ -234,14 +234,13 @@ static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
234} 234}
235 235
236#else /* CONFIG_IP_MULTIPLE_TABLES */ 236#else /* CONFIG_IP_MULTIPLE_TABLES */
237extern int __net_init fib4_rules_init(struct net *net); 237int __net_init fib4_rules_init(struct net *net);
238extern void __net_exit fib4_rules_exit(struct net *net); 238void __net_exit fib4_rules_exit(struct net *net);
239 239
240extern struct fib_table *fib_new_table(struct net *net, u32 id); 240struct fib_table *fib_new_table(struct net *net, u32 id);
241extern struct fib_table *fib_get_table(struct net *net, u32 id); 241struct fib_table *fib_get_table(struct net *net, u32 id);
242 242
243extern int __fib_lookup(struct net *net, struct flowi4 *flp, 243int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res);
244 struct fib_result *res);
245 244
246static inline int fib_lookup(struct net *net, struct flowi4 *flp, 245static inline int fib_lookup(struct net *net, struct flowi4 *flp,
247 struct fib_result *res) 246 struct fib_result *res)
@@ -269,12 +268,12 @@ static inline int fib_lookup(struct net *net, struct flowi4 *flp,
269 268
270/* Exported by fib_frontend.c */ 269/* Exported by fib_frontend.c */
271extern const struct nla_policy rtm_ipv4_policy[]; 270extern const struct nla_policy rtm_ipv4_policy[];
272extern void ip_fib_init(void); 271void ip_fib_init(void);
273extern __be32 fib_compute_spec_dst(struct sk_buff *skb); 272__be32 fib_compute_spec_dst(struct sk_buff *skb);
274extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, 273int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
275 u8 tos, int oif, struct net_device *dev, 274 u8 tos, int oif, struct net_device *dev,
276 struct in_device *idev, u32 *itag); 275 struct in_device *idev, u32 *itag);
277extern void fib_select_default(struct fib_result *res); 276void fib_select_default(struct fib_result *res);
278#ifdef CONFIG_IP_ROUTE_CLASSID 277#ifdef CONFIG_IP_ROUTE_CLASSID
279static inline int fib_num_tclassid_users(struct net *net) 278static inline int fib_num_tclassid_users(struct net *net)
280{ 279{
@@ -288,15 +287,15 @@ static inline int fib_num_tclassid_users(struct net *net)
288#endif 287#endif
289 288
290/* Exported by fib_semantics.c */ 289/* Exported by fib_semantics.c */
291extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 290int ip_fib_check_default(__be32 gw, struct net_device *dev);
292extern int fib_sync_down_dev(struct net_device *dev, int force); 291int fib_sync_down_dev(struct net_device *dev, int force);
293extern int fib_sync_down_addr(struct net *net, __be32 local); 292int fib_sync_down_addr(struct net *net, __be32 local);
294extern int fib_sync_up(struct net_device *dev); 293int fib_sync_up(struct net_device *dev);
295extern void fib_select_multipath(struct fib_result *res); 294void fib_select_multipath(struct fib_result *res);
296 295
297/* Exported by fib_trie.c */ 296/* Exported by fib_trie.c */
298extern void fib_trie_init(void); 297void fib_trie_init(void);
299extern struct fib_table *fib_trie_table(u32 id); 298struct fib_table *fib_trie_table(u32 id);
300 299
301static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) 300static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
302{ 301{
@@ -314,7 +313,7 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
314#endif 313#endif
315} 314}
316 315
317extern void free_fib_info(struct fib_info *fi); 316void free_fib_info(struct fib_info *fi);
318 317
319static inline void fib_info_put(struct fib_info *fi) 318static inline void fib_info_put(struct fib_info *fi)
320{ 319{
@@ -323,8 +322,8 @@ static inline void fib_info_put(struct fib_info *fi)
323} 322}
324 323
325#ifdef CONFIG_PROC_FS 324#ifdef CONFIG_PROC_FS
326extern int __net_init fib_proc_init(struct net *net); 325int __net_init fib_proc_init(struct net *net);
327extern void __net_exit fib_proc_exit(struct net *net); 326void __net_exit fib_proc_exit(struct net *net);
328#else 327#else
329static inline int fib_proc_init(struct net *net) 328static inline int fib_proc_init(struct net *net)
330{ 329{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index a0a4a100f5c9..732f8c6ae975 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -150,6 +150,9 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
150 __be32 src, __be32 dst, __u8 proto, 150 __be32 src, __be32 dst, __u8 proto,
151 __u8 tos, __u8 ttl, __be16 df, bool xnet); 151 __u8 tos, __u8 ttl, __be16 df, bool xnet);
152 152
153struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
154 int gso_type_mask);
155
153static inline void iptunnel_xmit_stats(int err, 156static inline void iptunnel_xmit_stats(int err,
154 struct net_device_stats *err_stats, 157 struct net_device_stats *err_stats,
155 struct pcpu_tstats __percpu *stats) 158 struct pcpu_tstats __percpu *stats)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index f0d70f066f3d..5679d927562b 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -109,7 +109,6 @@ extern int ip_vs_conn_tab_size;
109struct ip_vs_iphdr { 109struct ip_vs_iphdr {
110 __u32 len; /* IPv4 simply where L4 starts 110 __u32 len; /* IPv4 simply where L4 starts
111 IPv6 where L4 Transport Header starts */ 111 IPv6 where L4 Transport Header starts */
112 __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */
113 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
114 __s16 protocol; 113 __s16 protocol;
115 __s32 flags; 114 __s32 flags;
@@ -117,34 +116,12 @@ struct ip_vs_iphdr {
117 union nf_inet_addr daddr; 116 union nf_inet_addr daddr;
118}; 117};
119 118
120/* Dependency to module: nf_defrag_ipv6 */
121#if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
122static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
123{
124 return skb->nfct_reasm;
125}
126static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh)
129{
130 if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb)))
131 return skb_header_pointer(skb_nfct_reasm(skb),
132 ipvsh->thoff_reasm, len, buffer);
133
134 return skb_header_pointer(skb, offset, len, buffer);
135}
136#else
137static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
138{
139 return NULL;
140}
141static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, 119static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
142 int len, void *buffer, 120 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh) 121 const struct ip_vs_iphdr *ipvsh)
144{ 122{
145 return skb_header_pointer(skb, offset, len, buffer); 123 return skb_header_pointer(skb, offset, len, buffer);
146} 124}
147#endif
148 125
149static inline void 126static inline void
150ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) 127ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr)
@@ -171,19 +148,12 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
171 (struct ipv6hdr *)skb_network_header(skb); 148 (struct ipv6hdr *)skb_network_header(skb);
172 iphdr->saddr.in6 = iph->saddr; 149 iphdr->saddr.in6 = iph->saddr;
173 iphdr->daddr.in6 = iph->daddr; 150 iphdr->daddr.in6 = iph->daddr;
174 /* ipv6_find_hdr() updates len, flags, thoff_reasm */ 151 /* ipv6_find_hdr() updates len, flags */
175 iphdr->thoff_reasm = 0;
176 iphdr->len = 0; 152 iphdr->len = 0;
177 iphdr->flags = 0; 153 iphdr->flags = 0;
178 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, 154 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
179 &iphdr->fragoffs, 155 &iphdr->fragoffs,
180 &iphdr->flags); 156 &iphdr->flags);
181 /* get proto from re-assembled packet and it's offset */
182 if (skb_nfct_reasm(skb))
183 iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb),
184 &iphdr->thoff_reasm,
185 -1, NULL, NULL);
186
187 } else 157 } else
188#endif 158#endif
189 { 159 {
@@ -236,7 +206,7 @@ static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
236#ifdef CONFIG_IP_VS_DEBUG 206#ifdef CONFIG_IP_VS_DEBUG
237#include <linux/net.h> 207#include <linux/net.h>
238 208
239extern int ip_vs_get_debug_level(void); 209int ip_vs_get_debug_level(void);
240 210
241static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, 211static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
242 const union nf_inet_addr *addr, 212 const union nf_inet_addr *addr,
@@ -532,9 +502,9 @@ struct ip_vs_proto_data {
532 struct tcp_states_t *tcp_state_table; 502 struct tcp_states_t *tcp_state_table;
533}; 503};
534 504
535extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); 505struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
536extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, 506struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
537 unsigned short proto); 507 unsigned short proto);
538 508
539struct ip_vs_conn_param { 509struct ip_vs_conn_param {
540 struct net *net; 510 struct net *net;
@@ -723,8 +693,6 @@ struct ip_vs_dest_dst {
723 struct rcu_head rcu_head; 693 struct rcu_head rcu_head;
724}; 694};
725 695
726/* In grace period after removing */
727#define IP_VS_DEST_STATE_REMOVING 0x01
728/* 696/*
729 * The real server destination forwarding entry 697 * The real server destination forwarding entry
730 * with ip address, port number, and so on. 698 * with ip address, port number, and so on.
@@ -742,7 +710,7 @@ struct ip_vs_dest {
742 710
743 atomic_t refcnt; /* reference counter */ 711 atomic_t refcnt; /* reference counter */
744 struct ip_vs_stats stats; /* statistics */ 712 struct ip_vs_stats stats; /* statistics */
745 unsigned long state; /* state flags */ 713 unsigned long idle_start; /* start time, jiffies */
746 714
747 /* connection counters and thresholds */ 715 /* connection counters and thresholds */
748 atomic_t activeconns; /* active connections */ 716 atomic_t activeconns; /* active connections */
@@ -756,14 +724,13 @@ struct ip_vs_dest {
756 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ 724 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */
757 725
758 /* for virtual service */ 726 /* for virtual service */
759 struct ip_vs_service *svc; /* service it belongs to */ 727 struct ip_vs_service __rcu *svc; /* service it belongs to */
760 __u16 protocol; /* which protocol (TCP/UDP) */ 728 __u16 protocol; /* which protocol (TCP/UDP) */
761 __be16 vport; /* virtual port number */ 729 __be16 vport; /* virtual port number */
762 union nf_inet_addr vaddr; /* virtual IP address */ 730 union nf_inet_addr vaddr; /* virtual IP address */
763 __u32 vfwmark; /* firewall mark of service */ 731 __u32 vfwmark; /* firewall mark of service */
764 732
765 struct list_head t_list; /* in dest_trash */ 733 struct list_head t_list; /* in dest_trash */
766 struct rcu_head rcu_head;
767 unsigned int in_rs_table:1; /* we are in rs_table */ 734 unsigned int in_rs_table:1; /* we are in rs_table */
768}; 735};
769 736
@@ -1176,8 +1143,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1176 * IPVS core functions 1143 * IPVS core functions
1177 * (from ip_vs_core.c) 1144 * (from ip_vs_core.c)
1178 */ 1145 */
1179extern const char *ip_vs_proto_name(unsigned int proto); 1146const char *ip_vs_proto_name(unsigned int proto);
1180extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1147void ip_vs_init_hash_table(struct list_head *table, int rows);
1181#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) 1148#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
1182 1149
1183#define IP_VS_APP_TYPE_FTP 1 1150#define IP_VS_APP_TYPE_FTP 1
@@ -1240,22 +1207,22 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1240 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic_dec();
1241 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1242} 1209}
1243extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
1244extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 1211void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1245 1212
1246struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1213struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
1247 const union nf_inet_addr *daddr, 1214 const union nf_inet_addr *daddr,
1248 __be16 dport, unsigned int flags, 1215 __be16 dport, unsigned int flags,
1249 struct ip_vs_dest *dest, __u32 fwmark); 1216 struct ip_vs_dest *dest, __u32 fwmark);
1250extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1217void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1251 1218
1252extern const char * ip_vs_state_name(__u16 proto, int state); 1219const char *ip_vs_state_name(__u16 proto, int state);
1253 1220
1254extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); 1221void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
1255extern int ip_vs_check_template(struct ip_vs_conn *ct); 1222int ip_vs_check_template(struct ip_vs_conn *ct);
1256extern void ip_vs_random_dropentry(struct net *net); 1223void ip_vs_random_dropentry(struct net *net);
1257extern int ip_vs_conn_init(void); 1224int ip_vs_conn_init(void);
1258extern void ip_vs_conn_cleanup(void); 1225void ip_vs_conn_cleanup(void);
1259 1226
1260static inline void ip_vs_control_del(struct ip_vs_conn *cp) 1227static inline void ip_vs_control_del(struct ip_vs_conn *cp)
1261{ 1228{
@@ -1320,37 +1287,36 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1320/* 1287/*
1321 * IPVS netns init & cleanup functions 1288 * IPVS netns init & cleanup functions
1322 */ 1289 */
1323extern int ip_vs_estimator_net_init(struct net *net); 1290int ip_vs_estimator_net_init(struct net *net);
1324extern int ip_vs_control_net_init(struct net *net); 1291int ip_vs_control_net_init(struct net *net);
1325extern int ip_vs_protocol_net_init(struct net *net); 1292int ip_vs_protocol_net_init(struct net *net);
1326extern int ip_vs_app_net_init(struct net *net); 1293int ip_vs_app_net_init(struct net *net);
1327extern int ip_vs_conn_net_init(struct net *net); 1294int ip_vs_conn_net_init(struct net *net);
1328extern int ip_vs_sync_net_init(struct net *net); 1295int ip_vs_sync_net_init(struct net *net);
1329extern void ip_vs_conn_net_cleanup(struct net *net); 1296void ip_vs_conn_net_cleanup(struct net *net);
1330extern void ip_vs_app_net_cleanup(struct net *net); 1297void ip_vs_app_net_cleanup(struct net *net);
1331extern void ip_vs_protocol_net_cleanup(struct net *net); 1298void ip_vs_protocol_net_cleanup(struct net *net);
1332extern void ip_vs_control_net_cleanup(struct net *net); 1299void ip_vs_control_net_cleanup(struct net *net);
1333extern void ip_vs_estimator_net_cleanup(struct net *net); 1300void ip_vs_estimator_net_cleanup(struct net *net);
1334extern void ip_vs_sync_net_cleanup(struct net *net); 1301void ip_vs_sync_net_cleanup(struct net *net);
1335extern void ip_vs_service_net_cleanup(struct net *net); 1302void ip_vs_service_net_cleanup(struct net *net);
1336 1303
1337/* 1304/*
1338 * IPVS application functions 1305 * IPVS application functions
1339 * (from ip_vs_app.c) 1306 * (from ip_vs_app.c)
1340 */ 1307 */
1341#define IP_VS_APP_MAX_PORTS 8 1308#define IP_VS_APP_MAX_PORTS 8
1342extern struct ip_vs_app *register_ip_vs_app(struct net *net, 1309struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
1343 struct ip_vs_app *app); 1310void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1344extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); 1311int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1345extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1312void ip_vs_unbind_app(struct ip_vs_conn *cp);
1346extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1313int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
1347extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, 1314 __u16 port);
1348 __u16 proto, __u16 port); 1315int ip_vs_app_inc_get(struct ip_vs_app *inc);
1349extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 1316void ip_vs_app_inc_put(struct ip_vs_app *inc);
1350extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 1317
1351 1318int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1352extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1319int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1353extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1354 1320
1355int register_ip_vs_pe(struct ip_vs_pe *pe); 1321int register_ip_vs_pe(struct ip_vs_pe *pe);
1356int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1322int unregister_ip_vs_pe(struct ip_vs_pe *pe);
@@ -1371,17 +1337,15 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1371/* 1337/*
1372 * IPVS protocol functions (from ip_vs_proto.c) 1338 * IPVS protocol functions (from ip_vs_proto.c)
1373 */ 1339 */
1374extern int ip_vs_protocol_init(void); 1340int ip_vs_protocol_init(void);
1375extern void ip_vs_protocol_cleanup(void); 1341void ip_vs_protocol_cleanup(void);
1376extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1342void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
1377extern int *ip_vs_create_timeout_table(int *table, int size); 1343int *ip_vs_create_timeout_table(int *table, int size);
1378extern int 1344int ip_vs_set_state_timeout(int *table, int num, const char *const *names,
1379ip_vs_set_state_timeout(int *table, int num, const char *const *names, 1345 const char *name, int to);
1380 const char *name, int to); 1346void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
1381extern void 1347 const struct sk_buff *skb, int offset,
1382ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, 1348 const char *msg);
1383 const struct sk_buff *skb,
1384 int offset, const char *msg);
1385 1349
1386extern struct ip_vs_protocol ip_vs_protocol_tcp; 1350extern struct ip_vs_protocol ip_vs_protocol_tcp;
1387extern struct ip_vs_protocol ip_vs_protocol_udp; 1351extern struct ip_vs_protocol ip_vs_protocol_udp;
@@ -1394,22 +1358,22 @@ extern struct ip_vs_protocol ip_vs_protocol_sctp;
1394 * Registering/unregistering scheduler functions 1358 * Registering/unregistering scheduler functions
1395 * (from ip_vs_sched.c) 1359 * (from ip_vs_sched.c)
1396 */ 1360 */
1397extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1361int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1398extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1362int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1399extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1363int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1400 struct ip_vs_scheduler *scheduler); 1364 struct ip_vs_scheduler *scheduler);
1401extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, 1365void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1402 struct ip_vs_scheduler *sched); 1366 struct ip_vs_scheduler *sched);
1403extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1367struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1404extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1368void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1405extern struct ip_vs_conn * 1369struct ip_vs_conn *
1406ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1370ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1407 struct ip_vs_proto_data *pd, int *ignored, 1371 struct ip_vs_proto_data *pd, int *ignored,
1408 struct ip_vs_iphdr *iph); 1372 struct ip_vs_iphdr *iph);
1409extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1373int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1410 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); 1374 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1411 1375
1412extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1376void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1413 1377
1414 1378
1415/* 1379/*
@@ -1418,25 +1382,24 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1418extern struct ip_vs_stats ip_vs_stats; 1382extern struct ip_vs_stats ip_vs_stats;
1419extern int sysctl_ip_vs_sync_ver; 1383extern int sysctl_ip_vs_sync_ver;
1420 1384
1421extern struct ip_vs_service * 1385struct ip_vs_service *
1422ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, 1386ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,
1423 const union nf_inet_addr *vaddr, __be16 vport); 1387 const union nf_inet_addr *vaddr, __be16 vport);
1424 1388
1425extern bool 1389bool ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1426ip_vs_has_real_service(struct net *net, int af, __u16 protocol, 1390 const union nf_inet_addr *daddr, __be16 dport);
1427 const union nf_inet_addr *daddr, __be16 dport); 1391
1428 1392int ip_vs_use_count_inc(void);
1429extern int ip_vs_use_count_inc(void); 1393void ip_vs_use_count_dec(void);
1430extern void ip_vs_use_count_dec(void); 1394int ip_vs_register_nl_ioctl(void);
1431extern int ip_vs_register_nl_ioctl(void); 1395void ip_vs_unregister_nl_ioctl(void);
1432extern void ip_vs_unregister_nl_ioctl(void); 1396int ip_vs_control_init(void);
1433extern int ip_vs_control_init(void); 1397void ip_vs_control_cleanup(void);
1434extern void ip_vs_control_cleanup(void); 1398struct ip_vs_dest *
1435extern struct ip_vs_dest *
1436ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1399ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1437 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1400 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1438 __u16 protocol, __u32 fwmark, __u32 flags); 1401 __u16 protocol, __u32 fwmark, __u32 flags);
1439extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1402void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1440 1403
1441static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) 1404static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1442{ 1405{
@@ -1449,60 +1412,59 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1449 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1450} 1413}
1451 1414
1415static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
1416{
1417 if (atomic_dec_return(&dest->refcnt) < 0)
1418 kfree(dest);
1419}
1420
1452/* 1421/*
1453 * IPVS sync daemon data and function prototypes 1422 * IPVS sync daemon data and function prototypes
1454 * (from ip_vs_sync.c) 1423 * (from ip_vs_sync.c)
1455 */ 1424 */
1456extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, 1425int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
1457 __u8 syncid); 1426int stop_sync_thread(struct net *net, int state);
1458extern int stop_sync_thread(struct net *net, int state); 1427void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1459extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1460
1461 1428
1462/* 1429/*
1463 * IPVS rate estimator prototypes (from ip_vs_est.c) 1430 * IPVS rate estimator prototypes (from ip_vs_est.c)
1464 */ 1431 */
1465extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1432void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1466extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1433void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1467extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1434void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1468extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1435void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1469 struct ip_vs_stats *stats); 1436 struct ip_vs_stats *stats);
1470 1437
1471/* 1438/*
1472 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1439 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1473 */ 1440 */
1474extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1441int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1475 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1442 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1476extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1443int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1477 struct ip_vs_protocol *pp, 1444 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1478 struct ip_vs_iphdr *iph); 1445int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1479extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1446 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1480 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1447int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1481extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1448 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1482 struct ip_vs_protocol *pp, 1449int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1483 struct ip_vs_iphdr *iph); 1450 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1484extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1451int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1485 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1452 struct ip_vs_protocol *pp, int offset,
1486extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1453 unsigned int hooknum, struct ip_vs_iphdr *iph);
1487 struct ip_vs_protocol *pp, int offset, 1454void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1488 unsigned int hooknum, struct ip_vs_iphdr *iph);
1489extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1490 1455
1491#ifdef CONFIG_IP_VS_IPV6 1456#ifdef CONFIG_IP_VS_IPV6
1492extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1457int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1493 struct ip_vs_protocol *pp, 1458 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1494 struct ip_vs_iphdr *iph); 1459int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1495extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1460 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1496 struct ip_vs_protocol *pp, 1461int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1497 struct ip_vs_iphdr *iph); 1462 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1498extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1463int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1499 struct ip_vs_protocol *pp, 1464 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1500 struct ip_vs_iphdr *iph); 1465int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1501extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1466 struct ip_vs_protocol *pp, int offset,
1502 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1467 unsigned int hooknum, struct ip_vs_iphdr *iph);
1503extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1504 struct ip_vs_protocol *pp, int offset,
1505 unsigned int hooknum, struct ip_vs_iphdr *iph);
1506#endif 1468#endif
1507 1469
1508#ifdef CONFIG_SYSCTL 1470#ifdef CONFIG_SYSCTL
@@ -1551,15 +1513,15 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
1551 return fwd; 1513 return fwd;
1552} 1514}
1553 1515
1554extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 1516void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
1555 struct ip_vs_conn *cp, int dir); 1517 struct ip_vs_conn *cp, int dir);
1556 1518
1557#ifdef CONFIG_IP_VS_IPV6 1519#ifdef CONFIG_IP_VS_IPV6
1558extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, 1520void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,
1559 struct ip_vs_conn *cp, int dir); 1521 struct ip_vs_conn *cp, int dir);
1560#endif 1522#endif
1561 1523
1562extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 1524__sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
1563 1525
1564static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) 1526static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
1565{ 1527{
@@ -1618,13 +1580,13 @@ static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1618#endif 1580#endif
1619} 1581}
1620 1582
1621extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1583void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
1622 int outin); 1584 int outin);
1623extern int ip_vs_confirm_conntrack(struct sk_buff *skb); 1585int ip_vs_confirm_conntrack(struct sk_buff *skb);
1624extern void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, 1586void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct,
1625 struct ip_vs_conn *cp, u_int8_t proto, 1587 struct ip_vs_conn *cp, u_int8_t proto,
1626 const __be16 port, int from_rs); 1588 const __be16 port, int from_rs);
1627extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); 1589void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1628 1590
1629#else 1591#else
1630 1592
@@ -1649,7 +1611,7 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1649/* CONFIG_IP_VS_NFCT */ 1611/* CONFIG_IP_VS_NFCT */
1650#endif 1612#endif
1651 1613
1652static inline unsigned int 1614static inline int
1653ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1615ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1654{ 1616{
1655 /* 1617 /*
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index bbf1c8fb8511..488316e339a1 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -110,7 +110,8 @@ struct frag_hdr {
110 __be32 identification; 110 __be32 identification;
111}; 111};
112 112
113#define IP6_MF 0x0001 113#define IP6_MF 0x0001
114#define IP6_OFFSET 0xFFF8
114 115
115#include <net/sock.h> 116#include <net/sock.h>
116 117
@@ -244,14 +245,15 @@ struct ipv6_fl_socklist {
244 struct rcu_head rcu; 245 struct rcu_head rcu;
245}; 246};
246 247
247extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 248struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
248extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 249struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
249 struct ip6_flowlabel * fl, 250 struct ip6_flowlabel *fl,
250 struct ipv6_txoptions * fopt); 251 struct ipv6_txoptions *fopt);
251extern void fl6_free_socklist(struct sock *sk); 252void fl6_free_socklist(struct sock *sk);
252extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); 253int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
253extern int ip6_flowlabel_init(void); 254int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq);
254extern void ip6_flowlabel_cleanup(void); 255int ip6_flowlabel_init(void);
256void ip6_flowlabel_cleanup(void);
255 257
256static inline void fl6_sock_release(struct ip6_flowlabel *fl) 258static inline void fl6_sock_release(struct ip6_flowlabel *fl)
257{ 259{
@@ -259,7 +261,7 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
259 atomic_dec(&fl->users); 261 atomic_dec(&fl->users);
260} 262}
261 263
262extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 264void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
263 265
264int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, 266int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
265 struct icmp6hdr *thdr, int len); 267 struct icmp6hdr *thdr, int len);
@@ -267,19 +269,21 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
267struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, 269struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
268 struct sock *sk, struct flowi6 *fl6); 270 struct sock *sk, struct flowi6 *fl6);
269 271
270extern int ip6_ra_control(struct sock *sk, int sel); 272int ip6_ra_control(struct sock *sk, int sel);
271 273
272extern int ipv6_parse_hopopts(struct sk_buff *skb); 274int ipv6_parse_hopopts(struct sk_buff *skb);
273 275
274extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 276struct ipv6_txoptions *ipv6_dup_options(struct sock *sk,
275extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 277 struct ipv6_txoptions *opt);
276 int newtype, 278struct ipv6_txoptions *ipv6_renew_options(struct sock *sk,
277 struct ipv6_opt_hdr __user *newopt, 279 struct ipv6_txoptions *opt,
278 int newoptlen); 280 int newtype,
281 struct ipv6_opt_hdr __user *newopt,
282 int newoptlen);
279struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 283struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
280 struct ipv6_txoptions *opt); 284 struct ipv6_txoptions *opt);
281 285
282extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 286bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
283 287
284static inline bool ipv6_accept_ra(struct inet6_dev *idev) 288static inline bool ipv6_accept_ra(struct inet6_dev *idev)
285{ 289{
@@ -306,7 +310,7 @@ static inline int ip6_frag_mem(struct net *net)
306#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ 310#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
307#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 311#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
308 312
309extern int __ipv6_addr_type(const struct in6_addr *addr); 313int __ipv6_addr_type(const struct in6_addr *addr);
310static inline int ipv6_addr_type(const struct in6_addr *addr) 314static inline int ipv6_addr_type(const struct in6_addr *addr)
311{ 315{
312 return __ipv6_addr_type(addr) & 0xffff; 316 return __ipv6_addr_type(addr) & 0xffff;
@@ -537,14 +541,14 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
537} 541}
538 542
539/* more secured version of ipv6_addr_hash() */ 543/* more secured version of ipv6_addr_hash() */
540static inline u32 ipv6_addr_jhash(const struct in6_addr *a) 544static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
541{ 545{
542 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; 546 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
543 547
544 return jhash_3words(v, 548 return jhash_3words(v,
545 (__force u32)a->s6_addr32[2], 549 (__force u32)a->s6_addr32[2],
546 (__force u32)a->s6_addr32[3], 550 (__force u32)a->s6_addr32[3],
547 ipv6_hash_secret); 551 initval);
548} 552}
549 553
550static inline bool ipv6_addr_loopback(const struct in6_addr *a) 554static inline bool ipv6_addr_loopback(const struct in6_addr *a)
@@ -656,9 +660,9 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
656 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 660 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
657} 661}
658 662
659extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 663void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
660 664
661extern int ip6_dst_hoplimit(struct dst_entry *dst); 665int ip6_dst_hoplimit(struct dst_entry *dst);
662 666
663/* 667/*
664 * Header manipulation 668 * Header manipulation
@@ -682,83 +686,65 @@ static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
682 * rcv function (called from netdevice level) 686 * rcv function (called from netdevice level)
683 */ 687 */
684 688
685extern int ipv6_rcv(struct sk_buff *skb, 689int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
686 struct net_device *dev, 690 struct packet_type *pt, struct net_device *orig_dev);
687 struct packet_type *pt,
688 struct net_device *orig_dev);
689 691
690extern int ip6_rcv_finish(struct sk_buff *skb); 692int ip6_rcv_finish(struct sk_buff *skb);
691 693
692/* 694/*
693 * upper-layer output functions 695 * upper-layer output functions
694 */ 696 */
695extern int ip6_xmit(struct sock *sk, 697int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
696 struct sk_buff *skb, 698 struct ipv6_txoptions *opt, int tclass);
697 struct flowi6 *fl6, 699
698 struct ipv6_txoptions *opt, 700int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
699 int tclass); 701
700 702int ip6_append_data(struct sock *sk,
701extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 703 int getfrag(void *from, char *to, int offset, int len,
702 704 int odd, struct sk_buff *skb),
703extern int ip6_append_data(struct sock *sk, 705 void *from, int length, int transhdrlen, int hlimit,
704 int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), 706 int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
705 void *from, 707 struct rt6_info *rt, unsigned int flags, int dontfrag);
706 int length, 708
707 int transhdrlen, 709int ip6_push_pending_frames(struct sock *sk);
708 int hlimit, 710
709 int tclass, 711void ip6_flush_pending_frames(struct sock *sk);
710 struct ipv6_txoptions *opt, 712
711 struct flowi6 *fl6, 713int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
712 struct rt6_info *rt, 714struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
713 unsigned int flags, 715 const struct in6_addr *final_dst,
714 int dontfrag); 716 bool can_sleep);
715 717struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
716extern int ip6_push_pending_frames(struct sock *sk); 718 const struct in6_addr *final_dst,
717 719 bool can_sleep);
718extern void ip6_flush_pending_frames(struct sock *sk); 720struct dst_entry *ip6_blackhole_route(struct net *net,
719 721 struct dst_entry *orig_dst);
720extern int ip6_dst_lookup(struct sock *sk,
721 struct dst_entry **dst,
722 struct flowi6 *fl6);
723extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
724 struct flowi6 *fl6,
725 const struct in6_addr *final_dst,
726 bool can_sleep);
727extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
728 struct flowi6 *fl6,
729 const struct in6_addr *final_dst,
730 bool can_sleep);
731extern struct dst_entry * ip6_blackhole_route(struct net *net,
732 struct dst_entry *orig_dst);
733 722
734/* 723/*
735 * skb processing functions 724 * skb processing functions
736 */ 725 */
737 726
738extern int ip6_output(struct sk_buff *skb); 727int ip6_output(struct sk_buff *skb);
739extern int ip6_forward(struct sk_buff *skb); 728int ip6_forward(struct sk_buff *skb);
740extern int ip6_input(struct sk_buff *skb); 729int ip6_input(struct sk_buff *skb);
741extern int ip6_mc_input(struct sk_buff *skb); 730int ip6_mc_input(struct sk_buff *skb);
742 731
743extern int __ip6_local_out(struct sk_buff *skb); 732int __ip6_local_out(struct sk_buff *skb);
744extern int ip6_local_out(struct sk_buff *skb); 733int ip6_local_out(struct sk_buff *skb);
745 734
746/* 735/*
747 * Extension header (options) processing 736 * Extension header (options) processing
748 */ 737 */
749 738
750extern void ipv6_push_nfrag_opts(struct sk_buff *skb, 739void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
751 struct ipv6_txoptions *opt, 740 u8 *proto, struct in6_addr **daddr_p);
752 u8 *proto, 741void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
753 struct in6_addr **daddr_p); 742 u8 *proto);
754extern void ipv6_push_frag_opts(struct sk_buff *skb,
755 struct ipv6_txoptions *opt,
756 u8 *proto);
757 743
758extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 744int ipv6_skip_exthdr(const struct sk_buff *, int start, u8 *nexthdrp,
759 u8 *nexthdrp, __be16 *frag_offp); 745 __be16 *frag_offp);
760 746
761extern bool ipv6_ext_hdr(u8 nexthdr); 747bool ipv6_ext_hdr(u8 nexthdr);
762 748
763enum { 749enum {
764 IP6_FH_F_FRAG = (1 << 0), 750 IP6_FH_F_FRAG = (1 << 0),
@@ -767,57 +753,46 @@ enum {
767}; 753};
768 754
769/* find specified header and get offset to it */ 755/* find specified header and get offset to it */
770extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 756int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, int target,
771 int target, unsigned short *fragoff, int *fragflg); 757 unsigned short *fragoff, int *fragflg);
772 758
773extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 759int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
774 760
775extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 761struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
776 const struct ipv6_txoptions *opt, 762 const struct ipv6_txoptions *opt,
777 struct in6_addr *orig); 763 struct in6_addr *orig);
778 764
779/* 765/*
780 * socket options (ipv6_sockglue.c) 766 * socket options (ipv6_sockglue.c)
781 */ 767 */
782 768
783extern int ipv6_setsockopt(struct sock *sk, int level, 769int ipv6_setsockopt(struct sock *sk, int level, int optname,
784 int optname, 770 char __user *optval, unsigned int optlen);
785 char __user *optval, 771int ipv6_getsockopt(struct sock *sk, int level, int optname,
786 unsigned int optlen); 772 char __user *optval, int __user *optlen);
787extern int ipv6_getsockopt(struct sock *sk, int level, 773int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
788 int optname, 774 char __user *optval, unsigned int optlen);
789 char __user *optval, 775int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
790 int __user *optlen); 776 char __user *optval, int __user *optlen);
791extern int compat_ipv6_setsockopt(struct sock *sk, 777
792 int level, 778int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
793 int optname, 779
794 char __user *optval, 780int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
795 unsigned int optlen); 781 int *addr_len);
796extern int compat_ipv6_getsockopt(struct sock *sk, 782int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len,
797 int level, 783 int *addr_len);
798 int optname, 784void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
799 char __user *optval, 785 u32 info, u8 *payload);
800 int __user *optlen); 786void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
801 787void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
802extern int ip6_datagram_connect(struct sock *sk, 788
803 struct sockaddr *addr, int addr_len); 789int inet6_release(struct socket *sock);
804 790int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
805extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 791int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
806extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 792 int peer);
807extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 793int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
808 u32 info, u8 *payload); 794
809extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); 795int inet6_hash_connect(struct inet_timewait_death_row *death_row,
810extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
811
812extern int inet6_release(struct socket *sock);
813extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
814 int addr_len);
815extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
816 int *uaddr_len, int peer);
817extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
818 unsigned long arg);
819
820extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
821 struct sock *sk); 796 struct sock *sk);
822 797
823/* 798/*
@@ -829,30 +804,27 @@ extern const struct proto_ops inet6_dgram_ops;
829struct group_source_req; 804struct group_source_req;
830struct group_filter; 805struct group_filter;
831 806
832extern int ip6_mc_source(int add, int omode, struct sock *sk, 807int ip6_mc_source(int add, int omode, struct sock *sk,
833 struct group_source_req *pgsr); 808 struct group_source_req *pgsr);
834extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); 809int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
835extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, 810int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
836 struct group_filter __user *optval, 811 struct group_filter __user *optval, int __user *optlen);
837 int __user *optlen);
838extern unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
839 const struct in6_addr *daddr, u32 rnd);
840 812
841#ifdef CONFIG_PROC_FS 813#ifdef CONFIG_PROC_FS
842extern int ac6_proc_init(struct net *net); 814int ac6_proc_init(struct net *net);
843extern void ac6_proc_exit(struct net *net); 815void ac6_proc_exit(struct net *net);
844extern int raw6_proc_init(void); 816int raw6_proc_init(void);
845extern void raw6_proc_exit(void); 817void raw6_proc_exit(void);
846extern int tcp6_proc_init(struct net *net); 818int tcp6_proc_init(struct net *net);
847extern void tcp6_proc_exit(struct net *net); 819void tcp6_proc_exit(struct net *net);
848extern int udp6_proc_init(struct net *net); 820int udp6_proc_init(struct net *net);
849extern void udp6_proc_exit(struct net *net); 821void udp6_proc_exit(struct net *net);
850extern int udplite6_proc_init(void); 822int udplite6_proc_init(void);
851extern void udplite6_proc_exit(void); 823void udplite6_proc_exit(void);
852extern int ipv6_misc_proc_init(void); 824int ipv6_misc_proc_init(void);
853extern void ipv6_misc_proc_exit(void); 825void ipv6_misc_proc_exit(void);
854extern int snmp6_register_dev(struct inet6_dev *idev); 826int snmp6_register_dev(struct inet6_dev *idev);
855extern int snmp6_unregister_dev(struct inet6_dev *idev); 827int snmp6_unregister_dev(struct inet6_dev *idev);
856 828
857#else 829#else
858static inline int ac6_proc_init(struct net *net) { return 0; } 830static inline int ac6_proc_init(struct net *net) { return 0; }
@@ -865,10 +837,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
865extern struct ctl_table ipv6_route_table_template[]; 837extern struct ctl_table ipv6_route_table_template[];
866extern struct ctl_table ipv6_icmp_table_template[]; 838extern struct ctl_table ipv6_icmp_table_template[];
867 839
868extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 840struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
869extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 841struct ctl_table *ipv6_route_sysctl_init(struct net *net);
870extern int ipv6_sysctl_register(void); 842int ipv6_sysctl_register(void);
871extern void ipv6_sysctl_unregister(void); 843void ipv6_sysctl_unregister(void);
872#endif 844#endif
873 845
874#endif /* _NET_IPV6_H */ 846#endif /* _NET_IPV6_H */
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c1fec6b464cc..9e9e35465baf 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -123,23 +123,23 @@ extern struct list_head ipx_routes;
123extern rwlock_t ipx_routes_lock; 123extern rwlock_t ipx_routes_lock;
124 124
125extern struct list_head ipx_interfaces; 125extern struct list_head ipx_interfaces;
126extern struct ipx_interface *ipx_interfaces_head(void); 126struct ipx_interface *ipx_interfaces_head(void);
127extern spinlock_t ipx_interfaces_lock; 127extern spinlock_t ipx_interfaces_lock;
128 128
129extern struct ipx_interface *ipx_primary_net; 129extern struct ipx_interface *ipx_primary_net;
130 130
131extern int ipx_proc_init(void); 131int ipx_proc_init(void);
132extern void ipx_proc_exit(void); 132void ipx_proc_exit(void);
133 133
134extern const char *ipx_frame_name(__be16); 134const char *ipx_frame_name(__be16);
135extern const char *ipx_device_name(struct ipx_interface *intrfc); 135const char *ipx_device_name(struct ipx_interface *intrfc);
136 136
137static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) 137static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
138{ 138{
139 atomic_inc(&intrfc->refcnt); 139 atomic_inc(&intrfc->refcnt);
140} 140}
141 141
142extern void ipxitf_down(struct ipx_interface *intrfc); 142void ipxitf_down(struct ipx_interface *intrfc);
143 143
144static __inline__ void ipxitf_put(struct ipx_interface *intrfc) 144static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
145{ 145{
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index 80ffde3bb164..0224402260a7 100644
--- a/include/net/irda/ircomm_tty.h
+++ b/include/net/irda/ircomm_tty.h
@@ -105,13 +105,13 @@ struct ircomm_tty_cb {
105void ircomm_tty_start(struct tty_struct *tty); 105void ircomm_tty_start(struct tty_struct *tty);
106void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); 106void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
107 107
108extern int ircomm_tty_tiocmget(struct tty_struct *tty); 108int ircomm_tty_tiocmget(struct tty_struct *tty);
109extern int ircomm_tty_tiocmset(struct tty_struct *tty, 109int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set,
110 unsigned int set, unsigned int clear); 110 unsigned int clear);
111extern int ircomm_tty_ioctl(struct tty_struct *tty, 111int ircomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
112 unsigned int cmd, unsigned long arg); 112 unsigned long arg);
113extern void ircomm_tty_set_termios(struct tty_struct *tty, 113void ircomm_tty_set_termios(struct tty_struct *tty,
114 struct ktermios *old_termios); 114 struct ktermios *old_termios);
115 115
116#endif 116#endif
117 117
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 3bed61d379a8..a059465101ff 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -112,20 +112,19 @@ do { if(!(expr)) { \
112struct net_device; 112struct net_device;
113struct packet_type; 113struct packet_type;
114 114
115extern void irda_proc_register(void); 115void irda_proc_register(void);
116extern void irda_proc_unregister(void); 116void irda_proc_unregister(void);
117 117
118extern int irda_sysctl_register(void); 118int irda_sysctl_register(void);
119extern void irda_sysctl_unregister(void); 119void irda_sysctl_unregister(void);
120 120
121extern int irsock_init(void); 121int irsock_init(void);
122extern void irsock_cleanup(void); 122void irsock_cleanup(void);
123 123
124extern int irda_nl_register(void); 124int irda_nl_register(void);
125extern void irda_nl_unregister(void); 125void irda_nl_unregister(void);
126 126
127extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, 127int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
128 struct packet_type *ptype, 128 struct packet_type *ptype, struct net_device *orig_dev);
129 struct net_device *orig_dev);
130 129
131#endif /* NET_IRDA_H */ 130#endif /* NET_IRDA_H */
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 94c852d47d0f..11417475a6c3 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -162,7 +162,7 @@ typedef struct {
162 int irq, irq2; /* Interrupts used */ 162 int irq, irq2; /* Interrupts used */
163 int dma, dma2; /* DMA channel(s) used */ 163 int dma, dma2; /* DMA channel(s) used */
164 int fifo_size; /* FIFO size */ 164 int fifo_size; /* FIFO size */
165 int irqflags; /* interrupt flags (ie, IRQF_SHARED|IRQF_DISABLED) */ 165 int irqflags; /* interrupt flags (ie, IRQF_SHARED) */
166 int direction; /* Link direction, used by some FIR drivers */ 166 int direction; /* Link direction, used by some FIR drivers */
167 int enabled; /* Powered on? */ 167 int enabled; /* Powered on? */
168 int suspended; /* Suspended by APM */ 168 int suspended; /* Suspended by APM */
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 4c90824c50fb..f9d88da97af2 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -126,6 +126,6 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 struct sk_buff *skb, struct irlap_info *info); 126 struct sk_buff *skb, struct irlap_info *info);
127void irlap_print_event(IRLAP_EVENT event); 127void irlap_print_event(IRLAP_EVENT event);
128 128
129extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb); 129int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
130 130
131#endif 131#endif
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 6b1dc4f8eca5..57173ae398ae 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -163,7 +163,7 @@ void irlap_resend_rejected_frame(struct irlap_cb *self, int command);
163void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb, 163void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
164 __u8 caddr, int command); 164 __u8 caddr, int command);
165 165
166extern int irlap_insert_qos_negotiation_params(struct irlap_cb *self, 166int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
167 struct sk_buff *skb); 167 struct sk_buff *skb);
168 168
169#endif 169#endif
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 5d5a6a4732ef..a830b01baba4 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -432,44 +432,32 @@ struct iw_public_data {
432/* First : function strictly used inside the kernel */ 432/* First : function strictly used inside the kernel */
433 433
434/* Handle /proc/net/wireless, called in net/code/dev.c */ 434/* Handle /proc/net/wireless, called in net/code/dev.c */
435extern int dev_get_wireless_info(char * buffer, char **start, off_t offset, 435int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
436 int length);
437 436
438/* Second : functions that may be called by driver modules */ 437/* Second : functions that may be called by driver modules */
439 438
440/* Send a single event to user space */ 439/* Send a single event to user space */
441extern void wireless_send_event(struct net_device * dev, 440void wireless_send_event(struct net_device *dev, unsigned int cmd,
442 unsigned int cmd, 441 union iwreq_data *wrqu, const char *extra);
443 union iwreq_data * wrqu,
444 const char * extra);
445 442
446/* We may need a function to send a stream of events to user space. 443/* We may need a function to send a stream of events to user space.
447 * More on that later... */ 444 * More on that later... */
448 445
449/* Standard handler for SIOCSIWSPY */ 446/* Standard handler for SIOCSIWSPY */
450extern int iw_handler_set_spy(struct net_device * dev, 447int iw_handler_set_spy(struct net_device *dev, struct iw_request_info *info,
451 struct iw_request_info * info, 448 union iwreq_data *wrqu, char *extra);
452 union iwreq_data * wrqu,
453 char * extra);
454/* Standard handler for SIOCGIWSPY */ 449/* Standard handler for SIOCGIWSPY */
455extern int iw_handler_get_spy(struct net_device * dev, 450int iw_handler_get_spy(struct net_device *dev, struct iw_request_info *info,
456 struct iw_request_info * info, 451 union iwreq_data *wrqu, char *extra);
457 union iwreq_data * wrqu,
458 char * extra);
459/* Standard handler for SIOCSIWTHRSPY */ 452/* Standard handler for SIOCSIWTHRSPY */
460extern int iw_handler_set_thrspy(struct net_device * dev, 453int iw_handler_set_thrspy(struct net_device *dev, struct iw_request_info *info,
461 struct iw_request_info *info, 454 union iwreq_data *wrqu, char *extra);
462 union iwreq_data * wrqu,
463 char * extra);
464/* Standard handler for SIOCGIWTHRSPY */ 455/* Standard handler for SIOCGIWTHRSPY */
465extern int iw_handler_get_thrspy(struct net_device * dev, 456int iw_handler_get_thrspy(struct net_device *dev, struct iw_request_info *info,
466 struct iw_request_info *info, 457 union iwreq_data *wrqu, char *extra);
467 union iwreq_data * wrqu,
468 char * extra);
469/* Driver call to update spy records */ 458/* Driver call to update spy records */
470extern void wireless_spy_update(struct net_device * dev, 459void wireless_spy_update(struct net_device *dev, unsigned char *address,
471 unsigned char * address, 460 struct iw_quality *wstats);
472 struct iw_quality * wstats);
473 461
474/************************* INLINE FUNTIONS *************************/ 462/************************* INLINE FUNTIONS *************************/
475/* 463/*
diff --git a/include/net/lapb.h b/include/net/lapb.h
index df892a94f2c6..9510f8725f03 100644
--- a/include/net/lapb.h
+++ b/include/net/lapb.h
@@ -105,40 +105,40 @@ struct lapb_cb {
105}; 105};
106 106
107/* lapb_iface.c */ 107/* lapb_iface.c */
108extern void lapb_connect_confirmation(struct lapb_cb *lapb, int); 108void lapb_connect_confirmation(struct lapb_cb *lapb, int);
109extern void lapb_connect_indication(struct lapb_cb *lapb, int); 109void lapb_connect_indication(struct lapb_cb *lapb, int);
110extern void lapb_disconnect_confirmation(struct lapb_cb *lapb, int); 110void lapb_disconnect_confirmation(struct lapb_cb *lapb, int);
111extern void lapb_disconnect_indication(struct lapb_cb *lapb, int); 111void lapb_disconnect_indication(struct lapb_cb *lapb, int);
112extern int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *); 112int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *);
113extern int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *); 113int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *);
114 114
115/* lapb_in.c */ 115/* lapb_in.c */
116extern void lapb_data_input(struct lapb_cb *lapb, struct sk_buff *); 116void lapb_data_input(struct lapb_cb *lapb, struct sk_buff *);
117 117
118/* lapb_out.c */ 118/* lapb_out.c */
119extern void lapb_kick(struct lapb_cb *lapb); 119void lapb_kick(struct lapb_cb *lapb);
120extern void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *, int); 120void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *, int);
121extern void lapb_establish_data_link(struct lapb_cb *lapb); 121void lapb_establish_data_link(struct lapb_cb *lapb);
122extern void lapb_enquiry_response(struct lapb_cb *lapb); 122void lapb_enquiry_response(struct lapb_cb *lapb);
123extern void lapb_timeout_response(struct lapb_cb *lapb); 123void lapb_timeout_response(struct lapb_cb *lapb);
124extern void lapb_check_iframes_acked(struct lapb_cb *lapb, unsigned short); 124void lapb_check_iframes_acked(struct lapb_cb *lapb, unsigned short);
125extern void lapb_check_need_response(struct lapb_cb *lapb, int, int); 125void lapb_check_need_response(struct lapb_cb *lapb, int, int);
126 126
127/* lapb_subr.c */ 127/* lapb_subr.c */
128extern void lapb_clear_queues(struct lapb_cb *lapb); 128void lapb_clear_queues(struct lapb_cb *lapb);
129extern void lapb_frames_acked(struct lapb_cb *lapb, unsigned short); 129void lapb_frames_acked(struct lapb_cb *lapb, unsigned short);
130extern void lapb_requeue_frames(struct lapb_cb *lapb); 130void lapb_requeue_frames(struct lapb_cb *lapb);
131extern int lapb_validate_nr(struct lapb_cb *lapb, unsigned short); 131int lapb_validate_nr(struct lapb_cb *lapb, unsigned short);
132extern int lapb_decode(struct lapb_cb *lapb, struct sk_buff *, struct lapb_frame *); 132int lapb_decode(struct lapb_cb *lapb, struct sk_buff *, struct lapb_frame *);
133extern void lapb_send_control(struct lapb_cb *lapb, int, int, int); 133void lapb_send_control(struct lapb_cb *lapb, int, int, int);
134extern void lapb_transmit_frmr(struct lapb_cb *lapb); 134void lapb_transmit_frmr(struct lapb_cb *lapb);
135 135
136/* lapb_timer.c */ 136/* lapb_timer.c */
137extern void lapb_start_t1timer(struct lapb_cb *lapb); 137void lapb_start_t1timer(struct lapb_cb *lapb);
138extern void lapb_start_t2timer(struct lapb_cb *lapb); 138void lapb_start_t2timer(struct lapb_cb *lapb);
139extern void lapb_stop_t1timer(struct lapb_cb *lapb); 139void lapb_stop_t1timer(struct lapb_cb *lapb);
140extern void lapb_stop_t2timer(struct lapb_cb *lapb); 140void lapb_stop_t2timer(struct lapb_cb *lapb);
141extern int lapb_t1timer_running(struct lapb_cb *lapb); 141int lapb_t1timer_running(struct lapb_cb *lapb);
142 142
143/* 143/*
144 * Debug levels. 144 * Debug levels.
diff --git a/include/net/llc.h b/include/net/llc.h
index 9e7d7f08ef77..68490cbc8a65 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -95,29 +95,29 @@ struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
95extern struct list_head llc_sap_list; 95extern struct list_head llc_sap_list;
96extern spinlock_t llc_sap_list_lock; 96extern spinlock_t llc_sap_list_lock;
97 97
98extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 98int llc_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
99 struct packet_type *pt, struct net_device *orig_dev); 99 struct net_device *orig_dev);
100 100
101extern int llc_mac_hdr_init(struct sk_buff *skb, 101int llc_mac_hdr_init(struct sk_buff *skb, const unsigned char *sa,
102 const unsigned char *sa, const unsigned char *da); 102 const unsigned char *da);
103 103
104extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 104void llc_add_pack(int type,
105 struct sk_buff *skb)); 105 void (*handler)(struct llc_sap *sap, struct sk_buff *skb));
106extern void llc_remove_pack(int type); 106void llc_remove_pack(int type);
107 107
108extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb)); 108void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
109 109
110extern struct llc_sap *llc_sap_open(unsigned char lsap, 110struct llc_sap *llc_sap_open(unsigned char lsap,
111 int (*rcv)(struct sk_buff *skb, 111 int (*rcv)(struct sk_buff *skb,
112 struct net_device *dev, 112 struct net_device *dev,
113 struct packet_type *pt, 113 struct packet_type *pt,
114 struct net_device *orig_dev)); 114 struct net_device *orig_dev));
115static inline void llc_sap_hold(struct llc_sap *sap) 115static inline void llc_sap_hold(struct llc_sap *sap)
116{ 116{
117 atomic_inc(&sap->refcnt); 117 atomic_inc(&sap->refcnt);
118} 118}
119 119
120extern void llc_sap_close(struct llc_sap *sap); 120void llc_sap_close(struct llc_sap *sap);
121 121
122static inline void llc_sap_put(struct llc_sap *sap) 122static inline void llc_sap_put(struct llc_sap *sap)
123{ 123{
@@ -125,27 +125,27 @@ static inline void llc_sap_put(struct llc_sap *sap)
125 llc_sap_close(sap); 125 llc_sap_close(sap);
126} 126}
127 127
128extern struct llc_sap *llc_sap_find(unsigned char sap_value); 128struct llc_sap *llc_sap_find(unsigned char sap_value);
129 129
130extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, 130int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
131 unsigned char *dmac, unsigned char dsap); 131 unsigned char *dmac, unsigned char dsap);
132 132
133extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); 133void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
134extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); 134void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
135 135
136extern void llc_station_init(void); 136void llc_station_init(void);
137extern void llc_station_exit(void); 137void llc_station_exit(void);
138 138
139#ifdef CONFIG_PROC_FS 139#ifdef CONFIG_PROC_FS
140extern int llc_proc_init(void); 140int llc_proc_init(void);
141extern void llc_proc_exit(void); 141void llc_proc_exit(void);
142#else 142#else
143#define llc_proc_init() (0) 143#define llc_proc_init() (0)
144#define llc_proc_exit() do { } while(0) 144#define llc_proc_exit() do { } while(0)
145#endif /* CONFIG_PROC_FS */ 145#endif /* CONFIG_PROC_FS */
146#ifdef CONFIG_SYSCTL 146#ifdef CONFIG_SYSCTL
147extern int llc_sysctl_init(void); 147int llc_sysctl_init(void);
148extern void llc_sysctl_exit(void); 148void llc_sysctl_exit(void);
149 149
150extern int sysctl_llc2_ack_timeout; 150extern int sysctl_llc2_ack_timeout;
151extern int sysctl_llc2_busy_timeout; 151extern int sysctl_llc2_busy_timeout;
diff --git a/include/net/llc_c_ac.h b/include/net/llc_c_ac.h
index df83f69d2de4..f3be818e73c1 100644
--- a/include/net/llc_c_ac.h
+++ b/include/net/llc_c_ac.h
@@ -89,114 +89,92 @@
89 89
90typedef int (*llc_conn_action_t)(struct sock *sk, struct sk_buff *skb); 90typedef int (*llc_conn_action_t)(struct sock *sk, struct sk_buff *skb);
91 91
92extern int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb); 92int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb);
93extern int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb); 93int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb);
94extern int llc_conn_ac_conn_confirm(struct sock* sk, struct sk_buff *skb); 94int llc_conn_ac_conn_confirm(struct sock *sk, struct sk_buff *skb);
95extern int llc_conn_ac_data_ind(struct sock* sk, struct sk_buff *skb); 95int llc_conn_ac_data_ind(struct sock *sk, struct sk_buff *skb);
96extern int llc_conn_ac_disc_ind(struct sock* sk, struct sk_buff *skb); 96int llc_conn_ac_disc_ind(struct sock *sk, struct sk_buff *skb);
97extern int llc_conn_ac_rst_ind(struct sock* sk, struct sk_buff *skb); 97int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb);
98extern int llc_conn_ac_rst_confirm(struct sock* sk, struct sk_buff *skb); 98int llc_conn_ac_rst_confirm(struct sock *sk, struct sk_buff *skb);
99extern int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock* sk, 99int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock *sk,
100 struct sk_buff *skb);
101extern int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock* sk,
102 struct sk_buff *skb);
103extern int llc_conn_ac_send_disc_cmd_p_set_x(struct sock* sk,
104 struct sk_buff *skb);
105extern int llc_conn_ac_send_dm_rsp_f_set_p(struct sock* sk,
106 struct sk_buff *skb);
107extern int llc_conn_ac_send_dm_rsp_f_set_1(struct sock* sk,
108 struct sk_buff *skb);
109extern int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock* sk,
110 struct sk_buff *skb);
111extern int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock* sk,
112 struct sk_buff *skb);
113extern int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock* sk,
114 struct sk_buff *skb);
115extern int llc_conn_ac_send_i_cmd_p_set_1(struct sock* sk, struct sk_buff *skb);
116extern int llc_conn_ac_send_i_xxx_x_set_0(struct sock* sk, struct sk_buff *skb);
117extern int llc_conn_ac_resend_i_xxx_x_set_0(struct sock* sk,
118 struct sk_buff *skb);
119extern int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock* sk,
120 struct sk_buff *skb);
121extern int llc_conn_ac_resend_i_rsp_f_set_1(struct sock* sk,
122 struct sk_buff *skb);
123extern int llc_conn_ac_send_rej_cmd_p_set_1(struct sock* sk,
124 struct sk_buff *skb);
125extern int llc_conn_ac_send_rej_rsp_f_set_1(struct sock* sk,
126 struct sk_buff *skb);
127extern int llc_conn_ac_send_rej_xxx_x_set_0(struct sock* sk,
128 struct sk_buff *skb); 100 struct sk_buff *skb);
129extern int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock* sk, 101int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk,
130 struct sk_buff *skb); 102 struct sk_buff *skb);
131extern int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock* sk, 103int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb);
132 struct sk_buff *skb); 104int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
133extern int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock* sk, 105int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
134 struct sk_buff *skb); 106int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb);
135extern int llc_conn_ac_set_remote_busy(struct sock* sk, struct sk_buff *skb); 107int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb);
136extern int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock* sk, 108int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
109int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
110int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
111int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
112int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
137 struct sk_buff *skb); 113 struct sk_buff *skb);
138extern int llc_conn_ac_send_rr_cmd_p_set_1(struct sock* sk, 114int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
139 struct sk_buff *skb); 115int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
140extern int llc_conn_ac_send_rr_rsp_f_set_1(struct sock* sk, 116int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
141 struct sk_buff *skb); 117int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
142extern int llc_conn_ac_send_ack_rsp_f_set_1(struct sock* sk, 118int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
143 struct sk_buff *skb); 119int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
144extern int llc_conn_ac_send_rr_xxx_x_set_0(struct sock* sk, 120int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
145 struct sk_buff *skb); 121int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb);
146extern int llc_conn_ac_send_ack_xxx_x_set_0(struct sock* sk, 122int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
147 struct sk_buff *skb); 123int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
148extern int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock* sk, 124int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
149 struct sk_buff *skb); 125int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
150extern int llc_conn_ac_send_ua_rsp_f_set_p(struct sock* sk, 126int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
151 struct sk_buff *skb); 127int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
152extern int llc_conn_ac_set_s_flag_0(struct sock* sk, struct sk_buff *skb); 128int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb);
153extern int llc_conn_ac_set_s_flag_1(struct sock* sk, struct sk_buff *skb); 129int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
154extern int llc_conn_ac_start_p_timer(struct sock* sk, struct sk_buff *skb); 130int llc_conn_ac_set_s_flag_0(struct sock *sk, struct sk_buff *skb);
155extern int llc_conn_ac_start_ack_timer(struct sock* sk, struct sk_buff *skb); 131int llc_conn_ac_set_s_flag_1(struct sock *sk, struct sk_buff *skb);
156extern int llc_conn_ac_start_rej_timer(struct sock* sk, struct sk_buff *skb); 132int llc_conn_ac_start_p_timer(struct sock *sk, struct sk_buff *skb);
157extern int llc_conn_ac_start_ack_tmr_if_not_running(struct sock* sk, 133int llc_conn_ac_start_ack_timer(struct sock *sk, struct sk_buff *skb);
158 struct sk_buff *skb); 134int llc_conn_ac_start_rej_timer(struct sock *sk, struct sk_buff *skb);
159extern int llc_conn_ac_stop_ack_timer(struct sock* sk, struct sk_buff *skb); 135int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk,
160extern int llc_conn_ac_stop_p_timer(struct sock* sk, struct sk_buff *skb); 136 struct sk_buff *skb);
161extern int llc_conn_ac_stop_rej_timer(struct sock* sk, struct sk_buff *skb); 137int llc_conn_ac_stop_ack_timer(struct sock *sk, struct sk_buff *skb);
162extern int llc_conn_ac_stop_all_timers(struct sock* sk, struct sk_buff *skb); 138int llc_conn_ac_stop_p_timer(struct sock *sk, struct sk_buff *skb);
163extern int llc_conn_ac_stop_other_timers(struct sock* sk, struct sk_buff *skb); 139int llc_conn_ac_stop_rej_timer(struct sock *sk, struct sk_buff *skb);
164extern int llc_conn_ac_upd_nr_received(struct sock* sk, struct sk_buff *skb); 140int llc_conn_ac_stop_all_timers(struct sock *sk, struct sk_buff *skb);
165extern int llc_conn_ac_inc_tx_win_size(struct sock* sk, struct sk_buff *skb); 141int llc_conn_ac_stop_other_timers(struct sock *sk, struct sk_buff *skb);
166extern int llc_conn_ac_dec_tx_win_size(struct sock* sk, struct sk_buff *skb); 142int llc_conn_ac_upd_nr_received(struct sock *sk, struct sk_buff *skb);
167extern int llc_conn_ac_upd_p_flag(struct sock* sk, struct sk_buff *skb); 143int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb);
168extern int llc_conn_ac_set_data_flag_2(struct sock* sk, struct sk_buff *skb); 144int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct sk_buff *skb);
169extern int llc_conn_ac_set_data_flag_0(struct sock* sk, struct sk_buff *skb); 145int llc_conn_ac_upd_p_flag(struct sock *sk, struct sk_buff *skb);
170extern int llc_conn_ac_set_data_flag_1(struct sock* sk, struct sk_buff *skb); 146int llc_conn_ac_set_data_flag_2(struct sock *sk, struct sk_buff *skb);
171extern int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0(struct sock* sk, 147int llc_conn_ac_set_data_flag_0(struct sock *sk, struct sk_buff *skb);
172 struct sk_buff *skb); 148int llc_conn_ac_set_data_flag_1(struct sock *sk, struct sk_buff *skb);
173extern int llc_conn_ac_set_p_flag_0(struct sock* sk, struct sk_buff *skb); 149int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0(struct sock *sk,
174extern int llc_conn_ac_set_remote_busy_0(struct sock* sk, struct sk_buff *skb); 150 struct sk_buff *skb);
175extern int llc_conn_ac_set_retry_cnt_0(struct sock* sk, struct sk_buff *skb); 151int llc_conn_ac_set_p_flag_0(struct sock *sk, struct sk_buff *skb);
176extern int llc_conn_ac_set_cause_flag_0(struct sock* sk, struct sk_buff *skb); 152int llc_conn_ac_set_remote_busy_0(struct sock *sk, struct sk_buff *skb);
177extern int llc_conn_ac_set_cause_flag_1(struct sock* sk, struct sk_buff *skb); 153int llc_conn_ac_set_retry_cnt_0(struct sock *sk, struct sk_buff *skb);
178extern int llc_conn_ac_inc_retry_cnt_by_1(struct sock* sk, struct sk_buff *skb); 154int llc_conn_ac_set_cause_flag_0(struct sock *sk, struct sk_buff *skb);
179extern int llc_conn_ac_set_vr_0(struct sock* sk, struct sk_buff *skb); 155int llc_conn_ac_set_cause_flag_1(struct sock *sk, struct sk_buff *skb);
180extern int llc_conn_ac_inc_vr_by_1(struct sock* sk, struct sk_buff *skb); 156int llc_conn_ac_inc_retry_cnt_by_1(struct sock *sk, struct sk_buff *skb);
181extern int llc_conn_ac_set_vs_0(struct sock* sk, struct sk_buff *skb); 157int llc_conn_ac_set_vr_0(struct sock *sk, struct sk_buff *skb);
182extern int llc_conn_ac_set_vs_nr(struct sock* sk, struct sk_buff *skb); 158int llc_conn_ac_inc_vr_by_1(struct sock *sk, struct sk_buff *skb);
183extern int llc_conn_ac_rst_vs(struct sock* sk, struct sk_buff *skb); 159int llc_conn_ac_set_vs_0(struct sock *sk, struct sk_buff *skb);
184extern int llc_conn_ac_upd_vs(struct sock* sk, struct sk_buff *skb); 160int llc_conn_ac_set_vs_nr(struct sock *sk, struct sk_buff *skb);
185extern int llc_conn_disc(struct sock* sk, struct sk_buff *skb); 161int llc_conn_ac_rst_vs(struct sock *sk, struct sk_buff *skb);
186extern int llc_conn_reset(struct sock* sk, struct sk_buff *skb); 162int llc_conn_ac_upd_vs(struct sock *sk, struct sk_buff *skb);
187extern int llc_conn_ac_disc_confirm(struct sock* sk, struct sk_buff *skb); 163int llc_conn_disc(struct sock *sk, struct sk_buff *skb);
188extern u8 llc_circular_between(u8 a, u8 b, u8 c); 164int llc_conn_reset(struct sock *sk, struct sk_buff *skb);
189extern int llc_conn_ac_send_ack_if_needed(struct sock* sk, struct sk_buff *skb); 165int llc_conn_ac_disc_confirm(struct sock *sk, struct sk_buff *skb);
190extern int llc_conn_ac_adjust_npta_by_rr(struct sock* sk, struct sk_buff *skb); 166u8 llc_circular_between(u8 a, u8 b, u8 c);
191extern int llc_conn_ac_adjust_npta_by_rnr(struct sock* sk, struct sk_buff *skb); 167int llc_conn_ac_send_ack_if_needed(struct sock *sk, struct sk_buff *skb);
192extern int llc_conn_ac_rst_sendack_flag(struct sock* sk, struct sk_buff *skb); 168int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct sk_buff *skb);
193extern int llc_conn_ac_send_i_rsp_as_ack(struct sock* sk, struct sk_buff *skb); 169int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk, struct sk_buff *skb);
194extern int llc_conn_ac_send_i_as_ack(struct sock* sk, struct sk_buff *skb); 170int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb);
171int llc_conn_ac_send_i_rsp_as_ack(struct sock *sk, struct sk_buff *skb);
172int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb);
195 173
196extern void llc_conn_busy_tmr_cb(unsigned long timeout_data); 174void llc_conn_busy_tmr_cb(unsigned long timeout_data);
197extern void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data); 175void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data);
198extern void llc_conn_ack_tmr_cb(unsigned long timeout_data); 176void llc_conn_ack_tmr_cb(unsigned long timeout_data);
199extern void llc_conn_rej_tmr_cb(unsigned long timeout_data); 177void llc_conn_rej_tmr_cb(unsigned long timeout_data);
200 178
201extern void llc_conn_set_p_flag(struct sock *sk, u8 value); 179void llc_conn_set_p_flag(struct sock *sk, u8 value);
202#endif /* LLC_C_AC_H */ 180#endif /* LLC_C_AC_H */
diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h
index 6ca3113df39e..3948cf111dd0 100644
--- a/include/net/llc_c_ev.h
+++ b/include/net/llc_c_ev.h
@@ -128,138 +128,93 @@ static __inline__ struct llc_conn_state_ev *llc_conn_ev(struct sk_buff *skb)
128typedef int (*llc_conn_ev_t)(struct sock *sk, struct sk_buff *skb); 128typedef int (*llc_conn_ev_t)(struct sock *sk, struct sk_buff *skb);
129typedef int (*llc_conn_ev_qfyr_t)(struct sock *sk, struct sk_buff *skb); 129typedef int (*llc_conn_ev_qfyr_t)(struct sock *sk, struct sk_buff *skb);
130 130
131extern int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb); 131int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb);
132extern int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb); 132int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb);
133extern int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb); 133int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb);
134extern int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb); 134int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb);
135extern int llc_conn_ev_local_busy_detected(struct sock *sk, 135int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb);
136 struct sk_buff *skb); 136int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb);
137extern int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb); 137int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb);
138extern int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb); 138int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
139extern int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, 139int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
140int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
141int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
142 struct sk_buff *skb);
143int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
144int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
140 struct sk_buff *skb); 145 struct sk_buff *skb);
141extern int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, 146int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
142 struct sk_buff *skb); 147 struct sk_buff *skb);
143extern int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, 148int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
144 struct sk_buff *skb); 149int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
145extern int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, 150int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
146 struct sk_buff *skb); 151int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
147extern int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, 152int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
148 struct sk_buff *skb); 153int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
149extern int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
150 struct sk_buff *skb);
151extern int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
152 struct sk_buff *skb);
153extern int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
154 struct sk_buff *skb);
155extern int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
156 struct sk_buff *skb); 154 struct sk_buff *skb);
157extern int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, 155int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
158 struct sk_buff *skb); 156 struct sk_buff *skb);
159extern int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, 157int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb);
160 struct sk_buff *skb); 158int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb);
161extern int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, 159int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb);
162 struct sk_buff *skb); 160int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb);
163extern int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk, 161int llc_conn_ev_sendack_tmr_exp(struct sock *sk, struct sk_buff *skb);
164 struct sk_buff *skb);
165extern int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
166 struct sk_buff *skb);
167extern int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb);
168extern int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb);
169extern int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb);
170extern int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb);
171extern int llc_conn_ev_sendack_tmr_exp(struct sock *sk, struct sk_buff *skb);
172/* NOT_USED functions and their variations */ 162/* NOT_USED functions and their variations */
173extern int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, 163int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
174 struct sk_buff *skb); 164int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
175extern int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, 165int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
176 struct sk_buff *skb); 166 struct sk_buff *skb);
177extern int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, 167int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
178 struct sk_buff *skb); 168 struct sk_buff *skb);
179extern int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, 169int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
180 struct sk_buff *skb); 170int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
181extern int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, 171int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
182 struct sk_buff *skb); 172 struct sk_buff *skb);
183extern int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, 173int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
184 struct sk_buff *skb); 174 struct sk_buff *skb);
185extern int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, 175int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
186 struct sk_buff *skb); 176int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
187extern int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, 177int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
188 struct sk_buff *skb); 178int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
189extern int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, 179int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
190 struct sk_buff *skb); 180int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
191extern int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, 181int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
192 struct sk_buff *skb); 182int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
193extern int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, 183int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
194 struct sk_buff *skb); 184int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
195extern int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, 185int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
196 struct sk_buff *skb); 186int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
197extern int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, 187int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
198 struct sk_buff *skb); 188int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
199extern int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, 189int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb);
200 struct sk_buff *skb); 190int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb);
201extern int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, 191int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb);
202 struct sk_buff *skb);
203extern int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
204 struct sk_buff *skb);
205extern int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
206 struct sk_buff *skb);
207extern int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
208 struct sk_buff *skb);
209extern int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
210 struct sk_buff *skb);
211extern int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
212 struct sk_buff *skb);
213extern int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
214 struct sk_buff *skb);
215extern int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
216 struct sk_buff *skb);
217extern int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb);
218extern int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb);
219extern int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb);
220 192
221/* Available connection action qualifiers */ 193/* Available connection action qualifiers */
222extern int llc_conn_ev_qlfy_data_flag_eq_1(struct sock *sk, 194int llc_conn_ev_qlfy_data_flag_eq_1(struct sock *sk, struct sk_buff *skb);
223 struct sk_buff *skb); 195int llc_conn_ev_qlfy_data_flag_eq_0(struct sock *sk, struct sk_buff *skb);
224extern int llc_conn_ev_qlfy_data_flag_eq_0(struct sock *sk, 196int llc_conn_ev_qlfy_data_flag_eq_2(struct sock *sk, struct sk_buff *skb);
225 struct sk_buff *skb); 197int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk, struct sk_buff *skb);
226extern int llc_conn_ev_qlfy_data_flag_eq_2(struct sock *sk, 198int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, struct sk_buff *skb);
227 struct sk_buff *skb); 199int llc_conn_ev_qlfy_last_frame_eq_0(struct sock *sk, struct sk_buff *skb);
228extern int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk, struct sk_buff *skb); 200int llc_conn_ev_qlfy_p_flag_eq_0(struct sock *sk, struct sk_buff *skb);
229extern int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, 201int llc_conn_ev_qlfy_p_flag_eq_f(struct sock *sk, struct sk_buff *skb);
230 struct sk_buff *skb); 202int llc_conn_ev_qlfy_remote_busy_eq_0(struct sock *sk, struct sk_buff *skb);
231extern int llc_conn_ev_qlfy_last_frame_eq_0(struct sock *sk, 203int llc_conn_ev_qlfy_remote_busy_eq_1(struct sock *sk, struct sk_buff *skb);
232 struct sk_buff *skb); 204int llc_conn_ev_qlfy_retry_cnt_lt_n2(struct sock *sk, struct sk_buff *skb);
233extern int llc_conn_ev_qlfy_p_flag_eq_0(struct sock *sk, struct sk_buff *skb); 205int llc_conn_ev_qlfy_retry_cnt_gte_n2(struct sock *sk, struct sk_buff *skb);
234extern int llc_conn_ev_qlfy_p_flag_eq_f(struct sock *sk, struct sk_buff *skb); 206int llc_conn_ev_qlfy_s_flag_eq_1(struct sock *sk, struct sk_buff *skb);
235extern int llc_conn_ev_qlfy_remote_busy_eq_0(struct sock *sk, 207int llc_conn_ev_qlfy_s_flag_eq_0(struct sock *sk, struct sk_buff *skb);
236 struct sk_buff *skb); 208int llc_conn_ev_qlfy_cause_flag_eq_1(struct sock *sk, struct sk_buff *skb);
237extern int llc_conn_ev_qlfy_remote_busy_eq_1(struct sock *sk, 209int llc_conn_ev_qlfy_cause_flag_eq_0(struct sock *sk, struct sk_buff *skb);
238 struct sk_buff *skb); 210int llc_conn_ev_qlfy_set_status_conn(struct sock *sk, struct sk_buff *skb);
239extern int llc_conn_ev_qlfy_retry_cnt_lt_n2(struct sock *sk, 211int llc_conn_ev_qlfy_set_status_disc(struct sock *sk, struct sk_buff *skb);
240 struct sk_buff *skb); 212int llc_conn_ev_qlfy_set_status_failed(struct sock *sk, struct sk_buff *skb);
241extern int llc_conn_ev_qlfy_retry_cnt_gte_n2(struct sock *sk, 213int llc_conn_ev_qlfy_set_status_remote_busy(struct sock *sk,
242 struct sk_buff *skb);
243extern int llc_conn_ev_qlfy_s_flag_eq_1(struct sock *sk, struct sk_buff *skb);
244extern int llc_conn_ev_qlfy_s_flag_eq_0(struct sock *sk, struct sk_buff *skb);
245extern int llc_conn_ev_qlfy_cause_flag_eq_1(struct sock *sk,
246 struct sk_buff *skb);
247extern int llc_conn_ev_qlfy_cause_flag_eq_0(struct sock *sk,
248 struct sk_buff *skb); 214 struct sk_buff *skb);
249extern int llc_conn_ev_qlfy_set_status_conn(struct sock *sk, 215int llc_conn_ev_qlfy_set_status_refuse(struct sock *sk, struct sk_buff *skb);
250 struct sk_buff *skb); 216int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk, struct sk_buff *skb);
251extern int llc_conn_ev_qlfy_set_status_disc(struct sock *sk, 217int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk, struct sk_buff *skb);
252 struct sk_buff *skb);
253extern int llc_conn_ev_qlfy_set_status_failed(struct sock *sk,
254 struct sk_buff *skb);
255extern int llc_conn_ev_qlfy_set_status_remote_busy(struct sock *sk,
256 struct sk_buff *skb);
257extern int llc_conn_ev_qlfy_set_status_refuse(struct sock *sk,
258 struct sk_buff *skb);
259extern int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk,
260 struct sk_buff *skb);
261extern int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk,
262 struct sk_buff *skb);
263 218
264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb) 219static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb)
265{ 220{
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index 2f97d8ddce92..0134681acc4c 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -95,28 +95,24 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
95 return skb->cb[sizeof(skb->cb) - 1]; 95 return skb->cb[sizeof(skb->cb) - 1];
96} 96}
97 97
98extern struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, 98struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority,
99 struct proto *prot); 99 struct proto *prot);
100extern void llc_sk_free(struct sock *sk); 100void llc_sk_free(struct sock *sk);
101 101
102extern void llc_sk_reset(struct sock *sk); 102void llc_sk_reset(struct sock *sk);
103 103
104/* Access to a connection */ 104/* Access to a connection */
105extern int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); 105int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
106extern void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); 106void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
107extern void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); 107void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
108extern void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, 108void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
109 u8 first_p_bit); 109void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
110extern void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, 110int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr, u16 *how_many_unacked);
111 u8 first_f_bit); 111struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *daddr,
112extern int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr, 112 struct llc_addr *laddr);
113 u16 *how_many_unacked); 113void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk);
114extern struct sock *llc_lookup_established(struct llc_sap *sap, 114void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
115 struct llc_addr *daddr,
116 struct llc_addr *laddr);
117extern void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk);
118extern void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
119 115
120extern u8 llc_data_accept_state(u8 state); 116u8 llc_data_accept_state(u8 state);
121extern void llc_build_offset_table(void); 117void llc_build_offset_table(void);
122#endif /* LLC_CONN_H */ 118#endif /* LLC_CONN_H */
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index f0cb909b60eb..8d5c543cd620 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -62,8 +62,7 @@
62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
63#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
64 64
65extern int llc_establish_connection(struct sock *sk, u8 *lmac, 65int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap);
66 u8 *dmac, u8 dsap); 66int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
67extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); 67int llc_send_disc(struct sock *sk);
68extern int llc_send_disc(struct sock *sk);
69#endif /* LLC_IF_H */ 68#endif /* LLC_IF_H */
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 5a93d13ac95c..31e2de7d57c5 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -410,21 +410,20 @@ struct llc_frmr_info {
410 u8 ind_bits; /* indicator bits set with macro */ 410 u8 ind_bits; /* indicator bits set with macro */
411} __packed; 411} __packed;
412 412
413extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type); 413void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);
414extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value); 414void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
415extern void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit); 415void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit);
416extern void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit); 416void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit);
417extern void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr); 417void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr);
418extern void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 418void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
419extern void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 419void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
420extern void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 420void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
421extern void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit); 421void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit);
422extern void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit); 422void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit);
423extern void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, 423void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
424 struct llc_pdu_sn *prev_pdu, 424 u8 f_bit, u8 vs, u8 vr, u8 vzyxw);
425 u8 f_bit, u8 vs, u8 vr, u8 vzyxw); 425void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
426extern void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 426void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
427extern void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 427void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
428extern void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 428void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
429extern void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
430#endif /* LLC_PDU_H */ 429#endif /* LLC_PDU_H */
diff --git a/include/net/llc_s_ac.h b/include/net/llc_s_ac.h
index 37a3bbd02394..a61b98c108ee 100644
--- a/include/net/llc_s_ac.h
+++ b/include/net/llc_s_ac.h
@@ -25,15 +25,13 @@
25/* All action functions must look like this */ 25/* All action functions must look like this */
26typedef int (*llc_sap_action_t)(struct llc_sap *sap, struct sk_buff *skb); 26typedef int (*llc_sap_action_t)(struct llc_sap *sap, struct sk_buff *skb);
27 27
28extern int llc_sap_action_unitdata_ind(struct llc_sap *sap, 28int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb);
29 struct sk_buff *skb); 29int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb);
30extern int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb); 30int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb);
31extern int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb); 31int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb);
32extern int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb); 32int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb);
33extern int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb); 33int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb);
34extern int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb); 34int llc_sap_action_report_status(struct llc_sap *sap, struct sk_buff *skb);
35extern int llc_sap_action_report_status(struct llc_sap *sap, 35int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb);
36 struct sk_buff *skb); 36int llc_sap_action_test_ind(struct llc_sap *sap, struct sk_buff *skb);
37extern int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb);
38extern int llc_sap_action_test_ind(struct llc_sap *sap, struct sk_buff *skb);
39#endif /* LLC_S_AC_H */ 37#endif /* LLC_S_AC_H */
diff --git a/include/net/llc_s_ev.h b/include/net/llc_s_ev.h
index e3acb9329e4a..84db3a59ed28 100644
--- a/include/net/llc_s_ev.h
+++ b/include/net/llc_s_ev.h
@@ -53,15 +53,14 @@ struct llc_sap;
53 53
54typedef int (*llc_sap_ev_t)(struct llc_sap *sap, struct sk_buff *skb); 54typedef int (*llc_sap_ev_t)(struct llc_sap *sap, struct sk_buff *skb);
55 55
56extern int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb); 56int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb);
57extern int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb); 57int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb);
58extern int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb); 58int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb);
59extern int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb); 59int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb);
60extern int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb); 60int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb);
61extern int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb); 61int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb);
62extern int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb); 62int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb);
63extern int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb); 63int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb);
64extern int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb); 64int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb);
65extern int llc_sap_ev_deactivation_req(struct llc_sap *sap, 65int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb);
66 struct sk_buff *skb);
67#endif /* LLC_S_EV_H */ 66#endif /* LLC_S_EV_H */
diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h
index ed25bec2f648..1e4df9fd9fb2 100644
--- a/include/net/llc_sap.h
+++ b/include/net/llc_sap.h
@@ -19,18 +19,14 @@ struct net_device;
19struct sk_buff; 19struct sk_buff;
20struct sock; 20struct sock;
21 21
22extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); 22void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
23extern void llc_save_primitive(struct sock *sk, struct sk_buff* skb, 23void llc_save_primitive(struct sock *sk, struct sk_buff *skb,
24 unsigned char prim); 24 unsigned char prim);
25extern struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev, 25struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev,
26 u8 type, u32 data_size); 26 u8 type, u32 data_size);
27 27
28extern void llc_build_and_send_test_pkt(struct llc_sap *sap, 28void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb,
29 struct sk_buff *skb, 29 unsigned char *dmac, unsigned char dsap);
30 unsigned char *dmac, 30void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
31 unsigned char dsap); 31 unsigned char *dmac, unsigned char dsap);
32extern void llc_build_and_send_xid_pkt(struct llc_sap *sap,
33 struct sk_buff *skb,
34 unsigned char *dmac,
35 unsigned char dsap);
36#endif /* LLC_SAP_H */ 32#endif /* LLC_SAP_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index cc6035f1a2f1..7ceed99a05bc 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -829,6 +829,15 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
829 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 829 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
830 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 830 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
831 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 831 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
832 * @RX_FLAG_AMSDU_MORE: Some drivers may prefer to report separate A-MSDU
833 * subframes instead of a one huge frame for performance reasons.
834 * All, but the last MSDU from an A-MSDU should have this flag set. E.g.
835 * if an A-MSDU has 3 frames, the first 2 must have the flag set, while
836 * the 3rd (last) one must not have this flag set. The flag is used to
837 * deal with retransmission/duplication recovery properly since A-MSDU
838 * subframes share the same sequence number. Reported subframes can be
839 * either regular MSDU or singly A-MSDUs. Subframes must not be
840 * interleaved with other frames.
832 */ 841 */
833enum mac80211_rx_flags { 842enum mac80211_rx_flags {
834 RX_FLAG_MMIC_ERROR = BIT(0), 843 RX_FLAG_MMIC_ERROR = BIT(0),
@@ -859,6 +868,7 @@ enum mac80211_rx_flags {
859 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 868 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
860 RX_FLAG_10MHZ = BIT(28), 869 RX_FLAG_10MHZ = BIT(28),
861 RX_FLAG_5MHZ = BIT(29), 870 RX_FLAG_5MHZ = BIT(29),
871 RX_FLAG_AMSDU_MORE = BIT(30),
862}; 872};
863 873
864#define RX_FLAG_STBC_SHIFT 26 874#define RX_FLAG_STBC_SHIFT 26
@@ -1492,6 +1502,15 @@ struct ieee80211_tx_control {
1492 * 1502 *
1493 * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames 1503 * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
1494 * only, to allow getting TBTT of a DTIM beacon. 1504 * only, to allow getting TBTT of a DTIM beacon.
1505 *
1506 * @IEEE80211_HW_SUPPORTS_HT_CCK_RATES: Hardware supports mixing HT/CCK rates
1507 * and can cope with CCK rates in an aggregation session (e.g. by not
1508 * using aggregation for such frames.)
1509 *
1510 * @IEEE80211_HW_CHANCTX_STA_CSA: Support 802.11h based channel-switch (CSA)
1511 * for a single active channel while using channel contexts. When support
1512 * is not enabled the default action is to disconnect when getting the
1513 * CSA frame.
1495 */ 1514 */
1496enum ieee80211_hw_flags { 1515enum ieee80211_hw_flags {
1497 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1516 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1522,6 +1541,7 @@ enum ieee80211_hw_flags {
1522 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1541 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1523 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1542 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1524 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1543 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1544 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1525}; 1545};
1526 1546
1527/** 1547/**
@@ -2666,6 +2686,10 @@ enum ieee80211_roc_type {
2666 * zero using ieee80211_csa_is_complete() after the beacon has been 2686 * zero using ieee80211_csa_is_complete() after the beacon has been
2667 * transmitted and then call ieee80211_csa_finish(). 2687 * transmitted and then call ieee80211_csa_finish().
2668 * 2688 *
2689 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2690 * information in bss_conf is set up and the beacon can be retrieved. A
2691 * channel context is bound before this is called.
2692 * @leave_ibss: Leave the IBSS again.
2669 */ 2693 */
2670struct ieee80211_ops { 2694struct ieee80211_ops {
2671 void (*tx)(struct ieee80211_hw *hw, 2695 void (*tx)(struct ieee80211_hw *hw,
@@ -2857,6 +2881,9 @@ struct ieee80211_ops {
2857 void (*channel_switch_beacon)(struct ieee80211_hw *hw, 2881 void (*channel_switch_beacon)(struct ieee80211_hw *hw,
2858 struct ieee80211_vif *vif, 2882 struct ieee80211_vif *vif,
2859 struct cfg80211_chan_def *chandef); 2883 struct cfg80211_chan_def *chandef);
2884
2885 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2886 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2860}; 2887};
2861 2888
2862/** 2889/**
@@ -3920,6 +3947,25 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
3920 void *data); 3947 void *data);
3921 3948
3922/** 3949/**
3950 * ieee80211_iterate_active_interfaces_rtnl - iterate active interfaces
3951 *
3952 * This function iterates over the interfaces associated with a given
3953 * hardware that are currently active and calls the callback for them.
3954 * This version can only be used while holding the RTNL.
3955 *
3956 * @hw: the hardware struct of which the interfaces should be iterated over
3957 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3958 * @iterator: the iterator function to call, cannot sleep
3959 * @data: first argument of the iterator function
3960 */
3961void ieee80211_iterate_active_interfaces_rtnl(struct ieee80211_hw *hw,
3962 u32 iter_flags,
3963 void (*iterator)(void *data,
3964 u8 *mac,
3965 struct ieee80211_vif *vif),
3966 void *data);
3967
3968/**
3923 * ieee80211_queue_work - add work onto the mac80211 workqueue 3969 * ieee80211_queue_work - add work onto the mac80211 workqueue
3924 * 3970 *
3925 * Drivers and mac80211 use this to add work onto the mac80211 workqueue. 3971 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
@@ -4525,4 +4571,18 @@ void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
4525 struct cfg80211_wowlan_wakeup *wakeup, 4571 struct cfg80211_wowlan_wakeup *wakeup,
4526 gfp_t gfp); 4572 gfp_t gfp);
4527 4573
4574/**
4575 * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
4576 * @hw: pointer as obtained from ieee80211_alloc_hw()
4577 * @vif: virtual interface
4578 * @skb: frame to be sent from within the driver
4579 * @band: the band to transmit on
4580 * @sta: optional pointer to get the station to send the frame to
4581 *
4582 * Note: must be called under RCU lock
4583 */
4584bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
4585 struct ieee80211_vif *vif, struct sk_buff *skb,
4586 int band, struct ieee80211_sta **sta);
4587
4528#endif /* MAC80211_H */ 4588#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index d0d11df9cba1..807d6b7a943f 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -133,7 +133,7 @@ struct ieee802154_ops {
133 133
134/* Basic interface to register ieee802154 device */ 134/* Basic interface to register ieee802154 device */
135struct ieee802154_dev * 135struct ieee802154_dev *
136ieee802154_alloc_device(size_t priv_data_lex, struct ieee802154_ops *ops); 136ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops);
137void ieee802154_free_device(struct ieee802154_dev *dev); 137void ieee802154_free_device(struct ieee802154_dev *dev);
138int ieee802154_register_device(struct ieee802154_dev *dev); 138int ieee802154_register_device(struct ieee802154_dev *dev);
139void ieee802154_unregister_device(struct ieee802154_dev *dev); 139void ieee802154_unregister_device(struct ieee802154_dev *dev);
diff --git a/include/net/mrp.h b/include/net/mrp.h
index 4fbf02aa2ec1..31912c3be772 100644
--- a/include/net/mrp.h
+++ b/include/net/mrp.h
@@ -112,6 +112,7 @@ struct mrp_applicant {
112 struct mrp_application *app; 112 struct mrp_application *app;
113 struct net_device *dev; 113 struct net_device *dev;
114 struct timer_list join_timer; 114 struct timer_list join_timer;
115 struct timer_list periodic_timer;
115 116
116 spinlock_t lock; 117 spinlock_t lock;
117 struct sk_buff_head queue; 118 struct sk_buff_head queue;
@@ -125,19 +126,17 @@ struct mrp_port {
125 struct rcu_head rcu; 126 struct rcu_head rcu;
126}; 127};
127 128
128extern int mrp_register_application(struct mrp_application *app); 129int mrp_register_application(struct mrp_application *app);
129extern void mrp_unregister_application(struct mrp_application *app); 130void mrp_unregister_application(struct mrp_application *app);
130 131
131extern int mrp_init_applicant(struct net_device *dev, 132int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
132 struct mrp_application *app); 133void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
133extern void mrp_uninit_applicant(struct net_device *dev,
134 struct mrp_application *app);
135 134
136extern int mrp_request_join(const struct net_device *dev, 135int mrp_request_join(const struct net_device *dev,
137 const struct mrp_application *app, 136 const struct mrp_application *app,
138 const void *value, u8 len, u8 type); 137 const void *value, u8 len, u8 type);
139extern void mrp_request_leave(const struct net_device *dev, 138void mrp_request_leave(const struct net_device *dev,
140 const struct mrp_application *app, 139 const struct mrp_application *app,
141 const void *value, u8 len, u8 type); 140 const void *value, u8 len, u8 type);
142 141
143#endif /* _NET_MRP_H */ 142#endif /* _NET_MRP_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 3c4211f0bed6..6bbda34d5e59 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -110,8 +110,8 @@ struct ndisc_options {
110 110
111#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7) 111#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7)
112 112
113extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len, 113struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
114 struct ndisc_options *ndopts); 114 struct ndisc_options *ndopts);
115 115
116/* 116/*
117 * Return the padding between the option length and the start of the 117 * Return the padding between the option length and the start of the
@@ -189,58 +189,51 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, cons
189 return n; 189 return n;
190} 190}
191 191
192extern int ndisc_init(void); 192int ndisc_init(void);
193int ndisc_late_init(void);
193 194
194extern void ndisc_cleanup(void); 195void ndisc_late_cleanup(void);
196void ndisc_cleanup(void);
195 197
196extern int ndisc_rcv(struct sk_buff *skb); 198int ndisc_rcv(struct sk_buff *skb);
197 199
198extern void ndisc_send_ns(struct net_device *dev, 200void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
199 struct neighbour *neigh, 201 const struct in6_addr *solicit,
200 const struct in6_addr *solicit, 202 const struct in6_addr *daddr, const struct in6_addr *saddr);
201 const struct in6_addr *daddr,
202 const struct in6_addr *saddr);
203 203
204extern void ndisc_send_rs(struct net_device *dev, 204void ndisc_send_rs(struct net_device *dev,
205 const struct in6_addr *saddr, 205 const struct in6_addr *saddr, const struct in6_addr *daddr);
206 const struct in6_addr *daddr); 206void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
207extern void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, 207 const struct in6_addr *daddr,
208 const struct in6_addr *daddr, 208 const struct in6_addr *solicited_addr,
209 const struct in6_addr *solicited_addr, 209 bool router, bool solicited, bool override, bool inc_opt);
210 bool router, bool solicited, bool override,
211 bool inc_opt);
212 210
213extern void ndisc_send_redirect(struct sk_buff *skb, 211void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target);
214 const struct in6_addr *target);
215 212
216extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 213int ndisc_mc_map(const struct in6_addr *addr, char *buf, struct net_device *dev,
217 struct net_device *dev, int dir); 214 int dir);
218 215
219 216
220/* 217/*
221 * IGMP 218 * IGMP
222 */ 219 */
223extern int igmp6_init(void); 220int igmp6_init(void);
224 221
225extern void igmp6_cleanup(void); 222void igmp6_cleanup(void);
226 223
227extern int igmp6_event_query(struct sk_buff *skb); 224int igmp6_event_query(struct sk_buff *skb);
228 225
229extern int igmp6_event_report(struct sk_buff *skb); 226int igmp6_event_report(struct sk_buff *skb);
230 227
231 228
232#ifdef CONFIG_SYSCTL 229#ifdef CONFIG_SYSCTL
233extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 230int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
234 int write, 231 void __user *buffer, size_t *lenp, loff_t *ppos);
235 void __user *buffer,
236 size_t *lenp,
237 loff_t *ppos);
238int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, 232int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
239 void __user *oldval, size_t __user *oldlenp, 233 void __user *oldval, size_t __user *oldlenp,
240 void __user *newval, size_t newlen); 234 void __user *newval, size_t newlen);
241#endif 235#endif
242 236
243extern void inet6_ifinfo_notify(int event, 237void inet6_ifinfo_notify(int event, struct inet6_dev *idev);
244 struct inet6_dev *idev);
245 238
246#endif 239#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 1313456a0994..da68c9a90ac5 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -22,6 +22,7 @@
22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
23#include <net/netns/conntrack.h> 23#include <net/netns/conntrack.h>
24#endif 24#endif
25#include <net/netns/nftables.h>
25#include <net/netns/xfrm.h> 26#include <net/netns/xfrm.h>
26 27
27struct user_namespace; 28struct user_namespace;
@@ -74,6 +75,7 @@ struct net {
74 struct hlist_head *dev_index_head; 75 struct hlist_head *dev_index_head;
75 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 76 unsigned int dev_base_seq; /* protected by rtnl_mutex */
76 int ifindex; 77 int ifindex;
78 unsigned int dev_unreg_count;
77 79
78 /* core fib_rules */ 80 /* core fib_rules */
79 struct list_head rules_ops; 81 struct list_head rules_ops;
@@ -100,6 +102,9 @@ struct net {
100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 102#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
101 struct netns_ct ct; 103 struct netns_ct ct;
102#endif 104#endif
105#if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
106 struct netns_nftables nft;
107#endif
103#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 108#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
104 struct netns_nf_frag nf_frag; 109 struct netns_nf_frag nf_frag;
105#endif 110#endif
@@ -136,8 +141,8 @@ struct net {
136extern struct net init_net; 141extern struct net init_net;
137 142
138#ifdef CONFIG_NET_NS 143#ifdef CONFIG_NET_NS
139extern struct net *copy_net_ns(unsigned long flags, 144struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
140 struct user_namespace *user_ns, struct net *old_net); 145 struct net *old_net);
141 146
142#else /* CONFIG_NET_NS */ 147#else /* CONFIG_NET_NS */
143#include <linux/sched.h> 148#include <linux/sched.h>
@@ -154,11 +159,11 @@ static inline struct net *copy_net_ns(unsigned long flags,
154 159
155extern struct list_head net_namespace_list; 160extern struct list_head net_namespace_list;
156 161
157extern struct net *get_net_ns_by_pid(pid_t pid); 162struct net *get_net_ns_by_pid(pid_t pid);
158extern struct net *get_net_ns_by_fd(int pid); 163struct net *get_net_ns_by_fd(int pid);
159 164
160#ifdef CONFIG_NET_NS 165#ifdef CONFIG_NET_NS
161extern void __put_net(struct net *net); 166void __put_net(struct net *net);
162 167
163static inline struct net *get_net(struct net *net) 168static inline struct net *get_net(struct net *net)
164{ 169{
@@ -190,7 +195,7 @@ int net_eq(const struct net *net1, const struct net *net2)
190 return net1 == net2; 195 return net1 == net2;
191} 196}
192 197
193extern void net_drop_ns(void *); 198void net_drop_ns(void *);
194 199
195#else 200#else
196 201
@@ -307,19 +312,19 @@ struct pernet_operations {
307 * device which caused kernel oops, and panics during network 312 * device which caused kernel oops, and panics during network
308 * namespace cleanup. So please don't get this wrong. 313 * namespace cleanup. So please don't get this wrong.
309 */ 314 */
310extern int register_pernet_subsys(struct pernet_operations *); 315int register_pernet_subsys(struct pernet_operations *);
311extern void unregister_pernet_subsys(struct pernet_operations *); 316void unregister_pernet_subsys(struct pernet_operations *);
312extern int register_pernet_device(struct pernet_operations *); 317int register_pernet_device(struct pernet_operations *);
313extern void unregister_pernet_device(struct pernet_operations *); 318void unregister_pernet_device(struct pernet_operations *);
314 319
315struct ctl_table; 320struct ctl_table;
316struct ctl_table_header; 321struct ctl_table_header;
317 322
318#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
319extern int net_sysctl_init(void); 324int net_sysctl_init(void);
320extern struct ctl_table_header *register_net_sysctl(struct net *net, 325struct ctl_table_header *register_net_sysctl(struct net *net, const char *path,
321 const char *path, struct ctl_table *table); 326 struct ctl_table *table);
322extern void unregister_net_sysctl_table(struct ctl_table_header *header); 327void unregister_net_sysctl_table(struct ctl_table_header *header);
323#else 328#else
324static inline int net_sysctl_init(void) { return 0; } 329static inline int net_sysctl_init(void) { return 0; }
325static inline struct ctl_table_header *register_net_sysctl(struct net *net, 330static inline struct ctl_table_header *register_net_sysctl(struct net *net,
diff --git a/include/net/netevent.h b/include/net/netevent.h
index fe630dde35c3..d8bbb38584b6 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -26,8 +26,8 @@ enum netevent_notif_type {
26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ 26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
27}; 27};
28 28
29extern int register_netevent_notifier(struct notifier_block *nb); 29int register_netevent_notifier(struct notifier_block *nb);
30extern int unregister_netevent_notifier(struct notifier_block *nb); 30int unregister_netevent_notifier(struct notifier_block *nb);
31extern int call_netevent_notifiers(unsigned long val, void *v); 31int call_netevent_notifiers(unsigned long val, void *v);
32 32
33#endif 33#endif
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 7573d52a4346..6c3d12e2949f 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -16,9 +16,9 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; 16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp; 17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
18 18
19extern int nf_conntrack_ipv4_compat_init(void); 19int nf_conntrack_ipv4_compat_init(void);
20extern void nf_conntrack_ipv4_compat_fini(void); 20void nf_conntrack_ipv4_compat_fini(void);
21 21
22extern void need_ipv4_conntrack(void); 22void need_ipv4_conntrack(void);
23 23
24#endif /*_NF_CONNTRACK_IPV4_H*/ 24#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
index 6b00ea38546b..f01ef208dff6 100644
--- a/include/net/netfilter/ipv4/nf_defrag_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
@@ -1,6 +1,6 @@
1#ifndef _NF_DEFRAG_IPV4_H 1#ifndef _NF_DEFRAG_IPV4_H
2#define _NF_DEFRAG_IPV4_H 2#define _NF_DEFRAG_IPV4_H
3 3
4extern void nf_defrag_ipv4_enable(void); 4void nf_defrag_ipv4_enable(void);
5 5
6#endif /* _NF_DEFRAG_IPV4_H */ 6#endif /* _NF_DEFRAG_IPV4_H */
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
index fd79c9a1779d..27666d8a0bd0 100644
--- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -1,15 +1,12 @@
1#ifndef _NF_DEFRAG_IPV6_H 1#ifndef _NF_DEFRAG_IPV6_H
2#define _NF_DEFRAG_IPV6_H 2#define _NF_DEFRAG_IPV6_H
3 3
4extern void nf_defrag_ipv6_enable(void); 4void nf_defrag_ipv6_enable(void);
5 5
6extern int nf_ct_frag6_init(void); 6int nf_ct_frag6_init(void);
7extern void nf_ct_frag6_cleanup(void); 7void nf_ct_frag6_cleanup(void);
8extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user); 8struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
9extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, 9void nf_ct_frag6_consume_orig(struct sk_buff *skb);
10 struct net_device *in,
11 struct net_device *out,
12 int (*okfn)(struct sk_buff *));
13 10
14struct inet_frags_ctl; 11struct inet_frags_ctl;
15 12
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0c1288a50e8b..01ea6eed1bb1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -139,15 +139,13 @@ static inline struct net *nf_ct_net(const struct nf_conn *ct)
139} 139}
140 140
141/* Alter reply tuple (maybe alter helper). */ 141/* Alter reply tuple (maybe alter helper). */
142extern void 142void nf_conntrack_alter_reply(struct nf_conn *ct,
143nf_conntrack_alter_reply(struct nf_conn *ct, 143 const struct nf_conntrack_tuple *newreply);
144 const struct nf_conntrack_tuple *newreply);
145 144
146/* Is this tuple taken? (ignoring any belonging to the given 145/* Is this tuple taken? (ignoring any belonging to the given
147 conntrack). */ 146 conntrack). */
148extern int 147int nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
149nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, 148 const struct nf_conn *ignored_conntrack);
150 const struct nf_conn *ignored_conntrack);
151 149
152/* Return conntrack_info and tuple hash for given skb. */ 150/* Return conntrack_info and tuple hash for given skb. */
153static inline struct nf_conn * 151static inline struct nf_conn *
@@ -165,37 +163,34 @@ static inline void nf_ct_put(struct nf_conn *ct)
165} 163}
166 164
167/* Protocol module loading */ 165/* Protocol module loading */
168extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 166int nf_ct_l3proto_try_module_get(unsigned short l3proto);
169extern void nf_ct_l3proto_module_put(unsigned short l3proto); 167void nf_ct_l3proto_module_put(unsigned short l3proto);
170 168
171/* 169/*
172 * Allocate a hashtable of hlist_head (if nulls == 0), 170 * Allocate a hashtable of hlist_head (if nulls == 0),
173 * or hlist_nulls_head (if nulls == 1) 171 * or hlist_nulls_head (if nulls == 1)
174 */ 172 */
175extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls); 173void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
176 174
177extern void nf_ct_free_hashtable(void *hash, unsigned int size); 175void nf_ct_free_hashtable(void *hash, unsigned int size);
178 176
179extern struct nf_conntrack_tuple_hash * 177struct nf_conntrack_tuple_hash *
180__nf_conntrack_find(struct net *net, u16 zone, 178__nf_conntrack_find(struct net *net, u16 zone,
181 const struct nf_conntrack_tuple *tuple); 179 const struct nf_conntrack_tuple *tuple);
182 180
183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); 181int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report); 182bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report);
185 183
186extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report); 184void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
187 185
188extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 186bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
189 unsigned int nhoff, u_int16_t l3num, 187 u_int16_t l3num, struct nf_conntrack_tuple *tuple);
190 struct nf_conntrack_tuple *tuple); 188bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
191extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 189 const struct nf_conntrack_tuple *orig);
192 const struct nf_conntrack_tuple *orig);
193 190
194extern void __nf_ct_refresh_acct(struct nf_conn *ct, 191void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
195 enum ip_conntrack_info ctinfo, 192 const struct sk_buff *skb,
196 const struct sk_buff *skb, 193 unsigned long extra_jiffies, int do_acct);
197 unsigned long extra_jiffies,
198 int do_acct);
199 194
200/* Refresh conntrack for this many jiffies and do accounting */ 195/* Refresh conntrack for this many jiffies and do accounting */
201static inline void nf_ct_refresh_acct(struct nf_conn *ct, 196static inline void nf_ct_refresh_acct(struct nf_conn *ct,
@@ -214,10 +209,8 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
214 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); 209 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
215} 210}
216 211
217extern bool __nf_ct_kill_acct(struct nf_conn *ct, 212bool __nf_ct_kill_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
218 enum ip_conntrack_info ctinfo, 213 const struct sk_buff *skb, int do_acct);
219 const struct sk_buff *skb,
220 int do_acct);
221 214
222/* kill conntrack and do accounting */ 215/* kill conntrack and do accounting */
223static inline bool nf_ct_kill_acct(struct nf_conn *ct, 216static inline bool nf_ct_kill_acct(struct nf_conn *ct,
@@ -244,19 +237,17 @@ static inline struct nf_conn *nf_ct_untracked_get(void)
244{ 237{
245 return &__raw_get_cpu_var(nf_conntrack_untracked); 238 return &__raw_get_cpu_var(nf_conntrack_untracked);
246} 239}
247extern void nf_ct_untracked_status_or(unsigned long bits); 240void nf_ct_untracked_status_or(unsigned long bits);
248 241
249/* Iterate over all conntracks: if iter returns true, it's deleted. */ 242/* Iterate over all conntracks: if iter returns true, it's deleted. */
250extern void 243void nf_ct_iterate_cleanup(struct net *net,
251nf_ct_iterate_cleanup(struct net *net, 244 int (*iter)(struct nf_conn *i, void *data),
252 int (*iter)(struct nf_conn *i, void *data), 245 void *data, u32 portid, int report);
253 void *data, u32 portid, int report); 246void nf_conntrack_free(struct nf_conn *ct);
254extern void nf_conntrack_free(struct nf_conn *ct); 247struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone,
255extern struct nf_conn * 248 const struct nf_conntrack_tuple *orig,
256nf_conntrack_alloc(struct net *net, u16 zone, 249 const struct nf_conntrack_tuple *repl,
257 const struct nf_conntrack_tuple *orig, 250 gfp_t gfp);
258 const struct nf_conntrack_tuple *repl,
259 gfp_t gfp);
260 251
261static inline int nf_ct_is_template(const struct nf_conn *ct) 252static inline int nf_ct_is_template(const struct nf_conn *ct)
262{ 253{
@@ -287,7 +278,7 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
287 278
288struct kernel_param; 279struct kernel_param;
289 280
290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 281int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
291extern unsigned int nf_conntrack_htable_size; 282extern unsigned int nf_conntrack_htable_size;
292extern unsigned int nf_conntrack_max; 283extern unsigned int nf_conntrack_max;
293extern unsigned int nf_conntrack_hash_rnd; 284extern unsigned int nf_conntrack_hash_rnd;
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 2bdb7a15fe06..79d8d16732b4 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -19,17 +19,21 @@ struct nf_conn_counter {
19 atomic64_t bytes; 19 atomic64_t bytes;
20}; 20};
21 21
22struct nf_conn_acct {
23 struct nf_conn_counter counter[IP_CT_DIR_MAX];
24};
25
22static inline 26static inline
23struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) 27struct nf_conn_acct *nf_conn_acct_find(const struct nf_conn *ct)
24{ 28{
25 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT); 29 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT);
26} 30}
27 31
28static inline 32static inline
29struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) 33struct nf_conn_acct *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
30{ 34{
31 struct net *net = nf_ct_net(ct); 35 struct net *net = nf_ct_net(ct);
32 struct nf_conn_counter *acct; 36 struct nf_conn_acct *acct;
33 37
34 if (!net->ct.sysctl_acct) 38 if (!net->ct.sysctl_acct)
35 return NULL; 39 return NULL;
@@ -42,8 +46,8 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
42 return acct; 46 return acct;
43}; 47};
44 48
45extern unsigned int 49unsigned int seq_print_acct(struct seq_file *s, const struct nf_conn *ct,
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 50 int dir);
47 51
48/* Check if connection tracking accounting is enabled */ 52/* Check if connection tracking accounting is enabled */
49static inline bool nf_ct_acct_enabled(struct net *net) 53static inline bool nf_ct_acct_enabled(struct net *net)
@@ -57,9 +61,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
57 net->ct.sysctl_acct = enable; 61 net->ct.sysctl_acct = enable;
58} 62}
59 63
60extern int nf_conntrack_acct_pernet_init(struct net *net); 64int nf_conntrack_acct_pernet_init(struct net *net);
61extern void nf_conntrack_acct_pernet_fini(struct net *net); 65void nf_conntrack_acct_pernet_fini(struct net *net);
62 66
63extern int nf_conntrack_acct_init(void); 67int nf_conntrack_acct_init(void);
64extern void nf_conntrack_acct_fini(void); 68void nf_conntrack_acct_fini(void);
65#endif /* _NF_CONNTRACK_ACCT_H */ 69#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index fb2b6234e937..15308b8eb5b5 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -20,49 +20,42 @@
20/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
21 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
22 of connection tracking. */ 22 of connection tracking. */
23extern unsigned int nf_conntrack_in(struct net *net, 23unsigned int nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
24 u_int8_t pf, 24 struct sk_buff *skb);
25 unsigned int hooknum, 25
26 struct sk_buff *skb); 26int nf_conntrack_init_net(struct net *net);
27 27void nf_conntrack_cleanup_net(struct net *net);
28extern int nf_conntrack_init_net(struct net *net); 28void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
29extern void nf_conntrack_cleanup_net(struct net *net); 29
30extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list); 30int nf_conntrack_proto_pernet_init(struct net *net);
31 31void nf_conntrack_proto_pernet_fini(struct net *net);
32extern int nf_conntrack_proto_pernet_init(struct net *net); 32
33extern void nf_conntrack_proto_pernet_fini(struct net *net); 33int nf_conntrack_proto_init(void);
34 34void nf_conntrack_proto_fini(void);
35extern int nf_conntrack_proto_init(void); 35
36extern void nf_conntrack_proto_fini(void); 36int nf_conntrack_init_start(void);
37 37void nf_conntrack_cleanup_start(void);
38extern int nf_conntrack_init_start(void); 38
39extern void nf_conntrack_cleanup_start(void); 39void nf_conntrack_init_end(void);
40 40void nf_conntrack_cleanup_end(void);
41extern void nf_conntrack_init_end(void); 41
42extern void nf_conntrack_cleanup_end(void); 42bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff,
43 43 unsigned int dataoff, u_int16_t l3num, u_int8_t protonum,
44extern bool 44 struct nf_conntrack_tuple *tuple,
45nf_ct_get_tuple(const struct sk_buff *skb, 45 const struct nf_conntrack_l3proto *l3proto,
46 unsigned int nhoff, 46 const struct nf_conntrack_l4proto *l4proto);
47 unsigned int dataoff, 47
48 u_int16_t l3num, 48bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 u_int8_t protonum, 49 const struct nf_conntrack_tuple *orig,
50 struct nf_conntrack_tuple *tuple, 50 const struct nf_conntrack_l3proto *l3proto,
51 const struct nf_conntrack_l3proto *l3proto, 51 const struct nf_conntrack_l4proto *l4proto);
52 const struct nf_conntrack_l4proto *l4proto);
53
54extern bool
55nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
56 const struct nf_conntrack_tuple *orig,
57 const struct nf_conntrack_l3proto *l3proto,
58 const struct nf_conntrack_l4proto *l4proto);
59 52
60/* Find a connection corresponding to a tuple. */ 53/* Find a connection corresponding to a tuple. */
61extern struct nf_conntrack_tuple_hash * 54struct nf_conntrack_tuple_hash *
62nf_conntrack_find_get(struct net *net, u16 zone, 55nf_conntrack_find_get(struct net *net, u16 zone,
63 const struct nf_conntrack_tuple *tuple); 56 const struct nf_conntrack_tuple *tuple);
64 57
65extern int __nf_conntrack_confirm(struct sk_buff *skb); 58int __nf_conntrack_confirm(struct sk_buff *skb);
66 59
67/* Confirm a connection: returns NF_DROP if packet must be dropped. */ 60/* Confirm a connection: returns NF_DROP if packet must be dropped. */
68static inline int nf_conntrack_confirm(struct sk_buff *skb) 61static inline int nf_conntrack_confirm(struct sk_buff *skb)
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 092dc651689f..0e3d08e4b1d3 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -68,10 +68,12 @@ struct nf_ct_event_notifier {
68 int (*fcn)(unsigned int events, struct nf_ct_event *item); 68 int (*fcn)(unsigned int events, struct nf_ct_event *item);
69}; 69};
70 70
71extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); 71int nf_conntrack_register_notifier(struct net *net,
72extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); 72 struct nf_ct_event_notifier *nb);
73void nf_conntrack_unregister_notifier(struct net *net,
74 struct nf_ct_event_notifier *nb);
73 75
74extern void nf_ct_deliver_cached_events(struct nf_conn *ct); 76void nf_ct_deliver_cached_events(struct nf_conn *ct);
75 77
76static inline void 78static inline void
77nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 79nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
@@ -166,8 +168,10 @@ struct nf_exp_event_notifier {
166 int (*fcn)(unsigned int events, struct nf_exp_event *item); 168 int (*fcn)(unsigned int events, struct nf_exp_event *item);
167}; 169};
168 170
169extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); 171int nf_ct_expect_register_notifier(struct net *net,
170extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); 172 struct nf_exp_event_notifier *nb);
173void nf_ct_expect_unregister_notifier(struct net *net,
174 struct nf_exp_event_notifier *nb);
171 175
172static inline void 176static inline void
173nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 177nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -207,11 +211,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207 nf_ct_expect_event_report(event, exp, 0, 0); 211 nf_ct_expect_event_report(event, exp, 0, 0);
208} 212}
209 213
210extern int nf_conntrack_ecache_pernet_init(struct net *net); 214int nf_conntrack_ecache_pernet_init(struct net *net);
211extern void nf_conntrack_ecache_pernet_fini(struct net *net); 215void nf_conntrack_ecache_pernet_fini(struct net *net);
212 216
213extern int nf_conntrack_ecache_init(void); 217int nf_conntrack_ecache_init(void);
214extern void nf_conntrack_ecache_fini(void); 218void nf_conntrack_ecache_fini(void);
215#else /* CONFIG_NF_CONNTRACK_EVENTS */ 219#else /* CONFIG_NF_CONNTRACK_EVENTS */
216 220
217static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 221static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index ff95434e50ca..956b175523ff 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -36,7 +36,7 @@ enum nf_ct_ext_id {
36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj 38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj
39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_acct
40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
@@ -73,7 +73,7 @@ static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id))) 73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
74 74
75/* Destroy all relationships */ 75/* Destroy all relationships */
76extern void __nf_ct_ext_destroy(struct nf_conn *ct); 76void __nf_ct_ext_destroy(struct nf_conn *ct);
77static inline void nf_ct_ext_destroy(struct nf_conn *ct) 77static inline void nf_ct_ext_destroy(struct nf_conn *ct)
78{ 78{
79 if (ct->ext) 79 if (ct->ext)
@@ -86,7 +86,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct)
86static inline void nf_ct_ext_free(struct nf_conn *ct) 86static inline void nf_ct_ext_free(struct nf_conn *ct)
87{ 87{
88 if (ct->ext) 88 if (ct->ext)
89 kfree(ct->ext); 89 kfree_rcu(ct->ext, rcu);
90} 90}
91 91
92/* Add this type, returns pointer to data or NULL. */ 92/* Add this type, returns pointer to data or NULL. */
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 26c4ae5bfbb8..6cf614bc0029 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -52,21 +52,24 @@ struct nf_conntrack_helper {
52 unsigned int queue_num; /* For user-space helpers. */ 52 unsigned int queue_num; /* For user-space helpers. */
53}; 53};
54 54
55extern struct nf_conntrack_helper * 55struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
56__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum); 56 u16 l3num, u8 protonum);
57 57
58extern struct nf_conntrack_helper * 58struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
59nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum); 59 u16 l3num,
60 u8 protonum);
60 61
61extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 62int nf_conntrack_helper_register(struct nf_conntrack_helper *);
62extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 63void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
63 64
64extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp); 65struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct,
66 struct nf_conntrack_helper *helper,
67 gfp_t gfp);
65 68
66extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, 69int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
67 gfp_t flags); 70 gfp_t flags);
68 71
69extern void nf_ct_helper_destroy(struct nf_conn *ct); 72void nf_ct_helper_destroy(struct nf_conn *ct);
70 73
71static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 74static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
72{ 75{
@@ -82,17 +85,16 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
82 return (void *)help->data; 85 return (void *)help->data;
83} 86}
84 87
85extern int nf_conntrack_helper_pernet_init(struct net *net); 88int nf_conntrack_helper_pernet_init(struct net *net);
86extern void nf_conntrack_helper_pernet_fini(struct net *net); 89void nf_conntrack_helper_pernet_fini(struct net *net);
87 90
88extern int nf_conntrack_helper_init(void); 91int nf_conntrack_helper_init(void);
89extern void nf_conntrack_helper_fini(void); 92void nf_conntrack_helper_fini(void);
90 93
91extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 94int nf_conntrack_broadcast_help(struct sk_buff *skb, unsigned int protoff,
92 unsigned int protoff, 95 struct nf_conn *ct,
93 struct nf_conn *ct, 96 enum ip_conntrack_info ctinfo,
94 enum ip_conntrack_info ctinfo, 97 unsigned int timeout);
95 unsigned int timeout);
96 98
97struct nf_ct_helper_expectfn { 99struct nf_ct_helper_expectfn {
98 struct list_head head; 100 struct list_head head;
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 3bb89eac3fa1..3efab704b7eb 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -77,17 +77,17 @@ struct nf_conntrack_l3proto {
77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
78 78
79/* Protocol pernet registration. */ 79/* Protocol pernet registration. */
80extern int nf_ct_l3proto_pernet_register(struct net *net, 80int nf_ct_l3proto_pernet_register(struct net *net,
81 struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_ct_l3proto_pernet_unregister(struct net *net, 82void nf_ct_l3proto_pernet_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto); 83 struct nf_conntrack_l3proto *proto);
84 84
85/* Protocol global registration. */ 85/* Protocol global registration. */
86extern int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto); 86int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
87extern void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto); 87void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
88 88
89extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 89struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
90extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 90void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
91 91
92/* Existing built-in protocols */ 92/* Existing built-in protocols */
93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic; 93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index b411d7b17dec..4c8d573830b7 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -114,22 +114,22 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
114 114
115#define MAX_NF_CT_PROTO 256 115#define MAX_NF_CT_PROTO 256
116 116
117extern struct nf_conntrack_l4proto * 117struct nf_conntrack_l4proto *__nf_ct_l4proto_find(u_int16_t l3proto,
118__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 118 u_int8_t l4proto);
119 119
120extern struct nf_conntrack_l4proto * 120struct nf_conntrack_l4proto *nf_ct_l4proto_find_get(u_int16_t l3proto,
121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); 121 u_int8_t l4proto);
122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
123 123
124/* Protocol pernet registration. */ 124/* Protocol pernet registration. */
125extern int nf_ct_l4proto_pernet_register(struct net *net, 125int nf_ct_l4proto_pernet_register(struct net *net,
126 struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_ct_l4proto_pernet_unregister(struct net *net, 127void nf_ct_l4proto_pernet_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto); 128 struct nf_conntrack_l4proto *proto);
129 129
130/* Protocol global registration. */ 130/* Protocol global registration. */
131extern int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto); 131int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto);
132extern void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto); 132void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto);
133 133
134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn) 134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
135{ 135{
@@ -140,11 +140,11 @@ static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
140} 140}
141 141
142/* Generic netlink helpers */ 142/* Generic netlink helpers */
143extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, 143int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
144 const struct nf_conntrack_tuple *tuple); 144 const struct nf_conntrack_tuple *tuple);
145extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 145int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
146 struct nf_conntrack_tuple *t); 146 struct nf_conntrack_tuple *t);
147extern int nf_ct_port_nlattr_tuple_size(void); 147int nf_ct_port_nlattr_tuple_size(void);
148extern const struct nla_policy nf_ct_port_nla_policy[]; 148extern const struct nla_policy nf_ct_port_nla_policy[];
149 149
150#ifdef CONFIG_SYSCTL 150#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_seqadj.h b/include/net/netfilter/nf_conntrack_seqadj.h
index f6177a5fe0ca..4b3362991a25 100644
--- a/include/net/netfilter/nf_conntrack_seqadj.h
+++ b/include/net/netfilter/nf_conntrack_seqadj.h
@@ -30,22 +30,18 @@ static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)
30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC); 30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC);
31} 31}
32 32
33extern int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 33int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
34 s32 off); 34 s32 off);
35extern int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 35int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
36 __be32 seq, s32 off); 36 __be32 seq, s32 off);
37extern void nf_ct_tcp_seqadj_set(struct sk_buff *skb, 37void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct,
38 struct nf_conn *ct, 38 enum ip_conntrack_info ctinfo, s32 off);
39 enum ip_conntrack_info ctinfo, 39
40 s32 off); 40int nf_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
41 41 enum ip_conntrack_info ctinfo, unsigned int protoff);
42extern int nf_ct_seq_adjust(struct sk_buff *skb, 42s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, u32 seq);
43 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 43
44 unsigned int protoff); 44int nf_conntrack_seqadj_init(void);
45extern s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, 45void nf_conntrack_seqadj_fini(void);
46 u32 seq);
47
48extern int nf_conntrack_seqadj_init(void);
49extern void nf_conntrack_seqadj_fini(void);
50 46
51#endif /* _NF_CONNTRACK_SEQADJ_H */ 47#endif /* _NF_CONNTRACK_SEQADJ_H */
diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h
index 806f54a290d6..6793614e6502 100644
--- a/include/net/netfilter/nf_conntrack_synproxy.h
+++ b/include/net/netfilter/nf_conntrack_synproxy.h
@@ -56,22 +56,20 @@ struct synproxy_options {
56 56
57struct tcphdr; 57struct tcphdr;
58struct xt_synproxy_info; 58struct xt_synproxy_info;
59extern void synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, 59bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
60 const struct tcphdr *th, 60 const struct tcphdr *th,
61 struct synproxy_options *opts); 61 struct synproxy_options *opts);
62extern unsigned int synproxy_options_size(const struct synproxy_options *opts); 62unsigned int synproxy_options_size(const struct synproxy_options *opts);
63extern void synproxy_build_options(struct tcphdr *th, 63void synproxy_build_options(struct tcphdr *th,
64 const struct synproxy_options *opts); 64 const struct synproxy_options *opts);
65 65
66extern void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, 66void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info,
67 struct synproxy_options *opts); 67 struct synproxy_options *opts);
68extern void synproxy_check_timestamp_cookie(struct synproxy_options *opts); 68void synproxy_check_timestamp_cookie(struct synproxy_options *opts);
69 69
70extern unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, 70unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
71 unsigned int protoff, 71 struct tcphdr *th, struct nf_conn *ct,
72 struct tcphdr *th, 72 enum ip_conntrack_info ctinfo,
73 struct nf_conn *ct, 73 const struct nf_conn_synproxy *synproxy);
74 enum ip_conntrack_info ctinfo,
75 const struct nf_conn_synproxy *synproxy);
76 74
77#endif /* _NF_CONNTRACK_SYNPROXY_H */ 75#endif /* _NF_CONNTRACK_SYNPROXY_H */
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index d23aceb16d94..62308713dd7f 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -76,8 +76,8 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
76} 76}
77 77
78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
79extern int nf_conntrack_timeout_init(void); 79int nf_conntrack_timeout_init(void);
80extern void nf_conntrack_timeout_fini(void); 80void nf_conntrack_timeout_fini(void);
81#else 81#else
82static inline int nf_conntrack_timeout_init(void) 82static inline int nf_conntrack_timeout_init(void)
83{ 83{
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
index b00461413efd..300ae2209f25 100644
--- a/include/net/netfilter/nf_conntrack_timestamp.h
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -48,11 +48,11 @@ static inline void nf_ct_set_tstamp(struct net *net, bool enable)
48} 48}
49 49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_pernet_init(struct net *net); 51int nf_conntrack_tstamp_pernet_init(struct net *net);
52extern void nf_conntrack_tstamp_pernet_fini(struct net *net); 52void nf_conntrack_tstamp_pernet_fini(struct net *net);
53 53
54extern int nf_conntrack_tstamp_init(void); 54int nf_conntrack_tstamp_init(void);
55extern void nf_conntrack_tstamp_fini(void); 55void nf_conntrack_tstamp_fini(void);
56#else 56#else
57static inline int nf_conntrack_tstamp_pernet_init(struct net *net) 57static inline int nf_conntrack_tstamp_pernet_init(struct net *net)
58{ 58{
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 59a192420053..07eaaf604092 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -41,13 +41,16 @@ struct nf_conn_nat {
41}; 41};
42 42
43/* Set up the info structure to map into this range. */ 43/* Set up the info structure to map into this range. */
44extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 44unsigned int nf_nat_setup_info(struct nf_conn *ct,
45 const struct nf_nat_range *range, 45 const struct nf_nat_range *range,
46 enum nf_nat_manip_type maniptype); 46 enum nf_nat_manip_type maniptype);
47
48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
49 unsigned int hooknum);
47 50
48/* Is this tuple already taken? (not by us)*/ 51/* Is this tuple already taken? (not by us)*/
49extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 52int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
50 const struct nf_conn *ignored_conntrack); 53 const struct nf_conn *ignored_conntrack);
51 54
52static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) 55static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
53{ 56{
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 972e1e47ec79..fbfd1ba4254e 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -7,12 +7,10 @@
7/* This header used to share core functionality between the standalone 7/* This header used to share core functionality between the standalone
8 NAT module, and the compatibility layer's use of NAT for masquerading. */ 8 NAT module, and the compatibility layer's use of NAT for masquerading. */
9 9
10extern unsigned int nf_nat_packet(struct nf_conn *ct, 10unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
11 enum ip_conntrack_info ctinfo, 11 unsigned int hooknum, struct sk_buff *skb);
12 unsigned int hooknum,
13 struct sk_buff *skb);
14 12
15extern int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family); 13int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family);
16 14
17static inline int nf_nat_initialized(struct nf_conn *ct, 15static inline int nf_nat_initialized(struct nf_conn *ct,
18 enum nf_nat_manip_type manip) 16 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 404324d1d0c4..01bcc6bfbcc9 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,14 +7,11 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
11 struct nf_conn *ct, 11 enum ip_conntrack_info ctinfo,
12 enum ip_conntrack_info ctinfo, 12 unsigned int protoff, unsigned int match_offset,
13 unsigned int protoff, 13 unsigned int match_len, const char *rep_buffer,
14 unsigned int match_offset, 14 unsigned int rep_len, bool adjust);
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len, bool adjust);
18 15
19static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 16static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
20 struct nf_conn *ct, 17 struct nf_conn *ct,
@@ -30,18 +27,14 @@ static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
30 rep_buffer, rep_len, true); 27 rep_buffer, rep_len, true);
31} 28}
32 29
33extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 30int nf_nat_mangle_udp_packet(struct sk_buff *skb, struct nf_conn *ct,
34 struct nf_conn *ct, 31 enum ip_conntrack_info ctinfo,
35 enum ip_conntrack_info ctinfo, 32 unsigned int protoff, unsigned int match_offset,
36 unsigned int protoff, 33 unsigned int match_len, const char *rep_buffer,
37 unsigned int match_offset, 34 unsigned int rep_len);
38 unsigned int match_len,
39 const char *rep_buffer,
40 unsigned int rep_len);
41 35
42/* Setup NAT on this expected conntrack so it follows master, but goes 36/* Setup NAT on this expected conntrack so it follows master, but goes
43 * to port ct->master->saved_proto. */ 37 * to port ct->master->saved_proto. */
44extern void nf_nat_follow_master(struct nf_conn *ct, 38void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this);
45 struct nf_conntrack_expect *this);
46 39
47#endif 40#endif
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index bd3b97e02c82..5a2919b2e09a 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -35,18 +35,15 @@ struct nf_nat_l3proto {
35 struct nf_nat_range *range); 35 struct nf_nat_range *range);
36}; 36};
37 37
38extern int nf_nat_l3proto_register(const struct nf_nat_l3proto *); 38int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39extern void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *); 39void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40extern const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto); 40const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
41 41
42extern int nf_nat_icmp_reply_translation(struct sk_buff *skb, 42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 struct nf_conn *ct, 43 enum ip_conntrack_info ctinfo,
44 enum ip_conntrack_info ctinfo, 44 unsigned int hooknum);
45 unsigned int hooknum); 45int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
46extern int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, 46 enum ip_conntrack_info ctinfo,
47 struct nf_conn *ct, 47 unsigned int hooknum, unsigned int hdrlen);
48 enum ip_conntrack_info ctinfo,
49 unsigned int hooknum,
50 unsigned int hdrlen);
51 48
52#endif /* _NF_NAT_L3PROTO_H */ 49#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
index 24feb68d1bcc..12f4cc841b6e 100644
--- a/include/net/netfilter/nf_nat_l4proto.h
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -42,10 +42,11 @@ struct nf_nat_l4proto {
42}; 42};
43 43
44/* Protocol registration. */ 44/* Protocol registration. */
45extern int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto); 45int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
46extern void nf_nat_l4proto_unregister(u8 l3proto, const struct nf_nat_l4proto *l4proto); 46void nf_nat_l4proto_unregister(u8 l3proto,
47 const struct nf_nat_l4proto *l4proto);
47 48
48extern const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto); 49const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
49 50
50/* Built-in protocols. */ 51/* Built-in protocols. */
51extern const struct nf_nat_l4proto nf_nat_l4proto_tcp; 52extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
@@ -54,19 +55,18 @@ extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6; 55extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
55extern const struct nf_nat_l4proto nf_nat_l4proto_unknown; 56extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
56 57
57extern bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple, 58bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype, 59 enum nf_nat_manip_type maniptype,
59 const union nf_conntrack_man_proto *min, 60 const union nf_conntrack_man_proto *min,
60 const union nf_conntrack_man_proto *max); 61 const union nf_conntrack_man_proto *max);
61 62
62extern void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, 63void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
63 struct nf_conntrack_tuple *tuple, 64 struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range, 65 const struct nf_nat_range *range,
65 enum nf_nat_manip_type maniptype, 66 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct, 67 const struct nf_conn *ct, u16 *rover);
67 u16 *rover);
68 68
69extern int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[], 69int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
70 struct nf_nat_range *range); 70 struct nf_nat_range *range);
71 71
72#endif /*_NF_NAT_L4PROTO_H*/ 72#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index aaba4bbcdda0..c1d5b3e34a21 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -28,7 +28,7 @@ struct nf_queue_handler {
28 28
29void nf_register_queue_handler(const struct nf_queue_handler *qh); 29void nf_register_queue_handler(const struct nf_queue_handler *qh);
30void nf_unregister_queue_handler(void); 30void nf_unregister_queue_handler(void);
31extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 31void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
32 32
33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); 33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry);
34void nf_queue_entry_release_refs(struct nf_queue_entry *entry); 34void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
new file mode 100644
index 000000000000..5a91abfc0c30
--- /dev/null
+++ b/include/net/netfilter/nf_tables.h
@@ -0,0 +1,519 @@
1#ifndef _NET_NF_TABLES_H
2#define _NET_NF_TABLES_H
3
4#include <linux/list.h>
5#include <linux/netfilter.h>
6#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h>
9
10#define NFT_JUMP_STACK_SIZE 16
11
12struct nft_pktinfo {
13 struct sk_buff *skb;
14 const struct net_device *in;
15 const struct net_device *out;
16 u8 hooknum;
17 u8 nhoff;
18 u8 thoff;
19 /* for x_tables compatibility */
20 struct xt_action_param xt;
21};
22
23static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
24 const struct nf_hook_ops *ops,
25 struct sk_buff *skb,
26 const struct net_device *in,
27 const struct net_device *out)
28{
29 pkt->skb = skb;
30 pkt->in = pkt->xt.in = in;
31 pkt->out = pkt->xt.out = out;
32 pkt->hooknum = pkt->xt.hooknum = ops->hooknum;
33 pkt->xt.family = ops->pf;
34}
35
36struct nft_data {
37 union {
38 u32 data[4];
39 struct {
40 u32 verdict;
41 struct nft_chain *chain;
42 };
43 };
44} __attribute__((aligned(__alignof__(u64))));
45
46static inline int nft_data_cmp(const struct nft_data *d1,
47 const struct nft_data *d2,
48 unsigned int len)
49{
50 return memcmp(d1->data, d2->data, len);
51}
52
53static inline void nft_data_copy(struct nft_data *dst,
54 const struct nft_data *src)
55{
56 BUILD_BUG_ON(__alignof__(*dst) != __alignof__(u64));
57 *(u64 *)&dst->data[0] = *(u64 *)&src->data[0];
58 *(u64 *)&dst->data[2] = *(u64 *)&src->data[2];
59}
60
61static inline void nft_data_debug(const struct nft_data *data)
62{
63 pr_debug("data[0]=%x data[1]=%x data[2]=%x data[3]=%x\n",
64 data->data[0], data->data[1],
65 data->data[2], data->data[3]);
66}
67
68/**
69 * struct nft_ctx - nf_tables rule/set context
70 *
71 * @net: net namespace
72 * @skb: netlink skb
73 * @nlh: netlink message header
74 * @afi: address family info
75 * @table: the table the chain is contained in
76 * @chain: the chain the rule is contained in
77 * @nla: netlink attributes
78 */
79struct nft_ctx {
80 struct net *net;
81 const struct sk_buff *skb;
82 const struct nlmsghdr *nlh;
83 const struct nft_af_info *afi;
84 const struct nft_table *table;
85 const struct nft_chain *chain;
86 const struct nlattr * const *nla;
87};
88
89struct nft_data_desc {
90 enum nft_data_types type;
91 unsigned int len;
92};
93
94int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data,
95 struct nft_data_desc *desc, const struct nlattr *nla);
96void nft_data_uninit(const struct nft_data *data, enum nft_data_types type);
97int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
98 enum nft_data_types type, unsigned int len);
99
100static inline enum nft_data_types nft_dreg_to_type(enum nft_registers reg)
101{
102 return reg == NFT_REG_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE;
103}
104
105static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
106{
107 return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1;
108}
109
110int nft_validate_input_register(enum nft_registers reg);
111int nft_validate_output_register(enum nft_registers reg);
112int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg,
113 const struct nft_data *data,
114 enum nft_data_types type);
115
116/**
117 * struct nft_set_elem - generic representation of set elements
118 *
119 * @cookie: implementation specific element cookie
120 * @key: element key
121 * @data: element data (maps only)
122 * @flags: element flags (end of interval)
123 *
124 * The cookie can be used to store a handle to the element for subsequent
125 * removal.
126 */
127struct nft_set_elem {
128 void *cookie;
129 struct nft_data key;
130 struct nft_data data;
131 u32 flags;
132};
133
134struct nft_set;
135struct nft_set_iter {
136 unsigned int count;
137 unsigned int skip;
138 int err;
139 int (*fn)(const struct nft_ctx *ctx,
140 const struct nft_set *set,
141 const struct nft_set_iter *iter,
142 const struct nft_set_elem *elem);
143};
144
145/**
146 * struct nft_set_ops - nf_tables set operations
147 *
148 * @lookup: look up an element within the set
149 * @insert: insert new element into set
150 * @remove: remove element from set
151 * @walk: iterate over all set elemeennts
152 * @privsize: function to return size of set private data
153 * @init: initialize private data of new set instance
154 * @destroy: destroy private data of set instance
155 * @list: nf_tables_set_ops list node
156 * @owner: module reference
157 * @features: features supported by the implementation
158 */
159struct nft_set_ops {
160 bool (*lookup)(const struct nft_set *set,
161 const struct nft_data *key,
162 struct nft_data *data);
163 int (*get)(const struct nft_set *set,
164 struct nft_set_elem *elem);
165 int (*insert)(const struct nft_set *set,
166 const struct nft_set_elem *elem);
167 void (*remove)(const struct nft_set *set,
168 const struct nft_set_elem *elem);
169 void (*walk)(const struct nft_ctx *ctx,
170 const struct nft_set *set,
171 struct nft_set_iter *iter);
172
173 unsigned int (*privsize)(const struct nlattr * const nla[]);
174 int (*init)(const struct nft_set *set,
175 const struct nlattr * const nla[]);
176 void (*destroy)(const struct nft_set *set);
177
178 struct list_head list;
179 struct module *owner;
180 u32 features;
181};
182
183int nft_register_set(struct nft_set_ops *ops);
184void nft_unregister_set(struct nft_set_ops *ops);
185
186/**
187 * struct nft_set - nf_tables set instance
188 *
189 * @list: table set list node
190 * @bindings: list of set bindings
191 * @name: name of the set
192 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
193 * @dtype: data type (verdict or numeric type defined by userspace)
194 * @ops: set ops
195 * @flags: set flags
196 * @klen: key length
197 * @dlen: data length
198 * @data: private set data
199 */
200struct nft_set {
201 struct list_head list;
202 struct list_head bindings;
203 char name[IFNAMSIZ];
204 u32 ktype;
205 u32 dtype;
206 /* runtime data below here */
207 const struct nft_set_ops *ops ____cacheline_aligned;
208 u16 flags;
209 u8 klen;
210 u8 dlen;
211 unsigned char data[]
212 __attribute__((aligned(__alignof__(u64))));
213};
214
215static inline void *nft_set_priv(const struct nft_set *set)
216{
217 return (void *)set->data;
218}
219
220struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
221 const struct nlattr *nla);
222
223/**
224 * struct nft_set_binding - nf_tables set binding
225 *
226 * @list: set bindings list node
227 * @chain: chain containing the rule bound to the set
228 *
229 * A set binding contains all information necessary for validation
230 * of new elements added to a bound set.
231 */
232struct nft_set_binding {
233 struct list_head list;
234 const struct nft_chain *chain;
235};
236
237int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
238 struct nft_set_binding *binding);
239void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
240 struct nft_set_binding *binding);
241
242
243/**
244 * struct nft_expr_type - nf_tables expression type
245 *
246 * @select_ops: function to select nft_expr_ops
247 * @ops: default ops, used when no select_ops functions is present
248 * @list: used internally
249 * @name: Identifier
250 * @owner: module reference
251 * @policy: netlink attribute policy
252 * @maxattr: highest netlink attribute number
253 */
254struct nft_expr_type {
255 const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *,
256 const struct nlattr * const tb[]);
257 const struct nft_expr_ops *ops;
258 struct list_head list;
259 const char *name;
260 struct module *owner;
261 const struct nla_policy *policy;
262 unsigned int maxattr;
263};
264
265/**
266 * struct nft_expr_ops - nf_tables expression operations
267 *
268 * @eval: Expression evaluation function
269 * @size: full expression size, including private data size
270 * @init: initialization function
271 * @destroy: destruction function
272 * @dump: function to dump parameters
273 * @type: expression type
274 * @validate: validate expression, called during loop detection
275 * @data: extra data to attach to this expression operation
276 */
277struct nft_expr;
278struct nft_expr_ops {
279 void (*eval)(const struct nft_expr *expr,
280 struct nft_data data[NFT_REG_MAX + 1],
281 const struct nft_pktinfo *pkt);
282 unsigned int size;
283
284 int (*init)(const struct nft_ctx *ctx,
285 const struct nft_expr *expr,
286 const struct nlattr * const tb[]);
287 void (*destroy)(const struct nft_expr *expr);
288 int (*dump)(struct sk_buff *skb,
289 const struct nft_expr *expr);
290 int (*validate)(const struct nft_ctx *ctx,
291 const struct nft_expr *expr,
292 const struct nft_data **data);
293 const struct nft_expr_type *type;
294 void *data;
295};
296
297#define NFT_EXPR_MAXATTR 16
298#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
299 ALIGN(size, __alignof__(struct nft_expr)))
300
301/**
302 * struct nft_expr - nf_tables expression
303 *
304 * @ops: expression ops
305 * @data: expression private data
306 */
307struct nft_expr {
308 const struct nft_expr_ops *ops;
309 unsigned char data[];
310};
311
312static inline void *nft_expr_priv(const struct nft_expr *expr)
313{
314 return (void *)expr->data;
315}
316
317/**
318 * struct nft_rule - nf_tables rule
319 *
320 * @list: used internally
321 * @rcu_head: used internally for rcu
322 * @handle: rule handle
323 * @genmask: generation mask
324 * @dlen: length of expression data
325 * @data: expression data
326 */
327struct nft_rule {
328 struct list_head list;
329 struct rcu_head rcu_head;
330 u64 handle:46,
331 genmask:2,
332 dlen:16;
333 unsigned char data[]
334 __attribute__((aligned(__alignof__(struct nft_expr))));
335};
336
337/**
338 * struct nft_rule_trans - nf_tables rule update in transaction
339 *
340 * @list: used internally
341 * @rule: rule that needs to be updated
342 * @chain: chain that this rule belongs to
343 * @table: table for which this chain applies
344 * @nlh: netlink header of the message that contain this update
345 * @family: family expressesed as AF_*
346 */
347struct nft_rule_trans {
348 struct list_head list;
349 struct nft_rule *rule;
350 const struct nft_chain *chain;
351 const struct nft_table *table;
352 const struct nlmsghdr *nlh;
353 u8 family;
354};
355
356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
357{
358 return (struct nft_expr *)&rule->data[0];
359}
360
361static inline struct nft_expr *nft_expr_next(const struct nft_expr *expr)
362{
363 return ((void *)expr) + expr->ops->size;
364}
365
366static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
367{
368 return (struct nft_expr *)&rule->data[rule->dlen];
369}
370
371/*
372 * The last pointer isn't really necessary, but the compiler isn't able to
373 * determine that the result of nft_expr_last() is always the same since it
374 * can't assume that the dlen value wasn't changed within calls in the loop.
375 */
376#define nft_rule_for_each_expr(expr, last, rule) \
377 for ((expr) = nft_expr_first(rule), (last) = nft_expr_last(rule); \
378 (expr) != (last); \
379 (expr) = nft_expr_next(expr))
380
381enum nft_chain_flags {
382 NFT_BASE_CHAIN = 0x1,
383};
384
385/**
386 * struct nft_chain - nf_tables chain
387 *
388 * @rules: list of rules in the chain
389 * @list: used internally
390 * @rcu_head: used internally
391 * @net: net namespace that this chain belongs to
392 * @table: table that this chain belongs to
393 * @handle: chain handle
394 * @flags: bitmask of enum nft_chain_flags
395 * @use: number of jump references to this chain
396 * @level: length of longest path to this chain
397 * @name: name of the chain
398 */
399struct nft_chain {
400 struct list_head rules;
401 struct list_head list;
402 struct rcu_head rcu_head;
403 struct net *net;
404 struct nft_table *table;
405 u64 handle;
406 u8 flags;
407 u16 use;
408 u16 level;
409 char name[NFT_CHAIN_MAXNAMELEN];
410};
411
412enum nft_chain_type {
413 NFT_CHAIN_T_DEFAULT = 0,
414 NFT_CHAIN_T_ROUTE,
415 NFT_CHAIN_T_NAT,
416 NFT_CHAIN_T_MAX
417};
418
419struct nft_stats {
420 u64 bytes;
421 u64 pkts;
422};
423
424/**
425 * struct nft_base_chain - nf_tables base chain
426 *
427 * @ops: netfilter hook ops
428 * @type: chain type
429 * @policy: default policy
430 * @stats: per-cpu chain stats
431 * @chain: the chain
432 */
433struct nft_base_chain {
434 struct nf_hook_ops ops;
435 enum nft_chain_type type;
436 u8 policy;
437 struct nft_stats __percpu *stats;
438 struct nft_chain chain;
439};
440
441static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain)
442{
443 return container_of(chain, struct nft_base_chain, chain);
444}
445
446unsigned int nft_do_chain_pktinfo(struct nft_pktinfo *pkt,
447 const struct nf_hook_ops *ops);
448
449/**
450 * struct nft_table - nf_tables table
451 *
452 * @list: used internally
453 * @chains: chains in the table
454 * @sets: sets in the table
455 * @hgenerator: handle generator state
456 * @use: number of chain references to this table
457 * @flags: table flag (see enum nft_table_flags)
458 * @name: name of the table
459 */
460struct nft_table {
461 struct list_head list;
462 struct list_head chains;
463 struct list_head sets;
464 u64 hgenerator;
465 u32 use;
466 u16 flags;
467 char name[];
468};
469
470/**
471 * struct nft_af_info - nf_tables address family info
472 *
473 * @list: used internally
474 * @family: address family
475 * @nhooks: number of hooks in this family
476 * @owner: module owner
477 * @tables: used internally
478 * @hooks: hookfn overrides for packet validation
479 */
480struct nft_af_info {
481 struct list_head list;
482 int family;
483 unsigned int nhooks;
484 struct module *owner;
485 struct list_head tables;
486 nf_hookfn *hooks[NF_MAX_HOOKS];
487};
488
489int nft_register_afinfo(struct net *, struct nft_af_info *);
490void nft_unregister_afinfo(struct nft_af_info *);
491
492struct nf_chain_type {
493 unsigned int hook_mask;
494 const char *name;
495 enum nft_chain_type type;
496 nf_hookfn *fn[NF_MAX_HOOKS];
497 struct module *me;
498 int family;
499};
500
501int nft_register_chain_type(struct nf_chain_type *);
502void nft_unregister_chain_type(struct nf_chain_type *);
503
504int nft_register_expr(struct nft_expr_type *);
505void nft_unregister_expr(struct nft_expr_type *);
506
507#define MODULE_ALIAS_NFT_FAMILY(family) \
508 MODULE_ALIAS("nft-afinfo-" __stringify(family))
509
510#define MODULE_ALIAS_NFT_CHAIN(family, name) \
511 MODULE_ALIAS("nft-chain-" __stringify(family) "-" name)
512
513#define MODULE_ALIAS_NFT_EXPR(name) \
514 MODULE_ALIAS("nft-expr-" name)
515
516#define MODULE_ALIAS_NFT_SET() \
517 MODULE_ALIAS("nft-set")
518
519#endif /* _NET_NF_TABLES_H */
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
new file mode 100644
index 000000000000..cf2b7ae2b9d8
--- /dev/null
+++ b/include/net/netfilter/nf_tables_core.h
@@ -0,0 +1,42 @@
1#ifndef _NET_NF_TABLES_CORE_H
2#define _NET_NF_TABLES_CORE_H
3
4int nf_tables_core_module_init(void);
5void nf_tables_core_module_exit(void);
6
7int nft_immediate_module_init(void);
8void nft_immediate_module_exit(void);
9
10struct nft_cmp_fast_expr {
11 u32 data;
12 enum nft_registers sreg:8;
13 u8 len;
14};
15
16extern const struct nft_expr_ops nft_cmp_fast_ops;
17
18int nft_cmp_module_init(void);
19void nft_cmp_module_exit(void);
20
21int nft_lookup_module_init(void);
22void nft_lookup_module_exit(void);
23
24int nft_bitwise_module_init(void);
25void nft_bitwise_module_exit(void);
26
27int nft_byteorder_module_init(void);
28void nft_byteorder_module_exit(void);
29
30struct nft_payload {
31 enum nft_payload_bases base:8;
32 u8 offset;
33 u8 len;
34 enum nft_registers dreg:8;
35};
36
37extern const struct nft_expr_ops nft_payload_fast_ops;
38
39int nft_payload_module_init(void);
40void nft_payload_module_exit(void);
41
42#endif /* _NET_NF_TABLES_CORE_H */
diff --git a/include/net/netfilter/nf_tables_ipv4.h b/include/net/netfilter/nf_tables_ipv4.h
new file mode 100644
index 000000000000..1be1c2c197ee
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv4.h
@@ -0,0 +1,23 @@
1#ifndef _NF_TABLES_IPV4_H_
2#define _NF_TABLES_IPV4_H_
3
4#include <net/netfilter/nf_tables.h>
5#include <net/ip.h>
6
7static inline void
8nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 struct iphdr *ip;
15
16 nft_set_pktinfo(pkt, ops, skb, in, out);
17
18 pkt->xt.thoff = ip_hdrlen(pkt->skb);
19 ip = ip_hdr(pkt->skb);
20 pkt->xt.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
21}
22
23#endif
diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
new file mode 100644
index 000000000000..4a9b88a65963
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv6.h
@@ -0,0 +1,30 @@
1#ifndef _NF_TABLES_IPV6_H_
2#define _NF_TABLES_IPV6_H_
3
4#include <linux/netfilter_ipv6/ip6_tables.h>
5#include <net/ipv6.h>
6
7static inline int
8nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 int protohdr, thoff = 0;
15 unsigned short frag_off;
16
17 nft_set_pktinfo(pkt, ops, skb, in, out);
18
19 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
20 /* If malformed, drop it */
21 if (protohdr < 0)
22 return -1;
23
24 pkt->xt.thoff = thoff;
25 pkt->xt.fragoff = frag_off;
26
27 return 0;
28}
29
30#endif
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 495c71f66e7e..79f45e19f31e 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -16,7 +16,7 @@ struct xt_rateest {
16 struct rcu_head rcu; 16 struct rcu_head rcu;
17}; 17};
18 18
19extern struct xt_rateest *xt_rateest_lookup(const char *name); 19struct xt_rateest *xt_rateest_lookup(const char *name);
20extern void xt_rateest_put(struct xt_rateest *est); 20void xt_rateest_put(struct xt_rateest *est);
21 21
22#endif /* _XT_RATEEST_H */ 22#endif /* _XT_RATEEST_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 9690b0f6698a..2b47eaadba8f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -225,44 +225,31 @@ struct nl_info {
225 u32 portid; 225 u32 portid;
226}; 226};
227 227
228extern int netlink_rcv_skb(struct sk_buff *skb, 228int netlink_rcv_skb(struct sk_buff *skb,
229 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *, struct nlmsghdr *));
230 struct nlmsghdr *)); 230int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231 unsigned int group, int report, gfp_t flags);
232 u32 portid, unsigned int group, int report, 232
233 gfp_t flags); 233int nla_validate(const struct nlattr *head, int len, int maxtype,
234 234 const struct nla_policy *policy);
235extern int nla_validate(const struct nlattr *head, 235int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
236 int len, int maxtype, 236 int len, const struct nla_policy *policy);
237 const struct nla_policy *policy); 237int nla_policy_len(const struct nla_policy *, int);
238extern int nla_parse(struct nlattr **tb, int maxtype, 238struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype);
239 const struct nlattr *head, int len, 239size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize);
240 const struct nla_policy *policy); 240int nla_memcpy(void *dest, const struct nlattr *src, int count);
241extern int nla_policy_len(const struct nla_policy *, int); 241int nla_memcmp(const struct nlattr *nla, const void *data, size_t size);
242extern struct nlattr * nla_find(const struct nlattr *head, 242int nla_strcmp(const struct nlattr *nla, const char *str);
243 int len, int attrtype); 243struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
244extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 244void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
245 size_t dstsize); 245struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
246extern int nla_memcpy(void *dest, const struct nlattr *src, int count); 246void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
247extern int nla_memcmp(const struct nlattr *nla, const void *data, 247void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
248 size_t size); 248 const void *data);
249extern int nla_strcmp(const struct nlattr *nla, const char *str); 249void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
250extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, 250int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
251 int attrlen); 251int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
252extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen); 252int nla_append(struct sk_buff *skb, int attrlen, const void *data);
253extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype,
254 int attrlen);
255extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
256extern void __nla_put(struct sk_buff *skb, int attrtype,
257 int attrlen, const void *data);
258extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen,
259 const void *data);
260extern int nla_put(struct sk_buff *skb, int attrtype,
261 int attrlen, const void *data);
262extern int nla_put_nohdr(struct sk_buff *skb, int attrlen,
263 const void *data);
264extern int nla_append(struct sk_buff *skb, int attrlen,
265 const void *data);
266 253
267/************************************************************************** 254/**************************************************************************
268 * Netlink Messages 255 * Netlink Messages
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index bf2ec2202c56..ee520cba2ec2 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -15,6 +15,10 @@ struct fib_rules_ops;
15struct hlist_head; 15struct hlist_head;
16struct fib_table; 16struct fib_table;
17struct sock; 17struct sock;
18struct local_ports {
19 seqlock_t lock;
20 int range[2];
21};
18 22
19struct netns_ipv4 { 23struct netns_ipv4 {
20#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
@@ -62,10 +66,11 @@ struct netns_ipv4 {
62 int sysctl_icmp_ratemask; 66 int sysctl_icmp_ratemask;
63 int sysctl_icmp_errors_use_inbound_ifaddr; 67 int sysctl_icmp_errors_use_inbound_ifaddr;
64 68
69 struct local_ports sysctl_local_ports;
70
65 int sysctl_tcp_ecn; 71 int sysctl_tcp_ecn;
66 72
67 kgid_t sysctl_ping_group_range[2]; 73 kgid_t sysctl_ping_group_range[2];
68 long sysctl_tcp_mem[3];
69 74
70 atomic_t dev_addr_genid; 75 atomic_t dev_addr_genid;
71 76
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
new file mode 100644
index 000000000000..15d056d534e3
--- /dev/null
+++ b/include/net/netns/nftables.h
@@ -0,0 +1,19 @@
1#ifndef _NETNS_NFTABLES_H_
2#define _NETNS_NFTABLES_H_
3
4#include <linux/list.h>
5
6struct nft_af_info;
7
8struct netns_nftables {
9 struct list_head af_info;
10 struct list_head commit_list;
11 struct nft_af_info *ipv4;
12 struct nft_af_info *ipv6;
13 struct nft_af_info *arp;
14 struct nft_af_info *bridge;
15 u8 gencursor;
16 u8 genctr;
17};
18
19#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 121dcf854db5..110350aca3df 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -183,51 +183,50 @@ extern int sysctl_netrom_routing_control;
183extern int sysctl_netrom_link_fails_count; 183extern int sysctl_netrom_link_fails_count;
184extern int sysctl_netrom_reset_circuit; 184extern int sysctl_netrom_reset_circuit;
185 185
186extern int nr_rx_frame(struct sk_buff *, struct net_device *); 186int nr_rx_frame(struct sk_buff *, struct net_device *);
187extern void nr_destroy_socket(struct sock *); 187void nr_destroy_socket(struct sock *);
188 188
189/* nr_dev.c */ 189/* nr_dev.c */
190extern int nr_rx_ip(struct sk_buff *, struct net_device *); 190int nr_rx_ip(struct sk_buff *, struct net_device *);
191extern void nr_setup(struct net_device *); 191void nr_setup(struct net_device *);
192 192
193/* nr_in.c */ 193/* nr_in.c */
194extern int nr_process_rx_frame(struct sock *, struct sk_buff *); 194int nr_process_rx_frame(struct sock *, struct sk_buff *);
195 195
196/* nr_loopback.c */ 196/* nr_loopback.c */
197extern void nr_loopback_init(void); 197void nr_loopback_init(void);
198extern void nr_loopback_clear(void); 198void nr_loopback_clear(void);
199extern int nr_loopback_queue(struct sk_buff *); 199int nr_loopback_queue(struct sk_buff *);
200 200
201/* nr_out.c */ 201/* nr_out.c */
202extern void nr_output(struct sock *, struct sk_buff *); 202void nr_output(struct sock *, struct sk_buff *);
203extern void nr_send_nak_frame(struct sock *); 203void nr_send_nak_frame(struct sock *);
204extern void nr_kick(struct sock *); 204void nr_kick(struct sock *);
205extern void nr_transmit_buffer(struct sock *, struct sk_buff *); 205void nr_transmit_buffer(struct sock *, struct sk_buff *);
206extern void nr_establish_data_link(struct sock *); 206void nr_establish_data_link(struct sock *);
207extern void nr_enquiry_response(struct sock *); 207void nr_enquiry_response(struct sock *);
208extern void nr_check_iframes_acked(struct sock *, unsigned short); 208void nr_check_iframes_acked(struct sock *, unsigned short);
209 209
210/* nr_route.c */ 210/* nr_route.c */
211extern void nr_rt_device_down(struct net_device *); 211void nr_rt_device_down(struct net_device *);
212extern struct net_device *nr_dev_first(void); 212struct net_device *nr_dev_first(void);
213extern struct net_device *nr_dev_get(ax25_address *); 213struct net_device *nr_dev_get(ax25_address *);
214extern int nr_rt_ioctl(unsigned int, void __user *); 214int nr_rt_ioctl(unsigned int, void __user *);
215extern void nr_link_failed(ax25_cb *, int); 215void nr_link_failed(ax25_cb *, int);
216extern int nr_route_frame(struct sk_buff *, ax25_cb *); 216int nr_route_frame(struct sk_buff *, ax25_cb *);
217extern const struct file_operations nr_nodes_fops; 217extern const struct file_operations nr_nodes_fops;
218extern const struct file_operations nr_neigh_fops; 218extern const struct file_operations nr_neigh_fops;
219extern void nr_rt_free(void); 219void nr_rt_free(void);
220 220
221/* nr_subr.c */ 221/* nr_subr.c */
222extern void nr_clear_queues(struct sock *); 222void nr_clear_queues(struct sock *);
223extern void nr_frames_acked(struct sock *, unsigned short); 223void nr_frames_acked(struct sock *, unsigned short);
224extern void nr_requeue_frames(struct sock *); 224void nr_requeue_frames(struct sock *);
225extern int nr_validate_nr(struct sock *, unsigned short); 225int nr_validate_nr(struct sock *, unsigned short);
226extern int nr_in_rx_window(struct sock *, unsigned short); 226int nr_in_rx_window(struct sock *, unsigned short);
227extern void nr_write_internal(struct sock *, int); 227void nr_write_internal(struct sock *, int);
228 228
229extern void __nr_transmit_reply(struct sk_buff *skb, int mine, 229void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags);
230 unsigned char cmdflags);
231 230
232/* 231/*
233 * This routine is called when a Connect Acknowledge with the Choke Flag 232 * This routine is called when a Connect Acknowledge with the Choke Flag
@@ -247,24 +246,24 @@ do { \
247 __nr_transmit_reply((skb), (mine), NR_RESET); \ 246 __nr_transmit_reply((skb), (mine), NR_RESET); \
248} while (0) 247} while (0)
249 248
250extern void nr_disconnect(struct sock *, int); 249void nr_disconnect(struct sock *, int);
251 250
252/* nr_timer.c */ 251/* nr_timer.c */
253extern void nr_init_timers(struct sock *sk); 252void nr_init_timers(struct sock *sk);
254extern void nr_start_heartbeat(struct sock *); 253void nr_start_heartbeat(struct sock *);
255extern void nr_start_t1timer(struct sock *); 254void nr_start_t1timer(struct sock *);
256extern void nr_start_t2timer(struct sock *); 255void nr_start_t2timer(struct sock *);
257extern void nr_start_t4timer(struct sock *); 256void nr_start_t4timer(struct sock *);
258extern void nr_start_idletimer(struct sock *); 257void nr_start_idletimer(struct sock *);
259extern void nr_stop_heartbeat(struct sock *); 258void nr_stop_heartbeat(struct sock *);
260extern void nr_stop_t1timer(struct sock *); 259void nr_stop_t1timer(struct sock *);
261extern void nr_stop_t2timer(struct sock *); 260void nr_stop_t2timer(struct sock *);
262extern void nr_stop_t4timer(struct sock *); 261void nr_stop_t4timer(struct sock *);
263extern void nr_stop_idletimer(struct sock *); 262void nr_stop_idletimer(struct sock *);
264extern int nr_t1timer_running(struct sock *); 263int nr_t1timer_running(struct sock *);
265 264
266/* sysctl_net_netrom.c */ 265/* sysctl_net_netrom.c */
267extern void nr_register_sysctl(void); 266void nr_register_sysctl(void);
268extern void nr_unregister_sysctl(void); 267void nr_unregister_sysctl(void);
269 268
270#endif 269#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
new file mode 100644
index 000000000000..36acecd5f06c
--- /dev/null
+++ b/include/net/nfc/digital.h
@@ -0,0 +1,227 @@
1/*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __NFC_DIGITAL_H
17#define __NFC_DIGITAL_H
18
19#include <linux/skbuff.h>
20#include <net/nfc/nfc.h>
21
22/**
23 * Configuration types for in_configure_hw and tg_configure_hw.
24 */
25enum {
26 NFC_DIGITAL_CONFIG_RF_TECH = 0,
27 NFC_DIGITAL_CONFIG_FRAMING,
28};
29
30/**
31 * RF technology values passed as param argument to in_configure_hw and
32 * tg_configure_hw for NFC_DIGITAL_CONFIG_RF_TECH configuration type.
33 */
34enum {
35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F,
38
39 NFC_DIGITAL_RF_TECH_LAST,
40};
41
42/**
43 * Framing configuration passed as param argument to in_configure_hw and
44 * tg_configure_hw for NFC_DIGITAL_CONFIG_FRAMING configuration type.
45 */
46enum {
47 NFC_DIGITAL_FRAMING_NFCA_SHORT = 0,
48 NFC_DIGITAL_FRAMING_NFCA_STANDARD,
49 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A,
50
51 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54
55 NFC_DIGITAL_FRAMING_NFCF,
56 NFC_DIGITAL_FRAMING_NFCF_T3T,
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59
60 NFC_DIGITAL_FRAMING_LAST,
61};
62
63#define DIGITAL_MDAA_NFCID1_SIZE 3
64
65struct digital_tg_mdaa_params {
66 u16 sens_res;
67 u8 nfcid1[DIGITAL_MDAA_NFCID1_SIZE];
68 u8 sel_res;
69
70 u8 nfcid2[NFC_NFCID2_MAXSIZE];
71 u16 sc;
72};
73
74struct nfc_digital_dev;
75
76/**
77 * nfc_digital_cmd_complete_t - Definition of command result callback
78 *
79 * @ddev: nfc_digital_device ref
80 * @arg: user data
81 * @resp: response data
82 *
83 * resp pointer can be an error code and will be checked with IS_ERR() macro.
84 * The callback is responsible for freeing resp sk_buff.
85 */
86typedef void (*nfc_digital_cmd_complete_t)(struct nfc_digital_dev *ddev,
87 void *arg, struct sk_buff *resp);
88
89/**
90 * Device side NFC Digital operations
91 *
92 * Initiator mode:
93 * @in_configure_hw: Hardware configuration for RF technology and communication
94 * framing in initiator mode. This is a synchronous function.
95 * @in_send_cmd: Initiator mode data exchange using RF technology and framing
96 * previously set with in_configure_hw. The peer response is returned
97 * through callback cb. If an io error occurs or the peer didn't reply
98 * within the specified timeout (ms), the error code is passed back through
99 * the resp pointer. This is an asynchronous function.
100 *
101 * Target mode: Only NFC-DEP protocol is supported in target mode.
102 * @tg_configure_hw: Hardware configuration for RF technology and communication
103 * framing in target mode. This is a synchronous function.
104 * @tg_send_cmd: Target mode data exchange using RF technology and framing
105 * previously set with tg_configure_hw. The peer next command is returned
106 * through callback cb. If an io error occurs or the peer didn't reply
107 * within the specified timeout (ms), the error code is passed back through
108 * the resp pointer. This is an asynchronous function.
109 * @tg_listen: Put the device in listen mode waiting for data from the peer
110 * device. This is an asynchronous function.
111 * @tg_listen_mdaa: If supported, put the device in automatic listen mode with
112 * mode detection and automatic anti-collision. In this mode, the device
113 * automatically detects the RF technology and executes the anti-collision
114 * detection using the command responses specified in mdaa_params. The
115 * mdaa_params structure contains SENS_RES, NFCID1, and SEL_RES for 106A RF
116 * tech. NFCID2 and system code (sc) for 212F and 424F. The driver returns
117 * the NFC-DEP ATR_REQ command through cb. The digital stack deducts the RF
118 * tech by analyzing the SoD of the frame containing the ATR_REQ command.
119 * This is an asynchronous function.
120 *
121 * @switch_rf: Turns device radio on or off. The stack does not call explicitly
122 * switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
123 * the device radio on.
124 * @abort_cmd: Discard the last sent command.
125 */
126struct nfc_digital_ops {
127 int (*in_configure_hw)(struct nfc_digital_dev *ddev, int type,
128 int param);
129 int (*in_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
130 u16 timeout, nfc_digital_cmd_complete_t cb,
131 void *arg);
132
133 int (*tg_configure_hw)(struct nfc_digital_dev *ddev, int type,
134 int param);
135 int (*tg_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
136 u16 timeout, nfc_digital_cmd_complete_t cb,
137 void *arg);
138 int (*tg_listen)(struct nfc_digital_dev *ddev, u16 timeout,
139 nfc_digital_cmd_complete_t cb, void *arg);
140 int (*tg_listen_mdaa)(struct nfc_digital_dev *ddev,
141 struct digital_tg_mdaa_params *mdaa_params,
142 u16 timeout, nfc_digital_cmd_complete_t cb,
143 void *arg);
144
145 int (*switch_rf)(struct nfc_digital_dev *ddev, bool on);
146 void (*abort_cmd)(struct nfc_digital_dev *ddev);
147};
148
149#define NFC_DIGITAL_POLL_MODE_COUNT_MAX 6 /* 106A, 212F, and 424F in & tg */
150
151typedef int (*digital_poll_t)(struct nfc_digital_dev *ddev, u8 rf_tech);
152
153struct digital_poll_tech {
154 u8 rf_tech;
155 digital_poll_t poll_func;
156};
157
158/**
159 * Driver capabilities - bit mask made of the following values
160 *
161 * @NFC_DIGITAL_DRV_CAPS_IN_CRC: The driver handles CRC calculation in initiator
162 * mode.
163 * @NFC_DIGITAL_DRV_CAPS_TG_CRC: The driver handles CRC calculation in target
164 * mode.
165 */
166#define NFC_DIGITAL_DRV_CAPS_IN_CRC 0x0001
167#define NFC_DIGITAL_DRV_CAPS_TG_CRC 0x0002
168
169struct nfc_digital_dev {
170 struct nfc_dev *nfc_dev;
171 struct nfc_digital_ops *ops;
172
173 u32 protocols;
174
175 int tx_headroom;
176 int tx_tailroom;
177
178 u32 driver_capabilities;
179 void *driver_data;
180
181 struct digital_poll_tech poll_techs[NFC_DIGITAL_POLL_MODE_COUNT_MAX];
182 u8 poll_tech_count;
183 u8 poll_tech_index;
184 struct mutex poll_lock;
185
186 struct work_struct cmd_work;
187 struct work_struct cmd_complete_work;
188 struct list_head cmd_queue;
189 struct mutex cmd_lock;
190
191 struct work_struct poll_work;
192
193 u8 curr_protocol;
194 u8 curr_rf_tech;
195 u8 curr_nfc_dep_pni;
196
197 int (*skb_check_crc)(struct sk_buff *skb);
198 void (*skb_add_crc)(struct sk_buff *skb);
199};
200
201struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
202 __u32 supported_protocols,
203 __u32 driver_capabilities,
204 int tx_headroom,
205 int tx_tailroom);
206void nfc_digital_free_device(struct nfc_digital_dev *ndev);
207int nfc_digital_register_device(struct nfc_digital_dev *ndev);
208void nfc_digital_unregister_device(struct nfc_digital_dev *ndev);
209
210static inline void nfc_digital_set_parent_dev(struct nfc_digital_dev *ndev,
211 struct device *dev)
212{
213 nfc_set_parent_dev(ndev->nfc_dev, dev);
214}
215
216static inline void nfc_digital_set_drvdata(struct nfc_digital_dev *dev,
217 void *data)
218{
219 dev->driver_data = data;
220}
221
222static inline void *nfc_digital_get_drvdata(struct nfc_digital_dev *dev)
223{
224 return dev->driver_data;
225}
226
227#endif /* __NFC_DIGITAL_H */
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b64b7bce4b94..2eca2960ca9c 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -24,12 +24,6 @@
24 24
25#include <net/nfc/nfc.h> 25#include <net/nfc/nfc.h>
26 26
27struct nfc_phy_ops {
28 int (*write)(void *dev_id, struct sk_buff *skb);
29 int (*enable)(void *dev_id);
30 void (*disable)(void *dev_id);
31};
32
33struct nfc_hci_dev; 27struct nfc_hci_dev;
34 28
35struct nfc_hci_ops { 29struct nfc_hci_ops {
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 88785e5c6b2c..e5aa5acafea0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -166,6 +166,10 @@
166#define NCI_GID_NFCEE_MGMT 0x2 166#define NCI_GID_NFCEE_MGMT 0x2
167#define NCI_GID_PROPRIETARY 0xf 167#define NCI_GID_PROPRIETARY 0xf
168 168
169/* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */
170#define NCI_SPI_HDR_LEN 4
171#define NCI_SPI_CRC_LEN 2
172
169/* ---- NCI Packet structures ---- */ 173/* ---- NCI Packet structures ---- */
170#define NCI_CTRL_HDR_SIZE 3 174#define NCI_CTRL_HDR_SIZE 3
171#define NCI_DATA_HDR_SIZE 3 175#define NCI_DATA_HDR_SIZE 3
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 99fc1f3a392a..6126f1f992b4 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -207,19 +207,9 @@ int nci_to_errno(__u8 code);
207#define NCI_SPI_CRC_ENABLED 0x01 207#define NCI_SPI_CRC_ENABLED 0x01
208 208
209/* ----- NCI SPI structures ----- */ 209/* ----- NCI SPI structures ----- */
210struct nci_spi_dev; 210struct nci_spi {
211 211 struct nci_dev *ndev;
212struct nci_spi_ops {
213 int (*open)(struct nci_spi_dev *ndev);
214 int (*close)(struct nci_spi_dev *ndev);
215 void (*assert_int)(struct nci_spi_dev *ndev);
216 void (*deassert_int)(struct nci_spi_dev *ndev);
217};
218
219struct nci_spi_dev {
220 struct nci_dev *nci_dev;
221 struct spi_device *spi; 212 struct spi_device *spi;
222 struct nci_spi_ops *ops;
223 213
224 unsigned int xfer_udelay; /* microseconds delay between 214 unsigned int xfer_udelay; /* microseconds delay between
225 transactions */ 215 transactions */
@@ -227,31 +217,15 @@ struct nci_spi_dev {
227 217
228 struct completion req_completion; 218 struct completion req_completion;
229 u8 req_result; 219 u8 req_result;
230
231 void *driver_data;
232}; 220};
233 221
234/* ----- NCI SPI Devices ----- */ 222/* ----- NCI SPI ----- */
235struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi, 223struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
236 struct nci_spi_ops *ops, 224 u8 acknowledge_mode, unsigned int delay,
237 u32 supported_protocols, 225 struct nci_dev *ndev);
238 u32 supported_se, 226int nci_spi_send(struct nci_spi *nspi,
239 u8 acknowledge_mode, 227 struct completion *write_handshake_completion,
240 unsigned int delay); 228 struct sk_buff *skb);
241void nci_spi_free_device(struct nci_spi_dev *ndev); 229struct sk_buff *nci_spi_read(struct nci_spi *nspi);
242int nci_spi_register_device(struct nci_spi_dev *ndev);
243void nci_spi_unregister_device(struct nci_spi_dev *ndev);
244int nci_spi_recv_frame(struct nci_spi_dev *ndev);
245
246static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
247 void *data)
248{
249 ndev->driver_data = data;
250}
251
252static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
253{
254 return ndev->driver_data;
255}
256 230
257#endif /* __NCI_CORE_H */ 231#endif /* __NCI_CORE_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index f68ee68e4e3e..82fc4e43fc6e 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -28,9 +28,14 @@
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30 30
31#define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg) 31#define nfc_info(dev, fmt, ...) dev_info((dev), "NFC: " fmt, ##__VA_ARGS__)
32#define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg) 32#define nfc_err(dev, fmt, ...) dev_err((dev), "NFC: " fmt, ##__VA_ARGS__)
33#define nfc_dev_dbg(dev, fmt, arg...) dev_dbg((dev), fmt "\n", ## arg) 33
34struct nfc_phy_ops {
35 int (*write)(void *dev_id, struct sk_buff *skb);
36 int (*enable)(void *dev_id);
37 void (*disable)(void *dev_id);
38};
34 39
35struct nfc_dev; 40struct nfc_dev;
36 41
@@ -48,6 +53,8 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 53typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 54 int err);
50 55
56typedef void (*se_io_cb_t)(void *context, u8 *apdu, size_t apdu_len, int err);
57
51struct nfc_target; 58struct nfc_target;
52 59
53struct nfc_ops { 60struct nfc_ops {
@@ -74,12 +81,23 @@ struct nfc_ops {
74 int (*discover_se)(struct nfc_dev *dev); 81 int (*discover_se)(struct nfc_dev *dev);
75 int (*enable_se)(struct nfc_dev *dev, u32 se_idx); 82 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
76 int (*disable_se)(struct nfc_dev *dev, u32 se_idx); 83 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
84 int (*se_io) (struct nfc_dev *dev, u32 se_idx,
85 u8 *apdu, size_t apdu_length,
86 se_io_cb_t cb, void *cb_context);
77}; 87};
78 88
79#define NFC_TARGET_IDX_ANY -1 89#define NFC_TARGET_IDX_ANY -1
80#define NFC_MAX_GT_LEN 48 90#define NFC_MAX_GT_LEN 48
81#define NFC_ATR_RES_GT_OFFSET 15 91#define NFC_ATR_RES_GT_OFFSET 15
82 92
93/**
94 * struct nfc_target - NFC target descriptiom
95 *
96 * @sens_res: 2 bytes describing the target SENS_RES response, if the target
97 * is a type A one. The %sens_res most significant byte must be byte 2
98 * as described by the NFC Forum digital specification (i.e. the platform
99 * configuration one) while %sens_res least significant byte is byte 1.
100 */
83struct nfc_target { 101struct nfc_target {
84 u32 idx; 102 u32 idx;
85 u32 supported_protocols; 103 u32 supported_protocols;
@@ -243,5 +261,6 @@ void nfc_driver_failure(struct nfc_dev *dev, int err);
243 261
244int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type); 262int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
245int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 263int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
264struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
246 265
247#endif /* __NET_NFC_H */ 266#endif /* __NET_NFC_H */
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 42e9fac51b31..05e41383856b 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -1,13 +1,13 @@
1#ifndef _NET_P8022_H 1#ifndef _NET_P8022_H
2#define _NET_P8022_H 2#define _NET_P8022_H
3extern struct datalink_proto * 3struct datalink_proto *
4 register_8022_client(unsigned char type, 4register_8022_client(unsigned char type,
5 int (*func)(struct sk_buff *skb, 5 int (*func)(struct sk_buff *skb,
6 struct net_device *dev, 6 struct net_device *dev,
7 struct packet_type *pt, 7 struct packet_type *pt,
8 struct net_device *orig_dev)); 8 struct net_device *orig_dev));
9extern void unregister_8022_client(struct datalink_proto *proto); 9void unregister_8022_client(struct datalink_proto *proto);
10 10
11extern struct datalink_proto *make_8023_client(void); 11struct datalink_proto *make_8023_client(void);
12extern void destroy_8023_client(struct datalink_proto *dl); 12void destroy_8023_client(struct datalink_proto *dl);
13#endif 13#endif
diff --git a/include/net/ping.h b/include/net/ping.h
index 5db0224b73ac..90f48417b03d 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -31,7 +31,8 @@
31 31
32/* Compatibility glue so we can support IPv6 when it's compiled as a module */ 32/* Compatibility glue so we can support IPv6 when it's compiled as a module */
33struct pingv6_ops { 33struct pingv6_ops {
34 int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len); 34 int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len,
35 int *addr_len);
35 int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg, 36 int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg,
36 struct sk_buff *skb); 37 struct sk_buff *skb);
37 int (*icmpv6_err_convert)(u8 type, u8 code, int *err); 38 int (*icmpv6_err_convert)(u8 type, u8 code, int *err);
@@ -103,8 +104,8 @@ void ping_seq_stop(struct seq_file *seq, void *v);
103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo); 104int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo);
104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo); 105void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo);
105 106
106extern int __init ping_proc_init(void); 107int __init ping_proc_init(void);
107extern void ping_proc_exit(void); 108void ping_proc_exit(void);
108#endif 109#endif
109 110
110void __init ping_init(void); 111void __init ping_init(void);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 047c0476c0a0..fbf7676c9a02 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -96,20 +96,20 @@ extern const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS];
96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; 96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
97#endif 97#endif
98 98
99extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); 99int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
100extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num); 100int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
101extern int inet_add_offload(const struct net_offload *prot, unsigned char num); 101int inet_add_offload(const struct net_offload *prot, unsigned char num);
102extern int inet_del_offload(const struct net_offload *prot, unsigned char num); 102int inet_del_offload(const struct net_offload *prot, unsigned char num);
103extern void inet_register_protosw(struct inet_protosw *p); 103void inet_register_protosw(struct inet_protosw *p);
104extern void inet_unregister_protosw(struct inet_protosw *p); 104void inet_unregister_protosw(struct inet_protosw *p);
105 105
106#if IS_ENABLED(CONFIG_IPV6) 106#if IS_ENABLED(CONFIG_IPV6)
107extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num); 107int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
108extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num); 108int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
109extern int inet6_register_protosw(struct inet_protosw *p); 109int inet6_register_protosw(struct inet_protosw *p);
110extern void inet6_unregister_protosw(struct inet_protosw *p); 110void inet6_unregister_protosw(struct inet_protosw *p);
111#endif 111#endif
112extern int inet6_add_offload(const struct net_offload *prot, unsigned char num); 112int inet6_add_offload(const struct net_offload *prot, unsigned char num);
113extern int inet6_del_offload(const struct net_offload *prot, unsigned char num); 113int inet6_del_offload(const struct net_offload *prot, unsigned char num);
114 114
115#endif /* _PROTOCOL_H */ 115#endif /* _PROTOCOL_H */
diff --git a/include/net/psnap.h b/include/net/psnap.h
index fe456c295b04..78db4cc1306a 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,11 +1,11 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto * 4struct datalink_proto *
5register_snap_client(const unsigned char *desc, 5register_snap_client(const unsigned char *desc,
6 int (*rcvfunc)(struct sk_buff *, struct net_device *, 6 int (*rcvfunc)(struct sk_buff *, struct net_device *,
7 struct packet_type *, 7 struct packet_type *,
8 struct net_device *orig_dev)); 8 struct net_device *orig_dev));
9extern void unregister_snap_client(struct datalink_proto *proto); 9void unregister_snap_client(struct datalink_proto *proto);
10 10
11#endif 11#endif
diff --git a/include/net/raw.h b/include/net/raw.h
index 42ce6fe7a2d5..6a40c6562dd2 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -26,7 +26,7 @@ extern struct proto raw_prot;
26void raw_icmp_error(struct sk_buff *, int, u32); 26void raw_icmp_error(struct sk_buff *, int, u32);
27int raw_local_deliver(struct sk_buff *, int); 27int raw_local_deliver(struct sk_buff *, int);
28 28
29extern int raw_rcv(struct sock *, struct sk_buff *); 29int raw_rcv(struct sock *, struct sk_buff *);
30 30
31#define RAW_HTABLE_SIZE MAX_INET_PROTOS 31#define RAW_HTABLE_SIZE MAX_INET_PROTOS
32 32
@@ -36,8 +36,8 @@ struct raw_hashinfo {
36}; 36};
37 37
38#ifdef CONFIG_PROC_FS 38#ifdef CONFIG_PROC_FS
39extern int raw_proc_init(void); 39int raw_proc_init(void);
40extern void raw_proc_exit(void); 40void raw_proc_exit(void);
41 41
42struct raw_iter_state { 42struct raw_iter_state {
43 struct seq_net_private p; 43 struct seq_net_private p;
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index e7ea660e4db6..87783dea0791 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -7,8 +7,7 @@ void raw6_icmp_error(struct sk_buff *, int nexthdr,
7 u8 type, u8 code, int inner_offset, __be32); 7 u8 type, u8 code, int inner_offset, __be32);
8bool raw6_local_deliver(struct sk_buff *, int); 8bool raw6_local_deliver(struct sk_buff *, int);
9 9
10extern int rawv6_rcv(struct sock *sk, 10int rawv6_rcv(struct sock *sk, struct sk_buff *skb);
11 struct sk_buff *skb);
12 11
13#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 12#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
14int rawv6_mh_filter_register(int (*filter)(struct sock *sock, 13int rawv6_mh_filter_register(int (*filter)(struct sock *sock,
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 59795e42c8b6..7f830ff67f08 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -43,11 +43,12 @@ struct request_sock_ops {
43 struct request_sock *req); 43 struct request_sock *req);
44}; 44};
45 45
46extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req); 46int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
47 47
48/* struct request_sock - mini sock to represent a connection request 48/* struct request_sock - mini sock to represent a connection request
49 */ 49 */
50struct request_sock { 50struct request_sock {
51 struct sock_common __req_common;
51 struct request_sock *dl_next; 52 struct request_sock *dl_next;
52 u16 mss; 53 u16 mss;
53 u8 num_retrans; /* number of retransmits */ 54 u8 num_retrans; /* number of retransmits */
@@ -162,13 +163,13 @@ struct request_sock_queue {
162 */ 163 */
163}; 164};
164 165
165extern int reqsk_queue_alloc(struct request_sock_queue *queue, 166int reqsk_queue_alloc(struct request_sock_queue *queue,
166 unsigned int nr_table_entries); 167 unsigned int nr_table_entries);
167 168
168extern void __reqsk_queue_destroy(struct request_sock_queue *queue); 169void __reqsk_queue_destroy(struct request_sock_queue *queue);
169extern void reqsk_queue_destroy(struct request_sock_queue *queue); 170void reqsk_queue_destroy(struct request_sock_queue *queue);
170extern void reqsk_fastopen_remove(struct sock *sk, 171void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,
171 struct request_sock *req, bool reset); 172 bool reset);
172 173
173static inline struct request_sock * 174static inline struct request_sock *
174 reqsk_queue_yank_acceptq(struct request_sock_queue *queue) 175 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
diff --git a/include/net/rose.h b/include/net/rose.h
index 555dd198aab7..50811fe2c585 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -160,38 +160,42 @@ extern int sysctl_rose_routing_control;
160extern int sysctl_rose_link_fail_timeout; 160extern int sysctl_rose_link_fail_timeout;
161extern int sysctl_rose_maximum_vcs; 161extern int sysctl_rose_maximum_vcs;
162extern int sysctl_rose_window_size; 162extern int sysctl_rose_window_size;
163extern int rosecmp(rose_address *, rose_address *); 163
164extern int rosecmpm(rose_address *, rose_address *, unsigned short); 164int rosecmp(rose_address *, rose_address *);
165extern char *rose2asc(char *buf, const rose_address *); 165int rosecmpm(rose_address *, rose_address *, unsigned short);
166extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *); 166char *rose2asc(char *buf, const rose_address *);
167extern void rose_kill_by_neigh(struct rose_neigh *); 167struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
168extern unsigned int rose_new_lci(struct rose_neigh *); 168void rose_kill_by_neigh(struct rose_neigh *);
169extern int rose_rx_call_request(struct sk_buff *, struct net_device *, struct rose_neigh *, unsigned int); 169unsigned int rose_new_lci(struct rose_neigh *);
170extern void rose_destroy_socket(struct sock *); 170int rose_rx_call_request(struct sk_buff *, struct net_device *,
171 struct rose_neigh *, unsigned int);
172void rose_destroy_socket(struct sock *);
171 173
172/* rose_dev.c */ 174/* rose_dev.c */
173extern void rose_setup(struct net_device *); 175void rose_setup(struct net_device *);
174 176
175/* rose_in.c */ 177/* rose_in.c */
176extern int rose_process_rx_frame(struct sock *, struct sk_buff *); 178int rose_process_rx_frame(struct sock *, struct sk_buff *);
177 179
178/* rose_link.c */ 180/* rose_link.c */
179extern void rose_start_ftimer(struct rose_neigh *); 181void rose_start_ftimer(struct rose_neigh *);
180extern void rose_stop_ftimer(struct rose_neigh *); 182void rose_stop_ftimer(struct rose_neigh *);
181extern void rose_stop_t0timer(struct rose_neigh *); 183void rose_stop_t0timer(struct rose_neigh *);
182extern int rose_ftimer_running(struct rose_neigh *); 184int rose_ftimer_running(struct rose_neigh *);
183extern void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *, unsigned short); 185void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *,
184extern void rose_transmit_clear_request(struct rose_neigh *, unsigned int, unsigned char, unsigned char); 186 unsigned short);
185extern void rose_transmit_link(struct sk_buff *, struct rose_neigh *); 187void rose_transmit_clear_request(struct rose_neigh *, unsigned int,
188 unsigned char, unsigned char);
189void rose_transmit_link(struct sk_buff *, struct rose_neigh *);
186 190
187/* rose_loopback.c */ 191/* rose_loopback.c */
188extern void rose_loopback_init(void); 192void rose_loopback_init(void);
189extern void rose_loopback_clear(void); 193void rose_loopback_clear(void);
190extern int rose_loopback_queue(struct sk_buff *, struct rose_neigh *); 194int rose_loopback_queue(struct sk_buff *, struct rose_neigh *);
191 195
192/* rose_out.c */ 196/* rose_out.c */
193extern void rose_kick(struct sock *); 197void rose_kick(struct sock *);
194extern void rose_enquiry_response(struct sock *); 198void rose_enquiry_response(struct sock *);
195 199
196/* rose_route.c */ 200/* rose_route.c */
197extern struct rose_neigh *rose_loopback_neigh; 201extern struct rose_neigh *rose_loopback_neigh;
@@ -199,43 +203,45 @@ extern const struct file_operations rose_neigh_fops;
199extern const struct file_operations rose_nodes_fops; 203extern const struct file_operations rose_nodes_fops;
200extern const struct file_operations rose_routes_fops; 204extern const struct file_operations rose_routes_fops;
201 205
202extern void rose_add_loopback_neigh(void); 206void rose_add_loopback_neigh(void);
203extern int __must_check rose_add_loopback_node(rose_address *); 207int __must_check rose_add_loopback_node(rose_address *);
204extern void rose_del_loopback_node(rose_address *); 208void rose_del_loopback_node(rose_address *);
205extern void rose_rt_device_down(struct net_device *); 209void rose_rt_device_down(struct net_device *);
206extern void rose_link_device_down(struct net_device *); 210void rose_link_device_down(struct net_device *);
207extern struct net_device *rose_dev_first(void); 211struct net_device *rose_dev_first(void);
208extern struct net_device *rose_dev_get(rose_address *); 212struct net_device *rose_dev_get(rose_address *);
209extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *); 213struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
210extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *, int); 214struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *,
211extern int rose_rt_ioctl(unsigned int, void __user *); 215 unsigned char *, int);
212extern void rose_link_failed(ax25_cb *, int); 216int rose_rt_ioctl(unsigned int, void __user *);
213extern int rose_route_frame(struct sk_buff *, ax25_cb *); 217void rose_link_failed(ax25_cb *, int);
214extern void rose_rt_free(void); 218int rose_route_frame(struct sk_buff *, ax25_cb *);
219void rose_rt_free(void);
215 220
216/* rose_subr.c */ 221/* rose_subr.c */
217extern void rose_clear_queues(struct sock *); 222void rose_clear_queues(struct sock *);
218extern void rose_frames_acked(struct sock *, unsigned short); 223void rose_frames_acked(struct sock *, unsigned short);
219extern void rose_requeue_frames(struct sock *); 224void rose_requeue_frames(struct sock *);
220extern int rose_validate_nr(struct sock *, unsigned short); 225int rose_validate_nr(struct sock *, unsigned short);
221extern void rose_write_internal(struct sock *, int); 226void rose_write_internal(struct sock *, int);
222extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *); 227int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
223extern int rose_parse_facilities(unsigned char *, unsigned int, struct rose_facilities_struct *); 228int rose_parse_facilities(unsigned char *, unsigned int,
224extern void rose_disconnect(struct sock *, int, int, int); 229 struct rose_facilities_struct *);
230void rose_disconnect(struct sock *, int, int, int);
225 231
226/* rose_timer.c */ 232/* rose_timer.c */
227extern void rose_start_heartbeat(struct sock *); 233void rose_start_heartbeat(struct sock *);
228extern void rose_start_t1timer(struct sock *); 234void rose_start_t1timer(struct sock *);
229extern void rose_start_t2timer(struct sock *); 235void rose_start_t2timer(struct sock *);
230extern void rose_start_t3timer(struct sock *); 236void rose_start_t3timer(struct sock *);
231extern void rose_start_hbtimer(struct sock *); 237void rose_start_hbtimer(struct sock *);
232extern void rose_start_idletimer(struct sock *); 238void rose_start_idletimer(struct sock *);
233extern void rose_stop_heartbeat(struct sock *); 239void rose_stop_heartbeat(struct sock *);
234extern void rose_stop_timer(struct sock *); 240void rose_stop_timer(struct sock *);
235extern void rose_stop_idletimer(struct sock *); 241void rose_stop_idletimer(struct sock *);
236 242
237/* sysctl_net_rose.c */ 243/* sysctl_net_rose.c */
238extern void rose_register_sysctl(void); 244void rose_register_sysctl(void);
239extern void rose_unregister_sysctl(void); 245void rose_unregister_sysctl(void);
240 246
241#endif 247#endif
diff --git a/include/net/route.h b/include/net/route.h
index afdeeb5bec25..f68c167280a7 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -39,6 +39,7 @@
39#define RTO_ONLINK 0x01 39#define RTO_ONLINK 0x01
40 40
41#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) 41#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE))
42#define RT_CONN_FLAGS_TOS(sk,tos) (RT_TOS(tos) | sock_flag(sk, SOCK_LOCALROUTE))
42 43
43struct fib_nh; 44struct fib_nh;
44struct fib_info; 45struct fib_info;
@@ -87,34 +88,28 @@ struct ip_rt_acct {
87}; 88};
88 89
89struct rt_cache_stat { 90struct rt_cache_stat {
90 unsigned int in_hit;
91 unsigned int in_slow_tot; 91 unsigned int in_slow_tot;
92 unsigned int in_slow_mc; 92 unsigned int in_slow_mc;
93 unsigned int in_no_route; 93 unsigned int in_no_route;
94 unsigned int in_brd; 94 unsigned int in_brd;
95 unsigned int in_martian_dst; 95 unsigned int in_martian_dst;
96 unsigned int in_martian_src; 96 unsigned int in_martian_src;
97 unsigned int out_hit;
98 unsigned int out_slow_tot; 97 unsigned int out_slow_tot;
99 unsigned int out_slow_mc; 98 unsigned int out_slow_mc;
100 unsigned int gc_total;
101 unsigned int gc_ignored;
102 unsigned int gc_goal_miss;
103 unsigned int gc_dst_overflow;
104 unsigned int in_hlist_search;
105 unsigned int out_hlist_search;
106}; 99};
107 100
108extern struct ip_rt_acct __percpu *ip_rt_acct; 101extern struct ip_rt_acct __percpu *ip_rt_acct;
109 102
110struct in_device; 103struct in_device;
111extern int ip_rt_init(void); 104
112extern void rt_cache_flush(struct net *net); 105int ip_rt_init(void);
113extern void rt_flush_dev(struct net_device *dev); 106void rt_cache_flush(struct net *net);
114extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); 107void rt_flush_dev(struct net_device *dev);
115extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, 108struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
116 struct sock *sk); 109struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
117extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); 110 struct sock *sk);
111struct dst_entry *ipv4_blackhole_route(struct net *net,
112 struct dst_entry *dst_orig);
118 113
119static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp) 114static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp)
120{ 115{
@@ -162,8 +157,8 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
162 return ip_route_output_key(net, fl4); 157 return ip_route_output_key(net, fl4);
163} 158}
164 159
165extern int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, 160int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
166 u8 tos, struct net_device *devin); 161 u8 tos, struct net_device *devin);
167 162
168static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, 163static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
169 u8 tos, struct net_device *devin) 164 u8 tos, struct net_device *devin)
@@ -179,24 +174,25 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
179 return err; 174 return err;
180} 175}
181 176
182extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, 177void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif,
183 int oif, u32 mark, u8 protocol, int flow_flags); 178 u32 mark, u8 protocol, int flow_flags);
184extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu); 179void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu);
185extern void ipv4_redirect(struct sk_buff *skb, struct net *net, 180void ipv4_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark,
186 int oif, u32 mark, u8 protocol, int flow_flags); 181 u8 protocol, int flow_flags);
187extern void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk); 182void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk);
188extern void ip_rt_send_redirect(struct sk_buff *skb); 183void ip_rt_send_redirect(struct sk_buff *skb);
189 184
190extern unsigned int inet_addr_type(struct net *net, __be32 addr); 185unsigned int inet_addr_type(struct net *net, __be32 addr);
191extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); 186unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
192extern void ip_rt_multicast_event(struct in_device *); 187 __be32 addr);
193extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 188void ip_rt_multicast_event(struct in_device *);
194extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 189int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
195extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); 190void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
191int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
196 192
197struct in_ifaddr; 193struct in_ifaddr;
198extern void fib_add_ifaddr(struct in_ifaddr *); 194void fib_add_ifaddr(struct in_ifaddr *);
199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); 195void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
200 196
201static inline void ip_rt_put(struct rtable *rt) 197static inline void ip_rt_put(struct rtable *rt)
202{ 198{
@@ -317,12 +313,20 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
317 return hoplimit; 313 return hoplimit;
318} 314}
319 315
320static inline int ip_skb_dst_mtu(struct sk_buff *skb) 316static inline bool ip_sk_accept_pmtu(const struct sock *sk)
317{
318 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE;
319}
320
321static inline bool ip_sk_use_pmtu(const struct sock *sk)
321{ 322{
322 struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; 323 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
324}
323 325
324 return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? 326static inline int ip_skb_dst_mtu(const struct sk_buff *skb)
325 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 327{
328 return (!skb->sk || ip_sk_use_pmtu(skb->sk)) ?
329 dst_mtu(skb_dst(skb)) : skb_dst(skb)->dev->mtu;
326} 330}
327 331
328#endif /* _ROUTE_H */ 332#endif /* _ROUTE_H */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 702664833a53..bb13a182fba6 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -8,14 +8,12 @@ typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func, rtnl_calcit_func);
13 rtnl_calcit_func); 13void rtnl_register(int protocol, int msgtype,
14extern void rtnl_register(int protocol, int msgtype, 14 rtnl_doit_func, rtnl_dumpit_func, rtnl_calcit_func);
15 rtnl_doit_func, rtnl_dumpit_func, 15int rtnl_unregister(int protocol, int msgtype);
16 rtnl_calcit_func); 16void rtnl_unregister_all(int protocol);
17extern int rtnl_unregister(int protocol, int msgtype);
18extern void rtnl_unregister_all(int protocol);
19 17
20static inline int rtnl_msg_family(const struct nlmsghdr *nlh) 18static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
21{ 19{
@@ -83,11 +81,11 @@ struct rtnl_link_ops {
83 unsigned int (*get_num_rx_queues)(void); 81 unsigned int (*get_num_rx_queues)(void);
84}; 82};
85 83
86extern int __rtnl_link_register(struct rtnl_link_ops *ops); 84int __rtnl_link_register(struct rtnl_link_ops *ops);
87extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); 85void __rtnl_link_unregister(struct rtnl_link_ops *ops);
88 86
89extern int rtnl_link_register(struct rtnl_link_ops *ops); 87int rtnl_link_register(struct rtnl_link_ops *ops);
90extern void rtnl_link_unregister(struct rtnl_link_ops *ops); 88void rtnl_link_unregister(struct rtnl_link_ops *ops);
91 89
92/** 90/**
93 * struct rtnl_af_ops - rtnetlink address family operations 91 * struct rtnl_af_ops - rtnetlink address family operations
@@ -117,18 +115,18 @@ struct rtnl_af_ops {
117 const struct nlattr *attr); 115 const struct nlattr *attr);
118}; 116};
119 117
120extern int __rtnl_af_register(struct rtnl_af_ops *ops); 118int __rtnl_af_register(struct rtnl_af_ops *ops);
121extern void __rtnl_af_unregister(struct rtnl_af_ops *ops); 119void __rtnl_af_unregister(struct rtnl_af_ops *ops);
122 120
123extern int rtnl_af_register(struct rtnl_af_ops *ops); 121int rtnl_af_register(struct rtnl_af_ops *ops);
124extern void rtnl_af_unregister(struct rtnl_af_ops *ops); 122void rtnl_af_unregister(struct rtnl_af_ops *ops);
125 123
124struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
125struct net_device *rtnl_create_link(struct net *net, char *ifname,
126 const struct rtnl_link_ops *ops,
127 struct nlattr *tb[]);
128int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
126 129
127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
128extern struct net_device *rtnl_create_link(struct net *net,
129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
130extern int rtnl_configure_link(struct net_device *dev,
131 const struct ifinfomsg *ifm);
132extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 130extern const struct nla_policy ifla_policy[IFLA_MAX+1];
133 131
134#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 132#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f4eb365f7dcd..d0a6321c302e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -702,13 +702,20 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
702} 702}
703 703
704void psched_ratecfg_precompute(struct psched_ratecfg *r, 704void psched_ratecfg_precompute(struct psched_ratecfg *r,
705 const struct tc_ratespec *conf); 705 const struct tc_ratespec *conf,
706 u64 rate64);
706 707
707static inline void psched_ratecfg_getrate(struct tc_ratespec *res, 708static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
708 const struct psched_ratecfg *r) 709 const struct psched_ratecfg *r)
709{ 710{
710 memset(res, 0, sizeof(*res)); 711 memset(res, 0, sizeof(*res));
711 res->rate = r->rate_bytes_ps; 712
713 /* legacy struct tc_ratespec has a 32bit @rate field
714 * Qdisc using 64bit rate should add new attributes
715 * in order to maintain compatibility.
716 */
717 res->rate = min_t(u64, r->rate_bytes_ps, ~0U);
718
712 res->overhead = r->overhead; 719 res->overhead = r->overhead;
713 res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); 720 res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);
714} 721}
diff --git a/include/net/scm.h b/include/net/scm.h
index 8de2d37d2077..262532d111f5 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -33,11 +33,11 @@ struct scm_cookie {
33#endif 33#endif
34}; 34};
35 35
36extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); 36void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
37extern void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); 37void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
38extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); 38int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
39extern void __scm_destroy(struct scm_cookie *scm); 39void __scm_destroy(struct scm_cookie *scm);
40extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); 40struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl);
41 41
42#ifdef CONFIG_SECURITY_NETWORK 42#ifdef CONFIG_SECURITY_NETWORK
43static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) 43static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 259924d63ba6..6bd44fe94c26 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -42,56 +42,38 @@
42#include <linux/types.h> 42#include <linux/types.h>
43#include <net/sctp/sctp.h> 43#include <net/sctp/sctp.h>
44#include <linux/crc32c.h> 44#include <linux/crc32c.h>
45#include <linux/crc32.h>
45 46
46static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length) 47static inline __wsum sctp_csum_update(const void *buff, int len, __wsum sum)
47{ 48{
48 return crc32c(crc, buffer, length); 49 /* This uses the crypto implementation of crc32c, which is either
49} 50 * implemented w/ hardware support or resolves to __crc32c_le().
50
51static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
52{
53 __u32 crc = ~(__u32)0;
54 __u8 zero[sizeof(__u32)] = {0};
55
56 /* Optimize this routine to be SCTP specific, knowing how
57 * to skip the checksum field of the SCTP header.
58 */ 51 */
59 52 return crc32c(sum, buff, len);
60 /* Calculate CRC up to the checksum. */
61 crc = sctp_crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32));
62
63 /* Skip checksum field of the header. */
64 crc = sctp_crc32c(crc, zero, sizeof(__u32));
65
66 /* Calculate the rest of the CRC. */
67 crc = sctp_crc32c(crc, &buffer[sizeof(struct sctphdr)],
68 length - sizeof(struct sctphdr));
69 return crc;
70}
71
72static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
73{
74 return sctp_crc32c(crc32, buffer, length);
75} 53}
76 54
77static inline __le32 sctp_end_cksum(__u32 crc32) 55static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2,
56 int offset, int len)
78{ 57{
79 return cpu_to_le32(~crc32); 58 return __crc32c_le_combine(csum, csum2, len);
80} 59}
81 60
82/* Calculate the CRC32C checksum of an SCTP packet. */
83static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, 61static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
84 unsigned int offset) 62 unsigned int offset)
85{ 63{
86 const struct sk_buff *iter; 64 struct sctphdr *sh = sctp_hdr(skb);
65 __le32 ret, old = sh->checksum;
66 const struct skb_checksum_ops ops = {
67 .update = sctp_csum_update,
68 .combine = sctp_csum_combine,
69 };
87 70
88 __u32 crc32 = sctp_start_cksum(skb->data + offset, 71 sh->checksum = 0;
89 skb_headlen(skb) - offset); 72 ret = cpu_to_le32(~__skb_checksum(skb, offset, skb->len - offset,
90 skb_walk_frags(skb, iter) 73 ~(__u32)0, &ops));
91 crc32 = sctp_update_cksum((__u8 *) iter->data, 74 sh->checksum = old;
92 skb_headlen(iter), crc32);
93 75
94 return sctp_end_cksum(crc32); 76 return ret;
95} 77}
96 78
97#endif /* __sctp_checksum_h__ */ 79#endif /* __sctp_checksum_h__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 3794c5ad20fe..c5fe80697f8d 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -90,12 +90,11 @@
90/* 90/*
91 * sctp/protocol.c 91 * sctp/protocol.c
92 */ 92 */
93extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *, 93int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
94 sctp_scope_t, gfp_t gfp, 94 sctp_scope_t, gfp_t gfp, int flags);
95 int flags); 95struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
96extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 96int sctp_register_pf(struct sctp_pf *, sa_family_t);
97extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 97void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
98extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
99 98
100/* 99/*
101 * sctp/socket.c 100 * sctp/socket.c
@@ -110,7 +109,7 @@ void sctp_sock_rfree(struct sk_buff *skb);
110void sctp_copy_sock(struct sock *newsk, struct sock *sk, 109void sctp_copy_sock(struct sock *newsk, struct sock *sk,
111 struct sctp_association *asoc); 110 struct sctp_association *asoc);
112extern struct percpu_counter sctp_sockets_allocated; 111extern struct percpu_counter sctp_sockets_allocated;
113extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); 112int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
114 113
115/* 114/*
116 * sctp/primitive.c 115 * sctp/primitive.c
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 2174d8da0770..67b5d0068273 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -629,6 +629,7 @@ struct sctp_chunk {
629#define SCTP_NEED_FRTX 0x1 629#define SCTP_NEED_FRTX 0x1
630#define SCTP_DONT_FRTX 0x2 630#define SCTP_DONT_FRTX 0x2
631 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ 631 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
632 resent:1, /* Has this chunk ever been resent. */
632 has_tsn:1, /* Does this chunk have a TSN yet? */ 633 has_tsn:1, /* Does this chunk have a TSN yet? */
633 has_ssn:1, /* Does this chunk have a SSN yet? */ 634 has_ssn:1, /* Does this chunk have a SSN yet? */
634 singleton:1, /* Only chunk in the packet? */ 635 singleton:1, /* Only chunk in the packet? */
@@ -1725,12 +1726,6 @@ struct sctp_association {
1725 /* How many duplicated TSNs have we seen? */ 1726 /* How many duplicated TSNs have we seen? */
1726 int numduptsns; 1727 int numduptsns;
1727 1728
1728 /* Number of seconds of idle time before an association is closed.
1729 * In the association context, this is really used as a boolean
1730 * since the real timeout is stored in the timeouts array
1731 */
1732 __u32 autoclose;
1733
1734 /* These are to support 1729 /* These are to support
1735 * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses 1730 * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses
1736 * and Enforcement of Flow and Message Limits" 1731 * and Enforcement of Flow and Message Limits"
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index 6ca975bebd37..f257486f17be 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,19 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern void net_secret_init(void); 6__u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ip_id(__be32 daddr); 7__u32 secure_ipv6_id(const __be32 daddr[4]);
8extern __u32 secure_ipv6_id(const __be32 daddr[4]); 8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 10 __be16 dport);
11 __be16 dport); 11__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
12extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, 12 __be16 sport, __be16 dport);
13 __be16 sport, __be16 dport); 13__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
14extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, 14 __be16 sport, __be16 dport);
15 __be16 sport, __be16 dport); 15u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
16extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, 16 __be16 sport, __be16 dport);
17 __be16 sport, __be16 dport); 17u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
18extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, 18 __be16 sport, __be16 dport);
19 __be16 sport, __be16 dport);
20 19
21#endif /* _NET_SECURE_SEQ */ 20#endif /* _NET_SECURE_SEQ */
diff --git a/include/net/sock.h b/include/net/sock.h
index 6ba2e7b0e2b1..2ef3c3eca47a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -156,7 +156,7 @@ typedef __u64 __bitwise __addrpair;
156 */ 156 */
157struct sock_common { 157struct sock_common {
158 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned 158 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
159 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH() 159 * address on 64bit arches : cf INET_MATCH()
160 */ 160 */
161 union { 161 union {
162 __addrpair skc_addrpair; 162 __addrpair skc_addrpair;
@@ -191,6 +191,12 @@ struct sock_common {
191#ifdef CONFIG_NET_NS 191#ifdef CONFIG_NET_NS
192 struct net *skc_net; 192 struct net *skc_net;
193#endif 193#endif
194
195#if IS_ENABLED(CONFIG_IPV6)
196 struct in6_addr skc_v6_daddr;
197 struct in6_addr skc_v6_rcv_saddr;
198#endif
199
194 /* 200 /*
195 * fields between dontcopy_begin/dontcopy_end 201 * fields between dontcopy_begin/dontcopy_end
196 * are not copied in sock_copy() 202 * are not copied in sock_copy()
@@ -218,7 +224,7 @@ struct cg_proto;
218 * @sk_lock: synchronizer 224 * @sk_lock: synchronizer
219 * @sk_rcvbuf: size of receive buffer in bytes 225 * @sk_rcvbuf: size of receive buffer in bytes
220 * @sk_wq: sock wait queue and async head 226 * @sk_wq: sock wait queue and async head
221 * @sk_rx_dst: receive input route used by early tcp demux 227 * @sk_rx_dst: receive input route used by early demux
222 * @sk_dst_cache: destination cache 228 * @sk_dst_cache: destination cache
223 * @sk_dst_lock: destination cache lock 229 * @sk_dst_lock: destination cache lock
224 * @sk_policy: flow policy 230 * @sk_policy: flow policy
@@ -233,6 +239,7 @@ struct cg_proto;
233 * @sk_ll_usec: usecs to busypoll when there is no data 239 * @sk_ll_usec: usecs to busypoll when there is no data
234 * @sk_allocation: allocation mode 240 * @sk_allocation: allocation mode
235 * @sk_pacing_rate: Pacing rate (if supported by transport/packet scheduler) 241 * @sk_pacing_rate: Pacing rate (if supported by transport/packet scheduler)
242 * @sk_max_pacing_rate: Maximum pacing rate (%SO_MAX_PACING_RATE)
236 * @sk_sndbuf: size of send buffer in bytes 243 * @sk_sndbuf: size of send buffer in bytes
237 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
238 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
@@ -299,6 +306,12 @@ struct sock {
299#define sk_dontcopy_begin __sk_common.skc_dontcopy_begin 306#define sk_dontcopy_begin __sk_common.skc_dontcopy_begin
300#define sk_dontcopy_end __sk_common.skc_dontcopy_end 307#define sk_dontcopy_end __sk_common.skc_dontcopy_end
301#define sk_hash __sk_common.skc_hash 308#define sk_hash __sk_common.skc_hash
309#define sk_portpair __sk_common.skc_portpair
310#define sk_num __sk_common.skc_num
311#define sk_dport __sk_common.skc_dport
312#define sk_addrpair __sk_common.skc_addrpair
313#define sk_daddr __sk_common.skc_daddr
314#define sk_rcv_saddr __sk_common.skc_rcv_saddr
302#define sk_family __sk_common.skc_family 315#define sk_family __sk_common.skc_family
303#define sk_state __sk_common.skc_state 316#define sk_state __sk_common.skc_state
304#define sk_reuse __sk_common.skc_reuse 317#define sk_reuse __sk_common.skc_reuse
@@ -307,6 +320,9 @@ struct sock {
307#define sk_bind_node __sk_common.skc_bind_node 320#define sk_bind_node __sk_common.skc_bind_node
308#define sk_prot __sk_common.skc_prot 321#define sk_prot __sk_common.skc_prot
309#define sk_net __sk_common.skc_net 322#define sk_net __sk_common.skc_net
323#define sk_v6_daddr __sk_common.skc_v6_daddr
324#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
325
310 socket_lock_t sk_lock; 326 socket_lock_t sk_lock;
311 struct sk_buff_head sk_receive_queue; 327 struct sk_buff_head sk_receive_queue;
312 /* 328 /*
@@ -363,6 +379,7 @@ struct sock {
363 int sk_wmem_queued; 379 int sk_wmem_queued;
364 gfp_t sk_allocation; 380 gfp_t sk_allocation;
365 u32 sk_pacing_rate; /* bytes per second */ 381 u32 sk_pacing_rate; /* bytes per second */
382 u32 sk_max_pacing_rate;
366 netdev_features_t sk_route_caps; 383 netdev_features_t sk_route_caps;
367 netdev_features_t sk_route_nocaps; 384 netdev_features_t sk_route_nocaps;
368 int sk_gso_type; 385 int sk_gso_type;
@@ -409,6 +426,11 @@ struct sock {
409 void (*sk_destruct)(struct sock *sk); 426 void (*sk_destruct)(struct sock *sk);
410}; 427};
411 428
429#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data)))
430
431#define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk)))
432#define rcu_assign_sk_user_data(sk, ptr) rcu_assign_pointer(__sk_user_data((sk)), ptr)
433
412/* 434/*
413 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK 435 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK
414 * or not whether his port will be reused by someone else. SK_FORCE_REUSE 436 * or not whether his port will be reused by someone else. SK_FORCE_REUSE
@@ -746,7 +768,7 @@ static inline int sk_stream_wspace(const struct sock *sk)
746 return sk->sk_sndbuf - sk->sk_wmem_queued; 768 return sk->sk_sndbuf - sk->sk_wmem_queued;
747} 769}
748 770
749extern void sk_stream_write_space(struct sock *sk); 771void sk_stream_write_space(struct sock *sk);
750 772
751/* OOB backlog add */ 773/* OOB backlog add */
752static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 774static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
@@ -788,7 +810,7 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
788 return 0; 810 return 0;
789} 811}
790 812
791extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb); 813int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
792 814
793static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) 815static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
794{ 816{
@@ -853,15 +875,15 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
853 __rc; \ 875 __rc; \
854 }) 876 })
855 877
856extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); 878int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
857extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); 879int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
858extern void sk_stream_wait_close(struct sock *sk, long timeo_p); 880void sk_stream_wait_close(struct sock *sk, long timeo_p);
859extern int sk_stream_error(struct sock *sk, int flags, int err); 881int sk_stream_error(struct sock *sk, int flags, int err);
860extern void sk_stream_kill_queues(struct sock *sk); 882void sk_stream_kill_queues(struct sock *sk);
861extern void sk_set_memalloc(struct sock *sk); 883void sk_set_memalloc(struct sock *sk);
862extern void sk_clear_memalloc(struct sock *sk); 884void sk_clear_memalloc(struct sock *sk);
863 885
864extern int sk_wait_data(struct sock *sk, long *timeo); 886int sk_wait_data(struct sock *sk, long *timeo);
865 887
866struct request_sock_ops; 888struct request_sock_ops;
867struct timewait_sock_ops; 889struct timewait_sock_ops;
@@ -1013,11 +1035,10 @@ enum cg_proto_flags {
1013}; 1035};
1014 1036
1015struct cg_proto { 1037struct cg_proto {
1016 void (*enter_memory_pressure)(struct sock *sk); 1038 struct res_counter memory_allocated; /* Current allocated memory. */
1017 struct res_counter *memory_allocated; /* Current allocated memory. */ 1039 struct percpu_counter sockets_allocated; /* Current number of sockets. */
1018 struct percpu_counter *sockets_allocated; /* Current number of sockets. */ 1040 int memory_pressure;
1019 int *memory_pressure; 1041 long sysctl_mem[3];
1020 long *sysctl_mem;
1021 unsigned long flags; 1042 unsigned long flags;
1022 /* 1043 /*
1023 * memcg field is used to find which memcg we belong directly 1044 * memcg field is used to find which memcg we belong directly
@@ -1031,8 +1052,8 @@ struct cg_proto {
1031 struct mem_cgroup *memcg; 1052 struct mem_cgroup *memcg;
1032}; 1053};
1033 1054
1034extern int proto_register(struct proto *prot, int alloc_slab); 1055int proto_register(struct proto *prot, int alloc_slab);
1035extern void proto_unregister(struct proto *prot); 1056void proto_unregister(struct proto *prot);
1036 1057
1037static inline bool memcg_proto_active(struct cg_proto *cg_proto) 1058static inline bool memcg_proto_active(struct cg_proto *cg_proto)
1038{ 1059{
@@ -1113,7 +1134,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk)
1113 return false; 1134 return false;
1114 1135
1115 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1136 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1116 return !!*sk->sk_cgrp->memory_pressure; 1137 return !!sk->sk_cgrp->memory_pressure;
1117 1138
1118 return !!*sk->sk_prot->memory_pressure; 1139 return !!*sk->sk_prot->memory_pressure;
1119} 1140}
@@ -1133,8 +1154,7 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
1133 struct proto *prot = sk->sk_prot; 1154 struct proto *prot = sk->sk_prot;
1134 1155
1135 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1156 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1136 if (*cg_proto->memory_pressure) 1157 cg_proto->memory_pressure = 0;
1137 *cg_proto->memory_pressure = 0;
1138 } 1158 }
1139 1159
1140} 1160}
@@ -1149,7 +1169,7 @@ static inline void sk_enter_memory_pressure(struct sock *sk)
1149 struct proto *prot = sk->sk_prot; 1169 struct proto *prot = sk->sk_prot;
1150 1170
1151 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1171 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1152 cg_proto->enter_memory_pressure(sk); 1172 cg_proto->memory_pressure = 1;
1153 } 1173 }
1154 1174
1155 sk->sk_prot->enter_memory_pressure(sk); 1175 sk->sk_prot->enter_memory_pressure(sk);
@@ -1170,7 +1190,7 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1170 struct res_counter *fail; 1190 struct res_counter *fail;
1171 int ret; 1191 int ret;
1172 1192
1173 ret = res_counter_charge_nofail(prot->memory_allocated, 1193 ret = res_counter_charge_nofail(&prot->memory_allocated,
1174 amt << PAGE_SHIFT, &fail); 1194 amt << PAGE_SHIFT, &fail);
1175 if (ret < 0) 1195 if (ret < 0)
1176 *parent_status = OVER_LIMIT; 1196 *parent_status = OVER_LIMIT;
@@ -1179,13 +1199,13 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1179static inline void memcg_memory_allocated_sub(struct cg_proto *prot, 1199static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1180 unsigned long amt) 1200 unsigned long amt)
1181{ 1201{
1182 res_counter_uncharge(prot->memory_allocated, amt << PAGE_SHIFT); 1202 res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT);
1183} 1203}
1184 1204
1185static inline u64 memcg_memory_allocated_read(struct cg_proto *prot) 1205static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1186{ 1206{
1187 u64 ret; 1207 u64 ret;
1188 ret = res_counter_read_u64(prot->memory_allocated, RES_USAGE); 1208 ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE);
1189 return ret >> PAGE_SHIFT; 1209 return ret >> PAGE_SHIFT;
1190} 1210}
1191 1211
@@ -1233,7 +1253,7 @@ static inline void sk_sockets_allocated_dec(struct sock *sk)
1233 struct cg_proto *cg_proto = sk->sk_cgrp; 1253 struct cg_proto *cg_proto = sk->sk_cgrp;
1234 1254
1235 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1255 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1236 percpu_counter_dec(cg_proto->sockets_allocated); 1256 percpu_counter_dec(&cg_proto->sockets_allocated);
1237 } 1257 }
1238 1258
1239 percpu_counter_dec(prot->sockets_allocated); 1259 percpu_counter_dec(prot->sockets_allocated);
@@ -1247,7 +1267,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk)
1247 struct cg_proto *cg_proto = sk->sk_cgrp; 1267 struct cg_proto *cg_proto = sk->sk_cgrp;
1248 1268
1249 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1269 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1250 percpu_counter_inc(cg_proto->sockets_allocated); 1270 percpu_counter_inc(&cg_proto->sockets_allocated);
1251 } 1271 }
1252 1272
1253 percpu_counter_inc(prot->sockets_allocated); 1273 percpu_counter_inc(prot->sockets_allocated);
@@ -1259,7 +1279,7 @@ sk_sockets_allocated_read_positive(struct sock *sk)
1259 struct proto *prot = sk->sk_prot; 1279 struct proto *prot = sk->sk_prot;
1260 1280
1261 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1281 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1262 return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); 1282 return percpu_counter_read_positive(&sk->sk_cgrp->sockets_allocated);
1263 1283
1264 return percpu_counter_read_positive(prot->sockets_allocated); 1284 return percpu_counter_read_positive(prot->sockets_allocated);
1265} 1285}
@@ -1287,8 +1307,8 @@ proto_memory_pressure(struct proto *prot)
1287 1307
1288#ifdef CONFIG_PROC_FS 1308#ifdef CONFIG_PROC_FS
1289/* Called with local bh disabled */ 1309/* Called with local bh disabled */
1290extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); 1310void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
1291extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1311int sock_prot_inuse_get(struct net *net, struct proto *proto);
1292#else 1312#else
1293static inline void sock_prot_inuse_add(struct net *net, struct proto *prot, 1313static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1294 int inc) 1314 int inc)
@@ -1364,8 +1384,8 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
1364/* 1384/*
1365 * Functions for memory accounting 1385 * Functions for memory accounting
1366 */ 1386 */
1367extern int __sk_mem_schedule(struct sock *sk, int size, int kind); 1387int __sk_mem_schedule(struct sock *sk, int size, int kind);
1368extern void __sk_mem_reclaim(struct sock *sk); 1388void __sk_mem_reclaim(struct sock *sk);
1369 1389
1370#define SK_MEM_QUANTUM ((int)PAGE_SIZE) 1390#define SK_MEM_QUANTUM ((int)PAGE_SIZE)
1371#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) 1391#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
@@ -1473,14 +1493,14 @@ do { \
1473 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1493 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1474} while (0) 1494} while (0)
1475 1495
1476extern void lock_sock_nested(struct sock *sk, int subclass); 1496void lock_sock_nested(struct sock *sk, int subclass);
1477 1497
1478static inline void lock_sock(struct sock *sk) 1498static inline void lock_sock(struct sock *sk)
1479{ 1499{
1480 lock_sock_nested(sk, 0); 1500 lock_sock_nested(sk, 0);
1481} 1501}
1482 1502
1483extern void release_sock(struct sock *sk); 1503void release_sock(struct sock *sk);
1484 1504
1485/* BH context may only use the following locking interface. */ 1505/* BH context may only use the following locking interface. */
1486#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 1506#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
@@ -1489,7 +1509,7 @@ extern void release_sock(struct sock *sk);
1489 SINGLE_DEPTH_NESTING) 1509 SINGLE_DEPTH_NESTING)
1490#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1510#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
1491 1511
1492extern bool lock_sock_fast(struct sock *sk); 1512bool lock_sock_fast(struct sock *sk);
1493/** 1513/**
1494 * unlock_sock_fast - complement of lock_sock_fast 1514 * unlock_sock_fast - complement of lock_sock_fast
1495 * @sk: socket 1515 * @sk: socket
@@ -1507,108 +1527,84 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
1507} 1527}
1508 1528
1509 1529
1510extern struct sock *sk_alloc(struct net *net, int family, 1530struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1511 gfp_t priority, 1531 struct proto *prot);
1512 struct proto *prot); 1532void sk_free(struct sock *sk);
1513extern void sk_free(struct sock *sk); 1533void sk_release_kernel(struct sock *sk);
1514extern void sk_release_kernel(struct sock *sk); 1534struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1515extern struct sock *sk_clone_lock(const struct sock *sk, 1535
1516 const gfp_t priority); 1536struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1517 1537 gfp_t priority);
1518extern struct sk_buff *sock_wmalloc(struct sock *sk, 1538struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1519 unsigned long size, int force, 1539 gfp_t priority);
1520 gfp_t priority); 1540void sock_wfree(struct sk_buff *skb);
1521extern struct sk_buff *sock_rmalloc(struct sock *sk, 1541void skb_orphan_partial(struct sk_buff *skb);
1522 unsigned long size, int force, 1542void sock_rfree(struct sk_buff *skb);
1523 gfp_t priority); 1543void sock_edemux(struct sk_buff *skb);
1524extern void sock_wfree(struct sk_buff *skb); 1544
1525extern void skb_orphan_partial(struct sk_buff *skb); 1545int sock_setsockopt(struct socket *sock, int level, int op,
1526extern void sock_rfree(struct sk_buff *skb); 1546 char __user *optval, unsigned int optlen);
1527extern void sock_edemux(struct sk_buff *skb); 1547
1528 1548int sock_getsockopt(struct socket *sock, int level, int op,
1529extern int sock_setsockopt(struct socket *sock, int level, 1549 char __user *optval, int __user *optlen);
1530 int op, char __user *optval, 1550struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1531 unsigned int optlen); 1551 int noblock, int *errcode);
1532 1552struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1533extern int sock_getsockopt(struct socket *sock, int level, 1553 unsigned long data_len, int noblock,
1534 int op, char __user *optval, 1554 int *errcode, int max_page_order);
1535 int __user *optlen); 1555void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1536extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1556void sock_kfree_s(struct sock *sk, void *mem, int size);
1537 unsigned long size, 1557void sk_send_sigurg(struct sock *sk);
1538 int noblock,
1539 int *errcode);
1540extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1541 unsigned long header_len,
1542 unsigned long data_len,
1543 int noblock,
1544 int *errcode,
1545 int max_page_order);
1546extern void *sock_kmalloc(struct sock *sk, int size,
1547 gfp_t priority);
1548extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1549extern void sk_send_sigurg(struct sock *sk);
1550 1558
1551/* 1559/*
1552 * Functions to fill in entries in struct proto_ops when a protocol 1560 * Functions to fill in entries in struct proto_ops when a protocol
1553 * does not implement a particular function. 1561 * does not implement a particular function.
1554 */ 1562 */
1555extern int sock_no_bind(struct socket *, 1563int sock_no_bind(struct socket *, struct sockaddr *, int);
1556 struct sockaddr *, int); 1564int sock_no_connect(struct socket *, struct sockaddr *, int, int);
1557extern int sock_no_connect(struct socket *, 1565int sock_no_socketpair(struct socket *, struct socket *);
1558 struct sockaddr *, int, int); 1566int sock_no_accept(struct socket *, struct socket *, int);
1559extern int sock_no_socketpair(struct socket *, 1567int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1560 struct socket *); 1568unsigned int sock_no_poll(struct file *, struct socket *,
1561extern int sock_no_accept(struct socket *, 1569 struct poll_table_struct *);
1562 struct socket *, int); 1570int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1563extern int sock_no_getname(struct socket *, 1571int sock_no_listen(struct socket *, int);
1564 struct sockaddr *, int *, int); 1572int sock_no_shutdown(struct socket *, int);
1565extern unsigned int sock_no_poll(struct file *, struct socket *, 1573int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1566 struct poll_table_struct *); 1574int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1567extern int sock_no_ioctl(struct socket *, unsigned int, 1575int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t);
1568 unsigned long); 1576int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t,
1569extern int sock_no_listen(struct socket *, int); 1577 int);
1570extern int sock_no_shutdown(struct socket *, int); 1578int sock_no_mmap(struct file *file, struct socket *sock,
1571extern int sock_no_getsockopt(struct socket *, int , int, 1579 struct vm_area_struct *vma);
1572 char __user *, int __user *); 1580ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1573extern int sock_no_setsockopt(struct socket *, int, int, 1581 size_t size, int flags);
1574 char __user *, unsigned int);
1575extern int sock_no_sendmsg(struct kiocb *, struct socket *,
1576 struct msghdr *, size_t);
1577extern int sock_no_recvmsg(struct kiocb *, struct socket *,
1578 struct msghdr *, size_t, int);
1579extern int sock_no_mmap(struct file *file,
1580 struct socket *sock,
1581 struct vm_area_struct *vma);
1582extern ssize_t sock_no_sendpage(struct socket *sock,
1583 struct page *page,
1584 int offset, size_t size,
1585 int flags);
1586 1582
1587/* 1583/*
1588 * Functions to fill in entries in struct proto_ops when a protocol 1584 * Functions to fill in entries in struct proto_ops when a protocol
1589 * uses the inet style. 1585 * uses the inet style.
1590 */ 1586 */
1591extern int sock_common_getsockopt(struct socket *sock, int level, int optname, 1587int sock_common_getsockopt(struct socket *sock, int level, int optname,
1592 char __user *optval, int __user *optlen); 1588 char __user *optval, int __user *optlen);
1593extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1589int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1594 struct msghdr *msg, size_t size, int flags); 1590 struct msghdr *msg, size_t size, int flags);
1595extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1591int sock_common_setsockopt(struct socket *sock, int level, int optname,
1596 char __user *optval, unsigned int optlen); 1592 char __user *optval, unsigned int optlen);
1597extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1593int compat_sock_common_getsockopt(struct socket *sock, int level,
1598 int optname, char __user *optval, int __user *optlen); 1594 int optname, char __user *optval, int __user *optlen);
1599extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1595int compat_sock_common_setsockopt(struct socket *sock, int level,
1600 int optname, char __user *optval, unsigned int optlen); 1596 int optname, char __user *optval, unsigned int optlen);
1601 1597
1602extern void sk_common_release(struct sock *sk); 1598void sk_common_release(struct sock *sk);
1603 1599
1604/* 1600/*
1605 * Default socket callbacks and setup code 1601 * Default socket callbacks and setup code
1606 */ 1602 */
1607 1603
1608/* Initialise core socket variables */ 1604/* Initialise core socket variables */
1609extern void sock_init_data(struct socket *sock, struct sock *sk); 1605void sock_init_data(struct socket *sock, struct sock *sk);
1610 1606
1611extern void sk_filter_release_rcu(struct rcu_head *rcu); 1607void sk_filter_release_rcu(struct rcu_head *rcu);
1612 1608
1613/** 1609/**
1614 * sk_filter_release - release a socket filter 1610 * sk_filter_release - release a socket filter
@@ -1625,16 +1621,14 @@ static inline void sk_filter_release(struct sk_filter *fp)
1625 1621
1626static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1622static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
1627{ 1623{
1628 unsigned int size = sk_filter_len(fp); 1624 atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1629
1630 atomic_sub(size, &sk->sk_omem_alloc);
1631 sk_filter_release(fp); 1625 sk_filter_release(fp);
1632} 1626}
1633 1627
1634static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 1628static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
1635{ 1629{
1636 atomic_inc(&fp->refcnt); 1630 atomic_inc(&fp->refcnt);
1637 atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); 1631 atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1638} 1632}
1639 1633
1640/* 1634/*
@@ -1668,9 +1662,12 @@ static inline void sock_put(struct sock *sk)
1668 if (atomic_dec_and_test(&sk->sk_refcnt)) 1662 if (atomic_dec_and_test(&sk->sk_refcnt))
1669 sk_free(sk); 1663 sk_free(sk);
1670} 1664}
1665/* Generic version of sock_put(), dealing with all sockets
1666 * (TCP_TIMEWAIT, ESTABLISHED...)
1667 */
1668void sock_gen_put(struct sock *sk);
1671 1669
1672extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, 1670int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested);
1673 const int nested);
1674 1671
1675static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) 1672static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
1676{ 1673{
@@ -1724,8 +1721,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1724 write_unlock_bh(&sk->sk_callback_lock); 1721 write_unlock_bh(&sk->sk_callback_lock);
1725} 1722}
1726 1723
1727extern kuid_t sock_i_uid(struct sock *sk); 1724kuid_t sock_i_uid(struct sock *sk);
1728extern unsigned long sock_i_ino(struct sock *sk); 1725unsigned long sock_i_ino(struct sock *sk);
1729 1726
1730static inline struct dst_entry * 1727static inline struct dst_entry *
1731__sk_dst_get(struct sock *sk) 1728__sk_dst_get(struct sock *sk)
@@ -1747,8 +1744,6 @@ sk_dst_get(struct sock *sk)
1747 return dst; 1744 return dst;
1748} 1745}
1749 1746
1750extern void sk_reset_txq(struct sock *sk);
1751
1752static inline void dst_negative_advice(struct sock *sk) 1747static inline void dst_negative_advice(struct sock *sk)
1753{ 1748{
1754 struct dst_entry *ndst, *dst = __sk_dst_get(sk); 1749 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
@@ -1758,7 +1753,7 @@ static inline void dst_negative_advice(struct sock *sk)
1758 1753
1759 if (ndst != dst) { 1754 if (ndst != dst) {
1760 rcu_assign_pointer(sk->sk_dst_cache, ndst); 1755 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1761 sk_reset_txq(sk); 1756 sk_tx_queue_clear(sk);
1762 } 1757 }
1763 } 1758 }
1764} 1759}
@@ -1800,16 +1795,16 @@ sk_dst_reset(struct sock *sk)
1800 spin_unlock(&sk->sk_dst_lock); 1795 spin_unlock(&sk->sk_dst_lock);
1801} 1796}
1802 1797
1803extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1798struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1804 1799
1805extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1800struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1806 1801
1807static inline bool sk_can_gso(const struct sock *sk) 1802static inline bool sk_can_gso(const struct sock *sk)
1808{ 1803{
1809 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1804 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1810} 1805}
1811 1806
1812extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1807void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1813 1808
1814static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) 1809static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
1815{ 1810{
@@ -2022,14 +2017,14 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2022 sk_mem_charge(sk, skb->truesize); 2017 sk_mem_charge(sk, skb->truesize);
2023} 2018}
2024 2019
2025extern void sk_reset_timer(struct sock *sk, struct timer_list *timer, 2020void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2026 unsigned long expires); 2021 unsigned long expires);
2027 2022
2028extern void sk_stop_timer(struct sock *sk, struct timer_list *timer); 2023void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2029 2024
2030extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 2025int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2031 2026
2032extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); 2027int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2033 2028
2034/* 2029/*
2035 * Recover an error report and clear atomically 2030 * Recover an error report and clear atomically
@@ -2097,7 +2092,7 @@ static inline struct page_frag *sk_page_frag(struct sock *sk)
2097 return &sk->sk_frag; 2092 return &sk->sk_frag;
2098} 2093}
2099 2094
2100extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); 2095bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2101 2096
2102/* 2097/*
2103 * Default write policy as shown to user space via poll/select/SIGIO 2098 * Default write policy as shown to user space via poll/select/SIGIO
@@ -2135,10 +2130,10 @@ static inline int sock_intr_errno(long timeo)
2135 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 2130 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2136} 2131}
2137 2132
2138extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 2133void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2139 struct sk_buff *skb); 2134 struct sk_buff *skb);
2140extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2135void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2141 struct sk_buff *skb); 2136 struct sk_buff *skb);
2142 2137
2143static inline void 2138static inline void
2144sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 2139sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -2171,8 +2166,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2171 __sock_recv_wifi_status(msg, sk, skb); 2166 __sock_recv_wifi_status(msg, sk, skb);
2172} 2167}
2173 2168
2174extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2169void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2175 struct sk_buff *skb); 2170 struct sk_buff *skb);
2176 2171
2177static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2172static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2178 struct sk_buff *skb) 2173 struct sk_buff *skb)
@@ -2197,7 +2192,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2197 * 2192 *
2198 * Currently only depends on SOCK_TIMESTAMPING* flags. 2193 * Currently only depends on SOCK_TIMESTAMPING* flags.
2199 */ 2194 */
2200extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2195void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2201 2196
2202/** 2197/**
2203 * sk_eat_skb - Release a skb if it is no longer needed 2198 * sk_eat_skb - Release a skb if it is no longer needed
@@ -2261,11 +2256,11 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2261 return NULL; 2256 return NULL;
2262} 2257}
2263 2258
2264extern void sock_enable_timestamp(struct sock *sk, int flag); 2259void sock_enable_timestamp(struct sock *sk, int flag);
2265extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2260int sock_get_timestamp(struct sock *, struct timeval __user *);
2266extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2261int sock_get_timestampns(struct sock *, struct timespec __user *);
2267extern int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, 2262int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2268 int level, int type); 2263 int type);
2269 2264
2270/* 2265/*
2271 * Enable debug/info messages 2266 * Enable debug/info messages
diff --git a/include/net/stp.h b/include/net/stp.h
index ad447f105417..3af174d70d9e 100644
--- a/include/net/stp.h
+++ b/include/net/stp.h
@@ -8,7 +8,7 @@ struct stp_proto {
8 void *data; 8 void *data;
9}; 9};
10 10
11extern int stp_proto_register(const struct stp_proto *proto); 11int stp_proto_register(const struct stp_proto *proto);
12extern void stp_proto_unregister(const struct stp_proto *proto); 12void stp_proto_unregister(const struct stp_proto *proto);
13 13
14#endif /* _NET_STP_H */ 14#endif /* _NET_STP_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index b1aa324c5e65..70e55d200610 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -50,7 +50,7 @@
50extern struct inet_hashinfo tcp_hashinfo; 50extern struct inet_hashinfo tcp_hashinfo;
51 51
52extern struct percpu_counter tcp_orphan_count; 52extern struct percpu_counter tcp_orphan_count;
53extern void tcp_time_wait(struct sock *sk, int state, int timeo); 53void tcp_time_wait(struct sock *sk, int state, int timeo);
54 54
55#define MAX_TCP_HEADER (128 + MAX_HEADER) 55#define MAX_TCP_HEADER (128 + MAX_HEADER)
56#define MAX_TCP_OPTION_SPACE 40 56#define MAX_TCP_OPTION_SPACE 40
@@ -259,6 +259,7 @@ extern int sysctl_tcp_max_orphans;
259extern int sysctl_tcp_fack; 259extern int sysctl_tcp_fack;
260extern int sysctl_tcp_reordering; 260extern int sysctl_tcp_reordering;
261extern int sysctl_tcp_dsack; 261extern int sysctl_tcp_dsack;
262extern long sysctl_tcp_mem[3];
262extern int sysctl_tcp_wmem[3]; 263extern int sysctl_tcp_wmem[3];
263extern int sysctl_tcp_rmem[3]; 264extern int sysctl_tcp_rmem[3];
264extern int sysctl_tcp_app_win; 265extern int sysctl_tcp_app_win;
@@ -274,7 +275,6 @@ extern int sysctl_tcp_mtu_probing;
274extern int sysctl_tcp_base_mss; 275extern int sysctl_tcp_base_mss;
275extern int sysctl_tcp_workaround_signed_windows; 276extern int sysctl_tcp_workaround_signed_windows;
276extern int sysctl_tcp_slow_start_after_idle; 277extern int sysctl_tcp_slow_start_after_idle;
277extern int sysctl_tcp_max_ssthresh;
278extern int sysctl_tcp_thin_linear_timeouts; 278extern int sysctl_tcp_thin_linear_timeouts;
279extern int sysctl_tcp_thin_dupack; 279extern int sysctl_tcp_thin_dupack;
280extern int sysctl_tcp_early_retrans; 280extern int sysctl_tcp_early_retrans;
@@ -325,7 +325,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
325 return false; 325 return false;
326} 326}
327 327
328extern bool tcp_check_oom(struct sock *sk, int shift); 328bool tcp_check_oom(struct sock *sk, int shift);
329 329
330/* syncookies: remember time of last synqueue overflow */ 330/* syncookies: remember time of last synqueue overflow */
331static inline void tcp_synq_overflow(struct sock *sk) 331static inline void tcp_synq_overflow(struct sock *sk)
@@ -348,38 +348,36 @@ extern struct proto tcp_prot;
348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
350 350
351extern void tcp_init_mem(struct net *net); 351void tcp_tasklet_init(void);
352 352
353extern void tcp_tasklet_init(void); 353void tcp_v4_err(struct sk_buff *skb, u32);
354 354
355extern void tcp_v4_err(struct sk_buff *skb, u32); 355void tcp_shutdown(struct sock *sk, int how);
356 356
357extern void tcp_shutdown (struct sock *sk, int how); 357void tcp_v4_early_demux(struct sk_buff *skb);
358 358int tcp_v4_rcv(struct sk_buff *skb);
359extern void tcp_v4_early_demux(struct sk_buff *skb); 359
360extern int tcp_v4_rcv(struct sk_buff *skb); 360int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
361 361int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
362extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 362 size_t size);
363extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 363int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
364 size_t size); 364 int flags);
365extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 365void tcp_release_cb(struct sock *sk);
366 size_t size, int flags); 366void tcp_wfree(struct sk_buff *skb);
367extern void tcp_release_cb(struct sock *sk); 367void tcp_write_timer_handler(struct sock *sk);
368extern void tcp_wfree(struct sk_buff *skb); 368void tcp_delack_timer_handler(struct sock *sk);
369extern void tcp_write_timer_handler(struct sock *sk); 369int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
370extern void tcp_delack_timer_handler(struct sock *sk); 370int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
371extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 371 const struct tcphdr *th, unsigned int len);
372extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 372void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
373 const struct tcphdr *th, unsigned int len); 373 const struct tcphdr *th, unsigned int len);
374extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 374void tcp_rcv_space_adjust(struct sock *sk);
375 const struct tcphdr *th, unsigned int len); 375void tcp_cleanup_rbuf(struct sock *sk, int copied);
376extern void tcp_rcv_space_adjust(struct sock *sk); 376int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
377extern void tcp_cleanup_rbuf(struct sock *sk, int copied); 377void tcp_twsk_destructor(struct sock *sk);
378extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 378ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
379extern void tcp_twsk_destructor(struct sock *sk); 379 struct pipe_inode_info *pipe, size_t len,
380extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, 380 unsigned int flags);
381 struct pipe_inode_info *pipe, size_t len,
382 unsigned int flags);
383 381
384static inline void tcp_dec_quickack_mode(struct sock *sk, 382static inline void tcp_dec_quickack_mode(struct sock *sk,
385 const unsigned int pkts) 383 const unsigned int pkts)
@@ -409,66 +407,65 @@ enum tcp_tw_status {
409}; 407};
410 408
411 409
412extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 410enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
413 struct sk_buff *skb, 411 struct sk_buff *skb,
414 const struct tcphdr *th); 412 const struct tcphdr *th);
415extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 413struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
416 struct request_sock *req, 414 struct request_sock *req, struct request_sock **prev,
417 struct request_sock **prev, 415 bool fastopen);
418 bool fastopen); 416int tcp_child_process(struct sock *parent, struct sock *child,
419extern int tcp_child_process(struct sock *parent, struct sock *child, 417 struct sk_buff *skb);
420 struct sk_buff *skb); 418void tcp_enter_loss(struct sock *sk, int how);
421extern void tcp_enter_loss(struct sock *sk, int how); 419void tcp_clear_retrans(struct tcp_sock *tp);
422extern void tcp_clear_retrans(struct tcp_sock *tp); 420void tcp_update_metrics(struct sock *sk);
423extern void tcp_update_metrics(struct sock *sk); 421void tcp_init_metrics(struct sock *sk);
424extern void tcp_init_metrics(struct sock *sk); 422void tcp_metrics_init(void);
425extern void tcp_metrics_init(void); 423bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst,
426extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 424 bool paws_check);
427extern bool tcp_remember_stamp(struct sock *sk); 425bool tcp_remember_stamp(struct sock *sk);
428extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 426bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
429extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 427void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
430extern void tcp_disable_fack(struct tcp_sock *tp); 428void tcp_disable_fack(struct tcp_sock *tp);
431extern void tcp_close(struct sock *sk, long timeout); 429void tcp_close(struct sock *sk, long timeout);
432extern void tcp_init_sock(struct sock *sk); 430void tcp_init_sock(struct sock *sk);
433extern unsigned int tcp_poll(struct file * file, struct socket *sock, 431unsigned int tcp_poll(struct file *file, struct socket *sock,
434 struct poll_table_struct *wait); 432 struct poll_table_struct *wait);
435extern int tcp_getsockopt(struct sock *sk, int level, int optname, 433int tcp_getsockopt(struct sock *sk, int level, int optname,
434 char __user *optval, int __user *optlen);
435int tcp_setsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, unsigned int optlen);
437int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, int __user *optlen); 438 char __user *optval, int __user *optlen);
437extern int tcp_setsockopt(struct sock *sk, int level, int optname, 439int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
438 char __user *optval, unsigned int optlen); 440 char __user *optval, unsigned int optlen);
439extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname, 441void tcp_set_keepalive(struct sock *sk, int val);
440 char __user *optval, int __user *optlen); 442void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
441extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname, 443int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
442 char __user *optval, unsigned int optlen); 444 size_t len, int nonblock, int flags, int *addr_len);
443extern void tcp_set_keepalive(struct sock *sk, int val); 445void tcp_parse_options(const struct sk_buff *skb,
444extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 446 struct tcp_options_received *opt_rx,
445extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 447 int estab, struct tcp_fastopen_cookie *foc);
446 size_t len, int nonblock, int flags, int *addr_len); 448const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
447extern void tcp_parse_options(const struct sk_buff *skb,
448 struct tcp_options_received *opt_rx,
449 int estab, struct tcp_fastopen_cookie *foc);
450extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
451 449
452/* 450/*
453 * TCP v4 functions exported for the inet6 API 451 * TCP v4 functions exported for the inet6 API
454 */ 452 */
455 453
456extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 454void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
457extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 455int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
458extern struct sock * tcp_create_openreq_child(struct sock *sk, 456struct sock *tcp_create_openreq_child(struct sock *sk,
459 struct request_sock *req, 457 struct request_sock *req,
460 struct sk_buff *skb); 458 struct sk_buff *skb);
461extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, 459struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
462 struct request_sock *req, 460 struct request_sock *req,
463 struct dst_entry *dst); 461 struct dst_entry *dst);
464extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); 462int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
465extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, 463int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
466 int addr_len); 464int tcp_connect(struct sock *sk);
467extern int tcp_connect(struct sock *sk); 465struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
468extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 466 struct request_sock *req,
469 struct request_sock *req, 467 struct tcp_fastopen_cookie *foc);
470 struct tcp_fastopen_cookie *foc); 468int tcp_disconnect(struct sock *sk, int flags);
471extern int tcp_disconnect(struct sock *sk, int flags);
472 469
473void tcp_connect_init(struct sock *sk); 470void tcp_connect_init(struct sock *sk);
474void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); 471void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
@@ -476,16 +473,32 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
476void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb); 473void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
477 474
478/* From syncookies.c */ 475/* From syncookies.c */
479extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 476int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
480extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 477 u32 cookie);
481 u32 cookie); 478struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
482extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 479 struct ip_options *opt);
483 struct ip_options *opt);
484#ifdef CONFIG_SYN_COOKIES 480#ifdef CONFIG_SYN_COOKIES
485extern u32 __cookie_v4_init_sequence(const struct iphdr *iph, 481#include <linux/ktime.h>
486 const struct tcphdr *th, u16 *mssp); 482
487extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 483/* Syncookies use a monotonic timer which increments every 64 seconds.
488 __u16 *mss); 484 * This counter is used both as a hash input and partially encoded into
485 * the cookie value. A cookie is only validated further if the delta
486 * between the current counter value and the encoded one is less than this,
487 * i.e. a sent cookie is valid only at most for 128 seconds (or less if
488 * the counter advances immediately after a cookie is generated).
489 */
490#define MAX_SYNCOOKIE_AGE 2
491
492static inline u32 tcp_cookie_time(void)
493{
494 struct timespec now;
495 getnstimeofday(&now);
496 return now.tv_sec >> 6; /* 64 seconds granularity */
497}
498
499u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
500 u16 *mssp);
501__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss);
489#else 502#else
490static inline __u32 cookie_v4_init_sequence(struct sock *sk, 503static inline __u32 cookie_v4_init_sequence(struct sock *sk,
491 struct sk_buff *skb, 504 struct sk_buff *skb,
@@ -495,19 +508,19 @@ static inline __u32 cookie_v4_init_sequence(struct sock *sk,
495} 508}
496#endif 509#endif
497 510
498extern __u32 cookie_init_timestamp(struct request_sock *req); 511__u32 cookie_init_timestamp(struct request_sock *req);
499extern bool cookie_check_timestamp(struct tcp_options_received *opt, 512bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net,
500 struct net *net, bool *ecn_ok); 513 bool *ecn_ok);
501 514
502/* From net/ipv6/syncookies.c */ 515/* From net/ipv6/syncookies.c */
503extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, 516int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
504 u32 cookie); 517 u32 cookie);
505extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 518struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
506#ifdef CONFIG_SYN_COOKIES 519#ifdef CONFIG_SYN_COOKIES
507extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, 520u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
508 const struct tcphdr *th, u16 *mssp); 521 const struct tcphdr *th, u16 *mssp);
509extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 522__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
510 __u16 *mss); 523 __u16 *mss);
511#else 524#else
512static inline __u32 cookie_v6_init_sequence(struct sock *sk, 525static inline __u32 cookie_v6_init_sequence(struct sock *sk,
513 struct sk_buff *skb, 526 struct sk_buff *skb,
@@ -518,47 +531,46 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
518#endif 531#endif
519/* tcp_output.c */ 532/* tcp_output.c */
520 533
521extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 534void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
522 int nonagle); 535 int nonagle);
523extern bool tcp_may_send_now(struct sock *sk); 536bool tcp_may_send_now(struct sock *sk);
524extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *); 537int __tcp_retransmit_skb(struct sock *, struct sk_buff *);
525extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 538int tcp_retransmit_skb(struct sock *, struct sk_buff *);
526extern void tcp_retransmit_timer(struct sock *sk); 539void tcp_retransmit_timer(struct sock *sk);
527extern void tcp_xmit_retransmit_queue(struct sock *); 540void tcp_xmit_retransmit_queue(struct sock *);
528extern void tcp_simple_retransmit(struct sock *); 541void tcp_simple_retransmit(struct sock *);
529extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 542int tcp_trim_head(struct sock *, struct sk_buff *, u32);
530extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); 543int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
531 544
532extern void tcp_send_probe0(struct sock *); 545void tcp_send_probe0(struct sock *);
533extern void tcp_send_partial(struct sock *); 546void tcp_send_partial(struct sock *);
534extern int tcp_write_wakeup(struct sock *); 547int tcp_write_wakeup(struct sock *);
535extern void tcp_send_fin(struct sock *sk); 548void tcp_send_fin(struct sock *sk);
536extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 549void tcp_send_active_reset(struct sock *sk, gfp_t priority);
537extern int tcp_send_synack(struct sock *); 550int tcp_send_synack(struct sock *);
538extern bool tcp_syn_flood_action(struct sock *sk, 551bool tcp_syn_flood_action(struct sock *sk, const struct sk_buff *skb,
539 const struct sk_buff *skb, 552 const char *proto);
540 const char *proto); 553void tcp_push_one(struct sock *, unsigned int mss_now);
541extern void tcp_push_one(struct sock *, unsigned int mss_now); 554void tcp_send_ack(struct sock *sk);
542extern void tcp_send_ack(struct sock *sk); 555void tcp_send_delayed_ack(struct sock *sk);
543extern void tcp_send_delayed_ack(struct sock *sk); 556void tcp_send_loss_probe(struct sock *sk);
544extern void tcp_send_loss_probe(struct sock *sk); 557bool tcp_schedule_loss_probe(struct sock *sk);
545extern bool tcp_schedule_loss_probe(struct sock *sk);
546 558
547/* tcp_input.c */ 559/* tcp_input.c */
548extern void tcp_cwnd_application_limited(struct sock *sk); 560void tcp_cwnd_application_limited(struct sock *sk);
549extern void tcp_resume_early_retransmit(struct sock *sk); 561void tcp_resume_early_retransmit(struct sock *sk);
550extern void tcp_rearm_rto(struct sock *sk); 562void tcp_rearm_rto(struct sock *sk);
551extern void tcp_reset(struct sock *sk); 563void tcp_reset(struct sock *sk);
552 564
553/* tcp_timer.c */ 565/* tcp_timer.c */
554extern void tcp_init_xmit_timers(struct sock *); 566void tcp_init_xmit_timers(struct sock *);
555static inline void tcp_clear_xmit_timers(struct sock *sk) 567static inline void tcp_clear_xmit_timers(struct sock *sk)
556{ 568{
557 inet_csk_clear_xmit_timers(sk); 569 inet_csk_clear_xmit_timers(sk);
558} 570}
559 571
560extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 572unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
561extern unsigned int tcp_current_mss(struct sock *sk); 573unsigned int tcp_current_mss(struct sock *sk);
562 574
563/* Bound MSS / TSO packet size with the half of the window */ 575/* Bound MSS / TSO packet size with the half of the window */
564static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) 576static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
@@ -584,20 +596,20 @@ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
584} 596}
585 597
586/* tcp.c */ 598/* tcp.c */
587extern void tcp_get_info(const struct sock *, struct tcp_info *); 599void tcp_get_info(const struct sock *, struct tcp_info *);
588 600
589/* Read 'sendfile()'-style from a TCP socket */ 601/* Read 'sendfile()'-style from a TCP socket */
590typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, 602typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
591 unsigned int, size_t); 603 unsigned int, size_t);
592extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 604int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
593 sk_read_actor_t recv_actor); 605 sk_read_actor_t recv_actor);
594 606
595extern void tcp_initialize_rcv_mss(struct sock *sk); 607void tcp_initialize_rcv_mss(struct sock *sk);
596 608
597extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); 609int tcp_mtu_to_mss(struct sock *sk, int pmtu);
598extern int tcp_mss_to_mtu(struct sock *sk, int mss); 610int tcp_mss_to_mtu(struct sock *sk, int mss);
599extern void tcp_mtup_init(struct sock *sk); 611void tcp_mtup_init(struct sock *sk);
600extern void tcp_init_buffer_space(struct sock *sk); 612void tcp_init_buffer_space(struct sock *sk);
601 613
602static inline void tcp_bound_rto(const struct sock *sk) 614static inline void tcp_bound_rto(const struct sock *sk)
603{ 615{
@@ -610,7 +622,7 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
610 return (tp->srtt >> 3) + tp->rttvar; 622 return (tp->srtt >> 3) + tp->rttvar;
611} 623}
612 624
613extern void tcp_set_rto(struct sock *sk); 625void tcp_set_rto(struct sock *sk);
614 626
615static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 627static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
616{ 628{
@@ -663,7 +675,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
663 * scaling applied to the result. The caller does these things 675 * scaling applied to the result. The caller does these things
664 * if necessary. This is a "raw" window selection. 676 * if necessary. This is a "raw" window selection.
665 */ 677 */
666extern u32 __tcp_select_window(struct sock *sk); 678u32 __tcp_select_window(struct sock *sk);
667 679
668void tcp_send_window_probe(struct sock *sk); 680void tcp_send_window_probe(struct sock *sk);
669 681
@@ -784,7 +796,7 @@ struct tcp_congestion_ops {
784 /* lower bound for congestion window (optional) */ 796 /* lower bound for congestion window (optional) */
785 u32 (*min_cwnd)(const struct sock *sk); 797 u32 (*min_cwnd)(const struct sock *sk);
786 /* do new cwnd calculation (required) */ 798 /* do new cwnd calculation (required) */
787 void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight); 799 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
788 /* call before changing ca_state (optional) */ 800 /* call before changing ca_state (optional) */
789 void (*set_state)(struct sock *sk, u8 new_state); 801 void (*set_state)(struct sock *sk, u8 new_state);
790 /* call when cwnd event occurs (optional) */ 802 /* call when cwnd event occurs (optional) */
@@ -800,24 +812,24 @@ struct tcp_congestion_ops {
800 struct module *owner; 812 struct module *owner;
801}; 813};
802 814
803extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); 815int tcp_register_congestion_control(struct tcp_congestion_ops *type);
804extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); 816void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
805 817
806extern void tcp_init_congestion_control(struct sock *sk); 818void tcp_init_congestion_control(struct sock *sk);
807extern void tcp_cleanup_congestion_control(struct sock *sk); 819void tcp_cleanup_congestion_control(struct sock *sk);
808extern int tcp_set_default_congestion_control(const char *name); 820int tcp_set_default_congestion_control(const char *name);
809extern void tcp_get_default_congestion_control(char *name); 821void tcp_get_default_congestion_control(char *name);
810extern void tcp_get_available_congestion_control(char *buf, size_t len); 822void tcp_get_available_congestion_control(char *buf, size_t len);
811extern void tcp_get_allowed_congestion_control(char *buf, size_t len); 823void tcp_get_allowed_congestion_control(char *buf, size_t len);
812extern int tcp_set_allowed_congestion_control(char *allowed); 824int tcp_set_allowed_congestion_control(char *allowed);
813extern int tcp_set_congestion_control(struct sock *sk, const char *name); 825int tcp_set_congestion_control(struct sock *sk, const char *name);
814extern void tcp_slow_start(struct tcp_sock *tp); 826int tcp_slow_start(struct tcp_sock *tp, u32 acked);
815extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); 827void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
816 828
817extern struct tcp_congestion_ops tcp_init_congestion_ops; 829extern struct tcp_congestion_ops tcp_init_congestion_ops;
818extern u32 tcp_reno_ssthresh(struct sock *sk); 830u32 tcp_reno_ssthresh(struct sock *sk);
819extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); 831void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
820extern u32 tcp_reno_min_cwnd(const struct sock *sk); 832u32 tcp_reno_min_cwnd(const struct sock *sk);
821extern struct tcp_congestion_ops tcp_reno; 833extern struct tcp_congestion_ops tcp_reno;
822 834
823static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -936,8 +948,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
936/* Use define here intentionally to get WARN_ON location shown at the caller */ 948/* Use define here intentionally to get WARN_ON location shown at the caller */
937#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 949#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
938 950
939extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 951void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
940extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 952__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
941 953
942/* The maximum number of MSS of available cwnd for which TSO defers 954/* The maximum number of MSS of available cwnd for which TSO defers
943 * sending if not using sysctl_tcp_tso_win_divisor. 955 * sending if not using sysctl_tcp_tso_win_divisor.
@@ -963,7 +975,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
963{ 975{
964 return tp->snd_una + tp->snd_wnd; 976 return tp->snd_una + tp->snd_wnd;
965} 977}
966extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 978bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight);
967 979
968static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, 980static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
969 const struct sk_buff *skb) 981 const struct sk_buff *skb)
@@ -1028,7 +1040,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1028#endif 1040#endif
1029} 1041}
1030 1042
1031extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); 1043bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
1032 1044
1033#undef STATE_TRACE 1045#undef STATE_TRACE
1034 1046
@@ -1039,9 +1051,9 @@ static const char *statename[]={
1039 "Close Wait","Last ACK","Listen","Closing" 1051 "Close Wait","Last ACK","Listen","Closing"
1040}; 1052};
1041#endif 1053#endif
1042extern void tcp_set_state(struct sock *sk, int state); 1054void tcp_set_state(struct sock *sk, int state);
1043 1055
1044extern void tcp_done(struct sock *sk); 1056void tcp_done(struct sock *sk);
1045 1057
1046static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 1058static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1047{ 1059{
@@ -1049,13 +1061,12 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1049 rx_opt->num_sacks = 0; 1061 rx_opt->num_sacks = 0;
1050} 1062}
1051 1063
1052extern u32 tcp_default_init_rwnd(u32 mss); 1064u32 tcp_default_init_rwnd(u32 mss);
1053 1065
1054/* Determine a window scaling and initial window to offer. */ 1066/* Determine a window scaling and initial window to offer. */
1055extern void tcp_select_initial_window(int __space, __u32 mss, 1067void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd,
1056 __u32 *rcv_wnd, __u32 *window_clamp, 1068 __u32 *window_clamp, int wscale_ok,
1057 int wscale_ok, __u8 *rcv_wscale, 1069 __u8 *rcv_wscale, __u32 init_rcv_wnd);
1058 __u32 init_rcv_wnd);
1059 1070
1060static inline int tcp_win_from_space(int space) 1071static inline int tcp_win_from_space(int space)
1061{ 1072{
@@ -1095,11 +1106,11 @@ static inline void tcp_openreq_init(struct request_sock *req,
1095 ireq->wscale_ok = rx_opt->wscale_ok; 1106 ireq->wscale_ok = rx_opt->wscale_ok;
1096 ireq->acked = 0; 1107 ireq->acked = 0;
1097 ireq->ecn_ok = 0; 1108 ireq->ecn_ok = 0;
1098 ireq->rmt_port = tcp_hdr(skb)->source; 1109 ireq->ir_rmt_port = tcp_hdr(skb)->source;
1099 ireq->loc_port = tcp_hdr(skb)->dest; 1110 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1100} 1111}
1101 1112
1102extern void tcp_enter_memory_pressure(struct sock *sk); 1113void tcp_enter_memory_pressure(struct sock *sk);
1103 1114
1104static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1115static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1105{ 1116{
@@ -1252,21 +1263,20 @@ struct tcp_md5sig_pool {
1252}; 1263};
1253 1264
1254/* - functions */ 1265/* - functions */
1255extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 1266int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1256 const struct sock *sk, 1267 const struct sock *sk, const struct request_sock *req,
1257 const struct request_sock *req, 1268 const struct sk_buff *skb);
1258 const struct sk_buff *skb); 1269int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1259extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, 1270 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp);
1260 int family, const u8 *newkey, 1271int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1261 u8 newkeylen, gfp_t gfp); 1272 int family);
1262extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, 1273struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1263 int family);
1264extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1265 struct sock *addr_sk); 1274 struct sock *addr_sk);
1266 1275
1267#ifdef CONFIG_TCP_MD5SIG 1276#ifdef CONFIG_TCP_MD5SIG
1268extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1277struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1269 const union tcp_md5_addr *addr, int family); 1278 const union tcp_md5_addr *addr,
1279 int family);
1270#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key) 1280#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1271#else 1281#else
1272static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1282static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
@@ -1278,27 +1288,26 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1278#define tcp_twsk_md5_key(twsk) NULL 1288#define tcp_twsk_md5_key(twsk) NULL
1279#endif 1289#endif
1280 1290
1281extern bool tcp_alloc_md5sig_pool(void); 1291bool tcp_alloc_md5sig_pool(void);
1282 1292
1283extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1293struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1284static inline void tcp_put_md5sig_pool(void) 1294static inline void tcp_put_md5sig_pool(void)
1285{ 1295{
1286 local_bh_enable(); 1296 local_bh_enable();
1287} 1297}
1288 1298
1289extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1299int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1290extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1300int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
1291 unsigned int header_len); 1301 unsigned int header_len);
1292extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1302int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1293 const struct tcp_md5sig_key *key); 1303 const struct tcp_md5sig_key *key);
1294 1304
1295/* From tcp_fastopen.c */ 1305/* From tcp_fastopen.c */
1296extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, 1306void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1297 struct tcp_fastopen_cookie *cookie, 1307 struct tcp_fastopen_cookie *cookie, int *syn_loss,
1298 int *syn_loss, unsigned long *last_syn_loss); 1308 unsigned long *last_syn_loss);
1299extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss, 1309void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1300 struct tcp_fastopen_cookie *cookie, 1310 struct tcp_fastopen_cookie *cookie, bool syn_lost);
1301 bool syn_lost);
1302struct tcp_fastopen_request { 1311struct tcp_fastopen_request {
1303 /* Fast Open cookie. Size 0 means a cookie request */ 1312 /* Fast Open cookie. Size 0 means a cookie request */
1304 struct tcp_fastopen_cookie cookie; 1313 struct tcp_fastopen_cookie cookie;
@@ -1309,9 +1318,9 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1309 1318
1310extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1319extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1311int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1320int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1312extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, 1321void tcp_fastopen_cookie_gen(__be32 src, __be32 dst,
1313 struct tcp_fastopen_cookie *foc); 1322 struct tcp_fastopen_cookie *foc);
1314 1323void tcp_fastopen_init_key_once(bool publish);
1315#define TCP_FASTOPEN_KEY_LENGTH 16 1324#define TCP_FASTOPEN_KEY_LENGTH 16
1316 1325
1317/* Fastopen key context */ 1326/* Fastopen key context */
@@ -1507,7 +1516,6 @@ enum tcp_seq_states {
1507 TCP_SEQ_STATE_LISTENING, 1516 TCP_SEQ_STATE_LISTENING,
1508 TCP_SEQ_STATE_OPENREQ, 1517 TCP_SEQ_STATE_OPENREQ,
1509 TCP_SEQ_STATE_ESTABLISHED, 1518 TCP_SEQ_STATE_ESTABLISHED,
1510 TCP_SEQ_STATE_TIME_WAIT,
1511}; 1519};
1512 1520
1513int tcp_seq_open(struct inode *inode, struct file *file); 1521int tcp_seq_open(struct inode *inode, struct file *file);
@@ -1529,22 +1537,20 @@ struct tcp_iter_state {
1529 loff_t last_pos; 1537 loff_t last_pos;
1530}; 1538};
1531 1539
1532extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1540int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
1533extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); 1541void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1534 1542
1535extern struct request_sock_ops tcp_request_sock_ops; 1543extern struct request_sock_ops tcp_request_sock_ops;
1536extern struct request_sock_ops tcp6_request_sock_ops; 1544extern struct request_sock_ops tcp6_request_sock_ops;
1537 1545
1538extern void tcp_v4_destroy_sock(struct sock *sk); 1546void tcp_v4_destroy_sock(struct sock *sk);
1539 1547
1540extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, 1548struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
1541 netdev_features_t features); 1549 netdev_features_t features);
1542extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1550struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1543 struct sk_buff *skb); 1551int tcp_gro_complete(struct sk_buff *skb);
1544extern int tcp_gro_complete(struct sk_buff *skb);
1545 1552
1546extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, 1553void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
1547 __be32 daddr);
1548 1554
1549static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) 1555static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1550{ 1556{
@@ -1560,8 +1566,8 @@ static inline bool tcp_stream_memory_free(const struct sock *sk)
1560} 1566}
1561 1567
1562#ifdef CONFIG_PROC_FS 1568#ifdef CONFIG_PROC_FS
1563extern int tcp4_proc_init(void); 1569int tcp4_proc_init(void);
1564extern void tcp4_proc_exit(void); 1570void tcp4_proc_exit(void);
1565#endif 1571#endif
1566 1572
1567/* TCP af-specific functions */ 1573/* TCP af-specific functions */
@@ -1592,9 +1598,9 @@ struct tcp_request_sock_ops {
1592#endif 1598#endif
1593}; 1599};
1594 1600
1595extern int tcpv4_offload_init(void); 1601int tcpv4_offload_init(void);
1596 1602
1597extern void tcp_v4_init(void); 1603void tcp_v4_init(void);
1598extern void tcp_init(void); 1604void tcp_init(void);
1599 1605
1600#endif /* _TCP_H */ 1606#endif /* _TCP_H */
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 7df18bc43a97..05b94d9453de 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -1,19 +1,7 @@
1#ifndef _TCP_MEMCG_H 1#ifndef _TCP_MEMCG_H
2#define _TCP_MEMCG_H 2#define _TCP_MEMCG_H
3 3
4struct tcp_memcontrol {
5 struct cg_proto cg_proto;
6 /* per-cgroup tcp memory pressure knobs */
7 struct res_counter tcp_memory_allocated;
8 struct percpu_counter tcp_sockets_allocated;
9 /* those two are read-mostly, leave them at the end */
10 long tcp_prot_mem[3];
11 int tcp_memory_pressure;
12};
13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 4struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss); 5int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct mem_cgroup *memcg); 6void tcp_destroy_cgroup(struct mem_cgroup *memcg);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 7#endif /* _TCP_MEMCG_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index ef2e0b7843a0..a24f0f3e107f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -79,7 +79,7 @@ struct udp_table {
79 unsigned int log; 79 unsigned int log;
80}; 80};
81extern struct udp_table udp_table; 81extern struct udp_table udp_table;
82extern void udp_table_init(struct udp_table *, const char *); 82void udp_table_init(struct udp_table *, const char *);
83static inline struct udp_hslot *udp_hashslot(struct udp_table *table, 83static inline struct udp_hslot *udp_hashslot(struct udp_table *table,
84 struct net *net, unsigned int num) 84 struct net *net, unsigned int num)
85{ 85{
@@ -162,52 +162,53 @@ static inline void udp_lib_hash(struct sock *sk)
162 BUG(); 162 BUG();
163} 163}
164 164
165extern void udp_lib_unhash(struct sock *sk); 165void udp_lib_unhash(struct sock *sk);
166extern void udp_lib_rehash(struct sock *sk, u16 new_hash); 166void udp_lib_rehash(struct sock *sk, u16 new_hash);
167 167
168static inline void udp_lib_close(struct sock *sk, long timeout) 168static inline void udp_lib_close(struct sock *sk, long timeout)
169{ 169{
170 sk_common_release(sk); 170 sk_common_release(sk);
171} 171}
172 172
173extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 173int udp_lib_get_port(struct sock *sk, unsigned short snum,
174 int (*)(const struct sock *,const struct sock *), 174 int (*)(const struct sock *, const struct sock *),
175 unsigned int hash2_nulladdr); 175 unsigned int hash2_nulladdr);
176 176
177/* net/ipv4/udp.c */ 177/* net/ipv4/udp.c */
178extern int udp_get_port(struct sock *sk, unsigned short snum, 178void udp_v4_early_demux(struct sk_buff *skb);
179 int (*saddr_cmp)(const struct sock *, 179int udp_get_port(struct sock *sk, unsigned short snum,
180 const struct sock *)); 180 int (*saddr_cmp)(const struct sock *,
181extern void udp_err(struct sk_buff *, u32); 181 const struct sock *));
182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 182void udp_err(struct sk_buff *, u32);
183 struct msghdr *msg, size_t len); 183int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
184extern int udp_push_pending_frames(struct sock *sk); 184 size_t len);
185extern void udp_flush_pending_frames(struct sock *sk); 185int udp_push_pending_frames(struct sock *sk);
186extern void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst); 186void udp_flush_pending_frames(struct sock *sk);
187extern int udp_rcv(struct sk_buff *skb); 187void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst);
188extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 188int udp_rcv(struct sk_buff *skb);
189extern int udp_disconnect(struct sock *sk, int flags); 189int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
190extern unsigned int udp_poll(struct file *file, struct socket *sock, 190int udp_disconnect(struct sock *sk, int flags);
191 poll_table *wait); 191unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait);
192extern struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, 192struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
193 netdev_features_t features); 193 netdev_features_t features);
194extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 194int udp_lib_getsockopt(struct sock *sk, int level, int optname,
195 char __user *optval, int __user *optlen); 195 char __user *optval, int __user *optlen);
196extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 196int udp_lib_setsockopt(struct sock *sk, int level, int optname,
197 char __user *optval, unsigned int optlen, 197 char __user *optval, unsigned int optlen,
198 int (*push_pending_frames)(struct sock *)); 198 int (*push_pending_frames)(struct sock *));
199extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 199struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
200 __be32 daddr, __be16 dport, 200 __be32 daddr, __be16 dport, int dif);
201 int dif); 201struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
202extern struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 202 __be32 daddr, __be16 dport, int dif,
203 __be32 daddr, __be16 dport, 203 struct udp_table *tbl);
204 int dif, struct udp_table *tbl); 204struct sock *udp6_lib_lookup(struct net *net,
205extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, 205 const struct in6_addr *saddr, __be16 sport,
206 const struct in6_addr *daddr, __be16 dport, 206 const struct in6_addr *daddr, __be16 dport,
207 int dif); 207 int dif);
208extern struct sock *__udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, 208struct sock *__udp6_lib_lookup(struct net *net,
209 const struct in6_addr *daddr, __be16 dport, 209 const struct in6_addr *saddr, __be16 sport,
210 int dif, struct udp_table *tbl); 210 const struct in6_addr *daddr, __be16 dport,
211 int dif, struct udp_table *tbl);
211 212
212/* 213/*
213 * SNMP statistics for UDP and UDP-Lite 214 * SNMP statistics for UDP and UDP-Lite
@@ -229,13 +230,13 @@ extern struct sock *__udp6_lib_lookup(struct net *net, const struct in6_addr *sa
229} while(0) 230} while(0)
230 231
231#if IS_ENABLED(CONFIG_IPV6) 232#if IS_ENABLED(CONFIG_IPV6)
232#define UDPX_INC_STATS_BH(sk, field) \ 233#define UDPX_INC_STATS_BH(sk, field) \
233 do { \ 234do { \
234 if ((sk)->sk_family == AF_INET) \ 235 if ((sk)->sk_family == AF_INET) \
235 UDP_INC_STATS_BH(sock_net(sk), field, 0); \ 236 UDP_INC_STATS_BH(sock_net(sk), field, 0); \
236 else \ 237 else \
237 UDP6_INC_STATS_BH(sock_net(sk), field, 0); \ 238 UDP6_INC_STATS_BH(sock_net(sk), field, 0); \
238 } while (0); 239} while (0)
239#else 240#else
240#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(sock_net(sk), field, 0) 241#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(sock_net(sk), field, 0)
241#endif 242#endif
@@ -259,19 +260,19 @@ struct udp_iter_state {
259}; 260};
260 261
261#ifdef CONFIG_PROC_FS 262#ifdef CONFIG_PROC_FS
262extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); 263int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
263extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); 264void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
264 265
265extern int udp4_proc_init(void); 266int udp4_proc_init(void);
266extern void udp4_proc_exit(void); 267void udp4_proc_exit(void);
267#endif 268#endif
268 269
269extern int udpv4_offload_init(void); 270int udpv4_offload_init(void);
270 271
271extern void udp_init(void); 272void udp_init(void);
272 273
273extern void udp_encap_enable(void); 274void udp_encap_enable(void);
274#if IS_ENABLED(CONFIG_IPV6) 275#if IS_ENABLED(CONFIG_IPV6)
275extern void udpv6_encap_enable(void); 276void udpv6_encap_enable(void);
276#endif 277#endif
277#endif /* _UDP_H */ 278#endif /* _UDP_H */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 71375459a884..2caadabcd07b 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -126,7 +126,7 @@ static inline __wsum udplite_csum(struct sk_buff *skb)
126 return skb_checksum(skb, off, len, 0); 126 return skb_checksum(skb, off, len, 0);
127} 127}
128 128
129extern void udplite4_register(void); 129void udplite4_register(void);
130extern int udplite_get_port(struct sock *sk, unsigned short snum, 130int udplite_get_port(struct sock *sk, unsigned short snum,
131 int (*scmp)(const struct sock *, const struct sock *)); 131 int (*scmp)(const struct sock *, const struct sock *));
132#endif /* _UDPLITE_H */ 132#endif /* _UDPLITE_H */
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 2d64d3cd4999..6b6d180fb91a 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -36,5 +36,16 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
36 36
37__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); 37__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
38 38
39/* IP header + UDP + VXLAN + Ethernet header */
40#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
41/* IPv6 header + UDP + VXLAN + Ethernet header */
42#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
43
44#if IS_ENABLED(CONFIG_VXLAN)
39void vxlan_get_rx_port(struct net_device *netdev); 45void vxlan_get_rx_port(struct net_device *netdev);
46#else
47static inline void vxlan_get_rx_port(struct net_device *netdev)
48{
49}
50#endif
40#endif 51#endif
diff --git a/include/net/wext.h b/include/net/wext.h
index 4f6e7423174c..345911965dbb 100644
--- a/include/net/wext.h
+++ b/include/net/wext.h
@@ -6,13 +6,13 @@
6struct net; 6struct net;
7 7
8#ifdef CONFIG_WEXT_CORE 8#ifdef CONFIG_WEXT_CORE
9extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 9int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
10 void __user *arg); 10 void __user *arg);
11extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, 11int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
12 unsigned long arg); 12 unsigned long arg);
13 13
14extern struct iw_statistics *get_wireless_stats(struct net_device *dev); 14struct iw_statistics *get_wireless_stats(struct net_device *dev);
15extern int call_commit_handler(struct net_device *dev); 15int call_commit_handler(struct net_device *dev);
16#else 16#else
17static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 17static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
18 void __user *arg) 18 void __user *arg)
@@ -27,8 +27,8 @@ static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
27#endif 27#endif
28 28
29#ifdef CONFIG_WEXT_PROC 29#ifdef CONFIG_WEXT_PROC
30extern int wext_proc_init(struct net *net); 30int wext_proc_init(struct net *net);
31extern void wext_proc_exit(struct net *net); 31void wext_proc_exit(struct net *net);
32#else 32#else
33static inline int wext_proc_init(struct net *net) 33static inline int wext_proc_init(struct net *net)
34{ 34{
diff --git a/include/net/wimax.h b/include/net/wimax.h
index bbb74f990cab..98498e1daa06 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -438,9 +438,9 @@ struct wimax_dev {
438 * 438 *
439 * These functions are not exported to user space. 439 * These functions are not exported to user space.
440 */ 440 */
441extern void wimax_dev_init(struct wimax_dev *); 441void wimax_dev_init(struct wimax_dev *);
442extern int wimax_dev_add(struct wimax_dev *, struct net_device *); 442int wimax_dev_add(struct wimax_dev *, struct net_device *);
443extern void wimax_dev_rm(struct wimax_dev *); 443void wimax_dev_rm(struct wimax_dev *);
444 444
445static inline 445static inline
446struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev) 446struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev)
@@ -454,8 +454,8 @@ struct device *wimax_dev_to_dev(struct wimax_dev *wimax_dev)
454 return wimax_dev->net_dev->dev.parent; 454 return wimax_dev->net_dev->dev.parent;
455} 455}
456 456
457extern void wimax_state_change(struct wimax_dev *, enum wimax_st); 457void wimax_state_change(struct wimax_dev *, enum wimax_st);
458extern enum wimax_st wimax_state_get(struct wimax_dev *); 458enum wimax_st wimax_state_get(struct wimax_dev *);
459 459
460/* 460/*
461 * Radio Switch state reporting. 461 * Radio Switch state reporting.
@@ -463,8 +463,8 @@ extern enum wimax_st wimax_state_get(struct wimax_dev *);
463 * enum wimax_rf_state is declared in linux/wimax.h so the exports 463 * enum wimax_rf_state is declared in linux/wimax.h so the exports
464 * to user space can use it. 464 * to user space can use it.
465 */ 465 */
466extern void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state); 466void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state);
467extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state); 467void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
468 468
469 469
470/* 470/*
@@ -490,15 +490,14 @@ extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
490 * send diagnostics information that a device-specific diagnostics 490 * send diagnostics information that a device-specific diagnostics
491 * tool would be interested in. 491 * tool would be interested in.
492 */ 492 */
493extern struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *, 493struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *, const void *,
494 const void *, size_t, gfp_t); 494 size_t, gfp_t);
495extern int wimax_msg_send(struct wimax_dev *, struct sk_buff *); 495int wimax_msg_send(struct wimax_dev *, struct sk_buff *);
496extern int wimax_msg(struct wimax_dev *, const char *, 496int wimax_msg(struct wimax_dev *, const char *, const void *, size_t, gfp_t);
497 const void *, size_t, gfp_t);
498 497
499extern const void *wimax_msg_data_len(struct sk_buff *, size_t *); 498const void *wimax_msg_data_len(struct sk_buff *, size_t *);
500extern const void *wimax_msg_data(struct sk_buff *); 499const void *wimax_msg_data(struct sk_buff *);
501extern ssize_t wimax_msg_len(struct sk_buff *); 500ssize_t wimax_msg_len(struct sk_buff *);
502 501
503 502
504/* 503/*
@@ -513,7 +512,7 @@ extern ssize_t wimax_msg_len(struct sk_buff *);
513 * device's control structure and (as such) the 'struct wimax_dev' is 512 * device's control structure and (as such) the 'struct wimax_dev' is
514 * referenced by the caller. 513 * referenced by the caller.
515 */ 514 */
516extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state); 515int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state);
517extern int wimax_reset(struct wimax_dev *); 516int wimax_reset(struct wimax_dev *);
518 517
519#endif /* #ifndef __NET__WIMAX_H__ */ 518#endif /* #ifndef __NET__WIMAX_H__ */
diff --git a/include/net/x25.h b/include/net/x25.h
index b4a8a8923128..c383aa4edbf0 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -187,57 +187,57 @@ extern int sysctl_x25_clear_request_timeout;
187extern int sysctl_x25_ack_holdback_timeout; 187extern int sysctl_x25_ack_holdback_timeout;
188extern int sysctl_x25_forward; 188extern int sysctl_x25_forward;
189 189
190extern int x25_parse_address_block(struct sk_buff *skb, 190int x25_parse_address_block(struct sk_buff *skb,
191 struct x25_address *called_addr, 191 struct x25_address *called_addr,
192 struct x25_address *calling_addr); 192 struct x25_address *calling_addr);
193 193
194extern int x25_addr_ntoa(unsigned char *, struct x25_address *, 194int x25_addr_ntoa(unsigned char *, struct x25_address *, struct x25_address *);
195 struct x25_address *); 195int x25_addr_aton(unsigned char *, struct x25_address *, struct x25_address *);
196extern int x25_addr_aton(unsigned char *, struct x25_address *, 196struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
197 struct x25_address *); 197void x25_destroy_socket_from_timer(struct sock *);
198extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); 198int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
199extern void x25_destroy_socket_from_timer(struct sock *); 199void x25_kill_by_neigh(struct x25_neigh *);
200extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
201extern void x25_kill_by_neigh(struct x25_neigh *);
202 200
203/* x25_dev.c */ 201/* x25_dev.c */
204extern void x25_send_frame(struct sk_buff *, struct x25_neigh *); 202void x25_send_frame(struct sk_buff *, struct x25_neigh *);
205extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); 203int x25_lapb_receive_frame(struct sk_buff *, struct net_device *,
206extern void x25_establish_link(struct x25_neigh *); 204 struct packet_type *, struct net_device *);
207extern void x25_terminate_link(struct x25_neigh *); 205void x25_establish_link(struct x25_neigh *);
206void x25_terminate_link(struct x25_neigh *);
208 207
209/* x25_facilities.c */ 208/* x25_facilities.c */
210extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, 209int x25_parse_facilities(struct sk_buff *, struct x25_facilities *,
211 struct x25_dte_facilities *, unsigned long *); 210 struct x25_dte_facilities *, unsigned long *);
212extern int x25_create_facilities(unsigned char *, struct x25_facilities *, 211int x25_create_facilities(unsigned char *, struct x25_facilities *,
213 struct x25_dte_facilities *, unsigned long); 212 struct x25_dte_facilities *, unsigned long);
214extern int x25_negotiate_facilities(struct sk_buff *, struct sock *, 213int x25_negotiate_facilities(struct sk_buff *, struct sock *,
215 struct x25_facilities *, 214 struct x25_facilities *,
216 struct x25_dte_facilities *); 215 struct x25_dte_facilities *);
217extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); 216void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
218 217
219/* x25_forward.c */ 218/* x25_forward.c */
220extern void x25_clear_forward_by_lci(unsigned int lci); 219void x25_clear_forward_by_lci(unsigned int lci);
221extern void x25_clear_forward_by_dev(struct net_device *); 220void x25_clear_forward_by_dev(struct net_device *);
222extern int x25_forward_data(int, struct x25_neigh *, struct sk_buff *); 221int x25_forward_data(int, struct x25_neigh *, struct sk_buff *);
223extern int x25_forward_call(struct x25_address *, struct x25_neigh *, 222int x25_forward_call(struct x25_address *, struct x25_neigh *, struct sk_buff *,
224 struct sk_buff *, int); 223 int);
225 224
226/* x25_in.c */ 225/* x25_in.c */
227extern int x25_process_rx_frame(struct sock *, struct sk_buff *); 226int x25_process_rx_frame(struct sock *, struct sk_buff *);
228extern int x25_backlog_rcv(struct sock *, struct sk_buff *); 227int x25_backlog_rcv(struct sock *, struct sk_buff *);
229 228
230/* x25_link.c */ 229/* x25_link.c */
231extern void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short); 230void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short);
232extern void x25_link_device_up(struct net_device *); 231void x25_link_device_up(struct net_device *);
233extern void x25_link_device_down(struct net_device *); 232void x25_link_device_down(struct net_device *);
234extern void x25_link_established(struct x25_neigh *); 233void x25_link_established(struct x25_neigh *);
235extern void x25_link_terminated(struct x25_neigh *); 234void x25_link_terminated(struct x25_neigh *);
236extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char); 235void x25_transmit_clear_request(struct x25_neigh *, unsigned int,
237extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *); 236 unsigned char);
238extern int x25_subscr_ioctl(unsigned int, void __user *); 237void x25_transmit_link(struct sk_buff *, struct x25_neigh *);
239extern struct x25_neigh *x25_get_neigh(struct net_device *); 238int x25_subscr_ioctl(unsigned int, void __user *);
240extern void x25_link_free(void); 239struct x25_neigh *x25_get_neigh(struct net_device *);
240void x25_link_free(void);
241 241
242/* x25_neigh.c */ 242/* x25_neigh.c */
243static __inline__ void x25_neigh_hold(struct x25_neigh *nb) 243static __inline__ void x25_neigh_hold(struct x25_neigh *nb)
@@ -252,16 +252,16 @@ static __inline__ void x25_neigh_put(struct x25_neigh *nb)
252} 252}
253 253
254/* x25_out.c */ 254/* x25_out.c */
255extern int x25_output(struct sock *, struct sk_buff *); 255int x25_output(struct sock *, struct sk_buff *);
256extern void x25_kick(struct sock *); 256void x25_kick(struct sock *);
257extern void x25_enquiry_response(struct sock *); 257void x25_enquiry_response(struct sock *);
258 258
259/* x25_route.c */ 259/* x25_route.c */
260extern struct x25_route *x25_get_route(struct x25_address *addr); 260struct x25_route *x25_get_route(struct x25_address *addr);
261extern struct net_device *x25_dev_get(char *); 261struct net_device *x25_dev_get(char *);
262extern void x25_route_device_down(struct net_device *dev); 262void x25_route_device_down(struct net_device *dev);
263extern int x25_route_ioctl(unsigned int, void __user *); 263int x25_route_ioctl(unsigned int, void __user *);
264extern void x25_route_free(void); 264void x25_route_free(void);
265 265
266static __inline__ void x25_route_hold(struct x25_route *rt) 266static __inline__ void x25_route_hold(struct x25_route *rt)
267{ 267{
@@ -275,30 +275,31 @@ static __inline__ void x25_route_put(struct x25_route *rt)
275} 275}
276 276
277/* x25_subr.c */ 277/* x25_subr.c */
278extern void x25_clear_queues(struct sock *); 278void x25_clear_queues(struct sock *);
279extern void x25_frames_acked(struct sock *, unsigned short); 279void x25_frames_acked(struct sock *, unsigned short);
280extern void x25_requeue_frames(struct sock *); 280void x25_requeue_frames(struct sock *);
281extern int x25_validate_nr(struct sock *, unsigned short); 281int x25_validate_nr(struct sock *, unsigned short);
282extern void x25_write_internal(struct sock *, int); 282void x25_write_internal(struct sock *, int);
283extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); 283int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *,
284extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); 284 int *);
285void x25_disconnect(struct sock *, int, unsigned char, unsigned char);
285 286
286/* x25_timer.c */ 287/* x25_timer.c */
287extern void x25_init_timers(struct sock *sk); 288void x25_init_timers(struct sock *sk);
288extern void x25_start_heartbeat(struct sock *); 289void x25_start_heartbeat(struct sock *);
289extern void x25_start_t2timer(struct sock *); 290void x25_start_t2timer(struct sock *);
290extern void x25_start_t21timer(struct sock *); 291void x25_start_t21timer(struct sock *);
291extern void x25_start_t22timer(struct sock *); 292void x25_start_t22timer(struct sock *);
292extern void x25_start_t23timer(struct sock *); 293void x25_start_t23timer(struct sock *);
293extern void x25_stop_heartbeat(struct sock *); 294void x25_stop_heartbeat(struct sock *);
294extern void x25_stop_timer(struct sock *); 295void x25_stop_timer(struct sock *);
295extern unsigned long x25_display_timer(struct sock *); 296unsigned long x25_display_timer(struct sock *);
296extern void x25_check_rbuf(struct sock *); 297void x25_check_rbuf(struct sock *);
297 298
298/* sysctl_net_x25.c */ 299/* sysctl_net_x25.c */
299#ifdef CONFIG_SYSCTL 300#ifdef CONFIG_SYSCTL
300extern void x25_register_sysctl(void); 301void x25_register_sysctl(void);
301extern void x25_unregister_sysctl(void); 302void x25_unregister_sysctl(void);
302#else 303#else
303static inline void x25_register_sysctl(void) {}; 304static inline void x25_register_sysctl(void) {};
304static inline void x25_unregister_sysctl(void) {}; 305static inline void x25_unregister_sysctl(void) {};
@@ -318,6 +319,6 @@ extern rwlock_t x25_forward_list_lock;
318extern struct list_head x25_neigh_list; 319extern struct list_head x25_neigh_list;
319extern rwlock_t x25_neigh_list_lock; 320extern rwlock_t x25_neigh_list_lock;
320 321
321extern int x25_proc_init(void); 322int x25_proc_init(void);
322extern void x25_proc_exit(void); 323void x25_proc_exit(void);
323#endif 324#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e253bf0cc7ef..6b82fdf4ba71 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -307,15 +307,17 @@ struct xfrm_policy_afinfo {
307 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig); 307 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig);
308}; 308};
309 309
310extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 310int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
311extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 311int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
312extern void km_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c); 312void km_policy_notify(struct xfrm_policy *xp, int dir,
313extern void km_state_notify(struct xfrm_state *x, const struct km_event *c); 313 const struct km_event *c);
314void km_state_notify(struct xfrm_state *x, const struct km_event *c);
314 315
315struct xfrm_tmpl; 316struct xfrm_tmpl;
316extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 317int km_query(struct xfrm_state *x, struct xfrm_tmpl *t,
317extern void km_state_expired(struct xfrm_state *x, int hard, u32 portid); 318 struct xfrm_policy *pol);
318extern int __xfrm_state_delete(struct xfrm_state *x); 319void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
320int __xfrm_state_delete(struct xfrm_state *x);
319 321
320struct xfrm_state_afinfo { 322struct xfrm_state_afinfo {
321 unsigned int family; 323 unsigned int family;
@@ -344,12 +346,12 @@ struct xfrm_state_afinfo {
344 void (*local_error)(struct sk_buff *skb, u32 mtu); 346 void (*local_error)(struct sk_buff *skb, u32 mtu);
345}; 347};
346 348
347extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 349int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
348extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); 350int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
349extern struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 351struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
350extern void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 352void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
351 353
352extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 354void xfrm_state_delete_tunnel(struct xfrm_state *x);
353 355
354struct xfrm_type { 356struct xfrm_type {
355 char *description; 357 char *description;
@@ -372,8 +374,8 @@ struct xfrm_type {
372 u32 (*get_mtu)(struct xfrm_state *, int size); 374 u32 (*get_mtu)(struct xfrm_state *, int size);
373}; 375};
374 376
375extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family); 377int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
376extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family); 378int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
377 379
378struct xfrm_mode { 380struct xfrm_mode {
379 /* 381 /*
@@ -434,8 +436,8 @@ enum {
434 XFRM_MODE_FLAG_TUNNEL = 1, 436 XFRM_MODE_FLAG_TUNNEL = 1,
435}; 437};
436 438
437extern int xfrm_register_mode(struct xfrm_mode *mode, int family); 439int xfrm_register_mode(struct xfrm_mode *mode, int family);
438extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); 440int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
439 441
440static inline int xfrm_af2proto(unsigned int family) 442static inline int xfrm_af2proto(unsigned int family)
441{ 443{
@@ -595,8 +597,8 @@ struct xfrm_mgr {
595 const struct xfrm_kmaddress *k); 597 const struct xfrm_kmaddress *k);
596}; 598};
597 599
598extern int xfrm_register_km(struct xfrm_mgr *km); 600int xfrm_register_km(struct xfrm_mgr *km);
599extern int xfrm_unregister_km(struct xfrm_mgr *km); 601int xfrm_unregister_km(struct xfrm_mgr *km);
600 602
601/* 603/*
602 * This structure is used for the duration where packets are being 604 * This structure is used for the duration where packets are being
@@ -713,23 +715,23 @@ static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
713 audit_log_task_context(audit_buf); 715 audit_log_task_context(audit_buf);
714} 716}
715 717
716extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 718void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid,
717 kuid_t auid, u32 ses, u32 secid); 719 u32 ses, u32 secid);
718extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 720void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
719 kuid_t auid, u32 ses, u32 secid); 721 u32 ses, u32 secid);
720extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 722void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
721 kuid_t auid, u32 ses, u32 secid); 723 u32 ses, u32 secid);
722extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 724void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
723 kuid_t auid, u32 ses, u32 secid); 725 u32 ses, u32 secid);
724extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 726void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
725 struct sk_buff *skb); 727 struct sk_buff *skb);
726extern void xfrm_audit_state_replay(struct xfrm_state *x, 728void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
727 struct sk_buff *skb, __be32 net_seq); 729 __be32 net_seq);
728extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); 730void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family);
729extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, 731void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, __be32 net_spi,
730 __be32 net_spi, __be32 net_seq); 732 __be32 net_seq);
731extern void xfrm_audit_state_icvfail(struct xfrm_state *x, 733void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
732 struct sk_buff *skb, u8 proto); 734 u8 proto);
733#else 735#else
734 736
735static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 737static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
@@ -784,7 +786,7 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy)
784 atomic_inc(&policy->refcnt); 786 atomic_inc(&policy->refcnt);
785} 787}
786 788
787extern void xfrm_policy_destroy(struct xfrm_policy *policy); 789void xfrm_policy_destroy(struct xfrm_policy *policy);
788 790
789static inline void xfrm_pol_put(struct xfrm_policy *policy) 791static inline void xfrm_pol_put(struct xfrm_policy *policy)
790{ 792{
@@ -799,7 +801,7 @@ static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
799 xfrm_pol_put(pols[i]); 801 xfrm_pol_put(pols[i]);
800} 802}
801 803
802extern void __xfrm_state_destroy(struct xfrm_state *); 804void __xfrm_state_destroy(struct xfrm_state *);
803 805
804static inline void __xfrm_state_put(struct xfrm_state *x) 806static inline void __xfrm_state_put(struct xfrm_state *x)
805{ 807{
@@ -903,9 +905,8 @@ __be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
903 return port; 905 return port;
904} 906}
905 907
906extern bool xfrm_selector_match(const struct xfrm_selector *sel, 908bool xfrm_selector_match(const struct xfrm_selector *sel,
907 const struct flowi *fl, 909 const struct flowi *fl, unsigned short family);
908 unsigned short family);
909 910
910#ifdef CONFIG_SECURITY_NETWORK_XFRM 911#ifdef CONFIG_SECURITY_NETWORK_XFRM
911/* If neither has a context --> match 912/* If neither has a context --> match
@@ -975,7 +976,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
975} 976}
976#endif 977#endif
977 978
978extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 979void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
979 980
980struct sec_path { 981struct sec_path {
981 atomic_t refcnt; 982 atomic_t refcnt;
@@ -1000,7 +1001,7 @@ secpath_get(struct sec_path *sp)
1000 return sp; 1001 return sp;
1001} 1002}
1002 1003
1003extern void __secpath_destroy(struct sec_path *sp); 1004void __secpath_destroy(struct sec_path *sp);
1004 1005
1005static inline void 1006static inline void
1006secpath_put(struct sec_path *sp) 1007secpath_put(struct sec_path *sp)
@@ -1009,7 +1010,7 @@ secpath_put(struct sec_path *sp)
1009 __secpath_destroy(sp); 1010 __secpath_destroy(sp);
1010} 1011}
1011 1012
1012extern struct sec_path *secpath_dup(struct sec_path *src); 1013struct sec_path *secpath_dup(struct sec_path *src);
1013 1014
1014static inline void 1015static inline void
1015secpath_reset(struct sk_buff *skb) 1016secpath_reset(struct sk_buff *skb)
@@ -1059,7 +1060,8 @@ xfrm_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, un
1059} 1060}
1060 1061
1061#ifdef CONFIG_XFRM 1062#ifdef CONFIG_XFRM
1062extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); 1063int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb,
1064 unsigned short family);
1063 1065
1064static inline int __xfrm_policy_check2(struct sock *sk, int dir, 1066static inline int __xfrm_policy_check2(struct sock *sk, int dir,
1065 struct sk_buff *skb, 1067 struct sk_buff *skb,
@@ -1103,8 +1105,8 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
1103 return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1); 1105 return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1);
1104} 1106}
1105 1107
1106extern int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, 1108int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1107 unsigned int family, int reverse); 1109 unsigned int family, int reverse);
1108 1110
1109static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, 1111static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1110 unsigned int family) 1112 unsigned int family)
@@ -1119,7 +1121,7 @@ static inline int xfrm_decode_session_reverse(struct sk_buff *skb,
1119 return __xfrm_decode_session(skb, fl, family, 1); 1121 return __xfrm_decode_session(skb, fl, family, 1);
1120} 1122}
1121 1123
1122extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); 1124int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
1123 1125
1124static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 1126static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1125{ 1127{
@@ -1140,7 +1142,7 @@ static inline int xfrm6_route_forward(struct sk_buff *skb)
1140 return xfrm_route_forward(skb, AF_INET6); 1142 return xfrm_route_forward(skb, AF_INET6);
1141} 1143}
1142 1144
1143extern int __xfrm_sk_clone_policy(struct sock *sk); 1145int __xfrm_sk_clone_policy(struct sock *sk);
1144 1146
1145static inline int xfrm_sk_clone_policy(struct sock *sk) 1147static inline int xfrm_sk_clone_policy(struct sock *sk)
1146{ 1148{
@@ -1149,7 +1151,7 @@ static inline int xfrm_sk_clone_policy(struct sock *sk)
1149 return 0; 1151 return 0;
1150} 1152}
1151 1153
1152extern int xfrm_policy_delete(struct xfrm_policy *pol, int dir); 1154int xfrm_policy_delete(struct xfrm_policy *pol, int dir);
1153 1155
1154static inline void xfrm_sk_free_policy(struct sock *sk) 1156static inline void xfrm_sk_free_policy(struct sock *sk)
1155{ 1157{
@@ -1163,7 +1165,7 @@ static inline void xfrm_sk_free_policy(struct sock *sk)
1163 } 1165 }
1164} 1166}
1165 1167
1166extern void xfrm_garbage_collect(struct net *net); 1168void xfrm_garbage_collect(struct net *net);
1167 1169
1168#else 1170#else
1169 1171
@@ -1355,6 +1357,12 @@ struct xfrm_tunnel {
1355 int priority; 1357 int priority;
1356}; 1358};
1357 1359
1360struct xfrm_tunnel_notifier {
1361 int (*handler)(struct sk_buff *skb);
1362 struct xfrm_tunnel_notifier __rcu *next;
1363 int priority;
1364};
1365
1358struct xfrm6_tunnel { 1366struct xfrm6_tunnel {
1359 int (*handler)(struct sk_buff *skb); 1367 int (*handler)(struct sk_buff *skb);
1360 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 1368 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
@@ -1363,16 +1371,16 @@ struct xfrm6_tunnel {
1363 int priority; 1371 int priority;
1364}; 1372};
1365 1373
1366extern void xfrm_init(void); 1374void xfrm_init(void);
1367extern void xfrm4_init(void); 1375void xfrm4_init(void);
1368extern int xfrm_state_init(struct net *net); 1376int xfrm_state_init(struct net *net);
1369extern void xfrm_state_fini(struct net *net); 1377void xfrm_state_fini(struct net *net);
1370extern void xfrm4_state_init(void); 1378void xfrm4_state_init(void);
1371#ifdef CONFIG_XFRM 1379#ifdef CONFIG_XFRM
1372extern int xfrm6_init(void); 1380int xfrm6_init(void);
1373extern void xfrm6_fini(void); 1381void xfrm6_fini(void);
1374extern int xfrm6_state_init(void); 1382int xfrm6_state_init(void);
1375extern void xfrm6_state_fini(void); 1383void xfrm6_state_fini(void);
1376#else 1384#else
1377static inline int xfrm6_init(void) 1385static inline int xfrm6_init(void)
1378{ 1386{
@@ -1385,52 +1393,52 @@ static inline void xfrm6_fini(void)
1385#endif 1393#endif
1386 1394
1387#ifdef CONFIG_XFRM_STATISTICS 1395#ifdef CONFIG_XFRM_STATISTICS
1388extern int xfrm_proc_init(struct net *net); 1396int xfrm_proc_init(struct net *net);
1389extern void xfrm_proc_fini(struct net *net); 1397void xfrm_proc_fini(struct net *net);
1390#endif 1398#endif
1391 1399
1392extern int xfrm_sysctl_init(struct net *net); 1400int xfrm_sysctl_init(struct net *net);
1393#ifdef CONFIG_SYSCTL 1401#ifdef CONFIG_SYSCTL
1394extern void xfrm_sysctl_fini(struct net *net); 1402void xfrm_sysctl_fini(struct net *net);
1395#else 1403#else
1396static inline void xfrm_sysctl_fini(struct net *net) 1404static inline void xfrm_sysctl_fini(struct net *net)
1397{ 1405{
1398} 1406}
1399#endif 1407#endif
1400 1408
1401extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1409void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1402extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1410int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1403 int (*func)(struct xfrm_state *, int, void*), void *); 1411 int (*func)(struct xfrm_state *, int, void*), void *);
1404extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1412void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1405extern struct xfrm_state *xfrm_state_alloc(struct net *net); 1413struct xfrm_state *xfrm_state_alloc(struct net *net);
1406extern struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr, 1414struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr,
1407 const xfrm_address_t *saddr, 1415 const xfrm_address_t *saddr,
1408 const struct flowi *fl, 1416 const struct flowi *fl,
1409 struct xfrm_tmpl *tmpl, 1417 struct xfrm_tmpl *tmpl,
1410 struct xfrm_policy *pol, int *err, 1418 struct xfrm_policy *pol, int *err,
1411 unsigned short family); 1419 unsigned short family);
1412extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, 1420struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
1413 xfrm_address_t *daddr, 1421 xfrm_address_t *daddr,
1414 xfrm_address_t *saddr, 1422 xfrm_address_t *saddr,
1415 unsigned short family, 1423 unsigned short family,
1416 u8 mode, u8 proto, u32 reqid); 1424 u8 mode, u8 proto, u32 reqid);
1417extern int xfrm_state_check_expire(struct xfrm_state *x); 1425int xfrm_state_check_expire(struct xfrm_state *x);
1418extern void xfrm_state_insert(struct xfrm_state *x); 1426void xfrm_state_insert(struct xfrm_state *x);
1419extern int xfrm_state_add(struct xfrm_state *x); 1427int xfrm_state_add(struct xfrm_state *x);
1420extern int xfrm_state_update(struct xfrm_state *x); 1428int xfrm_state_update(struct xfrm_state *x);
1421extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, 1429struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1422 const xfrm_address_t *daddr, __be32 spi, 1430 const xfrm_address_t *daddr, __be32 spi,
1423 u8 proto, unsigned short family); 1431 u8 proto, unsigned short family);
1424extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, 1432struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1425 const xfrm_address_t *daddr, 1433 const xfrm_address_t *daddr,
1426 const xfrm_address_t *saddr, 1434 const xfrm_address_t *saddr,
1427 u8 proto, 1435 u8 proto,
1428 unsigned short family); 1436 unsigned short family);
1429#ifdef CONFIG_XFRM_SUB_POLICY 1437#ifdef CONFIG_XFRM_SUB_POLICY
1430extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1438int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
1431 int n, unsigned short family); 1439 unsigned short family);
1432extern int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, 1440int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1433 int n, unsigned short family); 1441 unsigned short family);
1434#else 1442#else
1435static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1443static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1436 int n, unsigned short family) 1444 int n, unsigned short family)
@@ -1462,68 +1470,69 @@ struct xfrmk_spdinfo {
1462 u32 spdhmcnt; 1470 u32 spdhmcnt;
1463}; 1471};
1464 1472
1465extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, 1473struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq);
1466 u32 seq); 1474int xfrm_state_delete(struct xfrm_state *x);
1467extern int xfrm_state_delete(struct xfrm_state *x); 1475int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1468extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1476void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1469extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1477void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1470extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1478u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
1471extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); 1479int xfrm_init_replay(struct xfrm_state *x);
1472extern int xfrm_init_replay(struct xfrm_state *x); 1480int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1473extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1481int __xfrm_init_state(struct xfrm_state *x, bool init_replay);
1474extern int __xfrm_init_state(struct xfrm_state *x, bool init_replay); 1482int xfrm_init_state(struct xfrm_state *x);
1475extern int xfrm_init_state(struct xfrm_state *x); 1483int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
1476extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); 1484int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
1477extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, 1485int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
1478 int encap_type); 1486int xfrm_output_resume(struct sk_buff *skb, int err);
1479extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); 1487int xfrm_output(struct sk_buff *skb);
1480extern int xfrm_output_resume(struct sk_buff *skb, int err); 1488int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1481extern int xfrm_output(struct sk_buff *skb); 1489void xfrm_local_error(struct sk_buff *skb, int mtu);
1482extern int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1490int xfrm4_extract_header(struct sk_buff *skb);
1483extern void xfrm_local_error(struct sk_buff *skb, int mtu); 1491int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1484extern int xfrm4_extract_header(struct sk_buff *skb); 1492int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1485extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1493 int encap_type);
1486extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, 1494int xfrm4_transport_finish(struct sk_buff *skb, int async);
1487 int encap_type); 1495int xfrm4_rcv(struct sk_buff *skb);
1488extern int xfrm4_transport_finish(struct sk_buff *skb, int async);
1489extern int xfrm4_rcv(struct sk_buff *skb);
1490 1496
1491static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1497static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1492{ 1498{
1493 return xfrm4_rcv_encap(skb, nexthdr, spi, 0); 1499 return xfrm4_rcv_encap(skb, nexthdr, spi, 0);
1494} 1500}
1495 1501
1496extern int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1502int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1497extern int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1503int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1498extern int xfrm4_output(struct sk_buff *skb); 1504int xfrm4_output(struct sk_buff *skb);
1499extern int xfrm4_output_finish(struct sk_buff *skb); 1505int xfrm4_output_finish(struct sk_buff *skb);
1500extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1506int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1501extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1507int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1502extern int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel *handler); 1508void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1503extern int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel *handler); 1509int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1504extern void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1510int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1505extern int xfrm6_extract_header(struct sk_buff *skb); 1511int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1506extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1512int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1507extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1513int xfrm6_extract_header(struct sk_buff *skb);
1508extern int xfrm6_transport_finish(struct sk_buff *skb, int async); 1514int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1509extern int xfrm6_rcv(struct sk_buff *skb); 1515int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
1510extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1516int xfrm6_transport_finish(struct sk_buff *skb, int async);
1511 xfrm_address_t *saddr, u8 proto); 1517int xfrm6_rcv(struct sk_buff *skb);
1512extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1518int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1513extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1519 xfrm_address_t *saddr, u8 proto);
1514extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1520void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1515extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); 1521int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1516extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1522int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1517extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1523__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1518extern int xfrm6_output(struct sk_buff *skb); 1524__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1519extern int xfrm6_output_finish(struct sk_buff *skb); 1525int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1520extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 1526int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1521 u8 **prevhdr); 1527int xfrm6_output(struct sk_buff *skb);
1522extern void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1528int xfrm6_output_finish(struct sk_buff *skb);
1529int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1530 u8 **prevhdr);
1523 1531
1524#ifdef CONFIG_XFRM 1532#ifdef CONFIG_XFRM
1525extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); 1533int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1526extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); 1534int xfrm_user_policy(struct sock *sk, int optname,
1535 u8 __user *optval, int optlen);
1527#else 1536#else
1528static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) 1537static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
1529{ 1538{
@@ -1540,59 +1549,62 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1540 1549
1541struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp); 1550struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
1542 1551
1543extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); 1552void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1544extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, 1553int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1545 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1554 int (*func)(struct xfrm_policy *, int, int, void*),
1546extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1555 void *);
1556void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1547int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1557int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1548struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, 1558struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1549 u8 type, int dir, 1559 u8 type, int dir,
1550 struct xfrm_selector *sel, 1560 struct xfrm_selector *sel,
1551 struct xfrm_sec_ctx *ctx, int delete, 1561 struct xfrm_sec_ctx *ctx, int delete,
1552 int *err); 1562 int *err);
1553struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err); 1563struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1564 u32 id, int delete, int *err);
1554int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1565int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1555u32 xfrm_get_acqseq(void); 1566u32 xfrm_get_acqseq(void);
1556extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1567int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1557struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark, 1568struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark,
1558 u8 mode, u32 reqid, u8 proto, 1569 u8 mode, u32 reqid, u8 proto,
1559 const xfrm_address_t *daddr, 1570 const xfrm_address_t *daddr,
1560 const xfrm_address_t *saddr, int create, 1571 const xfrm_address_t *saddr, int create,
1561 unsigned short family); 1572 unsigned short family);
1562extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1573int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1563 1574
1564#ifdef CONFIG_XFRM_MIGRATE 1575#ifdef CONFIG_XFRM_MIGRATE
1565extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1576int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1566 const struct xfrm_migrate *m, int num_bundles, 1577 const struct xfrm_migrate *m, int num_bundles,
1567 const struct xfrm_kmaddress *k); 1578 const struct xfrm_kmaddress *k);
1568extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1579struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m);
1569extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1580struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
1570 struct xfrm_migrate *m); 1581 struct xfrm_migrate *m);
1571extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1582int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1572 struct xfrm_migrate *m, int num_bundles, 1583 struct xfrm_migrate *m, int num_bundles,
1573 struct xfrm_kmaddress *k); 1584 struct xfrm_kmaddress *k);
1574#endif 1585#endif
1575 1586
1576extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1587int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1577extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid); 1588void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid);
1578extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1589int km_report(struct net *net, u8 proto, struct xfrm_selector *sel,
1579 1590 xfrm_address_t *addr);
1580extern void xfrm_input_init(void); 1591
1581extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1592void xfrm_input_init(void);
1582 1593int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
1583extern void xfrm_probe_algs(void); 1594
1584extern int xfrm_count_pfkey_auth_supported(void); 1595void xfrm_probe_algs(void);
1585extern int xfrm_count_pfkey_enc_supported(void); 1596int xfrm_count_pfkey_auth_supported(void);
1586extern struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx); 1597int xfrm_count_pfkey_enc_supported(void);
1587extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx); 1598struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx);
1588extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); 1599struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx);
1589extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); 1600struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id);
1590extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); 1601struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id);
1591extern struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe); 1602struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1592extern struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe); 1603struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe);
1593extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe); 1604struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe);
1594extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1605struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1595 int probe); 1606struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1607 int probe);
1596 1608
1597static inline bool xfrm6_addr_equal(const xfrm_address_t *a, 1609static inline bool xfrm6_addr_equal(const xfrm_address_t *a,
1598 const xfrm_address_t *b) 1610 const xfrm_address_t *b)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index e393171e2fac..979874c627ee 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -67,12 +67,14 @@ enum rdma_node_type {
67 RDMA_NODE_IB_CA = 1, 67 RDMA_NODE_IB_CA = 1,
68 RDMA_NODE_IB_SWITCH, 68 RDMA_NODE_IB_SWITCH,
69 RDMA_NODE_IB_ROUTER, 69 RDMA_NODE_IB_ROUTER,
70 RDMA_NODE_RNIC 70 RDMA_NODE_RNIC,
71 RDMA_NODE_USNIC,
71}; 72};
72 73
73enum rdma_transport_type { 74enum rdma_transport_type {
74 RDMA_TRANSPORT_IB, 75 RDMA_TRANSPORT_IB,
75 RDMA_TRANSPORT_IWARP 76 RDMA_TRANSPORT_IWARP,
77 RDMA_TRANSPORT_USNIC
76}; 78};
77 79
78enum rdma_transport_type 80enum rdma_transport_type
@@ -1436,6 +1438,7 @@ struct ib_device {
1436 1438
1437 int uverbs_abi_ver; 1439 int uverbs_abi_ver;
1438 u64 uverbs_cmd_mask; 1440 u64 uverbs_cmd_mask;
1441 u64 uverbs_ex_cmd_mask;
1439 1442
1440 char node_desc[64]; 1443 char node_desc[64];
1441 __be64 node_guid; 1444 __be64 node_guid;
@@ -2384,4 +2387,17 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
2384 struct ib_flow_attr *flow_attr, int domain); 2387 struct ib_flow_attr *flow_attr, int domain);
2385int ib_destroy_flow(struct ib_flow *flow_id); 2388int ib_destroy_flow(struct ib_flow *flow_id);
2386 2389
2390static inline int ib_check_mr_access(int flags)
2391{
2392 /*
2393 * Local write permission is required if remote write or
2394 * remote atomic permission is also requested.
2395 */
2396 if (flags & (IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_REMOTE_WRITE) &&
2397 !(flags & IB_ACCESS_LOCAL_WRITE))
2398 return -EINVAL;
2399
2400 return 0;
2401}
2402
2387#endif /* IB_VERBS_H */ 2403#endif /* IB_VERBS_H */
diff --git a/include/scsi/fc/fc_fc2.h b/include/scsi/fc/fc_fc2.h
index f87777d0d5bd..0b2671431305 100644
--- a/include/scsi/fc/fc_fc2.h
+++ b/include/scsi/fc/fc_fc2.h
@@ -104,7 +104,7 @@ struct fc_esb {
104 * esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90. 104 * esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.
105 */ 105 */
106#define ESB_ST_RESP (1 << 31) /* responder to exchange */ 106#define ESB_ST_RESP (1 << 31) /* responder to exchange */
107#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiaive */ 107#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiative */
108#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */ 108#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */
109#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */ 109#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */
110#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */ 110#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 13d81c5c4ebf..5d6ed6cf12cc 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -69,6 +69,7 @@ enum iscsi_uevent_e {
69 ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28, 69 ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28,
70 ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29, 70 ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
71 ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30, 71 ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
72 ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31,
72 73
73 /* up events */ 74 /* up events */
74 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 75 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -309,8 +310,16 @@ enum iscsi_param_type {
309 ISCSI_HOST_PARAM, /* iscsi_host_param */ 310 ISCSI_HOST_PARAM, /* iscsi_host_param */
310 ISCSI_NET_PARAM, /* iscsi_net_param */ 311 ISCSI_NET_PARAM, /* iscsi_net_param */
311 ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */ 312 ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
313 ISCSI_CHAP_PARAM, /* iscsi_chap_param */
312}; 314};
313 315
316/* structure for minimalist usecase */
317struct iscsi_param_info {
318 uint32_t len; /* Actual length of the param value */
319 uint16_t param; /* iscsi param */
320 uint8_t value[0]; /* length sized value follows */
321} __packed;
322
314struct iscsi_iface_param_info { 323struct iscsi_iface_param_info {
315 uint32_t iface_num; /* iface number, 0 - n */ 324 uint32_t iface_num; /* iface number, 0 - n */
316 uint32_t len; /* Actual length of the param */ 325 uint32_t len; /* Actual length of the param */
@@ -739,6 +748,14 @@ enum chap_type_e {
739 CHAP_TYPE_IN, 748 CHAP_TYPE_IN,
740}; 749};
741 750
751enum iscsi_chap_param {
752 ISCSI_CHAP_PARAM_INDEX,
753 ISCSI_CHAP_PARAM_CHAP_TYPE,
754 ISCSI_CHAP_PARAM_USERNAME,
755 ISCSI_CHAP_PARAM_PASSWORD,
756 ISCSI_CHAP_PARAM_PASSWORD_LEN
757};
758
742#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256 759#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
743#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256 760#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
744struct iscsi_chap_rec { 761struct iscsi_chap_rec {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index e1379b4e8faf..52beadf9a29b 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -410,6 +410,12 @@ struct fc_seq {
410 * @fh_type: The frame type 410 * @fh_type: The frame type
411 * @class: The class of service 411 * @class: The class of service
412 * @seq: The sequence in use on this exchange 412 * @seq: The sequence in use on this exchange
413 * @resp_active: Number of tasks that are concurrently executing @resp().
414 * @resp_task: If @resp_active > 0, either the task executing @resp(), the
415 * task that has been interrupted to execute the soft-IRQ
416 * executing @resp() or NULL if more than one task is executing
417 * @resp concurrently.
418 * @resp_wq: Waitqueue for the tasks waiting on @resp_active.
413 * @resp: Callback for responses on this exchange 419 * @resp: Callback for responses on this exchange
414 * @destructor: Called when destroying the exchange 420 * @destructor: Called when destroying the exchange
415 * @arg: Passed as a void pointer to the resp() callback 421 * @arg: Passed as a void pointer to the resp() callback
@@ -441,6 +447,9 @@ struct fc_exch {
441 u32 r_a_tov; 447 u32 r_a_tov;
442 u32 f_ctl; 448 u32 f_ctl;
443 struct fc_seq seq; 449 struct fc_seq seq;
450 int resp_active;
451 struct task_struct *resp_task;
452 wait_queue_head_t resp_wq;
444 void (*resp)(struct fc_seq *, struct fc_frame *, void *); 453 void (*resp)(struct fc_seq *, struct fc_frame *, void *);
445 void *arg; 454 void *arg;
446 void (*destructor)(struct fc_seq *, void *); 455 void (*destructor)(struct fc_seq *, void *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 4427393115ea..de7e3ee60f0c 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -90,6 +90,7 @@ enum fip_state {
90 * @lp: &fc_lport: libfc local port. 90 * @lp: &fc_lport: libfc local port.
91 * @sel_fcf: currently selected FCF, or NULL. 91 * @sel_fcf: currently selected FCF, or NULL.
92 * @fcfs: list of discovered FCFs. 92 * @fcfs: list of discovered FCFs.
93 * @cdev: (Optional) pointer to sysfs fcoe_ctlr_device.
93 * @fcf_count: number of discovered FCF entries. 94 * @fcf_count: number of discovered FCF entries.
94 * @sol_time: time when a multicast solicitation was last sent. 95 * @sol_time: time when a multicast solicitation was last sent.
95 * @sel_time: time after which to select an FCF. 96 * @sel_time: time after which to select an FCF.
@@ -127,6 +128,7 @@ struct fcoe_ctlr {
127 struct fc_lport *lp; 128 struct fc_lport *lp;
128 struct fcoe_fcf *sel_fcf; 129 struct fcoe_fcf *sel_fcf;
129 struct list_head fcfs; 130 struct list_head fcfs;
131 struct fcoe_ctlr_device *cdev;
130 u16 fcf_count; 132 u16 fcf_count;
131 unsigned long sol_time; 133 unsigned long sol_time;
132 unsigned long sel_time; 134 unsigned long sel_time;
@@ -168,8 +170,11 @@ static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr)
168 return (void *)(ctlr + 1); 170 return (void *)(ctlr + 1);
169} 171}
170 172
173/*
174 * This assumes that the fcoe_ctlr (x) is allocated with the fcoe_ctlr_device.
175 */
171#define fcoe_ctlr_to_ctlr_dev(x) \ 176#define fcoe_ctlr_to_ctlr_dev(x) \
172 (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1) 177 (x)->cdev
173 178
174/** 179/**
175 * struct fcoe_fcf - Fibre-Channel Forwarder 180 * struct fcoe_fcf - Fibre-Channel Forwarder
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index d477bfb73fb9..66d42edfb3fc 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -144,6 +144,7 @@ enum scsi_timeouts {
144#define ACCESS_CONTROL_IN 0x86 144#define ACCESS_CONTROL_IN 0x86
145#define ACCESS_CONTROL_OUT 0x87 145#define ACCESS_CONTROL_OUT 0x87
146#define READ_16 0x88 146#define READ_16 0x88
147#define COMPARE_AND_WRITE 0x89
147#define WRITE_16 0x8a 148#define WRITE_16 0x8a
148#define READ_ATTRIBUTE 0x8c 149#define READ_ATTRIBUTE 0x8c
149#define WRITE_ATTRIBUTE 0x8d 150#define WRITE_ATTRIBUTE 0x8d
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 755243572219..fe3b58e836c8 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -475,6 +475,9 @@ struct scsi_host_template {
475 */ 475 */
476 unsigned ordered_tag:1; 476 unsigned ordered_tag:1;
477 477
478 /* True if the controller does not support WRITE SAME */
479 unsigned no_write_same:1;
480
478 /* 481 /*
479 * Countdown for host blocking with no commands outstanding. 482 * Countdown for host blocking with no commands outstanding.
480 */ 483 */
@@ -598,9 +601,12 @@ struct Scsi_Host {
598 unsigned int host_eh_scheduled; /* EH scheduled without command */ 601 unsigned int host_eh_scheduled; /* EH scheduled without command */
599 602
600 unsigned int host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ 603 unsigned int host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
601 int resetting; /* if set, it means that last_reset is a valid value */ 604
605 /* next two fields are used to bound the time spent in error handling */
606 int eh_deadline;
602 unsigned long last_reset; 607 unsigned long last_reset;
603 608
609
604 /* 610 /*
605 * These three parameters can be used to allow for wide scsi, 611 * These three parameters can be used to allow for wide scsi,
606 * and for host adapters that support multiple busses 612 * and for host adapters that support multiple busses
@@ -674,6 +680,9 @@ struct Scsi_Host {
674 /* Don't resume host in EH */ 680 /* Don't resume host in EH */
675 unsigned eh_noresume:1; 681 unsigned eh_noresume:1;
676 682
683 /* The controller does not support WRITE SAME */
684 unsigned no_write_same:1;
685
677 /* 686 /*
678 * Optional work queue to be utilized by the transport 687 * Optional work queue to be utilized by the transport
679 */ 688 */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index d0f1602985e7..fe7c8f3e93f8 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -152,6 +152,7 @@ struct iscsi_transport {
152 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx, 152 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx,
153 uint32_t *num_entries, char *buf); 153 uint32_t *num_entries, char *buf);
154 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); 154 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx);
155 int (*set_chap) (struct Scsi_Host *shost, void *data, int len);
155 int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, 156 int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess,
156 int param, char *buf); 157 int param, char *buf);
157 int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, 158 int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess,
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
index ff0f04ac91aa..4ebf6913b7b2 100644
--- a/include/scsi/scsi_transport_srp.h
+++ b/include/scsi/scsi_transport_srp.h
@@ -13,6 +13,27 @@ struct srp_rport_identifiers {
13 u8 roles; 13 u8 roles;
14}; 14};
15 15
16/**
17 * enum srp_rport_state - SRP transport layer state
18 * @SRP_RPORT_RUNNING: Transport layer operational.
19 * @SRP_RPORT_BLOCKED: Transport layer not operational; fast I/O fail timer
20 * is running and I/O has been blocked.
21 * @SRP_RPORT_FAIL_FAST: Fast I/O fail timer has expired; fail I/O fast.
22 * @SRP_RPORT_LOST: Device loss timer has expired; port is being removed.
23 */
24enum srp_rport_state {
25 SRP_RPORT_RUNNING,
26 SRP_RPORT_BLOCKED,
27 SRP_RPORT_FAIL_FAST,
28 SRP_RPORT_LOST,
29};
30
31/**
32 * struct srp_rport
33 * @lld_data: LLD private data.
34 * @mutex: Protects against concurrent rport reconnect / fast_io_fail /
35 * dev_loss_tmo activity.
36 */
16struct srp_rport { 37struct srp_rport {
17 /* for initiator and target drivers */ 38 /* for initiator and target drivers */
18 39
@@ -23,11 +44,43 @@ struct srp_rport {
23 44
24 /* for initiator drivers */ 45 /* for initiator drivers */
25 46
26 void *lld_data; /* LLD private data */ 47 void *lld_data;
48
49 struct mutex mutex;
50 enum srp_rport_state state;
51 bool deleted;
52 int reconnect_delay;
53 int failed_reconnects;
54 struct delayed_work reconnect_work;
55 int fast_io_fail_tmo;
56 int dev_loss_tmo;
57 struct delayed_work fast_io_fail_work;
58 struct delayed_work dev_loss_work;
27}; 59};
28 60
61/**
62 * struct srp_function_template
63 * @has_rport_state: Whether or not to create the state, fast_io_fail_tmo and
64 * dev_loss_tmo sysfs attribute for an rport.
65 * @reset_timer_if_blocked: Whether or srp_timed_out() should reset the command
66 * timer if the device on which it has been queued is blocked.
67 * @reconnect_delay: If not NULL, points to the default reconnect_delay value.
68 * @fast_io_fail_tmo: If not NULL, points to the default fast_io_fail_tmo value.
69 * @dev_loss_tmo: If not NULL, points to the default dev_loss_tmo value.
70 * @reconnect: Callback function for reconnecting to the target. See also
71 * srp_reconnect_rport().
72 * @terminate_rport_io: Callback function for terminating all outstanding I/O
73 * requests for an rport.
74 */
29struct srp_function_template { 75struct srp_function_template {
30 /* for initiator drivers */ 76 /* for initiator drivers */
77 bool has_rport_state;
78 bool reset_timer_if_blocked;
79 int *reconnect_delay;
80 int *fast_io_fail_tmo;
81 int *dev_loss_tmo;
82 int (*reconnect)(struct srp_rport *rport);
83 void (*terminate_rport_io)(struct srp_rport *rport);
31 void (*rport_delete)(struct srp_rport *rport); 84 void (*rport_delete)(struct srp_rport *rport);
32 /* for target drivers */ 85 /* for target drivers */
33 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); 86 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
@@ -38,10 +91,36 @@ extern struct scsi_transport_template *
38srp_attach_transport(struct srp_function_template *); 91srp_attach_transport(struct srp_function_template *);
39extern void srp_release_transport(struct scsi_transport_template *); 92extern void srp_release_transport(struct scsi_transport_template *);
40 93
94extern void srp_rport_get(struct srp_rport *rport);
95extern void srp_rport_put(struct srp_rport *rport);
41extern struct srp_rport *srp_rport_add(struct Scsi_Host *, 96extern struct srp_rport *srp_rport_add(struct Scsi_Host *,
42 struct srp_rport_identifiers *); 97 struct srp_rport_identifiers *);
43extern void srp_rport_del(struct srp_rport *); 98extern void srp_rport_del(struct srp_rport *);
44 99extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo,
100 int dev_loss_tmo);
101extern int srp_reconnect_rport(struct srp_rport *rport);
102extern void srp_start_tl_fail_timers(struct srp_rport *rport);
45extern void srp_remove_host(struct Scsi_Host *); 103extern void srp_remove_host(struct Scsi_Host *);
46 104
105/**
106 * srp_chkready() - evaluate the transport layer state before I/O
107 *
108 * Returns a SCSI result code that can be returned by the LLD queuecommand()
109 * implementation. The role of this function is similar to that of
110 * fc_remote_port_chkready().
111 */
112static inline int srp_chkready(struct srp_rport *rport)
113{
114 switch (rport->state) {
115 case SRP_RPORT_RUNNING:
116 case SRP_RPORT_BLOCKED:
117 default:
118 return 0;
119 case SRP_RPORT_FAIL_FAST:
120 return DID_TRANSPORT_FAILFAST << 16;
121 case SRP_RPORT_LOST:
122 return DID_NO_CONNECT << 16;
123 }
124}
125
47#endif 126#endif
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index 3ce69fd92523..52f02a60dba7 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -170,7 +170,7 @@ struct ak4114 {
170 void * private_data; 170 void * private_data;
171 unsigned int init: 1; 171 unsigned int init: 1;
172 spinlock_t lock; 172 spinlock_t lock;
173 unsigned char regmap[7]; 173 unsigned char regmap[6];
174 unsigned char txcsb[5]; 174 unsigned char txcsb[5];
175 struct snd_kcontrol *kctls[AK4114_CONTROLS]; 175 struct snd_kcontrol *kctls[AK4114_CONTROLS];
176 struct snd_pcm_substream *playback_substream; 176 struct snd_pcm_substream *playback_substream;
@@ -189,7 +189,7 @@ struct ak4114 {
189 189
190int snd_ak4114_create(struct snd_card *card, 190int snd_ak4114_create(struct snd_card *card,
191 ak4114_read_t *read, ak4114_write_t *write, 191 ak4114_read_t *read, ak4114_write_t *write,
192 const unsigned char pgm[7], const unsigned char txcsb[5], 192 const unsigned char pgm[6], const unsigned char txcsb[5],
193 void *private_data, struct ak4114 **r_ak4114); 193 void *private_data, struct ak4114 **r_ak4114);
194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val); 194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
195void snd_ak4114_reinit(struct ak4114 *ak4114); 195void snd_ak4114_reinit(struct ak4114 *ak4114);
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 9031a26249b5..ae6c3b8ed2f5 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -171,4 +171,13 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
171 wake_up(&stream->runtime->sleep); 171 wake_up(&stream->runtime->sleep);
172} 172}
173 173
174static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
175{
176 if (snd_BUG_ON(!stream))
177 return;
178
179 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
180 wake_up(&stream->runtime->sleep);
181}
182
174#endif 183#endif
diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
index 4c68955f7330..7c2be4a51894 100644
--- a/include/sound/cs42l52.h
+++ b/include/sound/cs42l52.h
@@ -31,6 +31,8 @@ struct cs42l52_platform_data {
31 /* Charge Pump Freq. Check datasheet Pg73 */ 31 /* Charge Pump Freq. Check datasheet Pg73 */
32 unsigned int chgfreq; 32 unsigned int chgfreq;
33 33
34 /* Reset GPIO */
35 unsigned int reset_gpio;
34}; 36};
35 37
36#endif /* __CS42L52_H */ 38#endif /* __CS42L52_H */
diff --git a/include/sound/cs42l73.h b/include/sound/cs42l73.h
new file mode 100644
index 000000000000..f354be4cdc9e
--- /dev/null
+++ b/include/sound/cs42l73.h
@@ -0,0 +1,22 @@
1/*
2 * linux/sound/cs42l73.h -- Platform data for CS42L73
3 *
4 * Copyright (c) 2012 Cirrus Logic Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __CS42L73_H
12#define __CS42L73_H
13
14struct cs42l73_platform_data {
15 /* RST GPIO */
16 unsigned int reset_gpio;
17 unsigned int chgfreq;
18 int jack_detection;
19 unsigned int mclk_freq;
20};
21
22#endif /* __CS42L73_H */
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index f11c35cd5532..15017311f2e9 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -61,6 +61,8 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream)
61 * @slave_id: Slave requester id for the DMA channel. 61 * @slave_id: Slave requester id for the DMA channel.
62 * @filter_data: Custom DMA channel filter data, this will usually be used when 62 * @filter_data: Custom DMA channel filter data, this will usually be used when
63 * requesting the DMA channel. 63 * requesting the DMA channel.
64 * @chan_name: Custom channel name to use when requesting DMA channel.
65 * @fifo_size: FIFO size of the DAI controller in bytes
64 */ 66 */
65struct snd_dmaengine_dai_dma_data { 67struct snd_dmaengine_dai_dma_data {
66 dma_addr_t addr; 68 dma_addr_t addr;
@@ -68,6 +70,8 @@ struct snd_dmaengine_dai_dma_data {
68 u32 maxburst; 70 u32 maxburst;
69 unsigned int slave_id; 71 unsigned int slave_id;
70 void *filter_data; 72 void *filter_data;
73 const char *chan_name;
74 unsigned int fifo_size;
71}; 75};
72 76
73void snd_dmaengine_pcm_set_config_from_dai_data( 77void snd_dmaengine_pcm_set_config_from_dai_data(
@@ -96,6 +100,10 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
96 * playback. 100 * playback.
97 */ 101 */
98#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3) 102#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3)
103/*
104 * The PCM streams have custom channel names specified.
105 */
106#define SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME BIT(4)
99 107
100/** 108/**
101 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM 109 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index cf15b8213df7..5f73785f5977 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -52,6 +52,11 @@ struct snd_dma_device {
52#else 52#else
53#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ 53#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */
54#endif 54#endif
55#ifdef CONFIG_GENERIC_ALLOCATOR
56#define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */
57#else
58#define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV
59#endif
55 60
56/* 61/*
57 * info for buffer allocation 62 * info for buffer allocation
@@ -103,7 +108,7 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
103{ 108{
104 struct snd_sg_buf *sgbuf = dmab->private_data; 109 struct snd_sg_buf *sgbuf = dmab->private_data;
105 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 110 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
106 addr &= PAGE_MASK; 111 addr &= ~((dma_addr_t)PAGE_SIZE - 1);
107 return addr + offset % PAGE_SIZE; 112 return addr + offset % PAGE_SIZE;
108} 113}
109 114
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index d35412ae03b3..12afab18945d 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -36,7 +36,6 @@
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_CLK_FROM_ADG (1 << 30) /* clock parent is master */ 37#define RSND_SSI_CLK_FROM_ADG (1 << 30) /* clock parent is master */
38#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */ 38#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
39#define RSND_SSI_DEPENDENT (1 << 28) /* SSI needs SRU/SCU */
40 39
41#define RSND_SSI_PLAY (1 << 24) 40#define RSND_SSI_PLAY (1 << 24)
42 41
@@ -55,7 +54,7 @@ struct rsnd_ssi_platform_info {
55/* 54/*
56 * flags 55 * flags
57 */ 56 */
58#define RSND_SCU_USB_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */ 57#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
59 58
60struct rsnd_scu_platform_info { 59struct rsnd_scu_platform_info {
61 u32 flags; 60 u32 flags;
@@ -68,6 +67,7 @@ struct rsnd_scu_platform_info {
68 * 67 *
69 * A : generation 68 * A : generation
70 */ 69 */
70#define RSND_GEN_MASK (0xF << 0)
71#define RSND_GEN1 (1 << 0) /* fixme */ 71#define RSND_GEN1 (1 << 0) /* fixme */
72#define RSND_GEN2 (2 << 0) /* fixme */ 72#define RSND_GEN2 (2 << 0) /* fixme */
73 73
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index ae9a227d35d3..800c101bb096 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -105,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
105int snd_soc_dai_set_pll(struct snd_soc_dai *dai, 105int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
106 int pll_id, int source, unsigned int freq_in, unsigned int freq_out); 106 int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
107 107
108int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
109
108/* Digital Audio interface formatting */ 110/* Digital Audio interface formatting */
109int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); 111int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
110 112
@@ -131,6 +133,7 @@ struct snd_soc_dai_ops {
131 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source, 133 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
132 unsigned int freq_in, unsigned int freq_out); 134 unsigned int freq_in, unsigned int freq_out);
133 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); 135 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
136 int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
134 137
135 /* 138 /*
136 * DAI format configuration 139 * DAI format configuration
@@ -166,6 +169,13 @@ struct snd_soc_dai_ops {
166 struct snd_soc_dai *); 169 struct snd_soc_dai *);
167 int (*prepare)(struct snd_pcm_substream *, 170 int (*prepare)(struct snd_pcm_substream *,
168 struct snd_soc_dai *); 171 struct snd_soc_dai *);
172 /*
173 * NOTE: Commands passed to the trigger function are not necessarily
174 * compatible with the current state of the dai. For example this
175 * sequence of commands is possible: START STOP STOP.
176 * So do not unconditionally use refcounting functions in the trigger
177 * function, e.g. clk_enable/disable.
178 */
169 int (*trigger)(struct snd_pcm_substream *, int, 179 int (*trigger)(struct snd_pcm_substream *, int,
170 struct snd_soc_dai *); 180 struct snd_soc_dai *);
171 int (*bespoke_trigger)(struct snd_pcm_substream *, int, 181 int (*bespoke_trigger)(struct snd_pcm_substream *, int,
@@ -276,6 +286,13 @@ static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
276 dai->capture_dma_data = data; 286 dai->capture_dma_data = data;
277} 287}
278 288
289static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai,
290 void *playback, void *capture)
291{
292 dai->playback_dma_data = playback;
293 dai->capture_dma_data = capture;
294}
295
279static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai, 296static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,
280 void *data) 297 void *data)
281{ 298{
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 27a72d5d4b00..56ebdfca6273 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -104,7 +104,8 @@ struct device;
104 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 104 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
105 .kcontrol_news = wcontrols, .num_kcontrols = 1} 105 .kcontrol_news = wcontrols, .num_kcontrols = 1}
106#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 106#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
107{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, \ 107{ .id = snd_soc_dapm_mux, .name = wname, \
108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
108 .kcontrol_news = wcontrols, .num_kcontrols = 1} 109 .kcontrol_news = wcontrols, .num_kcontrols = 1}
109#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ 110#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
110{ .id = snd_soc_dapm_virt_mux, .name = wname, \ 111{ .id = snd_soc_dapm_virt_mux, .name = wname, \
@@ -286,6 +287,8 @@ struct device;
286 .info = snd_soc_info_volsw, \ 287 .info = snd_soc_info_volsw, \
287 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 288 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
288 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) } 289 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
290#define SOC_DAPM_SINGLE_VIRT(xname, max) \
291 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0)
289#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 292#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
290{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 293{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
291 .info = snd_soc_info_volsw, \ 294 .info = snd_soc_info_volsw, \
@@ -300,6 +303,8 @@ struct device;
300 .tlv.p = (tlv_array), \ 303 .tlv.p = (tlv_array), \
301 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 304 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
302 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 305 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
306#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \
307 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)
303#define SOC_DAPM_ENUM(xname, xenum) \ 308#define SOC_DAPM_ENUM(xname, xenum) \
304{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 309{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
305 .info = snd_soc_info_enum_double, \ 310 .info = snd_soc_info_enum_double, \
diff --git a/include/sound/soc.h b/include/sound/soc.h
index d22cb0a06feb..1f741cb24f33 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -13,6 +13,7 @@
13#ifndef __LINUX_SND_SOC_H 13#ifndef __LINUX_SND_SOC_H
14#define __LINUX_SND_SOC_H 14#define __LINUX_SND_SOC_H
15 15
16#include <linux/of.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/notifier.h> 19#include <linux/notifier.h>
@@ -330,7 +331,6 @@ struct soc_enum;
330struct snd_soc_jack; 331struct snd_soc_jack;
331struct snd_soc_jack_zone; 332struct snd_soc_jack_zone;
332struct snd_soc_jack_pin; 333struct snd_soc_jack_pin;
333struct snd_soc_cache_ops;
334#include <sound/soc-dapm.h> 334#include <sound/soc-dapm.h>
335#include <sound/soc-dpcm.h> 335#include <sound/soc-dpcm.h>
336 336
@@ -348,10 +348,6 @@ enum snd_soc_control_type {
348 SND_SOC_REGMAP, 348 SND_SOC_REGMAP,
349}; 349};
350 350
351enum snd_soc_compress_type {
352 SND_SOC_FLAT_COMPRESSION = 1,
353};
354
355enum snd_soc_pcm_subclass { 351enum snd_soc_pcm_subclass {
356 SND_SOC_PCM_CLASS_PCM = 0, 352 SND_SOC_PCM_CLASS_PCM = 0,
357 SND_SOC_PCM_CLASS_BE = 1, 353 SND_SOC_PCM_CLASS_BE = 1,
@@ -369,6 +365,7 @@ int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
369 365
370int snd_soc_register_card(struct snd_soc_card *card); 366int snd_soc_register_card(struct snd_soc_card *card);
371int snd_soc_unregister_card(struct snd_soc_card *card); 367int snd_soc_unregister_card(struct snd_soc_card *card);
368int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
372int snd_soc_suspend(struct device *dev); 369int snd_soc_suspend(struct device *dev);
373int snd_soc_resume(struct device *dev); 370int snd_soc_resume(struct device *dev);
374int snd_soc_poweroff(struct device *dev); 371int snd_soc_poweroff(struct device *dev);
@@ -386,6 +383,9 @@ void snd_soc_unregister_codec(struct device *dev);
386int snd_soc_register_component(struct device *dev, 383int snd_soc_register_component(struct device *dev,
387 const struct snd_soc_component_driver *cmpnt_drv, 384 const struct snd_soc_component_driver *cmpnt_drv,
388 struct snd_soc_dai_driver *dai_drv, int num_dai); 385 struct snd_soc_dai_driver *dai_drv, int num_dai);
386int devm_snd_soc_register_component(struct device *dev,
387 const struct snd_soc_component_driver *cmpnt_drv,
388 struct snd_soc_dai_driver *dai_drv, int num_dai);
389void snd_soc_unregister_component(struct device *dev); 389void snd_soc_unregister_component(struct device *dev);
390int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, 390int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
391 unsigned int reg); 391 unsigned int reg);
@@ -403,12 +403,6 @@ int snd_soc_cache_write(struct snd_soc_codec *codec,
403 unsigned int reg, unsigned int value); 403 unsigned int reg, unsigned int value);
404int snd_soc_cache_read(struct snd_soc_codec *codec, 404int snd_soc_cache_read(struct snd_soc_codec *codec,
405 unsigned int reg, unsigned int *value); 405 unsigned int reg, unsigned int *value);
406int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
407 unsigned int reg);
408int snd_soc_default_readable_register(struct snd_soc_codec *codec,
409 unsigned int reg);
410int snd_soc_default_writable_register(struct snd_soc_codec *codec,
411 unsigned int reg);
412int snd_soc_platform_read(struct snd_soc_platform *platform, 406int snd_soc_platform_read(struct snd_soc_platform *platform,
413 unsigned int reg); 407 unsigned int reg);
414int snd_soc_platform_write(struct snd_soc_platform *platform, 408int snd_soc_platform_write(struct snd_soc_platform *platform,
@@ -542,22 +536,6 @@ int snd_soc_put_strobe(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_value *ucontrol); 536 struct snd_ctl_elem_value *ucontrol);
543 537
544/** 538/**
545 * struct snd_soc_reg_access - Describes whether a given register is
546 * readable, writable or volatile.
547 *
548 * @reg: the register number
549 * @read: whether this register is readable
550 * @write: whether this register is writable
551 * @vol: whether this register is volatile
552 */
553struct snd_soc_reg_access {
554 u16 reg;
555 u16 read;
556 u16 write;
557 u16 vol;
558};
559
560/**
561 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection 539 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
562 * 540 *
563 * @pin: name of the pin to update 541 * @pin: name of the pin to update
@@ -657,17 +635,26 @@ struct snd_soc_compr_ops {
657 int (*trigger)(struct snd_compr_stream *); 635 int (*trigger)(struct snd_compr_stream *);
658}; 636};
659 637
660/* SoC cache ops */ 638/* component interface */
661struct snd_soc_cache_ops { 639struct snd_soc_component_driver {
640 const char *name;
641
642 /* DT */
643 int (*of_xlate_dai_name)(struct snd_soc_component *component,
644 struct of_phandle_args *args,
645 const char **dai_name);
646};
647
648struct snd_soc_component {
662 const char *name; 649 const char *name;
663 enum snd_soc_compress_type id; 650 int id;
664 int (*init)(struct snd_soc_codec *codec); 651 struct device *dev;
665 int (*exit)(struct snd_soc_codec *codec); 652 struct list_head list;
666 int (*read)(struct snd_soc_codec *codec, unsigned int reg, 653
667 unsigned int *value); 654 struct snd_soc_dai_driver *dai_drv;
668 int (*write)(struct snd_soc_codec *codec, unsigned int reg, 655 int num_dai;
669 unsigned int value); 656
670 int (*sync)(struct snd_soc_codec *codec); 657 const struct snd_soc_component_driver *driver;
671}; 658};
672 659
673/* SoC Audio Codec device */ 660/* SoC Audio Codec device */
@@ -683,8 +670,6 @@ struct snd_soc_codec {
683 struct list_head list; 670 struct list_head list;
684 struct list_head card_list; 671 struct list_head card_list;
685 int num_dai; 672 int num_dai;
686 enum snd_soc_compress_type compress_type;
687 size_t reg_size; /* reg_cache_size * reg_word_size */
688 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 673 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
689 int (*readable_register)(struct snd_soc_codec *, unsigned int); 674 int (*readable_register)(struct snd_soc_codec *, unsigned int);
690 int (*writable_register)(struct snd_soc_codec *, unsigned int); 675 int (*writable_register)(struct snd_soc_codec *, unsigned int);
@@ -708,13 +693,13 @@ struct snd_soc_codec {
708 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 693 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
709 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 694 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
710 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 695 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
711 int (*bulk_write_raw)(struct snd_soc_codec *, unsigned int, const void *, size_t);
712 void *reg_cache; 696 void *reg_cache;
713 const void *reg_def_copy;
714 const struct snd_soc_cache_ops *cache_ops;
715 struct mutex cache_rw_mutex; 697 struct mutex cache_rw_mutex;
716 int val_bytes; 698 int val_bytes;
717 699
700 /* component */
701 struct snd_soc_component component;
702
718 /* dapm */ 703 /* dapm */
719 struct snd_soc_dapm_context dapm; 704 struct snd_soc_dapm_context dapm;
720 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 705 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
@@ -733,6 +718,7 @@ struct snd_soc_codec_driver {
733 int (*remove)(struct snd_soc_codec *); 718 int (*remove)(struct snd_soc_codec *);
734 int (*suspend)(struct snd_soc_codec *); 719 int (*suspend)(struct snd_soc_codec *);
735 int (*resume)(struct snd_soc_codec *); 720 int (*resume)(struct snd_soc_codec *);
721 struct snd_soc_component_driver component_driver;
736 722
737 /* Default control and setup, added after probe() is run */ 723 /* Default control and setup, added after probe() is run */
738 const struct snd_kcontrol_new *controls; 724 const struct snd_kcontrol_new *controls;
@@ -760,9 +746,6 @@ struct snd_soc_codec_driver {
760 short reg_cache_step; 746 short reg_cache_step;
761 short reg_word_size; 747 short reg_word_size;
762 const void *reg_cache_default; 748 const void *reg_cache_default;
763 short reg_access_size;
764 const struct snd_soc_reg_access *reg_access_default;
765 enum snd_soc_compress_type compress_type;
766 749
767 /* codec bias level */ 750 /* codec bias level */
768 int (*set_bias_level)(struct snd_soc_codec *, 751 int (*set_bias_level)(struct snd_soc_codec *,
@@ -849,20 +832,6 @@ struct snd_soc_platform {
849#endif 832#endif
850}; 833};
851 834
852struct snd_soc_component_driver {
853 const char *name;
854};
855
856struct snd_soc_component {
857 const char *name;
858 int id;
859 int num_dai;
860 struct device *dev;
861 struct list_head list;
862
863 const struct snd_soc_component_driver *driver;
864};
865
866struct snd_soc_dai_link { 835struct snd_soc_dai_link {
867 /* config - must be set by machine driver */ 836 /* config - must be set by machine driver */
868 const char *name; /* Codec name */ 837 const char *name; /* Codec name */
@@ -944,12 +913,6 @@ struct snd_soc_codec_conf {
944 * associated per device 913 * associated per device
945 */ 914 */
946 const char *name_prefix; 915 const char *name_prefix;
947
948 /*
949 * set this to the desired compression type if you want to
950 * override the one supplied in codec->driver->compress_type
951 */
952 enum snd_soc_compress_type compress_type;
953}; 916};
954 917
955struct snd_soc_aux_dev { 918struct snd_soc_aux_dev {
@@ -1088,7 +1051,8 @@ struct snd_soc_pcm_runtime {
1088/* mixer control */ 1051/* mixer control */
1089struct soc_mixer_control { 1052struct soc_mixer_control {
1090 int min, max, platform_max; 1053 int min, max, platform_max;
1091 unsigned int reg, rreg, shift, rshift; 1054 int reg, rreg;
1055 unsigned int shift, rshift;
1092 unsigned int invert:1; 1056 unsigned int invert:1;
1093 unsigned int autodisable:1; 1057 unsigned int autodisable:1;
1094}; 1058};
@@ -1121,8 +1085,6 @@ struct soc_enum {
1121unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1085unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1122unsigned int snd_soc_write(struct snd_soc_codec *codec, 1086unsigned int snd_soc_write(struct snd_soc_codec *codec,
1123 unsigned int reg, unsigned int val); 1087 unsigned int reg, unsigned int val);
1124unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
1125 unsigned int reg, const void *data, size_t len);
1126 1088
1127/* device driver data */ 1089/* device driver data */
1128 1090
@@ -1201,6 +1163,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
1201 const char *propname); 1163 const char *propname);
1202unsigned int snd_soc_of_parse_daifmt(struct device_node *np, 1164unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
1203 const char *prefix); 1165 const char *prefix);
1166int snd_soc_of_get_dai_name(struct device_node *of_node,
1167 const char **dai_name);
1204 1168
1205#include <sound/soc-dai.h> 1169#include <sound/soc-dai.h>
1206 1170
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index e5d09d242ba3..a12589c4ee92 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -6,13 +6,13 @@ struct iscsit_transport {
6#define ISCSIT_TRANSPORT_NAME 16 6#define ISCSIT_TRANSPORT_NAME 16
7 char name[ISCSIT_TRANSPORT_NAME]; 7 char name[ISCSIT_TRANSPORT_NAME];
8 int transport_type; 8 int transport_type;
9 int priv_size;
9 struct module *owner; 10 struct module *owner;
10 struct list_head t_node; 11 struct list_head t_node;
11 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); 12 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *);
12 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); 13 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *);
13 void (*iscsit_free_np)(struct iscsi_np *); 14 void (*iscsit_free_np)(struct iscsi_np *);
14 void (*iscsit_free_conn)(struct iscsi_conn *); 15 void (*iscsit_free_conn)(struct iscsi_conn *);
15 struct iscsi_cmd *(*iscsit_alloc_cmd)(struct iscsi_conn *, gfp_t);
16 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *); 16 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *);
17 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32); 17 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);
18 int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int); 18 int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
@@ -22,6 +22,11 @@ struct iscsit_transport {
22 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *); 22 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
23}; 23};
24 24
25static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd)
26{
27 return (void *)(cmd + 1);
28}
29
25/* 30/*
26 * From iscsi_target_transport.c 31 * From iscsi_target_transport.c
27 */ 32 */
@@ -92,3 +97,4 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
92extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); 97extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t);
93extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, 98extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
94 unsigned char *, __be32); 99 unsigned char *, __be32);
100extern void iscsit_release_cmd(struct iscsi_cmd *);
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index ffa2696d64dc..39e0114d70c5 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -34,12 +34,18 @@ struct se_subsystem_api {
34 sense_reason_t (*parse_cdb)(struct se_cmd *cmd); 34 sense_reason_t (*parse_cdb)(struct se_cmd *cmd);
35 u32 (*get_device_type)(struct se_device *); 35 u32 (*get_device_type)(struct se_device *);
36 sector_t (*get_blocks)(struct se_device *); 36 sector_t (*get_blocks)(struct se_device *);
37 sector_t (*get_alignment_offset_lbas)(struct se_device *);
38 /* lbppbe = logical blocks per physical block exponent. see SBC-3 */
39 unsigned int (*get_lbppbe)(struct se_device *);
40 unsigned int (*get_io_min)(struct se_device *);
41 unsigned int (*get_io_opt)(struct se_device *);
37 unsigned char *(*get_sense_buffer)(struct se_cmd *); 42 unsigned char *(*get_sense_buffer)(struct se_cmd *);
38 bool (*get_write_cache)(struct se_device *); 43 bool (*get_write_cache)(struct se_device *);
39}; 44};
40 45
41struct sbc_ops { 46struct sbc_ops {
42 sense_reason_t (*execute_rw)(struct se_cmd *cmd); 47 sense_reason_t (*execute_rw)(struct se_cmd *cmd, struct scatterlist *,
48 u32, enum dma_data_direction);
43 sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd); 49 sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd);
44 sense_reason_t (*execute_write_same)(struct se_cmd *cmd); 50 sense_reason_t (*execute_write_same)(struct se_cmd *cmd);
45 sense_reason_t (*execute_write_same_unmap)(struct se_cmd *cmd); 51 sense_reason_t (*execute_write_same_unmap)(struct se_cmd *cmd);
@@ -73,6 +79,10 @@ int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
73/* core helpers also used by command snooping in pscsi */ 79/* core helpers also used by command snooping in pscsi */
74void *transport_kmap_data_sg(struct se_cmd *); 80void *transport_kmap_data_sg(struct se_cmd *);
75void transport_kunmap_data_sg(struct se_cmd *); 81void transport_kunmap_data_sg(struct se_cmd *);
82/* core helpers also used by xcopy during internal command setup */
83int target_alloc_sgl(struct scatterlist **, unsigned int *, u32, bool);
84sense_reason_t transport_generic_map_mem_to_cmd(struct se_cmd *,
85 struct scatterlist *, u32, struct scatterlist *, u32);
76 86
77void array_free(void *array, int n); 87void array_free(void *array, int n);
78 88
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index e34fc904f2e1..45412a6afa69 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -5,11 +5,12 @@
5#include <linux/configfs.h> 5#include <linux/configfs.h>
6#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
7#include <linux/blkdev.h> 7#include <linux/blkdev.h>
8#include <linux/percpu_ida.h>
8#include <scsi/scsi_cmnd.h> 9#include <scsi/scsi_cmnd.h>
9#include <net/sock.h> 10#include <net/sock.h>
10#include <net/tcp.h> 11#include <net/tcp.h>
11 12
12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc2-ml" 13#define TARGET_CORE_MOD_VERSION "v4.1.0"
13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION 14#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
14 15
15/* Maximum Number of LUNs per Target Portal Group */ 16/* Maximum Number of LUNs per Target Portal Group */
@@ -96,6 +97,10 @@
96 * block/blk-lib.c:blkdev_issue_discard() 97 * block/blk-lib.c:blkdev_issue_discard()
97 */ 98 */
98#define DA_EMULATE_TPWS 0 99#define DA_EMULATE_TPWS 0
100/* Emulation for CompareAndWrite (AtomicTestandSet) by default */
101#define DA_EMULATE_CAW 1
102/* Emulation for 3rd Party Copy (ExtendedCopy) by default */
103#define DA_EMULATE_3PC 1
99/* No Emulation for PSCSI by default */ 104/* No Emulation for PSCSI by default */
100#define DA_EMULATE_ALUA 0 105#define DA_EMULATE_ALUA 0
101/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ 106/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
@@ -158,6 +163,9 @@ enum se_cmd_flags_table {
158 SCF_ALUA_NON_OPTIMIZED = 0x00008000, 163 SCF_ALUA_NON_OPTIMIZED = 0x00008000,
159 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, 164 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000,
160 SCF_ACK_KREF = 0x00040000, 165 SCF_ACK_KREF = 0x00040000,
166 SCF_COMPARE_AND_WRITE = 0x00080000,
167 SCF_COMPARE_AND_WRITE_POST = 0x00100000,
168 SCF_CMD_XCOPY_PASSTHROUGH = 0x00200000,
161}; 169};
162 170
163/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 171/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -196,6 +204,7 @@ enum tcm_sense_reason_table {
196 TCM_ADDRESS_OUT_OF_RANGE = R(0x11), 204 TCM_ADDRESS_OUT_OF_RANGE = R(0x11),
197 TCM_OUT_OF_RESOURCES = R(0x12), 205 TCM_OUT_OF_RESOURCES = R(0x12),
198 TCM_PARAMETER_LIST_LENGTH_ERROR = R(0x13), 206 TCM_PARAMETER_LIST_LENGTH_ERROR = R(0x13),
207 TCM_MISCOMPARE_VERIFY = R(0x14),
199#undef R 208#undef R
200}; 209};
201 210
@@ -218,6 +227,7 @@ enum tcm_tmreq_table {
218 227
219/* fabric independent task management response values */ 228/* fabric independent task management response values */
220enum tcm_tmrsp_table { 229enum tcm_tmrsp_table {
230 TMR_FUNCTION_FAILED = 0,
221 TMR_FUNCTION_COMPLETE = 1, 231 TMR_FUNCTION_COMPLETE = 1,
222 TMR_TASK_DOES_NOT_EXIST = 2, 232 TMR_TASK_DOES_NOT_EXIST = 2,
223 TMR_LUN_DOES_NOT_EXIST = 3, 233 TMR_LUN_DOES_NOT_EXIST = 3,
@@ -273,11 +283,12 @@ struct t10_alua_lu_gp_member {
273struct t10_alua_tg_pt_gp { 283struct t10_alua_tg_pt_gp {
274 u16 tg_pt_gp_id; 284 u16 tg_pt_gp_id;
275 int tg_pt_gp_valid_id; 285 int tg_pt_gp_valid_id;
286 int tg_pt_gp_alua_supported_states;
276 int tg_pt_gp_alua_access_status; 287 int tg_pt_gp_alua_access_status;
277 int tg_pt_gp_alua_access_type; 288 int tg_pt_gp_alua_access_type;
278 int tg_pt_gp_nonop_delay_msecs; 289 int tg_pt_gp_nonop_delay_msecs;
279 int tg_pt_gp_trans_delay_msecs; 290 int tg_pt_gp_trans_delay_msecs;
280 int tg_pt_gp_implict_trans_secs; 291 int tg_pt_gp_implicit_trans_secs;
281 int tg_pt_gp_pref; 292 int tg_pt_gp_pref;
282 int tg_pt_gp_write_metadata; 293 int tg_pt_gp_write_metadata;
283 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */ 294 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
@@ -415,6 +426,8 @@ struct se_cmd {
415 enum dma_data_direction data_direction; 426 enum dma_data_direction data_direction;
416 /* For SAM Task Attribute */ 427 /* For SAM Task Attribute */
417 int sam_task_attr; 428 int sam_task_attr;
429 /* Used for se_sess->sess_tag_pool */
430 unsigned int map_tag;
418 /* Transport protocol dependent state, see transport_state_table */ 431 /* Transport protocol dependent state, see transport_state_table */
419 enum transport_state_table t_state; 432 enum transport_state_table t_state;
420 unsigned cmd_wait_set:1; 433 unsigned cmd_wait_set:1;
@@ -431,7 +444,6 @@ struct se_cmd {
431 /* Used for sense data */ 444 /* Used for sense data */
432 void *sense_buffer; 445 void *sense_buffer;
433 struct list_head se_delayed_node; 446 struct list_head se_delayed_node;
434 struct list_head se_lun_node;
435 struct list_head se_qf_node; 447 struct list_head se_qf_node;
436 struct se_device *se_dev; 448 struct se_device *se_dev;
437 struct se_dev_entry *se_deve; 449 struct se_dev_entry *se_deve;
@@ -444,11 +456,14 @@ struct se_cmd {
444 struct kref cmd_kref; 456 struct kref cmd_kref;
445 struct target_core_fabric_ops *se_tfo; 457 struct target_core_fabric_ops *se_tfo;
446 sense_reason_t (*execute_cmd)(struct se_cmd *); 458 sense_reason_t (*execute_cmd)(struct se_cmd *);
447 void (*transport_complete_callback)(struct se_cmd *); 459 sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *,
460 u32, enum dma_data_direction);
461 sense_reason_t (*transport_complete_callback)(struct se_cmd *);
448 462
449 unsigned char *t_task_cdb; 463 unsigned char *t_task_cdb;
450 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 464 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
451 unsigned long long t_task_lba; 465 unsigned long long t_task_lba;
466 unsigned int t_task_nolb;
452 unsigned int transport_state; 467 unsigned int transport_state;
453#define CMD_T_ABORTED (1 << 0) 468#define CMD_T_ABORTED (1 << 0)
454#define CMD_T_ACTIVE (1 << 1) 469#define CMD_T_ACTIVE (1 << 1)
@@ -456,20 +471,18 @@ struct se_cmd {
456#define CMD_T_SENT (1 << 4) 471#define CMD_T_SENT (1 << 4)
457#define CMD_T_STOP (1 << 5) 472#define CMD_T_STOP (1 << 5)
458#define CMD_T_FAILED (1 << 6) 473#define CMD_T_FAILED (1 << 6)
459#define CMD_T_LUN_STOP (1 << 7) 474#define CMD_T_DEV_ACTIVE (1 << 7)
460#define CMD_T_LUN_FE_STOP (1 << 8) 475#define CMD_T_REQUEST_STOP (1 << 8)
461#define CMD_T_DEV_ACTIVE (1 << 9) 476#define CMD_T_BUSY (1 << 9)
462#define CMD_T_REQUEST_STOP (1 << 10)
463#define CMD_T_BUSY (1 << 11)
464 spinlock_t t_state_lock; 477 spinlock_t t_state_lock;
465 struct completion t_transport_stop_comp; 478 struct completion t_transport_stop_comp;
466 struct completion transport_lun_fe_stop_comp;
467 struct completion transport_lun_stop_comp;
468 479
469 struct work_struct work; 480 struct work_struct work;
470 481
471 struct scatterlist *t_data_sg; 482 struct scatterlist *t_data_sg;
483 struct scatterlist *t_data_sg_orig;
472 unsigned int t_data_nents; 484 unsigned int t_data_nents;
485 unsigned int t_data_nents_orig;
473 void *t_data_vmap; 486 void *t_data_vmap;
474 struct scatterlist *t_bidi_data_sg; 487 struct scatterlist *t_bidi_data_sg;
475 unsigned int t_bidi_data_nents; 488 unsigned int t_bidi_data_nents;
@@ -482,6 +495,9 @@ struct se_cmd {
482 495
483 /* backend private data */ 496 /* backend private data */
484 void *priv; 497 void *priv;
498
499 /* Used for lun->lun_ref counting */
500 bool lun_ref_active;
485}; 501};
486 502
487struct se_ua { 503struct se_ua {
@@ -536,6 +552,8 @@ struct se_session {
536 struct list_head sess_wait_list; 552 struct list_head sess_wait_list;
537 spinlock_t sess_cmd_lock; 553 spinlock_t sess_cmd_lock;
538 struct kref sess_kref; 554 struct kref sess_kref;
555 void *sess_cmd_map;
556 struct percpu_ida sess_tag_pool;
539}; 557};
540 558
541struct se_device; 559struct se_device;
@@ -589,6 +607,8 @@ struct se_dev_attrib {
589 int emulate_tas; 607 int emulate_tas;
590 int emulate_tpu; 608 int emulate_tpu;
591 int emulate_tpws; 609 int emulate_tpws;
610 int emulate_caw;
611 int emulate_3pc;
592 int enforce_pr_isids; 612 int enforce_pr_isids;
593 int is_nonrot; 613 int is_nonrot;
594 int emulate_rest_reord; 614 int emulate_rest_reord;
@@ -608,6 +628,34 @@ struct se_dev_attrib {
608 struct config_group da_group; 628 struct config_group da_group;
609}; 629};
610 630
631struct se_port_stat_grps {
632 struct config_group stat_group;
633 struct config_group scsi_port_group;
634 struct config_group scsi_tgt_port_group;
635 struct config_group scsi_transport_group;
636};
637
638struct se_lun {
639#define SE_LUN_LINK_MAGIC 0xffff7771
640 u32 lun_link_magic;
641 /* See transport_lun_status_table */
642 enum transport_lun_status_table lun_status;
643 u32 lun_access;
644 u32 lun_flags;
645 u32 unpacked_lun;
646 atomic_t lun_acl_count;
647 spinlock_t lun_acl_lock;
648 spinlock_t lun_sep_lock;
649 struct completion lun_shutdown_comp;
650 struct list_head lun_acl_list;
651 struct se_device *lun_se_dev;
652 struct se_port *lun_sep;
653 struct config_group lun_group;
654 struct se_port_stat_grps port_stat_grps;
655 struct completion lun_ref_comp;
656 struct percpu_ref lun_ref;
657};
658
611struct se_dev_stat_grps { 659struct se_dev_stat_grps {
612 struct config_group stat_group; 660 struct config_group stat_group;
613 struct config_group scsi_dev_group; 661 struct config_group scsi_dev_group;
@@ -636,11 +684,10 @@ struct se_device {
636 /* Pointer to transport specific device structure */ 684 /* Pointer to transport specific device structure */
637 u32 dev_index; 685 u32 dev_index;
638 u64 creation_time; 686 u64 creation_time;
639 u32 num_resets; 687 atomic_long_t num_resets;
640 u64 num_cmds; 688 atomic_long_t num_cmds;
641 u64 read_bytes; 689 atomic_long_t read_bytes;
642 u64 write_bytes; 690 atomic_long_t write_bytes;
643 spinlock_t stats_lock;
644 /* Active commands on this virtual SE device */ 691 /* Active commands on this virtual SE device */
645 atomic_t simple_cmds; 692 atomic_t simple_cmds;
646 atomic_t dev_ordered_id; 693 atomic_t dev_ordered_id;
@@ -656,6 +703,7 @@ struct se_device {
656 spinlock_t se_port_lock; 703 spinlock_t se_port_lock;
657 spinlock_t se_tmr_lock; 704 spinlock_t se_tmr_lock;
658 spinlock_t qf_cmd_lock; 705 spinlock_t qf_cmd_lock;
706 struct semaphore caw_sem;
659 /* Used for legacy SPC-2 reservationsa */ 707 /* Used for legacy SPC-2 reservationsa */
660 struct se_node_acl *dev_reserved_node_acl; 708 struct se_node_acl *dev_reserved_node_acl;
661 /* Used for ALUA Logical Unit Group membership */ 709 /* Used for ALUA Logical Unit Group membership */
@@ -669,6 +717,7 @@ struct se_device {
669 struct list_head delayed_cmd_list; 717 struct list_head delayed_cmd_list;
670 struct list_head state_list; 718 struct list_head state_list;
671 struct list_head qf_cmd_list; 719 struct list_head qf_cmd_list;
720 struct list_head g_dev_node;
672 /* Pointer to associated SE HBA */ 721 /* Pointer to associated SE HBA */
673 struct se_hba *se_hba; 722 struct se_hba *se_hba;
674 /* T10 Inquiry and VPD WWN Information */ 723 /* T10 Inquiry and VPD WWN Information */
@@ -689,6 +738,7 @@ struct se_device {
689 struct se_subsystem_api *transport; 738 struct se_subsystem_api *transport;
690 /* Linked list for struct se_hba struct se_device list */ 739 /* Linked list for struct se_hba struct se_device list */
691 struct list_head dev_list; 740 struct list_head dev_list;
741 struct se_lun xcopy_lun;
692}; 742};
693 743
694struct se_hba { 744struct se_hba {
@@ -708,34 +758,6 @@ struct se_hba {
708 struct se_subsystem_api *transport; 758 struct se_subsystem_api *transport;
709}; 759};
710 760
711struct se_port_stat_grps {
712 struct config_group stat_group;
713 struct config_group scsi_port_group;
714 struct config_group scsi_tgt_port_group;
715 struct config_group scsi_transport_group;
716};
717
718struct se_lun {
719#define SE_LUN_LINK_MAGIC 0xffff7771
720 u32 lun_link_magic;
721 /* See transport_lun_status_table */
722 enum transport_lun_status_table lun_status;
723 u32 lun_access;
724 u32 lun_flags;
725 u32 unpacked_lun;
726 atomic_t lun_acl_count;
727 spinlock_t lun_acl_lock;
728 spinlock_t lun_cmd_lock;
729 spinlock_t lun_sep_lock;
730 struct completion lun_shutdown_comp;
731 struct list_head lun_cmd_list;
732 struct list_head lun_acl_list;
733 struct se_device *lun_se_dev;
734 struct se_port *lun_sep;
735 struct config_group lun_group;
736 struct se_port_stat_grps port_stat_grps;
737};
738
739struct scsi_port_stats { 761struct scsi_port_stats {
740 u64 cmd_pdus; 762 u64 cmd_pdus;
741 u64 tx_data_octets; 763 u64 tx_data_octets;
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 713c5004f4ae..e0801386e4dc 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -54,4 +54,3 @@ struct target_fabric_configfs {
54 struct target_fabric_configfs_template tf_cit_tmpl; 54 struct target_fabric_configfs_template tf_cit_tmpl;
55}; 55};
56 56
57#define TF_CIT_TMPL(tf) (&(tf)->tf_cit_tmpl)
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 7a16178424f9..4cf4fda404a3 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -84,6 +84,9 @@ struct target_core_fabric_ops {
84}; 84};
85 85
86struct se_session *transport_init_session(void); 86struct se_session *transport_init_session(void);
87int transport_alloc_session_tags(struct se_session *, unsigned int,
88 unsigned int);
89struct se_session *transport_init_session_tags(unsigned int, unsigned int);
87void __transport_register_session(struct se_portal_group *, 90void __transport_register_session(struct se_portal_group *,
88 struct se_node_acl *, struct se_session *, void *); 91 struct se_node_acl *, struct se_session *, void *);
89void transport_register_session(struct se_portal_group *, 92void transport_register_session(struct se_portal_group *,
@@ -131,8 +134,11 @@ int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
131void core_tmr_release_req(struct se_tmr_req *); 134void core_tmr_release_req(struct se_tmr_req *);
132int transport_generic_handle_tmr(struct se_cmd *); 135int transport_generic_handle_tmr(struct se_cmd *);
133void transport_generic_request_failure(struct se_cmd *, sense_reason_t); 136void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
137void __target_execute_cmd(struct se_cmd *);
134int transport_lookup_tmr_lun(struct se_cmd *, u32); 138int transport_lookup_tmr_lun(struct se_cmd *, u32);
135 139
140struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
141 unsigned char *);
136struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 142struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
137 unsigned char *); 143 unsigned char *);
138void core_tpg_clear_object_luns(struct se_portal_group *); 144void core_tpg_clear_object_luns(struct se_portal_group *);
@@ -175,4 +181,30 @@ u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *
175char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, 181char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *,
176 u32 *, char **); 182 u32 *, char **);
177 183
184/*
185 * The LIO target core uses DMA_TO_DEVICE to mean that data is going
186 * to the target (eg handling a WRITE) and DMA_FROM_DEVICE to mean
187 * that data is coming from the target (eg handling a READ). However,
188 * this is just the opposite of what we have to tell the DMA mapping
189 * layer -- eg when handling a READ, the HBA will have to DMA the data
190 * out of memory so it can send it to the initiator, which means we
191 * need to use DMA_TO_DEVICE when we map the data.
192 */
193static inline enum dma_data_direction
194target_reverse_dma_direction(struct se_cmd *se_cmd)
195{
196 if (se_cmd->se_cmd_flags & SCF_BIDI)
197 return DMA_BIDIRECTIONAL;
198
199 switch (se_cmd->data_direction) {
200 case DMA_TO_DEVICE:
201 return DMA_FROM_DEVICE;
202 case DMA_FROM_DEVICE:
203 return DMA_TO_DEVICE;
204 case DMA_NONE:
205 default:
206 return DMA_NONE;
207 }
208}
209
178#endif /* TARGET_CORE_FABRICH */ 210#endif /* TARGET_CORE_FABRICH */
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 5fc2dcdd21cd..03996b2bb04f 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -14,6 +14,7 @@ struct snd_soc_codec;
14struct snd_soc_platform; 14struct snd_soc_platform;
15struct snd_soc_card; 15struct snd_soc_card;
16struct snd_soc_dapm_widget; 16struct snd_soc_dapm_widget;
17struct snd_soc_dapm_path;
17 18
18/* 19/*
19 * Log register events 20 * Log register events
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index 5ebda976ea93..e2b9576d00e2 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -6,11 +6,9 @@
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9struct search;
10
11DECLARE_EVENT_CLASS(bcache_request, 9DECLARE_EVENT_CLASS(bcache_request,
12 TP_PROTO(struct search *s, struct bio *bio), 10 TP_PROTO(struct bcache_device *d, struct bio *bio),
13 TP_ARGS(s, bio), 11 TP_ARGS(d, bio),
14 12
15 TP_STRUCT__entry( 13 TP_STRUCT__entry(
16 __field(dev_t, dev ) 14 __field(dev_t, dev )
@@ -24,8 +22,8 @@ DECLARE_EVENT_CLASS(bcache_request,
24 22
25 TP_fast_assign( 23 TP_fast_assign(
26 __entry->dev = bio->bi_bdev->bd_dev; 24 __entry->dev = bio->bi_bdev->bd_dev;
27 __entry->orig_major = s->d->disk->major; 25 __entry->orig_major = d->disk->major;
28 __entry->orig_minor = s->d->disk->first_minor; 26 __entry->orig_minor = d->disk->first_minor;
29 __entry->sector = bio->bi_sector; 27 __entry->sector = bio->bi_sector;
30 __entry->orig_sector = bio->bi_sector - 16; 28 __entry->orig_sector = bio->bi_sector - 16;
31 __entry->nr_sector = bio->bi_size >> 9; 29 __entry->nr_sector = bio->bi_size >> 9;
@@ -79,13 +77,13 @@ DECLARE_EVENT_CLASS(btree_node,
79/* request.c */ 77/* request.c */
80 78
81DEFINE_EVENT(bcache_request, bcache_request_start, 79DEFINE_EVENT(bcache_request, bcache_request_start,
82 TP_PROTO(struct search *s, struct bio *bio), 80 TP_PROTO(struct bcache_device *d, struct bio *bio),
83 TP_ARGS(s, bio) 81 TP_ARGS(d, bio)
84); 82);
85 83
86DEFINE_EVENT(bcache_request, bcache_request_end, 84DEFINE_EVENT(bcache_request, bcache_request_end,
87 TP_PROTO(struct search *s, struct bio *bio), 85 TP_PROTO(struct bcache_device *d, struct bio *bio),
88 TP_ARGS(s, bio) 86 TP_ARGS(d, bio)
89); 87);
90 88
91DECLARE_EVENT_CLASS(bcache_bio, 89DECLARE_EVENT_CLASS(bcache_bio,
@@ -370,6 +368,35 @@ DEFINE_EVENT(btree_node, bcache_btree_set_root,
370 TP_ARGS(b) 368 TP_ARGS(b)
371); 369);
372 370
371TRACE_EVENT(bcache_keyscan,
372 TP_PROTO(unsigned nr_found,
373 unsigned start_inode, uint64_t start_offset,
374 unsigned end_inode, uint64_t end_offset),
375 TP_ARGS(nr_found,
376 start_inode, start_offset,
377 end_inode, end_offset),
378
379 TP_STRUCT__entry(
380 __field(__u32, nr_found )
381 __field(__u32, start_inode )
382 __field(__u64, start_offset )
383 __field(__u32, end_inode )
384 __field(__u64, end_offset )
385 ),
386
387 TP_fast_assign(
388 __entry->nr_found = nr_found;
389 __entry->start_inode = start_inode;
390 __entry->start_offset = start_offset;
391 __entry->end_inode = end_inode;
392 __entry->end_offset = end_offset;
393 ),
394
395 TP_printk("found %u keys from %u:%llu to %u:%llu", __entry->nr_found,
396 __entry->start_inode, __entry->start_offset,
397 __entry->end_inode, __entry->end_offset)
398);
399
373/* Allocator */ 400/* Allocator */
374 401
375TRACE_EVENT(bcache_alloc_invalidate, 402TRACE_EVENT(bcache_alloc_invalidate,
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 60ae7c3db912..4c2301d2ef1a 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
618 __field( unsigned int, nr_sector ) 618 __field( unsigned int, nr_sector )
619 __field( dev_t, old_dev ) 619 __field( dev_t, old_dev )
620 __field( sector_t, old_sector ) 620 __field( sector_t, old_sector )
621 __field( unsigned int, nr_bios )
621 __array( char, rwbs, RWBS_LEN) 622 __array( char, rwbs, RWBS_LEN)
622 ), 623 ),
623 624
@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
627 __entry->nr_sector = blk_rq_sectors(rq); 628 __entry->nr_sector = blk_rq_sectors(rq);
628 __entry->old_dev = dev; 629 __entry->old_dev = dev;
629 __entry->old_sector = from; 630 __entry->old_sector = from;
631 __entry->nr_bios = blk_rq_count_bios(rq);
630 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); 632 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
631 ), 633 ),
632 634
633 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 635 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
634 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 636 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
635 (unsigned long long)__entry->sector, 637 (unsigned long long)__entry->sector,
636 __entry->nr_sector, 638 __entry->nr_sector,
637 MAJOR(__entry->old_dev), MINOR(__entry->old_dev), 639 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
638 (unsigned long long)__entry->old_sector) 640 (unsigned long long)__entry->old_sector, __entry->nr_bios)
639); 641);
640 642
641#endif /* _TRACE_BLOCK_H */ 643#endif /* _TRACE_BLOCK_H */
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 2902657ba766..4832d75dcbae 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -42,6 +42,7 @@ struct extent_buffer;
42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
45 { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \
45 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 46 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
46 47
47#define show_root_type(obj) \ 48#define show_root_type(obj) \
@@ -161,12 +162,14 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
161 { EXTENT_FLAG_LOGGING, "LOGGING" }, \ 162 { EXTENT_FLAG_LOGGING, "LOGGING" }, \
162 { EXTENT_FLAG_FILLING, "FILLING" }) 163 { EXTENT_FLAG_FILLING, "FILLING" })
163 164
164TRACE_EVENT(btrfs_get_extent, 165TRACE_EVENT_CONDITION(btrfs_get_extent,
165 166
166 TP_PROTO(struct btrfs_root *root, struct extent_map *map), 167 TP_PROTO(struct btrfs_root *root, struct extent_map *map),
167 168
168 TP_ARGS(root, map), 169 TP_ARGS(root, map),
169 170
171 TP_CONDITION(map),
172
170 TP_STRUCT__entry( 173 TP_STRUCT__entry(
171 __field( u64, root_objectid ) 174 __field( u64, root_objectid )
172 __field( u64, start ) 175 __field( u64, start )
@@ -439,7 +442,7 @@ TRACE_EVENT(btrfs_sync_fs,
439 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 442 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
440 443
441 444
442TRACE_EVENT(btrfs_delayed_tree_ref, 445DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
443 446
444 TP_PROTO(struct btrfs_delayed_ref_node *ref, 447 TP_PROTO(struct btrfs_delayed_ref_node *ref,
445 struct btrfs_delayed_tree_ref *full_ref, 448 struct btrfs_delayed_tree_ref *full_ref,
@@ -481,7 +484,25 @@ TRACE_EVENT(btrfs_delayed_tree_ref,
481 (unsigned long long)__entry->seq) 484 (unsigned long long)__entry->seq)
482); 485);
483 486
484TRACE_EVENT(btrfs_delayed_data_ref, 487DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
488
489 TP_PROTO(struct btrfs_delayed_ref_node *ref,
490 struct btrfs_delayed_tree_ref *full_ref,
491 int action),
492
493 TP_ARGS(ref, full_ref, action)
494);
495
496DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
497
498 TP_PROTO(struct btrfs_delayed_ref_node *ref,
499 struct btrfs_delayed_tree_ref *full_ref,
500 int action),
501
502 TP_ARGS(ref, full_ref, action)
503);
504
505DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
485 506
486 TP_PROTO(struct btrfs_delayed_ref_node *ref, 507 TP_PROTO(struct btrfs_delayed_ref_node *ref,
487 struct btrfs_delayed_data_ref *full_ref, 508 struct btrfs_delayed_data_ref *full_ref,
@@ -527,7 +548,25 @@ TRACE_EVENT(btrfs_delayed_data_ref,
527 (unsigned long long)__entry->seq) 548 (unsigned long long)__entry->seq)
528); 549);
529 550
530TRACE_EVENT(btrfs_delayed_ref_head, 551DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
552
553 TP_PROTO(struct btrfs_delayed_ref_node *ref,
554 struct btrfs_delayed_data_ref *full_ref,
555 int action),
556
557 TP_ARGS(ref, full_ref, action)
558);
559
560DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
561
562 TP_PROTO(struct btrfs_delayed_ref_node *ref,
563 struct btrfs_delayed_data_ref *full_ref,
564 int action),
565
566 TP_ARGS(ref, full_ref, action)
567);
568
569DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
531 570
532 TP_PROTO(struct btrfs_delayed_ref_node *ref, 571 TP_PROTO(struct btrfs_delayed_ref_node *ref,
533 struct btrfs_delayed_ref_head *head_ref, 572 struct btrfs_delayed_ref_head *head_ref,
@@ -556,6 +595,24 @@ TRACE_EVENT(btrfs_delayed_ref_head,
556 __entry->is_data) 595 __entry->is_data)
557); 596);
558 597
598DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
599
600 TP_PROTO(struct btrfs_delayed_ref_node *ref,
601 struct btrfs_delayed_ref_head *head_ref,
602 int action),
603
604 TP_ARGS(ref, head_ref, action)
605);
606
607DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
608
609 TP_PROTO(struct btrfs_delayed_ref_node *ref,
610 struct btrfs_delayed_ref_head *head_ref,
611 int action),
612
613 TP_ARGS(ref, head_ref, action)
614);
615
559#define show_chunk_type(type) \ 616#define show_chunk_type(type) \
560 __print_flags(type, "|", \ 617 __print_flags(type, "|", \
561 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 618 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 52ae54828eda..e0dc355fa317 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -36,6 +36,11 @@
36 { CURSEG_COLD_NODE, "Cold NODE" }, \ 36 { CURSEG_COLD_NODE, "Cold NODE" }, \
37 { NO_CHECK_TYPE, "No TYPE" }) 37 { NO_CHECK_TYPE, "No TYPE" })
38 38
39#define show_file_type(type) \
40 __print_symbolic(type, \
41 { 0, "FILE" }, \
42 { 1, "DIR" })
43
39#define show_gc_type(type) \ 44#define show_gc_type(type) \
40 __print_symbolic(type, \ 45 __print_symbolic(type, \
41 { FG_GC, "Foreground GC" }, \ 46 { FG_GC, "Foreground GC" }, \
@@ -623,6 +628,52 @@ TRACE_EVENT(f2fs_do_submit_bio,
623 __entry->size) 628 __entry->size)
624); 629);
625 630
631DECLARE_EVENT_CLASS(f2fs__page,
632
633 TP_PROTO(struct page *page, int type),
634
635 TP_ARGS(page, type),
636
637 TP_STRUCT__entry(
638 __field(dev_t, dev)
639 __field(ino_t, ino)
640 __field(int, type)
641 __field(int, dir)
642 __field(pgoff_t, index)
643 __field(int, dirty)
644 ),
645
646 TP_fast_assign(
647 __entry->dev = page->mapping->host->i_sb->s_dev;
648 __entry->ino = page->mapping->host->i_ino;
649 __entry->type = type;
650 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
651 __entry->index = page->index;
652 __entry->dirty = PageDirty(page);
653 ),
654
655 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, dirty = %d",
656 show_dev_ino(__entry),
657 show_block_type(__entry->type),
658 show_file_type(__entry->dir),
659 (unsigned long)__entry->index,
660 __entry->dirty)
661);
662
663DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
664
665 TP_PROTO(struct page *page, int type),
666
667 TP_ARGS(page, type)
668);
669
670DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
671
672 TP_PROTO(struct page *page, int type),
673
674 TP_ARGS(page, type)
675);
676
626TRACE_EVENT(f2fs_submit_write_page, 677TRACE_EVENT(f2fs_submit_write_page,
627 678
628 TP_PROTO(struct page *page, block_t blk_addr, int type), 679 TP_PROTO(struct page *page, block_t blk_addr, int type),
diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h
new file mode 100644
index 000000000000..a8f5c32d174b
--- /dev/null
+++ b/include/trace/events/iommu.h
@@ -0,0 +1,162 @@
1/*
2 * iommu trace points
3 *
4 * Copyright (C) 2013 Shuah Khan <shuah.kh@samsung.com>
5 *
6 */
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM iommu
9
10#if !defined(_TRACE_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ)
11#define _TRACE_IOMMU_H
12
13#include <linux/tracepoint.h>
14#include <linux/pci.h>
15
16struct device;
17
18DECLARE_EVENT_CLASS(iommu_group_event,
19
20 TP_PROTO(int group_id, struct device *dev),
21
22 TP_ARGS(group_id, dev),
23
24 TP_STRUCT__entry(
25 __field(int, gid)
26 __string(device, dev_name(dev))
27 ),
28
29 TP_fast_assign(
30 __entry->gid = group_id;
31 __assign_str(device, dev_name(dev));
32 ),
33
34 TP_printk("IOMMU: groupID=%d device=%s",
35 __entry->gid, __get_str(device)
36 )
37);
38
39DEFINE_EVENT(iommu_group_event, add_device_to_group,
40
41 TP_PROTO(int group_id, struct device *dev),
42
43 TP_ARGS(group_id, dev)
44
45);
46
47DEFINE_EVENT(iommu_group_event, remove_device_from_group,
48
49 TP_PROTO(int group_id, struct device *dev),
50
51 TP_ARGS(group_id, dev)
52);
53
54DECLARE_EVENT_CLASS(iommu_device_event,
55
56 TP_PROTO(struct device *dev),
57
58 TP_ARGS(dev),
59
60 TP_STRUCT__entry(
61 __string(device, dev_name(dev))
62 ),
63
64 TP_fast_assign(
65 __assign_str(device, dev_name(dev));
66 ),
67
68 TP_printk("IOMMU: device=%s", __get_str(device)
69 )
70);
71
72DEFINE_EVENT(iommu_device_event, attach_device_to_domain,
73
74 TP_PROTO(struct device *dev),
75
76 TP_ARGS(dev)
77);
78
79DEFINE_EVENT(iommu_device_event, detach_device_from_domain,
80
81 TP_PROTO(struct device *dev),
82
83 TP_ARGS(dev)
84);
85
86DECLARE_EVENT_CLASS(iommu_map_unmap,
87
88 TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
89
90 TP_ARGS(iova, paddr, size),
91
92 TP_STRUCT__entry(
93 __field(u64, iova)
94 __field(u64, paddr)
95 __field(int, size)
96 ),
97
98 TP_fast_assign(
99 __entry->iova = iova;
100 __entry->paddr = paddr;
101 __entry->size = size;
102 ),
103
104 TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=0x%x",
105 __entry->iova, __entry->paddr, __entry->size
106 )
107);
108
109DEFINE_EVENT(iommu_map_unmap, map,
110
111 TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
112
113 TP_ARGS(iova, paddr, size)
114);
115
116DEFINE_EVENT_PRINT(iommu_map_unmap, unmap,
117
118 TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
119
120 TP_ARGS(iova, paddr, size),
121
122 TP_printk("IOMMU: iova=0x%016llx size=0x%x",
123 __entry->iova, __entry->size
124 )
125);
126
127DECLARE_EVENT_CLASS(iommu_error,
128
129 TP_PROTO(struct device *dev, unsigned long iova, int flags),
130
131 TP_ARGS(dev, iova, flags),
132
133 TP_STRUCT__entry(
134 __string(device, dev_name(dev))
135 __string(driver, dev_driver_string(dev))
136 __field(u64, iova)
137 __field(int, flags)
138 ),
139
140 TP_fast_assign(
141 __assign_str(device, dev_name(dev));
142 __assign_str(driver, dev_driver_string(dev));
143 __entry->iova = iova;
144 __entry->flags = flags;
145 ),
146
147 TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
148 __get_str(driver), __get_str(device),
149 __entry->iova, __entry->flags
150 )
151);
152
153DEFINE_EVENT(iommu_error, io_page_fault,
154
155 TP_PROTO(struct device *dev, unsigned long iova, int flags),
156
157 TP_ARGS(dev, iova, flags)
158);
159#endif /* _TRACE_IOMMU_H */
160
161/* This part must be outside protection */
162#include <trace/define_trace.h>
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 6bc943ecb841..aece1346ceb7 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -267,12 +267,12 @@ DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
267TRACE_EVENT(mm_page_alloc_extfrag, 267TRACE_EVENT(mm_page_alloc_extfrag,
268 268
269 TP_PROTO(struct page *page, 269 TP_PROTO(struct page *page,
270 int alloc_order, int fallback_order, 270 int alloc_order, int fallback_order,
271 int alloc_migratetype, int fallback_migratetype), 271 int alloc_migratetype, int fallback_migratetype, int new_migratetype),
272 272
273 TP_ARGS(page, 273 TP_ARGS(page,
274 alloc_order, fallback_order, 274 alloc_order, fallback_order,
275 alloc_migratetype, fallback_migratetype), 275 alloc_migratetype, fallback_migratetype, new_migratetype),
276 276
277 TP_STRUCT__entry( 277 TP_STRUCT__entry(
278 __field( struct page *, page ) 278 __field( struct page *, page )
@@ -280,6 +280,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
280 __field( int, fallback_order ) 280 __field( int, fallback_order )
281 __field( int, alloc_migratetype ) 281 __field( int, alloc_migratetype )
282 __field( int, fallback_migratetype ) 282 __field( int, fallback_migratetype )
283 __field( int, change_ownership )
283 ), 284 ),
284 285
285 TP_fast_assign( 286 TP_fast_assign(
@@ -288,6 +289,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
288 __entry->fallback_order = fallback_order; 289 __entry->fallback_order = fallback_order;
289 __entry->alloc_migratetype = alloc_migratetype; 290 __entry->alloc_migratetype = alloc_migratetype;
290 __entry->fallback_migratetype = fallback_migratetype; 291 __entry->fallback_migratetype = fallback_migratetype;
292 __entry->change_ownership = (new_migratetype == alloc_migratetype);
291 ), 293 ),
292 294
293 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", 295 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
@@ -299,7 +301,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
299 __entry->alloc_migratetype, 301 __entry->alloc_migratetype,
300 __entry->fallback_migratetype, 302 __entry->fallback_migratetype,
301 __entry->fallback_order < pageblock_order, 303 __entry->fallback_order < pageblock_order,
302 __entry->alloc_migratetype == __entry->fallback_migratetype) 304 __entry->change_ownership)
303); 305);
304 306
305#endif /* _TRACE_KMEM_H */ 307#endif /* _TRACE_KMEM_H */
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 7005d1109ec9..131a0bda7aec 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -296,23 +296,21 @@ DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
296 296
297TRACE_EVENT( 297TRACE_EVENT(
298 kvm_async_pf_completed, 298 kvm_async_pf_completed,
299 TP_PROTO(unsigned long address, struct page *page, u64 gva), 299 TP_PROTO(unsigned long address, u64 gva),
300 TP_ARGS(address, page, gva), 300 TP_ARGS(address, gva),
301 301
302 TP_STRUCT__entry( 302 TP_STRUCT__entry(
303 __field(unsigned long, address) 303 __field(unsigned long, address)
304 __field(pfn_t, pfn)
305 __field(u64, gva) 304 __field(u64, gva)
306 ), 305 ),
307 306
308 TP_fast_assign( 307 TP_fast_assign(
309 __entry->address = address; 308 __entry->address = address;
310 __entry->pfn = page ? page_to_pfn(page) : 0;
311 __entry->gva = gva; 309 __entry->gva = gva;
312 ), 310 ),
313 311
314 TP_printk("gva %#llx address %#lx pfn %#llx", __entry->gva, 312 TP_printk("gva %#llx address %#lx", __entry->gva,
315 __entry->address, __entry->pfn) 313 __entry->address)
316); 314);
317 315
318#endif 316#endif
diff --git a/include/trace/events/power_cpu_migrate.h b/include/trace/events/power_cpu_migrate.h
new file mode 100644
index 000000000000..f76dd4de625e
--- /dev/null
+++ b/include/trace/events/power_cpu_migrate.h
@@ -0,0 +1,67 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM power
3
4#if !defined(_TRACE_POWER_CPU_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_POWER_CPU_MIGRATE_H
6
7#include <linux/tracepoint.h>
8
9#define __cpu_migrate_proto \
10 TP_PROTO(u64 timestamp, \
11 u32 cpu_hwid)
12#define __cpu_migrate_args \
13 TP_ARGS(timestamp, \
14 cpu_hwid)
15
16DECLARE_EVENT_CLASS(cpu_migrate,
17
18 __cpu_migrate_proto,
19 __cpu_migrate_args,
20
21 TP_STRUCT__entry(
22 __field(u64, timestamp )
23 __field(u32, cpu_hwid )
24 ),
25
26 TP_fast_assign(
27 __entry->timestamp = timestamp;
28 __entry->cpu_hwid = cpu_hwid;
29 ),
30
31 TP_printk("timestamp=%llu cpu_hwid=0x%08lX",
32 (unsigned long long)__entry->timestamp,
33 (unsigned long)__entry->cpu_hwid
34 )
35);
36
37#define __define_cpu_migrate_event(name) \
38 DEFINE_EVENT(cpu_migrate, cpu_migrate_##name, \
39 __cpu_migrate_proto, \
40 __cpu_migrate_args \
41 )
42
43__define_cpu_migrate_event(begin);
44__define_cpu_migrate_event(finish);
45__define_cpu_migrate_event(current);
46
47#undef __define_cpu_migrate
48#undef __cpu_migrate_proto
49#undef __cpu_migrate_args
50
51/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
52#ifndef _PWR_CPU_MIGRATE_EVENT_AVOID_DOUBLE_DEFINING
53#define _PWR_CPU_MIGRATE_EVENT_AVOID_DOUBLE_DEFINING
54
55/*
56 * Set from_phys_cpu and to_phys_cpu to CPU_MIGRATE_ALL_CPUS to indicate
57 * a whole-cluster migration:
58 */
59#define CPU_MIGRATE_ALL_CPUS 0x80000000U
60#endif
61
62#endif /* _TRACE_POWER_CPU_MIGRATE_H */
63
64/* This part must be outside protection */
65#undef TRACE_INCLUDE_FILE
66#define TRACE_INCLUDE_FILE power_cpu_migrate
67#include <trace/define_trace.h>
diff --git a/include/trace/events/random.h b/include/trace/events/random.h
index 422df19de732..805af6db41cc 100644
--- a/include/trace/events/random.h
+++ b/include/trace/events/random.h
@@ -7,6 +7,25 @@
7#include <linux/writeback.h> 7#include <linux/writeback.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10TRACE_EVENT(add_device_randomness,
11 TP_PROTO(int bytes, unsigned long IP),
12
13 TP_ARGS(bytes, IP),
14
15 TP_STRUCT__entry(
16 __field( int, bytes )
17 __field(unsigned long, IP )
18 ),
19
20 TP_fast_assign(
21 __entry->bytes = bytes;
22 __entry->IP = IP;
23 ),
24
25 TP_printk("bytes %d caller %pF",
26 __entry->bytes, (void *)__entry->IP)
27);
28
10DECLARE_EVENT_CLASS(random__mix_pool_bytes, 29DECLARE_EVENT_CLASS(random__mix_pool_bytes,
11 TP_PROTO(const char *pool_name, int bytes, unsigned long IP), 30 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
12 31
@@ -68,7 +87,112 @@ TRACE_EVENT(credit_entropy_bits,
68 (void *)__entry->IP) 87 (void *)__entry->IP)
69); 88);
70 89
71TRACE_EVENT(get_random_bytes, 90TRACE_EVENT(push_to_pool,
91 TP_PROTO(const char *pool_name, int pool_bits, int input_bits),
92
93 TP_ARGS(pool_name, pool_bits, input_bits),
94
95 TP_STRUCT__entry(
96 __field( const char *, pool_name )
97 __field( int, pool_bits )
98 __field( int, input_bits )
99 ),
100
101 TP_fast_assign(
102 __entry->pool_name = pool_name;
103 __entry->pool_bits = pool_bits;
104 __entry->input_bits = input_bits;
105 ),
106
107 TP_printk("%s: pool_bits %d input_pool_bits %d",
108 __entry->pool_name, __entry->pool_bits,
109 __entry->input_bits)
110);
111
112TRACE_EVENT(debit_entropy,
113 TP_PROTO(const char *pool_name, int debit_bits),
114
115 TP_ARGS(pool_name, debit_bits),
116
117 TP_STRUCT__entry(
118 __field( const char *, pool_name )
119 __field( int, debit_bits )
120 ),
121
122 TP_fast_assign(
123 __entry->pool_name = pool_name;
124 __entry->debit_bits = debit_bits;
125 ),
126
127 TP_printk("%s: debit_bits %d", __entry->pool_name,
128 __entry->debit_bits)
129);
130
131TRACE_EVENT(add_input_randomness,
132 TP_PROTO(int input_bits),
133
134 TP_ARGS(input_bits),
135
136 TP_STRUCT__entry(
137 __field( int, input_bits )
138 ),
139
140 TP_fast_assign(
141 __entry->input_bits = input_bits;
142 ),
143
144 TP_printk("input_pool_bits %d", __entry->input_bits)
145);
146
147TRACE_EVENT(add_disk_randomness,
148 TP_PROTO(dev_t dev, int input_bits),
149
150 TP_ARGS(dev, input_bits),
151
152 TP_STRUCT__entry(
153 __field( dev_t, dev )
154 __field( int, input_bits )
155 ),
156
157 TP_fast_assign(
158 __entry->dev = dev;
159 __entry->input_bits = input_bits;
160 ),
161
162 TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev),
163 MINOR(__entry->dev), __entry->input_bits)
164);
165
166TRACE_EVENT(xfer_secondary_pool,
167 TP_PROTO(const char *pool_name, int xfer_bits, int request_bits,
168 int pool_entropy, int input_entropy),
169
170 TP_ARGS(pool_name, xfer_bits, request_bits, pool_entropy,
171 input_entropy),
172
173 TP_STRUCT__entry(
174 __field( const char *, pool_name )
175 __field( int, xfer_bits )
176 __field( int, request_bits )
177 __field( int, pool_entropy )
178 __field( int, input_entropy )
179 ),
180
181 TP_fast_assign(
182 __entry->pool_name = pool_name;
183 __entry->xfer_bits = xfer_bits;
184 __entry->request_bits = request_bits;
185 __entry->pool_entropy = pool_entropy;
186 __entry->input_entropy = input_entropy;
187 ),
188
189 TP_printk("pool %s xfer_bits %d request_bits %d pool_entropy %d "
190 "input_entropy %d", __entry->pool_name, __entry->xfer_bits,
191 __entry->request_bits, __entry->pool_entropy,
192 __entry->input_entropy)
193);
194
195DECLARE_EVENT_CLASS(random__get_random_bytes,
72 TP_PROTO(int nbytes, unsigned long IP), 196 TP_PROTO(int nbytes, unsigned long IP),
73 197
74 TP_ARGS(nbytes, IP), 198 TP_ARGS(nbytes, IP),
@@ -86,6 +210,18 @@ TRACE_EVENT(get_random_bytes,
86 TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP) 210 TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP)
87); 211);
88 212
213DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
214 TP_PROTO(int nbytes, unsigned long IP),
215
216 TP_ARGS(nbytes, IP)
217);
218
219DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
220 TP_PROTO(int nbytes, unsigned long IP),
221
222 TP_ARGS(nbytes, IP)
223);
224
89DECLARE_EVENT_CLASS(random__extract_entropy, 225DECLARE_EVENT_CLASS(random__extract_entropy,
90 TP_PROTO(const char *pool_name, int nbytes, int entropy_count, 226 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
91 unsigned long IP), 227 unsigned long IP),
@@ -126,7 +262,52 @@ DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
126 TP_ARGS(pool_name, nbytes, entropy_count, IP) 262 TP_ARGS(pool_name, nbytes, entropy_count, IP)
127); 263);
128 264
265TRACE_EVENT(random_read,
266 TP_PROTO(int got_bits, int need_bits, int pool_left, int input_left),
267
268 TP_ARGS(got_bits, need_bits, pool_left, input_left),
269
270 TP_STRUCT__entry(
271 __field( int, got_bits )
272 __field( int, need_bits )
273 __field( int, pool_left )
274 __field( int, input_left )
275 ),
276
277 TP_fast_assign(
278 __entry->got_bits = got_bits;
279 __entry->need_bits = need_bits;
280 __entry->pool_left = pool_left;
281 __entry->input_left = input_left;
282 ),
283
284 TP_printk("got_bits %d still_needed_bits %d "
285 "blocking_pool_entropy_left %d input_entropy_left %d",
286 __entry->got_bits, __entry->got_bits, __entry->pool_left,
287 __entry->input_left)
288);
289
290TRACE_EVENT(urandom_read,
291 TP_PROTO(int got_bits, int pool_left, int input_left),
292
293 TP_ARGS(got_bits, pool_left, input_left),
294
295 TP_STRUCT__entry(
296 __field( int, got_bits )
297 __field( int, pool_left )
298 __field( int, input_left )
299 ),
300
301 TP_fast_assign(
302 __entry->got_bits = got_bits;
303 __entry->pool_left = pool_left;
304 __entry->input_left = input_left;
305 ),
129 306
307 TP_printk("got_bits %d nonblocking_pool_entropy_left %d "
308 "input_entropy_left %d", __entry->got_bits,
309 __entry->pool_left, __entry->input_left)
310);
130 311
131#endif /* _TRACE_RANDOM_H */ 312#endif /* _TRACE_RANDOM_H */
132 313
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index ee2376cfaab3..aca382266411 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -39,15 +39,26 @@ TRACE_EVENT(rcu_utilization,
39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
40 40
41/* 41/*
42 * Tracepoint for grace-period events: starting and ending a grace 42 * Tracepoint for grace-period events. Takes a string identifying the
43 * period ("start" and "end", respectively), a CPU noting the start 43 * RCU flavor, the grace-period number, and a string identifying the
44 * of a new grace period or the end of an old grace period ("cpustart" 44 * grace-period-related event as follows:
45 * and "cpuend", respectively), a CPU passing through a quiescent 45 *
46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" 46 * "AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
47 * and "cpuofl", respectively), a CPU being kicked for being too 47 * "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
48 * long in dyntick-idle mode ("kick"), a CPU accelerating its new 48 * "newreq": Request a new grace period.
49 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU 49 * "start": Start a grace period.
50 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB"). 50 * "cpustart": CPU first notices a grace-period start.
51 * "cpuqs": CPU passes through a quiescent state.
52 * "cpuonl": CPU comes online.
53 * "cpuofl": CPU goes offline.
54 * "reqwait": GP kthread sleeps waiting for grace-period request.
55 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
56 * "fqswait": GP kthread waiting until time to force quiescent states.
57 * "fqsstart": GP kthread starts forcing quiescent states.
58 * "fqsend": GP kthread done forcing quiescent states.
59 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
60 * "end": End a grace period.
61 * "cpuend": CPU first notices a grace-period end.
51 */ 62 */
52TRACE_EVENT(rcu_grace_period, 63TRACE_EVENT(rcu_grace_period,
53 64
@@ -161,6 +172,46 @@ TRACE_EVENT(rcu_grace_period_init,
161); 172);
162 173
163/* 174/*
175 * Tracepoint for RCU no-CBs CPU callback handoffs. This event is intended
176 * to assist debugging of these handoffs.
177 *
178 * The first argument is the name of the RCU flavor, and the second is
179 * the number of the offloaded CPU are extracted. The third and final
180 * argument is a string as follows:
181 *
182 * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
183 * "WakeOvf": Wake rcuo kthread, CB list is huge.
184 * "WakeNot": Don't wake rcuo kthread.
185 * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
186 * "Poll": Start of new polling cycle for rcu_nocb_poll.
187 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
188 * "WokeEmpty": rcuo kthread woke to find empty list.
189 * "WokeNonEmpty": rcuo kthread woke to find non-empty list.
190 * "WaitQueue": Enqueue partially done, timed wait for it to complete.
191 * "WokeQueue": Partial enqueue now complete.
192 */
193TRACE_EVENT(rcu_nocb_wake,
194
195 TP_PROTO(const char *rcuname, int cpu, const char *reason),
196
197 TP_ARGS(rcuname, cpu, reason),
198
199 TP_STRUCT__entry(
200 __field(const char *, rcuname)
201 __field(int, cpu)
202 __field(const char *, reason)
203 ),
204
205 TP_fast_assign(
206 __entry->rcuname = rcuname;
207 __entry->cpu = cpu;
208 __entry->reason = reason;
209 ),
210
211 TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
212);
213
214/*
164 * Tracepoint for tasks blocking within preemptible-RCU read-side 215 * Tracepoint for tasks blocking within preemptible-RCU read-side
165 * critical sections. Track the type of RCU (which one day might 216 * critical sections. Track the type of RCU (which one day might
166 * include SRCU), the grace-period number that the task is blocking 217 * include SRCU), the grace-period number that the task is blocking
@@ -540,17 +591,17 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
540TRACE_EVENT(rcu_batch_end, 591TRACE_EVENT(rcu_batch_end,
541 592
542 TP_PROTO(const char *rcuname, int callbacks_invoked, 593 TP_PROTO(const char *rcuname, int callbacks_invoked,
543 bool cb, bool nr, bool iit, bool risk), 594 char cb, char nr, char iit, char risk),
544 595
545 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), 596 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
546 597
547 TP_STRUCT__entry( 598 TP_STRUCT__entry(
548 __field(const char *, rcuname) 599 __field(const char *, rcuname)
549 __field(int, callbacks_invoked) 600 __field(int, callbacks_invoked)
550 __field(bool, cb) 601 __field(char, cb)
551 __field(bool, nr) 602 __field(char, nr)
552 __field(bool, iit) 603 __field(char, iit)
553 __field(bool, risk) 604 __field(char, risk)
554 ), 605 ),
555 606
556 TP_fast_assign( 607 TP_fast_assign(
@@ -656,6 +707,7 @@ TRACE_EVENT(rcu_barrier,
656#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \ 707#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
657 level, grplo, grphi, event) \ 708 level, grplo, grphi, event) \
658 do { } while (0) 709 do { } while (0)
710#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
659#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) 711#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
660#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 712#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
661#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ 713#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 2e7d9947a10d..04c308413a5d 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
100 /* 100 /*
101 * For all intents and purposes a preempted task is a running task. 101 * For all intents and purposes a preempted task is a running task.
102 */ 102 */
103 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE) 103 if (task_preempt_count(p) & PREEMPT_ACTIVE)
104 state = TASK_RUNNING | TASK_STATE_MAX; 104 state = TASK_RUNNING | TASK_STATE_MAX;
105#endif 105#endif
106 106
@@ -424,6 +424,25 @@ TRACE_EVENT(sched_pi_setprio,
424 __entry->oldprio, __entry->newprio) 424 __entry->oldprio, __entry->newprio)
425); 425);
426 426
427#ifdef CONFIG_DETECT_HUNG_TASK
428TRACE_EVENT(sched_process_hang,
429 TP_PROTO(struct task_struct *tsk),
430 TP_ARGS(tsk),
431
432 TP_STRUCT__entry(
433 __array( char, comm, TASK_COMM_LEN )
434 __field( pid_t, pid )
435 ),
436
437 TP_fast_assign(
438 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
439 __entry->pid = tsk->pid;
440 ),
441
442 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
443);
444#endif /* CONFIG_DETECT_HUNG_TASK */
445
427#endif /* _TRACE_SCHED_H */ 446#endif /* _TRACE_SCHED_H */
428 447
429/* This part must be outside protection */ 448/* This part must be outside protection */
diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h
new file mode 100644
index 000000000000..7e02c983bbe2
--- /dev/null
+++ b/include/trace/events/spi.h
@@ -0,0 +1,156 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM spi
3
4#if !defined(_TRACE_SPI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SPI_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10DECLARE_EVENT_CLASS(spi_master,
11
12 TP_PROTO(struct spi_master *master),
13
14 TP_ARGS(master),
15
16 TP_STRUCT__entry(
17 __field( int, bus_num )
18 ),
19
20 TP_fast_assign(
21 __entry->bus_num = master->bus_num;
22 ),
23
24 TP_printk("spi%d", (int)__entry->bus_num)
25
26);
27
28DEFINE_EVENT(spi_master, spi_master_idle,
29
30 TP_PROTO(struct spi_master *master),
31
32 TP_ARGS(master)
33
34);
35
36DEFINE_EVENT(spi_master, spi_master_busy,
37
38 TP_PROTO(struct spi_master *master),
39
40 TP_ARGS(master)
41
42);
43
44DECLARE_EVENT_CLASS(spi_message,
45
46 TP_PROTO(struct spi_message *msg),
47
48 TP_ARGS(msg),
49
50 TP_STRUCT__entry(
51 __field( int, bus_num )
52 __field( int, chip_select )
53 __field( struct spi_message *, msg )
54 ),
55
56 TP_fast_assign(
57 __entry->bus_num = msg->spi->master->bus_num;
58 __entry->chip_select = msg->spi->chip_select;
59 __entry->msg = msg;
60 ),
61
62 TP_printk("spi%d.%d %p", (int)__entry->bus_num,
63 (int)__entry->chip_select,
64 (struct spi_message *)__entry->msg)
65);
66
67DEFINE_EVENT(spi_message, spi_message_submit,
68
69 TP_PROTO(struct spi_message *msg),
70
71 TP_ARGS(msg)
72
73);
74
75DEFINE_EVENT(spi_message, spi_message_start,
76
77 TP_PROTO(struct spi_message *msg),
78
79 TP_ARGS(msg)
80
81);
82
83TRACE_EVENT(spi_message_done,
84
85 TP_PROTO(struct spi_message *msg),
86
87 TP_ARGS(msg),
88
89 TP_STRUCT__entry(
90 __field( int, bus_num )
91 __field( int, chip_select )
92 __field( struct spi_message *, msg )
93 __field( unsigned, frame )
94 __field( unsigned, actual )
95 ),
96
97 TP_fast_assign(
98 __entry->bus_num = msg->spi->master->bus_num;
99 __entry->chip_select = msg->spi->chip_select;
100 __entry->msg = msg;
101 __entry->frame = msg->frame_length;
102 __entry->actual = msg->actual_length;
103 ),
104
105 TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num,
106 (int)__entry->chip_select,
107 (struct spi_message *)__entry->msg,
108 (unsigned)__entry->actual, (unsigned)__entry->frame)
109);
110
111DECLARE_EVENT_CLASS(spi_transfer,
112
113 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
114
115 TP_ARGS(msg, xfer),
116
117 TP_STRUCT__entry(
118 __field( int, bus_num )
119 __field( int, chip_select )
120 __field( struct spi_transfer *, xfer )
121 __field( int, len )
122 ),
123
124 TP_fast_assign(
125 __entry->bus_num = msg->spi->master->bus_num;
126 __entry->chip_select = msg->spi->chip_select;
127 __entry->xfer = xfer;
128 __entry->len = xfer->len;
129 ),
130
131 TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num,
132 (int)__entry->chip_select,
133 (struct spi_message *)__entry->xfer,
134 (int)__entry->len)
135);
136
137DEFINE_EVENT(spi_transfer, spi_transfer_start,
138
139 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
140
141 TP_ARGS(msg, xfer)
142
143);
144
145DEFINE_EVENT(spi_transfer, spi_transfer_stop,
146
147 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
148
149 TP_ARGS(msg, xfer)
150
151);
152
153#endif /* _TRACE_POWER_H */
154
155/* This part must be outside protection */
156#include <trace/define_trace.h>
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 43be87d5dd58..d51d16c7afd8 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -6,6 +6,8 @@
6 6
7#include <linux/sunrpc/sched.h> 7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h> 8#include <linux/sunrpc/clnt.h>
9#include <net/tcp_states.h>
10#include <linux/net.h>
9#include <linux/tracepoint.h> 11#include <linux/tracepoint.h>
10 12
11DECLARE_EVENT_CLASS(rpc_task_status, 13DECLARE_EVENT_CLASS(rpc_task_status,
@@ -15,18 +17,20 @@ DECLARE_EVENT_CLASS(rpc_task_status,
15 TP_ARGS(task), 17 TP_ARGS(task),
16 18
17 TP_STRUCT__entry( 19 TP_STRUCT__entry(
18 __field(const struct rpc_task *, task) 20 __field(unsigned int, task_id)
19 __field(const struct rpc_clnt *, clnt) 21 __field(unsigned int, client_id)
20 __field(int, status) 22 __field(int, status)
21 ), 23 ),
22 24
23 TP_fast_assign( 25 TP_fast_assign(
24 __entry->task = task; 26 __entry->task_id = task->tk_pid;
25 __entry->clnt = task->tk_client; 27 __entry->client_id = task->tk_client->cl_clid;
26 __entry->status = task->tk_status; 28 __entry->status = task->tk_status;
27 ), 29 ),
28 30
29 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) 31 TP_printk("task:%u@%u, status %d",
32 __entry->task_id, __entry->client_id,
33 __entry->status)
30); 34);
31 35
32DEFINE_EVENT(rpc_task_status, rpc_call_status, 36DEFINE_EVENT(rpc_task_status, rpc_call_status,
@@ -47,18 +51,20 @@ TRACE_EVENT(rpc_connect_status,
47 TP_ARGS(task, status), 51 TP_ARGS(task, status),
48 52
49 TP_STRUCT__entry( 53 TP_STRUCT__entry(
50 __field(const struct rpc_task *, task) 54 __field(unsigned int, task_id)
51 __field(const struct rpc_clnt *, clnt) 55 __field(unsigned int, client_id)
52 __field(int, status) 56 __field(int, status)
53 ), 57 ),
54 58
55 TP_fast_assign( 59 TP_fast_assign(
56 __entry->task = task; 60 __entry->task_id = task->tk_pid;
57 __entry->clnt = task->tk_client; 61 __entry->client_id = task->tk_client->cl_clid;
58 __entry->status = status; 62 __entry->status = status;
59 ), 63 ),
60 64
61 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status) 65 TP_printk("task:%u@%u, status %d",
66 __entry->task_id, __entry->client_id,
67 __entry->status)
62); 68);
63 69
64DECLARE_EVENT_CLASS(rpc_task_running, 70DECLARE_EVENT_CLASS(rpc_task_running,
@@ -68,8 +74,8 @@ DECLARE_EVENT_CLASS(rpc_task_running,
68 TP_ARGS(clnt, task, action), 74 TP_ARGS(clnt, task, action),
69 75
70 TP_STRUCT__entry( 76 TP_STRUCT__entry(
71 __field(const struct rpc_clnt *, clnt) 77 __field(unsigned int, task_id)
72 __field(const struct rpc_task *, task) 78 __field(unsigned int, client_id)
73 __field(const void *, action) 79 __field(const void *, action)
74 __field(unsigned long, runstate) 80 __field(unsigned long, runstate)
75 __field(int, status) 81 __field(int, status)
@@ -77,17 +83,16 @@ DECLARE_EVENT_CLASS(rpc_task_running,
77 ), 83 ),
78 84
79 TP_fast_assign( 85 TP_fast_assign(
80 __entry->clnt = clnt; 86 __entry->client_id = clnt->cl_clid;
81 __entry->task = task; 87 __entry->task_id = task->tk_pid;
82 __entry->action = action; 88 __entry->action = action;
83 __entry->runstate = task->tk_runstate; 89 __entry->runstate = task->tk_runstate;
84 __entry->status = task->tk_status; 90 __entry->status = task->tk_status;
85 __entry->flags = task->tk_flags; 91 __entry->flags = task->tk_flags;
86 ), 92 ),
87 93
88 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf", 94 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d action=%pf",
89 __entry->task, 95 __entry->task_id, __entry->client_id,
90 __entry->clnt,
91 __entry->flags, 96 __entry->flags,
92 __entry->runstate, 97 __entry->runstate,
93 __entry->status, 98 __entry->status,
@@ -126,8 +131,8 @@ DECLARE_EVENT_CLASS(rpc_task_queued,
126 TP_ARGS(clnt, task, q), 131 TP_ARGS(clnt, task, q),
127 132
128 TP_STRUCT__entry( 133 TP_STRUCT__entry(
129 __field(const struct rpc_clnt *, clnt) 134 __field(unsigned int, task_id)
130 __field(const struct rpc_task *, task) 135 __field(unsigned int, client_id)
131 __field(unsigned long, timeout) 136 __field(unsigned long, timeout)
132 __field(unsigned long, runstate) 137 __field(unsigned long, runstate)
133 __field(int, status) 138 __field(int, status)
@@ -136,8 +141,8 @@ DECLARE_EVENT_CLASS(rpc_task_queued,
136 ), 141 ),
137 142
138 TP_fast_assign( 143 TP_fast_assign(
139 __entry->clnt = clnt; 144 __entry->client_id = clnt->cl_clid;
140 __entry->task = task; 145 __entry->task_id = task->tk_pid;
141 __entry->timeout = task->tk_timeout; 146 __entry->timeout = task->tk_timeout;
142 __entry->runstate = task->tk_runstate; 147 __entry->runstate = task->tk_runstate;
143 __entry->status = task->tk_status; 148 __entry->status = task->tk_status;
@@ -145,9 +150,8 @@ DECLARE_EVENT_CLASS(rpc_task_queued,
145 __assign_str(q_name, rpc_qname(q)); 150 __assign_str(q_name, rpc_qname(q));
146 ), 151 ),
147 152
148 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s", 153 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
149 __entry->task, 154 __entry->task_id, __entry->client_id,
150 __entry->clnt,
151 __entry->flags, 155 __entry->flags,
152 __entry->runstate, 156 __entry->runstate,
153 __entry->status, 157 __entry->status,
@@ -172,6 +176,135 @@ DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
172 176
173); 177);
174 178
179#define rpc_show_socket_state(state) \
180 __print_symbolic(state, \
181 { SS_FREE, "FREE" }, \
182 { SS_UNCONNECTED, "UNCONNECTED" }, \
183 { SS_CONNECTING, "CONNECTING," }, \
184 { SS_CONNECTED, "CONNECTED," }, \
185 { SS_DISCONNECTING, "DISCONNECTING" })
186
187#define rpc_show_sock_state(state) \
188 __print_symbolic(state, \
189 { TCP_ESTABLISHED, "ESTABLISHED" }, \
190 { TCP_SYN_SENT, "SYN_SENT" }, \
191 { TCP_SYN_RECV, "SYN_RECV" }, \
192 { TCP_FIN_WAIT1, "FIN_WAIT1" }, \
193 { TCP_FIN_WAIT2, "FIN_WAIT2" }, \
194 { TCP_TIME_WAIT, "TIME_WAIT" }, \
195 { TCP_CLOSE, "CLOSE" }, \
196 { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \
197 { TCP_LAST_ACK, "LAST_ACK" }, \
198 { TCP_LISTEN, "LISTEN" }, \
199 { TCP_CLOSING, "CLOSING" })
200
201DECLARE_EVENT_CLASS(xs_socket_event,
202
203 TP_PROTO(
204 struct rpc_xprt *xprt,
205 struct socket *socket
206 ),
207
208 TP_ARGS(xprt, socket),
209
210 TP_STRUCT__entry(
211 __field(unsigned int, socket_state)
212 __field(unsigned int, sock_state)
213 __field(unsigned long long, ino)
214 __string(dstaddr,
215 xprt->address_strings[RPC_DISPLAY_ADDR])
216 __string(dstport,
217 xprt->address_strings[RPC_DISPLAY_PORT])
218 ),
219
220 TP_fast_assign(
221 struct inode *inode = SOCK_INODE(socket);
222 __entry->socket_state = socket->state;
223 __entry->sock_state = socket->sk->sk_state;
224 __entry->ino = (unsigned long long)inode->i_ino;
225 __assign_str(dstaddr,
226 xprt->address_strings[RPC_DISPLAY_ADDR]);
227 __assign_str(dstport,
228 xprt->address_strings[RPC_DISPLAY_PORT]);
229 ),
230
231 TP_printk(
232 "socket:[%llu] dstaddr=%s/%s "
233 "state=%u (%s) sk_state=%u (%s)",
234 __entry->ino, __get_str(dstaddr), __get_str(dstport),
235 __entry->socket_state,
236 rpc_show_socket_state(__entry->socket_state),
237 __entry->sock_state,
238 rpc_show_sock_state(__entry->sock_state)
239 )
240);
241#define DEFINE_RPC_SOCKET_EVENT(name) \
242 DEFINE_EVENT(xs_socket_event, name, \
243 TP_PROTO( \
244 struct rpc_xprt *xprt, \
245 struct socket *socket \
246 ), \
247 TP_ARGS(xprt, socket))
248
249DECLARE_EVENT_CLASS(xs_socket_event_done,
250
251 TP_PROTO(
252 struct rpc_xprt *xprt,
253 struct socket *socket,
254 int error
255 ),
256
257 TP_ARGS(xprt, socket, error),
258
259 TP_STRUCT__entry(
260 __field(int, error)
261 __field(unsigned int, socket_state)
262 __field(unsigned int, sock_state)
263 __field(unsigned long long, ino)
264 __string(dstaddr,
265 xprt->address_strings[RPC_DISPLAY_ADDR])
266 __string(dstport,
267 xprt->address_strings[RPC_DISPLAY_PORT])
268 ),
269
270 TP_fast_assign(
271 struct inode *inode = SOCK_INODE(socket);
272 __entry->socket_state = socket->state;
273 __entry->sock_state = socket->sk->sk_state;
274 __entry->ino = (unsigned long long)inode->i_ino;
275 __entry->error = error;
276 __assign_str(dstaddr,
277 xprt->address_strings[RPC_DISPLAY_ADDR]);
278 __assign_str(dstport,
279 xprt->address_strings[RPC_DISPLAY_PORT]);
280 ),
281
282 TP_printk(
283 "error=%d socket:[%llu] dstaddr=%s/%s "
284 "state=%u (%s) sk_state=%u (%s)",
285 __entry->error,
286 __entry->ino, __get_str(dstaddr), __get_str(dstport),
287 __entry->socket_state,
288 rpc_show_socket_state(__entry->socket_state),
289 __entry->sock_state,
290 rpc_show_sock_state(__entry->sock_state)
291 )
292);
293#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
294 DEFINE_EVENT(xs_socket_event_done, name, \
295 TP_PROTO( \
296 struct rpc_xprt *xprt, \
297 struct socket *socket, \
298 int error \
299 ), \
300 TP_ARGS(xprt, socket, error))
301
302DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
303DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
304DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
305DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
306DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
307
175#endif /* _TRACE_SUNRPC_H */ 308#endif /* _TRACE_SUNRPC_H */
176 309
177#include <trace/define_trace.h> 310#include <trace/define_trace.h>
diff --git a/include/trace/events/swiotlb.h b/include/trace/events/swiotlb.h
new file mode 100644
index 000000000000..7ea4c5e7c448
--- /dev/null
+++ b/include/trace/events/swiotlb.h
@@ -0,0 +1,46 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM swiotlb
3
4#if !defined(_TRACE_SWIOTLB_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SWIOTLB_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(swiotlb_bounced,
10
11 TP_PROTO(struct device *dev,
12 dma_addr_t dev_addr,
13 size_t size,
14 int swiotlb_force),
15
16 TP_ARGS(dev, dev_addr, size, swiotlb_force),
17
18 TP_STRUCT__entry(
19 __string( dev_name, dev_name(dev) )
20 __field( u64, dma_mask )
21 __field( dma_addr_t, dev_addr )
22 __field( size_t, size )
23 __field( int, swiotlb_force )
24 ),
25
26 TP_fast_assign(
27 __assign_str(dev_name, dev_name(dev));
28 __entry->dma_mask = (dev->dma_mask ? *dev->dma_mask : 0);
29 __entry->dev_addr = dev_addr;
30 __entry->size = size;
31 __entry->swiotlb_force = swiotlb_force;
32 ),
33
34 TP_printk("dev_name: %s dma_mask=%llx dev_addr=%llx "
35 "size=%zu %s",
36 __get_str(dev_name),
37 __entry->dma_mask,
38 (unsigned long long)__entry->dev_addr,
39 __entry->size,
40 __entry->swiotlb_force ? "swiotlb_force" : "" )
41);
42
43#endif /* _TRACE_SWIOTLB_H */
44
45/* This part must be outside protection */
46#include <trace/define_trace.h>
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
index aef8fc354025..da9cc0f05c93 100644
--- a/include/trace/events/target.h
+++ b/include/trace/events/target.h
@@ -144,7 +144,7 @@ TRACE_EVENT(target_sequencer_start,
144 ), 144 ),
145 145
146 TP_fast_assign( 146 TP_fast_assign(
147 __entry->unpacked_lun = cmd->se_lun->unpacked_lun; 147 __entry->unpacked_lun = cmd->orig_fe_lun;
148 __entry->opcode = cmd->t_task_cdb[0]; 148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length; 149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr; 150 __entry->task_attribute = cmd->sam_task_attr;
@@ -182,7 +182,7 @@ TRACE_EVENT(target_cmd_complete,
182 ), 182 ),
183 183
184 TP_fast_assign( 184 TP_fast_assign(
185 __entry->unpacked_lun = cmd->se_lun->unpacked_lun; 185 __entry->unpacked_lun = cmd->orig_fe_lun;
186 __entry->opcode = cmd->t_task_cdb[0]; 186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length; 187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr; 188 __entry->task_attribute = cmd->sam_task_attr;
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index 63cfcccaebb3..132a985aba8b 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -202,7 +202,7 @@ TRACE_EVENT(mm_shrink_slab_start,
202 202
203 TP_fast_assign( 203 TP_fast_assign(
204 __entry->shr = shr; 204 __entry->shr = shr;
205 __entry->shrink = shr->shrink; 205 __entry->shrink = shr->scan_objects;
206 __entry->nr_objects_to_shrink = nr_objects_to_shrink; 206 __entry->nr_objects_to_shrink = nr_objects_to_shrink;
207 __entry->gfp_flags = sc->gfp_mask; 207 __entry->gfp_flags = sc->gfp_mask;
208 __entry->pgs_scanned = pgs_scanned; 208 __entry->pgs_scanned = pgs_scanned;
@@ -241,7 +241,7 @@ TRACE_EVENT(mm_shrink_slab_end,
241 241
242 TP_fast_assign( 242 TP_fast_assign(
243 __entry->shr = shr; 243 __entry->shr = shr;
244 __entry->shrink = shr->shrink; 244 __entry->shrink = shr->scan_objects;
245 __entry->unused_scan = unused_scan_cnt; 245 __entry->unused_scan = unused_scan_cnt;
246 __entry->new_scan = new_scan_cnt; 246 __entry->new_scan = new_scan_cnt;
247 __entry->retval = shrinker_retval; 247 __entry->retval = shrinker_retval;
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 464ea82e10db..c7bbbe794e65 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -287,11 +287,11 @@ TRACE_EVENT(writeback_queue_io,
287 __field(int, reason) 287 __field(int, reason)
288 ), 288 ),
289 TP_fast_assign( 289 TP_fast_assign(
290 unsigned long *older_than_this = work->older_than_this; 290 unsigned long older_than_this = work->older_than_this;
291 strncpy(__entry->name, dev_name(wb->bdi->dev), 32); 291 strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
292 __entry->older = older_than_this ? *older_than_this : 0; 292 __entry->older = older_than_this;
293 __entry->age = older_than_this ? 293 __entry->age = older_than_this ?
294 (jiffies - *older_than_this) * 1000 / HZ : -1; 294 (jiffies - older_than_this) * 1000 / HZ : -1;
295 __entry->moved = moved; 295 __entry->moved = moved;
296 __entry->reason = work->reason; 296 __entry->reason = work->reason;
297 ), 297 ),
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 5c7ab17cbb02..5c38606613d8 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -90,6 +90,10 @@
90#define TRACE_EVENT_FLAGS(name, value) \ 90#define TRACE_EVENT_FLAGS(name, value) \
91 __TRACE_EVENT_FLAGS(name, value) 91 __TRACE_EVENT_FLAGS(name, value)
92 92
93#undef TRACE_EVENT_PERF_PERM
94#define TRACE_EVENT_PERF_PERM(name, expr...) \
95 __TRACE_EVENT_PERF_PERM(name, expr)
96
93#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 97#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
94 98
95 99
@@ -140,6 +144,9 @@
140#undef TRACE_EVENT_FLAGS 144#undef TRACE_EVENT_FLAGS
141#define TRACE_EVENT_FLAGS(event, flag) 145#define TRACE_EVENT_FLAGS(event, flag)
142 146
147#undef TRACE_EVENT_PERF_PERM
148#define TRACE_EVENT_PERF_PERM(event, expr...)
149
143#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 150#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
144 151
145/* 152/*
@@ -372,7 +379,8 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
372 __data_size += (len) * sizeof(type); 379 __data_size += (len) * sizeof(type);
373 380
374#undef __string 381#undef __string
375#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) 382#define __string(item, src) __dynamic_array(char, item, \
383 strlen((src) ? (const char *)(src) : "(null)") + 1)
376 384
377#undef DECLARE_EVENT_CLASS 385#undef DECLARE_EVENT_CLASS
378#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 386#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
@@ -437,9 +445,8 @@ static inline notrace int ftrace_get_offsets_##call( \
437 * { <assign>; } <-- Here we assign the entries by the __field and 445 * { <assign>; } <-- Here we assign the entries by the __field and
438 * __array macros. 446 * __array macros.
439 * 447 *
440 * if (!filter_current_check_discard(buffer, event_call, entry, event)) 448 * if (!filter_check_discard(ftrace_file, entry, buffer, event))
441 * trace_nowake_buffer_unlock_commit(buffer, 449 * trace_buffer_unlock_commit(buffer, event, irq_flags, pc);
442 * event, irq_flags, pc);
443 * } 450 * }
444 * 451 *
445 * static struct trace_event ftrace_event_type_<call> = { 452 * static struct trace_event ftrace_event_type_<call> = {
@@ -502,7 +509,7 @@ static inline notrace int ftrace_get_offsets_##call( \
502 509
503#undef __assign_str 510#undef __assign_str
504#define __assign_str(dst, src) \ 511#define __assign_str(dst, src) \
505 strcpy(__get_str(dst), src); 512 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
506 513
507#undef TP_fast_assign 514#undef TP_fast_assign
508#define TP_fast_assign(args...) args 515#define TP_fast_assign(args...) args
@@ -553,7 +560,7 @@ ftrace_raw_event_##call(void *__data, proto) \
553 \ 560 \
554 { assign; } \ 561 { assign; } \
555 \ 562 \
556 if (!filter_current_check_discard(buffer, event_call, entry, event)) \ 563 if (!filter_check_discard(ftrace_file, entry, buffer, event)) \
557 trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \ 564 trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \
558} 565}
559/* 566/*
diff --git a/include/uapi/asm-generic/errno.h b/include/uapi/asm-generic/errno.h
index a1331ce50445..1e1ea6e6e7a5 100644
--- a/include/uapi/asm-generic/errno.h
+++ b/include/uapi/asm-generic/errno.h
@@ -86,7 +86,7 @@
86#define EHOSTUNREACH 113 /* No route to host */ 86#define EHOSTUNREACH 113 /* No route to host */
87#define EALREADY 114 /* Operation already in progress */ 87#define EALREADY 114 /* Operation already in progress */
88#define EINPROGRESS 115 /* Operation now in progress */ 88#define EINPROGRESS 115 /* Operation now in progress */
89#define ESTALE 116 /* Stale NFS file handle */ 89#define ESTALE 116 /* Stale file handle */
90#define EUCLEAN 117 /* Structure needs cleaning */ 90#define EUCLEAN 117 /* Structure needs cleaning */
91#define ENOTNAM 118 /* Not a XENIX named type file */ 91#define ENOTNAM 118 /* Not a XENIX named type file */
92#define ENAVAIL 119 /* No XENIX semaphores available */ 92#define ENAVAIL 119 /* No XENIX semaphores available */
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index f04b69b6abf2..38f14d0264c3 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -78,4 +78,6 @@
78 78
79#define SO_BUSY_POLL 46 79#define SO_BUSY_POLL 46
80 80
81#define SO_MAX_PACING_RATE 47
82
81#endif /* __ASM_GENERIC_SOCKET_H */ 83#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/drm/armada_drm.h b/include/uapi/drm/armada_drm.h
new file mode 100644
index 000000000000..8dec3fdc99c7
--- /dev/null
+++ b/include/uapi/drm/armada_drm.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2012 Russell King
3 * With inspiration from the i915 driver
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#ifndef DRM_ARMADA_IOCTL_H
10#define DRM_ARMADA_IOCTL_H
11
12#define DRM_ARMADA_GEM_CREATE 0x00
13#define DRM_ARMADA_GEM_MMAP 0x02
14#define DRM_ARMADA_GEM_PWRITE 0x03
15
16#define ARMADA_IOCTL(dir, name, str) \
17 DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str)
18
19struct drm_armada_gem_create {
20 uint32_t handle;
21 uint32_t size;
22};
23#define DRM_IOCTL_ARMADA_GEM_CREATE \
24 ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create)
25
26struct drm_armada_gem_mmap {
27 uint32_t handle;
28 uint32_t pad;
29 uint64_t offset;
30 uint64_t size;
31 uint64_t addr;
32};
33#define DRM_IOCTL_ARMADA_GEM_MMAP \
34 ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap)
35
36struct drm_armada_gem_pwrite {
37 uint64_t ptr;
38 uint32_t handle;
39 uint32_t offset;
40 uint32_t size;
41};
42#define DRM_IOCTL_ARMADA_GEM_PWRITE \
43 ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite)
44
45#endif
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index ece867889cc7..9b24d65fed72 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -611,12 +611,37 @@ struct drm_gem_open {
611 __u64 size; 611 __u64 size;
612}; 612};
613 613
614#define DRM_CAP_DUMB_BUFFER 0x1
615#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
616#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
617#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
618#define DRM_CAP_PRIME 0x5
619#define DRM_PRIME_CAP_IMPORT 0x1
620#define DRM_PRIME_CAP_EXPORT 0x2
621#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
622#define DRM_CAP_ASYNC_PAGE_FLIP 0x7
623
614/** DRM_IOCTL_GET_CAP ioctl argument type */ 624/** DRM_IOCTL_GET_CAP ioctl argument type */
615struct drm_get_cap { 625struct drm_get_cap {
616 __u64 capability; 626 __u64 capability;
617 __u64 value; 627 __u64 value;
618}; 628};
619 629
630/**
631 * DRM_CLIENT_CAP_STEREO_3D
632 *
633 * if set to 1, the DRM core will expose the stereo 3D capabilities of the
634 * monitor by advertising the supported 3D layouts in the flags of struct
635 * drm_mode_modeinfo.
636 */
637#define DRM_CLIENT_CAP_STEREO_3D 1
638
639/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
640struct drm_set_client_cap {
641 __u64 capability;
642 __u64 value;
643};
644
620#define DRM_CLOEXEC O_CLOEXEC 645#define DRM_CLOEXEC O_CLOEXEC
621struct drm_prime_handle { 646struct drm_prime_handle {
622 __u32 handle; 647 __u32 handle;
@@ -649,6 +674,7 @@ struct drm_prime_handle {
649#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 674#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
650#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 675#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
651#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) 676#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)
677#define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap)
652 678
653#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 679#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
654#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 680#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
@@ -774,17 +800,6 @@ struct drm_event_vblank {
774 __u32 reserved; 800 __u32 reserved;
775}; 801};
776 802
777#define DRM_CAP_DUMB_BUFFER 0x1
778#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
779#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
780#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
781#define DRM_CAP_PRIME 0x5
782#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
783#define DRM_CAP_ASYNC_PAGE_FLIP 0x7
784
785#define DRM_PRIME_CAP_IMPORT 0x1
786#define DRM_PRIME_CAP_EXPORT 0x2
787
788/* typedef area */ 803/* typedef area */
789#ifndef __KERNEL__ 804#ifndef __KERNEL__
790typedef struct drm_clip_rect drm_clip_rect_t; 805typedef struct drm_clip_rect drm_clip_rect_t;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 550811712f78..f104c2603ebe 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -44,20 +44,35 @@
44 44
45/* Video mode flags */ 45/* Video mode flags */
46/* bit compatible with the xorg definitions. */ 46/* bit compatible with the xorg definitions. */
47#define DRM_MODE_FLAG_PHSYNC (1<<0) 47#define DRM_MODE_FLAG_PHSYNC (1<<0)
48#define DRM_MODE_FLAG_NHSYNC (1<<1) 48#define DRM_MODE_FLAG_NHSYNC (1<<1)
49#define DRM_MODE_FLAG_PVSYNC (1<<2) 49#define DRM_MODE_FLAG_PVSYNC (1<<2)
50#define DRM_MODE_FLAG_NVSYNC (1<<3) 50#define DRM_MODE_FLAG_NVSYNC (1<<3)
51#define DRM_MODE_FLAG_INTERLACE (1<<4) 51#define DRM_MODE_FLAG_INTERLACE (1<<4)
52#define DRM_MODE_FLAG_DBLSCAN (1<<5) 52#define DRM_MODE_FLAG_DBLSCAN (1<<5)
53#define DRM_MODE_FLAG_CSYNC (1<<6) 53#define DRM_MODE_FLAG_CSYNC (1<<6)
54#define DRM_MODE_FLAG_PCSYNC (1<<7) 54#define DRM_MODE_FLAG_PCSYNC (1<<7)
55#define DRM_MODE_FLAG_NCSYNC (1<<8) 55#define DRM_MODE_FLAG_NCSYNC (1<<8)
56#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ 56#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
57#define DRM_MODE_FLAG_BCAST (1<<10) 57#define DRM_MODE_FLAG_BCAST (1<<10)
58#define DRM_MODE_FLAG_PIXMUX (1<<11) 58#define DRM_MODE_FLAG_PIXMUX (1<<11)
59#define DRM_MODE_FLAG_DBLCLK (1<<12) 59#define DRM_MODE_FLAG_DBLCLK (1<<12)
60#define DRM_MODE_FLAG_CLKDIV2 (1<<13) 60#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
61 /*
62 * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
63 * (define not exposed to user space).
64 */
65#define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
66#define DRM_MODE_FLAG_3D_NONE (0<<14)
67#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
68#define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)
69#define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)
70#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)
71#define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)
72#define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)
73#define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)
74#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)
75
61 76
62/* DPMS flags */ 77/* DPMS flags */
63/* bit compatible with the xorg definitions. */ 78/* bit compatible with the xorg definitions. */
@@ -165,6 +180,7 @@ struct drm_mode_get_plane_res {
165#define DRM_MODE_ENCODER_LVDS 3 180#define DRM_MODE_ENCODER_LVDS 3
166#define DRM_MODE_ENCODER_TVDAC 4 181#define DRM_MODE_ENCODER_TVDAC 4
167#define DRM_MODE_ENCODER_VIRTUAL 5 182#define DRM_MODE_ENCODER_VIRTUAL 5
183#define DRM_MODE_ENCODER_DSI 6
168 184
169struct drm_mode_get_encoder { 185struct drm_mode_get_encoder {
170 __u32 encoder_id; 186 __u32 encoder_id;
@@ -203,6 +219,7 @@ struct drm_mode_get_encoder {
203#define DRM_MODE_CONNECTOR_TV 13 219#define DRM_MODE_CONNECTOR_TV 13
204#define DRM_MODE_CONNECTOR_eDP 14 220#define DRM_MODE_CONNECTOR_eDP 14
205#define DRM_MODE_CONNECTOR_VIRTUAL 15 221#define DRM_MODE_CONNECTOR_VIRTUAL 15
222#define DRM_MODE_CONNECTOR_DSI 16
206 223
207struct drm_mode_get_connector { 224struct drm_mode_get_connector {
208 225
@@ -223,6 +240,8 @@ struct drm_mode_get_connector {
223 __u32 connection; 240 __u32 connection;
224 __u32 mm_width, mm_height; /**< HxW in millimeters */ 241 __u32 mm_width, mm_height; /**< HxW in millimeters */
225 __u32 subpixel; 242 __u32 subpixel;
243
244 __u32 pad;
226}; 245};
227 246
228#define DRM_MODE_PROP_PENDING (1<<0) 247#define DRM_MODE_PROP_PENDING (1<<0)
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 55bb5729bd78..3a4e97bd8607 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -38,10 +38,10 @@
38 * 38 *
39 * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch 39 * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch
40 * event from the gpu l3 cache. Additional information supplied is ROW, 40 * event from the gpu l3 cache. Additional information supplied is ROW,
41 * BANK, SUBBANK of the affected cacheline. Userspace should keep track of 41 * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep
42 * these events and if a specific cache-line seems to have a persistent 42 * track of these events and if a specific cache-line seems to have a
43 * error remap it with the l3 remapping tool supplied in intel-gpu-tools. 43 * persistent error remap it with the l3 remapping tool supplied in
44 * The value supplied with the event is always 1. 44 * intel-gpu-tools. The value supplied with the event is always 1.
45 * 45 *
46 * I915_ERROR_UEVENT - Generated upon error detection, currently only via 46 * I915_ERROR_UEVENT - Generated upon error detection, currently only via
47 * hangcheck. The error detection event is a good indicator of when things 47 * hangcheck. The error detection event is a good indicator of when things
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index fa8b3adf9ffb..2f3f7ea8c77b 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -981,6 +981,8 @@ struct drm_radeon_cs {
981#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16 981#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16
982/* query if CP DMA is supported on the compute ring */ 982/* query if CP DMA is supported on the compute ring */
983#define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17 983#define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17
984/* CIK macrotile mode array */
985#define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18
984 986
985 987
986struct drm_radeon_info { 988struct drm_radeon_info {
@@ -1007,4 +1009,6 @@ struct drm_radeon_info {
1007#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3 1009#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3
1008#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2 1010#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2
1009 1011
1012#define CIK_TILE_MODE_DEPTH_STENCIL_1D 5
1013
1010#endif 1014#endif
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index 73bde4eaf16c..5e1ab552cbed 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -19,6 +19,9 @@
19 19
20#include <drm/drm.h> 20#include <drm/drm.h>
21 21
22#define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
23#define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
24
22struct drm_tegra_gem_create { 25struct drm_tegra_gem_create {
23 __u64 size; 26 __u64 size;
24 __u32 flags; 27 __u32 flags;
@@ -65,6 +68,12 @@ struct drm_tegra_get_syncpt {
65 __u32 id; 68 __u32 id;
66}; 69};
67 70
71struct drm_tegra_get_syncpt_base {
72 __u64 context;
73 __u32 syncpt;
74 __u32 id;
75};
76
68struct drm_tegra_syncpt { 77struct drm_tegra_syncpt {
69 __u32 id; 78 __u32 id;
70 __u32 incrs; 79 __u32 incrs;
@@ -115,15 +124,16 @@ struct drm_tegra_submit {
115 __u32 reserved[5]; /* future expansion */ 124 __u32 reserved[5]; /* future expansion */
116}; 125};
117 126
118#define DRM_TEGRA_GEM_CREATE 0x00 127#define DRM_TEGRA_GEM_CREATE 0x00
119#define DRM_TEGRA_GEM_MMAP 0x01 128#define DRM_TEGRA_GEM_MMAP 0x01
120#define DRM_TEGRA_SYNCPT_READ 0x02 129#define DRM_TEGRA_SYNCPT_READ 0x02
121#define DRM_TEGRA_SYNCPT_INCR 0x03 130#define DRM_TEGRA_SYNCPT_INCR 0x03
122#define DRM_TEGRA_SYNCPT_WAIT 0x04 131#define DRM_TEGRA_SYNCPT_WAIT 0x04
123#define DRM_TEGRA_OPEN_CHANNEL 0x05 132#define DRM_TEGRA_OPEN_CHANNEL 0x05
124#define DRM_TEGRA_CLOSE_CHANNEL 0x06 133#define DRM_TEGRA_CLOSE_CHANNEL 0x06
125#define DRM_TEGRA_GET_SYNCPT 0x07 134#define DRM_TEGRA_GET_SYNCPT 0x07
126#define DRM_TEGRA_SUBMIT 0x08 135#define DRM_TEGRA_SUBMIT 0x08
136#define DRM_TEGRA_GET_SYNCPT_BASE 0x09
127 137
128#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) 138#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
129#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) 139#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
@@ -134,5 +144,6 @@ struct drm_tegra_submit {
134#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel) 144#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel)
135#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) 145#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
136#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) 146#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
147#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
137 148
138#endif 149#endif
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index e7c94eeb9475..33d2b8fe166d 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -241,6 +241,8 @@ header-y += media.h
241header-y += mei.h 241header-y += mei.h
242header-y += mempolicy.h 242header-y += mempolicy.h
243header-y += meye.h 243header-y += meye.h
244header-y += mic_common.h
245header-y += mic_ioctl.h
244header-y += mii.h 246header-y += mii.h
245header-y += minix_fs.h 247header-y += minix_fs.h
246header-y += mman.h 248header-y += mman.h
@@ -284,6 +286,7 @@ header-y += nfs_mount.h
284header-y += nfsacl.h 286header-y += nfsacl.h
285header-y += nl80211.h 287header-y += nl80211.h
286header-y += nubus.h 288header-y += nubus.h
289header-y += nvme.h
287header-y += nvram.h 290header-y += nvram.h
288header-y += omap3isp.h 291header-y += omap3isp.h
289header-y += omapfb.h 292header-y += omapfb.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 75cef3fd97ad..44b05a09f193 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -68,6 +68,9 @@
68#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ 68#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */
69#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ 69#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ 70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
71#define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */
72#define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */
73#define AUDIT_FEATURE_CHANGE 1020 /* audit log listing feature changes */
71 74
72#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 75#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
73#define AUDIT_USER_AVC 1107 /* We filter this differently */ 76#define AUDIT_USER_AVC 1107 /* We filter this differently */
@@ -329,7 +332,6 @@ enum {
329#define AUDIT_ARCH_ARMEB (EM_ARM) 332#define AUDIT_ARCH_ARMEB (EM_ARM)
330#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) 333#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
331#define AUDIT_ARCH_FRV (EM_FRV) 334#define AUDIT_ARCH_FRV (EM_FRV)
332#define AUDIT_ARCH_H8300 (EM_H8_300)
333#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 335#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
334#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 336#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
335#define AUDIT_ARCH_M32R (EM_M32R) 337#define AUDIT_ARCH_M32R (EM_M32R)
@@ -358,6 +360,12 @@ enum {
358#define AUDIT_PERM_READ 4 360#define AUDIT_PERM_READ 4
359#define AUDIT_PERM_ATTR 8 361#define AUDIT_PERM_ATTR 8
360 362
363/* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as:
364 * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1
365 * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad
366 */
367#define AUDIT_MESSAGE_TEXT_MAX 8560
368
361struct audit_status { 369struct audit_status {
362 __u32 mask; /* Bit mask for valid entries */ 370 __u32 mask; /* Bit mask for valid entries */
363 __u32 enabled; /* 1 = enabled, 0 = disabled */ 371 __u32 enabled; /* 1 = enabled, 0 = disabled */
@@ -369,11 +377,28 @@ struct audit_status {
369 __u32 backlog; /* messages waiting in queue */ 377 __u32 backlog; /* messages waiting in queue */
370}; 378};
371 379
380struct audit_features {
381#define AUDIT_FEATURE_VERSION 1
382 __u32 vers;
383 __u32 mask; /* which bits we are dealing with */
384 __u32 features; /* which feature to enable/disable */
385 __u32 lock; /* which features to lock */
386};
387
388#define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0
389#define AUDIT_FEATURE_LOGINUID_IMMUTABLE 1
390#define AUDIT_LAST_FEATURE AUDIT_FEATURE_LOGINUID_IMMUTABLE
391
392#define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE)
393#define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */
394
372struct audit_tty_status { 395struct audit_tty_status {
373 __u32 enabled; /* 1 = enabled, 0 = disabled */ 396 __u32 enabled; /* 1 = enabled, 0 = disabled */
374 __u32 log_passwd; /* 1 = enabled, 0 = disabled */ 397 __u32 log_passwd; /* 1 = enabled, 0 = disabled */
375}; 398};
376 399
400#define AUDIT_UID_UNSET (unsigned int)-1
401
377/* audit_rule_data supports filter rules with both integer and string 402/* audit_rule_data supports filter rules with both integer and string
378 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and 403 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
379 * AUDIT_LIST_RULES requests. 404 * AUDIT_LIST_RULES requests.
diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
new file mode 100644
index 000000000000..164a7e263988
--- /dev/null
+++ b/include/uapi/linux/bcache.h
@@ -0,0 +1,373 @@
1#ifndef _LINUX_BCACHE_H
2#define _LINUX_BCACHE_H
3
4/*
5 * Bcache on disk data structures
6 */
7
8#include <asm/types.h>
9
10#define BITMASK(name, type, field, offset, size) \
11static inline __u64 name(const type *k) \
12{ return (k->field >> offset) & ~(~0ULL << size); } \
13 \
14static inline void SET_##name(type *k, __u64 v) \
15{ \
16 k->field &= ~(~(~0ULL << size) << offset); \
17 k->field |= (v & ~(~0ULL << size)) << offset; \
18}
19
20/* Btree keys - all units are in sectors */
21
22struct bkey {
23 __u64 high;
24 __u64 low;
25 __u64 ptr[];
26};
27
28#define KEY_FIELD(name, field, offset, size) \
29 BITMASK(name, struct bkey, field, offset, size)
30
31#define PTR_FIELD(name, offset, size) \
32static inline __u64 name(const struct bkey *k, unsigned i) \
33{ return (k->ptr[i] >> offset) & ~(~0ULL << size); } \
34 \
35static inline void SET_##name(struct bkey *k, unsigned i, __u64 v) \
36{ \
37 k->ptr[i] &= ~(~(~0ULL << size) << offset); \
38 k->ptr[i] |= (v & ~(~0ULL << size)) << offset; \
39}
40
41#define KEY_SIZE_BITS 16
42
43KEY_FIELD(KEY_PTRS, high, 60, 3)
44KEY_FIELD(HEADER_SIZE, high, 58, 2)
45KEY_FIELD(KEY_CSUM, high, 56, 2)
46KEY_FIELD(KEY_PINNED, high, 55, 1)
47KEY_FIELD(KEY_DIRTY, high, 36, 1)
48
49KEY_FIELD(KEY_SIZE, high, 20, KEY_SIZE_BITS)
50KEY_FIELD(KEY_INODE, high, 0, 20)
51
52/* Next time I change the on disk format, KEY_OFFSET() won't be 64 bits */
53
54static inline __u64 KEY_OFFSET(const struct bkey *k)
55{
56 return k->low;
57}
58
59static inline void SET_KEY_OFFSET(struct bkey *k, __u64 v)
60{
61 k->low = v;
62}
63
64/*
65 * The high bit being set is a relic from when we used it to do binary
66 * searches - it told you where a key started. It's not used anymore,
67 * and can probably be safely dropped.
68 */
69#define KEY(inode, offset, size) \
70((struct bkey) { \
71 .high = (1ULL << 63) | ((__u64) (size) << 20) | (inode), \
72 .low = (offset) \
73})
74
75#define ZERO_KEY KEY(0, 0, 0)
76
77#define MAX_KEY_INODE (~(~0 << 20))
78#define MAX_KEY_OFFSET (~0ULL >> 1)
79#define MAX_KEY KEY(MAX_KEY_INODE, MAX_KEY_OFFSET, 0)
80
81#define KEY_START(k) (KEY_OFFSET(k) - KEY_SIZE(k))
82#define START_KEY(k) KEY(KEY_INODE(k), KEY_START(k), 0)
83
84#define PTR_DEV_BITS 12
85
86PTR_FIELD(PTR_DEV, 51, PTR_DEV_BITS)
87PTR_FIELD(PTR_OFFSET, 8, 43)
88PTR_FIELD(PTR_GEN, 0, 8)
89
90#define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1)
91
92#define PTR(gen, offset, dev) \
93 ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
94
95/* Bkey utility code */
96
97static inline unsigned long bkey_u64s(const struct bkey *k)
98{
99 return (sizeof(struct bkey) / sizeof(__u64)) + KEY_PTRS(k);
100}
101
102static inline unsigned long bkey_bytes(const struct bkey *k)
103{
104 return bkey_u64s(k) * sizeof(__u64);
105}
106
107#define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src))
108
109static inline void bkey_copy_key(struct bkey *dest, const struct bkey *src)
110{
111 SET_KEY_INODE(dest, KEY_INODE(src));
112 SET_KEY_OFFSET(dest, KEY_OFFSET(src));
113}
114
115static inline struct bkey *bkey_next(const struct bkey *k)
116{
117 __u64 *d = (void *) k;
118 return (struct bkey *) (d + bkey_u64s(k));
119}
120
121static inline struct bkey *bkey_last(const struct bkey *k, unsigned nr_keys)
122{
123 __u64 *d = (void *) k;
124 return (struct bkey *) (d + nr_keys);
125}
126/* Enough for a key with 6 pointers */
127#define BKEY_PAD 8
128
129#define BKEY_PADDED(key) \
130 union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; }
131
132/* Superblock */
133
134/* Version 0: Cache device
135 * Version 1: Backing device
136 * Version 2: Seed pointer into btree node checksum
137 * Version 3: Cache device with new UUID format
138 * Version 4: Backing device with data offset
139 */
140#define BCACHE_SB_VERSION_CDEV 0
141#define BCACHE_SB_VERSION_BDEV 1
142#define BCACHE_SB_VERSION_CDEV_WITH_UUID 3
143#define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
144#define BCACHE_SB_MAX_VERSION 4
145
146#define SB_SECTOR 8
147#define SB_SIZE 4096
148#define SB_LABEL_SIZE 32
149#define SB_JOURNAL_BUCKETS 256U
150/* SB_JOURNAL_BUCKETS must be divisible by BITS_PER_LONG */
151#define MAX_CACHES_PER_SET 8
152
153#define BDEV_DATA_START_DEFAULT 16 /* sectors */
154
155struct cache_sb {
156 __u64 csum;
157 __u64 offset; /* sector where this sb was written */
158 __u64 version;
159
160 __u8 magic[16];
161
162 __u8 uuid[16];
163 union {
164 __u8 set_uuid[16];
165 __u64 set_magic;
166 };
167 __u8 label[SB_LABEL_SIZE];
168
169 __u64 flags;
170 __u64 seq;
171 __u64 pad[8];
172
173 union {
174 struct {
175 /* Cache devices */
176 __u64 nbuckets; /* device size */
177
178 __u16 block_size; /* sectors */
179 __u16 bucket_size; /* sectors */
180
181 __u16 nr_in_set;
182 __u16 nr_this_dev;
183 };
184 struct {
185 /* Backing devices */
186 __u64 data_offset;
187
188 /*
189 * block_size from the cache device section is still used by
190 * backing devices, so don't add anything here until we fix
191 * things to not need it for backing devices anymore
192 */
193 };
194 };
195
196 __u32 last_mount; /* time_t */
197
198 __u16 first_bucket;
199 union {
200 __u16 njournal_buckets;
201 __u16 keys;
202 };
203 __u64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */
204};
205
206static inline _Bool SB_IS_BDEV(const struct cache_sb *sb)
207{
208 return sb->version == BCACHE_SB_VERSION_BDEV
209 || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET;
210}
211
212BITMASK(CACHE_SYNC, struct cache_sb, flags, 0, 1);
213BITMASK(CACHE_DISCARD, struct cache_sb, flags, 1, 1);
214BITMASK(CACHE_REPLACEMENT, struct cache_sb, flags, 2, 3);
215#define CACHE_REPLACEMENT_LRU 0U
216#define CACHE_REPLACEMENT_FIFO 1U
217#define CACHE_REPLACEMENT_RANDOM 2U
218
219BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 0, 4);
220#define CACHE_MODE_WRITETHROUGH 0U
221#define CACHE_MODE_WRITEBACK 1U
222#define CACHE_MODE_WRITEAROUND 2U
223#define CACHE_MODE_NONE 3U
224BITMASK(BDEV_STATE, struct cache_sb, flags, 61, 2);
225#define BDEV_STATE_NONE 0U
226#define BDEV_STATE_CLEAN 1U
227#define BDEV_STATE_DIRTY 2U
228#define BDEV_STATE_STALE 3U
229
230/*
231 * Magic numbers
232 *
233 * The various other data structures have their own magic numbers, which are
234 * xored with the first part of the cache set's UUID
235 */
236
237#define JSET_MAGIC 0x245235c1a3625032ULL
238#define PSET_MAGIC 0x6750e15f87337f91ULL
239#define BSET_MAGIC 0x90135c78b99e07f5ULL
240
241static inline __u64 jset_magic(struct cache_sb *sb)
242{
243 return sb->set_magic ^ JSET_MAGIC;
244}
245
246static inline __u64 pset_magic(struct cache_sb *sb)
247{
248 return sb->set_magic ^ PSET_MAGIC;
249}
250
251static inline __u64 bset_magic(struct cache_sb *sb)
252{
253 return sb->set_magic ^ BSET_MAGIC;
254}
255
256/*
257 * Journal
258 *
259 * On disk format for a journal entry:
260 * seq is monotonically increasing; every journal entry has its own unique
261 * sequence number.
262 *
263 * last_seq is the oldest journal entry that still has keys the btree hasn't
264 * flushed to disk yet.
265 *
266 * version is for on disk format changes.
267 */
268
269#define BCACHE_JSET_VERSION_UUIDv1 1
270#define BCACHE_JSET_VERSION_UUID 1 /* Always latest UUID format */
271#define BCACHE_JSET_VERSION 1
272
273struct jset {
274 __u64 csum;
275 __u64 magic;
276 __u64 seq;
277 __u32 version;
278 __u32 keys;
279
280 __u64 last_seq;
281
282 BKEY_PADDED(uuid_bucket);
283 BKEY_PADDED(btree_root);
284 __u16 btree_level;
285 __u16 pad[3];
286
287 __u64 prio_bucket[MAX_CACHES_PER_SET];
288
289 union {
290 struct bkey start[0];
291 __u64 d[0];
292 };
293};
294
295/* Bucket prios/gens */
296
297struct prio_set {
298 __u64 csum;
299 __u64 magic;
300 __u64 seq;
301 __u32 version;
302 __u32 pad;
303
304 __u64 next_bucket;
305
306 struct bucket_disk {
307 __u16 prio;
308 __u8 gen;
309 } __attribute((packed)) data[];
310};
311
312/* UUIDS - per backing device/flash only volume metadata */
313
314struct uuid_entry {
315 union {
316 struct {
317 __u8 uuid[16];
318 __u8 label[32];
319 __u32 first_reg;
320 __u32 last_reg;
321 __u32 invalidated;
322
323 __u32 flags;
324 /* Size of flash only volumes */
325 __u64 sectors;
326 };
327
328 __u8 pad[128];
329 };
330};
331
332BITMASK(UUID_FLASH_ONLY, struct uuid_entry, flags, 0, 1);
333
334/* Btree nodes */
335
336/* Version 1: Seed pointer into btree node checksum
337 */
338#define BCACHE_BSET_CSUM 1
339#define BCACHE_BSET_VERSION 1
340
341/*
342 * Btree nodes
343 *
344 * On disk a btree node is a list/log of these; within each set the keys are
345 * sorted
346 */
347struct bset {
348 __u64 csum;
349 __u64 magic;
350 __u64 seq;
351 __u32 version;
352 __u32 keys;
353
354 union {
355 struct bkey start[0];
356 __u64 d[0];
357 };
358};
359
360/* OBSOLETE */
361
362/* UUIDS - per backing device/flash only volume metadata */
363
364struct uuid_entry_v0 {
365 __u8 uuid[16];
366 __u8 label[32];
367 __u32 first_reg;
368 __u32 last_reg;
369 __u32 invalidated;
370 __u32 pad;
371};
372
373#endif /* _LINUX_BCACHE_H */
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 05aed70627e2..45e618921c61 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -305,6 +305,31 @@ struct btrfs_ioctl_clone_range_args {
305#define BTRFS_DEFRAG_RANGE_COMPRESS 1 305#define BTRFS_DEFRAG_RANGE_COMPRESS 1
306#define BTRFS_DEFRAG_RANGE_START_IO 2 306#define BTRFS_DEFRAG_RANGE_START_IO 2
307 307
308#define BTRFS_SAME_DATA_DIFFERS 1
309/* For extent-same ioctl */
310struct btrfs_ioctl_same_extent_info {
311 __s64 fd; /* in - destination file */
312 __u64 logical_offset; /* in - start of extent in destination */
313 __u64 bytes_deduped; /* out - total # of bytes we were able
314 * to dedupe from this file */
315 /* status of this dedupe operation:
316 * 0 if dedup succeeds
317 * < 0 for error
318 * == BTRFS_SAME_DATA_DIFFERS if data differs
319 */
320 __s32 status; /* out - see above description */
321 __u32 reserved;
322};
323
324struct btrfs_ioctl_same_args {
325 __u64 logical_offset; /* in - start of extent in source */
326 __u64 length; /* in - length of extent */
327 __u16 dest_count; /* in - total elements in info array */
328 __u16 reserved1;
329 __u32 reserved2;
330 struct btrfs_ioctl_same_extent_info info[0];
331};
332
308struct btrfs_ioctl_space_info { 333struct btrfs_ioctl_space_info {
309 __u64 flags; 334 __u64 flags;
310 __u64 total_bytes; 335 __u64 total_bytes;
@@ -524,7 +549,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
524 struct btrfs_ioctl_search_args) 549 struct btrfs_ioctl_search_args)
525#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ 550#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
526 struct btrfs_ioctl_ino_lookup_args) 551 struct btrfs_ioctl_ino_lookup_args)
527#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, u64) 552#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
528#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ 553#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
529 struct btrfs_ioctl_space_args) 554 struct btrfs_ioctl_space_args)
530#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) 555#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
@@ -579,4 +604,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
579 struct btrfs_ioctl_get_dev_stats) 604 struct btrfs_ioctl_get_dev_stats)
580#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ 605#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
581 struct btrfs_ioctl_dev_replace_args) 606 struct btrfs_ioctl_dev_replace_args)
607#define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
608 struct btrfs_ioctl_same_args)
609
582#endif /* _UAPI_LINUX_BTRFS_H */ 610#endif /* _UAPI_LINUX_BTRFS_H */
diff --git a/include/uapi/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
index 3ebe387fea4d..382251a1d214 100644
--- a/include/uapi/linux/can/bcm.h
+++ b/include/uapi/linux/can/bcm.h
@@ -7,6 +7,38 @@
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Volkswagen nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * Alternatively, provided that this notice is retained in full, this
23 * software may be distributed under the terms of the GNU General
24 * Public License ("GPL") version 2, in which case the provisions of the
25 * GPL apply INSTEAD OF those given above.
26 *
27 * The provided data structures and external interfaces from this code
28 * are not restricted to be used by modules with a GPL compatible license.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
10 */ 42 */
11 43
12#ifndef CAN_BCM_H 44#ifndef CAN_BCM_H
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index 7b7148bded71..b63204545320 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -7,6 +7,38 @@
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Volkswagen nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * Alternatively, provided that this notice is retained in full, this
23 * software may be distributed under the terms of the GNU General
24 * Public License ("GPL") version 2, in which case the provisions of the
25 * GPL apply INSTEAD OF those given above.
26 *
27 * The provided data structures and external interfaces from this code
28 * are not restricted to be used by modules with a GPL compatible license.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
10 */ 42 */
11 43
12#ifndef CAN_ERROR_H 44#ifndef CAN_ERROR_H
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 4e27c82b564a..844c8964bdfe 100644
--- a/include/uapi/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
@@ -7,6 +7,38 @@
7 * Copyright (c) 2011 Volkswagen Group Electronic Research 7 * Copyright (c) 2011 Volkswagen Group Electronic Research
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Volkswagen nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * Alternatively, provided that this notice is retained in full, this
23 * software may be distributed under the terms of the GNU General
24 * Public License ("GPL") version 2, in which case the provisions of the
25 * GPL apply INSTEAD OF those given above.
26 *
27 * The provided data structures and external interfaces from this code
28 * are not restricted to be used by modules with a GPL compatible license.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
10 */ 42 */
11 43
12#ifndef CAN_GW_H 44#ifndef CAN_GW_H
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 14966ddb7df1..df944ed206a8 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -5,6 +5,14 @@
5 * 5 *
6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com> 6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the version 2 of the GNU General Public License
10 * as published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
8 */ 16 */
9 17
10#ifndef CAN_NETLINK_H 18#ifndef CAN_NETLINK_H
diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
index a814062b0719..c7d8c334e0ce 100644
--- a/include/uapi/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
@@ -8,6 +8,38 @@
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of Volkswagen nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * Alternatively, provided that this notice is retained in full, this
24 * software may be distributed under the terms of the GNU General
25 * Public License ("GPL") version 2, in which case the provisions of the
26 * GPL apply INSTEAD OF those given above.
27 *
28 * The provided data structures and external interfaces from this code
29 * are not restricted to be used by modules with a GPL compatible license.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
42 * DAMAGE.
11 */ 43 */
12 44
13#ifndef CAN_RAW_H 45#ifndef CAN_RAW_H
diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
new file mode 100644
index 000000000000..d7e4c6ce6171
--- /dev/null
+++ b/include/uapi/linux/cifs/cifs_mount.h
@@ -0,0 +1,27 @@
1/*
2 * include/uapi/linux/cifs/cifs_mount.h
3 *
4 * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)
5 *
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 * the GNU Lesser General Public License for more details.
15 */
16#ifndef _CIFS_MOUNT_H
17#define _CIFS_MOUNT_H
18
19/* Max string lengths for cifs mounting options. */
20#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
21#define CIFS_MAX_USERNAME_LEN 256 /* reasonable max for current servers */
22#define CIFS_MAX_PASSWORD_LEN 512 /* Windows max seems to be 256 wide chars */
23#define CIFS_MAX_SHARE_LEN 256 /* reasonable max share name length */
24#define CIFS_NI_MAXHOST 1024 /* max host name length (256 * 4 bytes) */
25
26
27#endif /* _CIFS_MOUNT_H */
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index afd0cbd52edb..c8a4302093a3 100644
--- a/include/uapi/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 25 270#define DM_VERSION_MINOR 27
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2013-06-26)" 272#define DM_VERSION_EXTRA "-ioctl (2013-10-30)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -341,4 +341,15 @@ enum {
341 */ 341 */
342#define DM_DATA_OUT_FLAG (1 << 16) /* Out */ 342#define DM_DATA_OUT_FLAG (1 << 16) /* Out */
343 343
344/*
345 * If set with DM_DEV_REMOVE or DM_REMOVE_ALL this indicates that if
346 * the device cannot be removed immediately because it is still in use
347 * it should instead be scheduled for removal when it gets closed.
348 *
349 * On return from DM_DEV_REMOVE, DM_DEV_STATUS or other ioctls, this
350 * flag indicates that the device is scheduled to be removed when it
351 * gets closed.
352 */
353#define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */
354
344#endif /* _LINUX_DM_IOCTL_H */ 355#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/uapi/linux/dqblk_xfs.h b/include/uapi/linux/dqblk_xfs.h
index 86552807aed9..dcd75cc26196 100644
--- a/include/uapi/linux/dqblk_xfs.h
+++ b/include/uapi/linux/dqblk_xfs.h
@@ -38,6 +38,7 @@
38#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ 38#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */
39#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ 39#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */
40#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ 40#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */
41#define Q_XGETQSTATV XQM_CMD(8) /* newer version of get quota */
41 42
42/* 43/*
43 * fs_disk_quota structure: 44 * fs_disk_quota structure:
@@ -163,4 +164,50 @@ typedef struct fs_quota_stat {
163 __u16 qs_iwarnlimit; /* limit for num warnings */ 164 __u16 qs_iwarnlimit; /* limit for num warnings */
164} fs_quota_stat_t; 165} fs_quota_stat_t;
165 166
167/*
168 * fs_quota_statv is used by Q_XGETQSTATV for a given file system. It provides
169 * a centralized way to get meta information about the quota subsystem. eg.
170 * space taken up for user, group, and project quotas, number of dquots
171 * currently incore.
172 *
173 * This version has proper versioning support with appropriate padding for
174 * future expansions, and ability to expand for future without creating any
175 * backward compatibility issues.
176 *
177 * Q_XGETQSTATV uses the passed in value of the requested version via
178 * fs_quota_statv.qs_version to determine the return data layout of
179 * fs_quota_statv. The kernel will fill the data fields relevant to that
180 * version.
181 *
182 * If kernel does not support user space caller specified version, EINVAL will
183 * be returned. User space caller can then reduce the version number and retry
184 * the same command.
185 */
186#define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */
187/*
188 * Some basic information about 'quota files' for Q_XGETQSTATV command
189 */
190struct fs_qfilestatv {
191 __u64 qfs_ino; /* inode number */
192 __u64 qfs_nblks; /* number of BBs 512-byte-blks */
193 __u32 qfs_nextents; /* number of extents */
194 __u32 qfs_pad; /* pad for 8-byte alignment */
195};
196
197struct fs_quota_statv {
198 __s8 qs_version; /* version for future changes */
199 __u8 qs_pad1; /* pad for 16bit alignment */
200 __u16 qs_flags; /* FS_QUOTA_.* flags */
201 __u32 qs_incoredqs; /* number of dquots incore */
202 struct fs_qfilestatv qs_uquota; /* user quota information */
203 struct fs_qfilestatv qs_gquota; /* group quota information */
204 struct fs_qfilestatv qs_pquota; /* project quota information */
205 __s32 qs_btimelimit; /* limit for blks timer */
206 __s32 qs_itimelimit; /* limit for inodes timer */
207 __s32 qs_rtbtimelimit;/* limit for rt blks timer */
208 __u16 qs_bwarnlimit; /* limit for num warnings */
209 __u16 qs_iwarnlimit; /* limit for num warnings */
210 __u64 qs_pad2[8]; /* for future proofing */
211};
212
166#endif /* _LINUX_DQBLK_XFS_H */ 213#endif /* _LINUX_DQBLK_XFS_H */
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 8e2b7bac4378..01529bd96438 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -22,6 +22,7 @@
22#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
23#define EM_PPC64 21 /* PowerPC64 */ 23#define EM_PPC64 21 /* PowerPC64 */
24#define EM_SPU 23 /* Cell BE SPU */ 24#define EM_SPU 23 /* Cell BE SPU */
25#define EM_ARM 40 /* ARM 32 bit */
25#define EM_SH 42 /* SuperH */ 26#define EM_SH 42 /* SuperH */
26#define EM_SPARCV9 43 /* SPARC v9 64-bit */ 27#define EM_SPARCV9 43 /* SPARC v9 64-bit */
27#define EM_IA_64 50 /* HP/Intel IA-64 */ 28#define EM_IA_64 50 /* HP/Intel IA-64 */
@@ -30,10 +31,10 @@
30#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ 31#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
31#define EM_V850 87 /* NEC v850 */ 32#define EM_V850 87 /* NEC v850 */
32#define EM_M32R 88 /* Renesas M32R */ 33#define EM_M32R 88 /* Renesas M32R */
33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */ 36#define EM_TI_C6000 140 /* TI C6X DSPs */
37#define EM_AARCH64 183 /* ARM 64 bit */
37#define EM_FRV 0x5441 /* Fujitsu FR-V */ 38#define EM_FRV 0x5441 /* Fujitsu FR-V */
38#define EM_AVR32 0x18ad /* Atmel AVR32 */ 39#define EM_AVR32 0x18ad /* Atmel AVR32 */
39 40
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
index 2c267bcbb85c..bc81fb2e1f0e 100644
--- a/include/uapi/linux/eventpoll.h
+++ b/include/uapi/linux/eventpoll.h
@@ -61,5 +61,16 @@ struct epoll_event {
61 __u64 data; 61 __u64 data;
62} EPOLL_PACKED; 62} EPOLL_PACKED;
63 63
64 64#ifdef CONFIG_PM_SLEEP
65static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
66{
67 if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
68 epev->events &= ~EPOLLWAKEUP;
69}
70#else
71static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
72{
73 epev->events &= ~EPOLLWAKEUP;
74}
75#endif
65#endif /* _UAPI_LINUX_EVENTPOLL_H */ 76#endif /* _UAPI_LINUX_EVENTPOLL_H */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index a4ed56cf0eac..6c28b61bb690 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -49,9 +49,9 @@ struct files_stat_struct {
49}; 49};
50 50
51struct inodes_stat_t { 51struct inodes_stat_t {
52 int nr_inodes; 52 long nr_inodes;
53 int nr_unused; 53 long nr_unused;
54 int dummy[5]; /* padding for sysctl ABI compatibility */ 54 long dummy[5]; /* padding for sysctl ABI compatibility */
55}; 55};
56 56
57 57
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
index c880a417d8a9..c3363ba1ae05 100644
--- a/include/uapi/linux/genetlink.h
+++ b/include/uapi/linux/genetlink.h
@@ -27,6 +27,8 @@ struct genlmsghdr {
27 */ 27 */
28#define GENL_ID_GENERATE 0 28#define GENL_ID_GENERATE 0
29#define GENL_ID_CTRL NLMSG_MIN_TYPE 29#define GENL_ID_CTRL NLMSG_MIN_TYPE
30#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
31#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
30 32
31/************************************************************************** 33/**************************************************************************
32 * Controller 34 * Controller
diff --git a/include/uapi/linux/hash_info.h b/include/uapi/linux/hash_info.h
new file mode 100644
index 000000000000..ca18c45f8304
--- /dev/null
+++ b/include/uapi/linux/hash_info.h
@@ -0,0 +1,37 @@
1/*
2 * Hash Info: Hash algorithms information
3 *
4 * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _UAPI_LINUX_HASH_INFO_H
14#define _UAPI_LINUX_HASH_INFO_H
15
16enum hash_algo {
17 HASH_ALGO_MD4,
18 HASH_ALGO_MD5,
19 HASH_ALGO_SHA1,
20 HASH_ALGO_RIPE_MD_160,
21 HASH_ALGO_SHA256,
22 HASH_ALGO_SHA384,
23 HASH_ALGO_SHA512,
24 HASH_ALGO_SHA224,
25 HASH_ALGO_RIPE_MD_128,
26 HASH_ALGO_RIPE_MD_256,
27 HASH_ALGO_RIPE_MD_320,
28 HASH_ALGO_WP_256,
29 HASH_ALGO_WP_384,
30 HASH_ALGO_WP_512,
31 HASH_ALGO_TGR_128,
32 HASH_ALGO_TGR_160,
33 HASH_ALGO_TGR_192,
34 HASH_ALGO__LAST
35};
36
37#endif /* _UAPI_LINUX_HASH_INFO_H */
diff --git a/include/uapi/linux/hsr_netlink.h b/include/uapi/linux/hsr_netlink.h
new file mode 100644
index 000000000000..2475cb8a53af
--- /dev/null
+++ b/include/uapi/linux/hsr_netlink.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2011-2013 Autronica Fire and Security AS
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * Author(s):
10 * 2011-2013 Arvid Brodin, arvid.brodin@xdin.com
11 */
12
13#ifndef __UAPI_HSR_NETLINK_H
14#define __UAPI_HSR_NETLINK_H
15
16/* Generic Netlink HSR family definition
17 */
18
19/* attributes */
20enum {
21 HSR_A_UNSPEC,
22 HSR_A_NODE_ADDR,
23 HSR_A_IFINDEX,
24 HSR_A_IF1_AGE,
25 HSR_A_IF2_AGE,
26 HSR_A_NODE_ADDR_B,
27 HSR_A_IF1_SEQ,
28 HSR_A_IF2_SEQ,
29 HSR_A_IF1_IFINDEX,
30 HSR_A_IF2_IFINDEX,
31 HSR_A_ADDR_B_IFINDEX,
32 __HSR_A_MAX,
33};
34#define HSR_A_MAX (__HSR_A_MAX - 1)
35
36
37/* commands */
38enum {
39 HSR_C_UNSPEC,
40 HSR_C_RING_ERROR,
41 HSR_C_NODE_DOWN,
42 HSR_C_GET_NODE_STATUS,
43 HSR_C_SET_NODE_STATUS,
44 HSR_C_GET_NODE_LIST,
45 HSR_C_SET_NODE_LIST,
46 __HSR_C_MAX,
47};
48#define HSR_C_MAX (__HSR_C_MAX - 1)
49
50#endif /* __UAPI_HSR_NETLINK_H */
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 1ec407b01e46..d758163b0e43 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -83,6 +83,7 @@
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ 83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address 84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address
85 * change when it's running */ 85 * change when it's running */
86#define IFF_MACVLAN 0x200000 /* Macvlan device */
86 87
87 88
88#define IF_GET_IFACE 0x0001 /* for querying only */ 89#define IF_GET_IFACE 0x0001 /* for querying only */
diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h
index a17edda8a781..9635a62f6f89 100644
--- a/include/uapi/linux/if_bonding.h
+++ b/include/uapi/linux/if_bonding.h
@@ -91,6 +91,8 @@
91#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ 91#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
92#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ 92#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
93#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ 93#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
94#define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */
95#define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */
94 96
95typedef struct ifbond { 97typedef struct ifbond {
96 __s32 bond_mode; 98 __s32 bond_mode;
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index ade07f1c491a..2ce0f6a78fa5 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -85,6 +85,7 @@
85#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 85#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
86#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ 86#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
87#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 87#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
88#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */
88#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 89#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
89#define ETH_P_TDLS 0x890D /* TDLS */ 90#define ETH_P_TDLS 0x890D /* TDLS */
90#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ 91#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 80394e8dc3a3..6db460121f84 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -325,6 +325,17 @@ struct ifla_vxlan_port_range {
325 __be16 high; 325 __be16 high;
326}; 326};
327 327
328/* Bonding section */
329
330enum {
331 IFLA_BOND_UNSPEC,
332 IFLA_BOND_MODE,
333 IFLA_BOND_ACTIVE_SLAVE,
334 __IFLA_BOND_MAX,
335};
336
337#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
338
328/* SR-IOV virtual function management section */ 339/* SR-IOV virtual function management section */
329 340
330enum { 341enum {
@@ -470,4 +481,19 @@ enum {
470 481
471#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1) 482#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
472 483
484
485/* HSR section */
486
487enum {
488 IFLA_HSR_UNSPEC,
489 IFLA_HSR_SLAVE1,
490 IFLA_HSR_SLAVE2,
491 IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */
492 IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */
493 IFLA_HSR_SEQ_NR,
494 __IFLA_HSR_MAX,
495};
496
497#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
498
473#endif /* _UAPI_LINUX_IF_LINK_H */ 499#endif /* _UAPI_LINUX_IF_LINK_H */
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index f9e8e496ae5d..393c5de09d42 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -115,6 +115,11 @@ struct in_addr {
115#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 115#define IP_PMTUDISC_WANT 1 /* Use per route hints */
116#define IP_PMTUDISC_DO 2 /* Always DF */ 116#define IP_PMTUDISC_DO 2 /* Always DF */
117#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ 117#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
118/* Always use interface mtu (ignores dst pmtu) but don't set DF flag.
119 * Also incoming ICMP frag_needed notifications will be ignored on
120 * this socket to prevent accepting spoofed ones.
121 */
122#define IP_PMTUDISC_INTERFACE 4
118 123
119#define IP_MULTICAST_IF 32 124#define IP_MULTICAST_IF 32
120#define IP_MULTICAST_TTL 33 125#define IP_MULTICAST_TTL 33
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 76457eef172a..ecc88592ecbe 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -152,6 +152,7 @@ struct input_keymap_entry {
152#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ 152#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
153 153
154#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 154#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
155#define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */
155 156
156#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ 157#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
157 158
@@ -194,6 +195,8 @@ struct input_keymap_entry {
194#define SYN_CONFIG 1 195#define SYN_CONFIG 1
195#define SYN_MT_REPORT 2 196#define SYN_MT_REPORT 2
196#define SYN_DROPPED 3 197#define SYN_DROPPED 3
198#define SYN_MAX 0xf
199#define SYN_CNT (SYN_MAX+1)
197 200
198/* 201/*
199 * Keys and buttons 202 * Keys and buttons
@@ -716,13 +719,7 @@ struct input_keymap_entry {
716#define BTN_DPAD_LEFT 0x222 719#define BTN_DPAD_LEFT 0x222
717#define BTN_DPAD_RIGHT 0x223 720#define BTN_DPAD_RIGHT 0x223
718 721
719#define BTN_FRET_FAR_UP 0x224 722#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
720#define BTN_FRET_UP 0x225
721#define BTN_FRET_MID 0x226
722#define BTN_FRET_LOW 0x227
723#define BTN_FRET_FAR_LOW 0x228
724#define BTN_STRUM_BAR_UP 0x229
725#define BTN_STRUM_BAR_DOWN 0x22a
726 723
727#define BTN_TRIGGER_HAPPY 0x2c0 724#define BTN_TRIGGER_HAPPY 0x2c0
728#define BTN_TRIGGER_HAPPY1 0x2c0 725#define BTN_TRIGGER_HAPPY1 0x2c0
@@ -837,21 +834,8 @@ struct input_keymap_entry {
837#define ABS_MT_TOOL_X 0x3c /* Center X tool position */ 834#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
838#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ 835#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
839 836
840/* Drums and guitars (mostly toys) */ 837
841#define ABS_TOM_FAR_LEFT 0x40 838#define ABS_MAX 0x3f
842#define ABS_TOM_LEFT 0x41
843#define ABS_TOM_RIGHT 0x42
844#define ABS_TOM_FAR_RIGHT 0x43
845#define ABS_CYMBAL_FAR_LEFT 0x44
846#define ABS_CYMBAL_LEFT 0x45
847#define ABS_CYMBAL_RIGHT 0x46
848#define ABS_CYMBAL_FAR_RIGHT 0x47
849#define ABS_BASS 0x48
850#define ABS_HI_HAT 0x49
851#define ABS_FRET_BOARD 0x4a /* Guitar fret board, vertical pos */
852#define ABS_WHAMMY_BAR 0x4b /* Guitar whammy bar (or vibrato) */
853
854#define ABS_MAX 0x4f
855#define ABS_CNT (ABS_MAX+1) 839#define ABS_CNT (ABS_MAX+1)
856 840
857/* 841/*
@@ -874,6 +858,7 @@ struct input_keymap_entry {
874#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ 858#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
875#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ 859#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
876#define SW_LINEIN_INSERT 0x0d /* set = inserted */ 860#define SW_LINEIN_INSERT 0x0d /* set = inserted */
861#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
877#define SW_MAX 0x0f 862#define SW_MAX 0x0f
878#define SW_CNT (SW_MAX+1) 863#define SW_CNT (SW_MAX+1)
879 864
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index 29458223d044..fbcffe8041f7 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -334,7 +334,7 @@ enum {
334 __IPVS_CMD_ATTR_MAX, 334 __IPVS_CMD_ATTR_MAX,
335}; 335};
336 336
337#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) 337#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
338 338
339/* 339/*
340 * Attributes used to describe a service 340 * Attributes used to describe a service
diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index c9b7f4faf97a..840cb990abe2 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -56,5 +56,6 @@
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */ 56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ 57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
58#define KEYCTL_INVALIDATE 21 /* invalidate a key */ 58#define KEYCTL_INVALIDATE 21 /* invalidate a key */
59#define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */
59 60
60#endif /* _LINUX_KEYCTL_H */ 61#endif /* _LINUX_KEYCTL_H */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 99c25338ede8..902f12461873 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -518,6 +518,10 @@ struct kvm_ppc_smmu_info {
518/* machine type bits, to be used as argument to KVM_CREATE_VM */ 518/* machine type bits, to be used as argument to KVM_CREATE_VM */
519#define KVM_VM_S390_UCONTROL 1 519#define KVM_VM_S390_UCONTROL 1
520 520
521/* on ppc, 0 indicate default, 1 should force HV and 2 PR */
522#define KVM_VM_PPC_HV 1
523#define KVM_VM_PPC_PR 2
524
521#define KVM_S390_SIE_PAGE_OFFSET 1 525#define KVM_S390_SIE_PAGE_OFFSET 1
522 526
523/* 527/*
@@ -541,6 +545,7 @@ struct kvm_ppc_smmu_info {
541#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 545#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
542#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 546#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
543#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 547#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
548#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
544 549
545/* 550/*
546 * Extension capability list. 551 * Extension capability list.
@@ -668,6 +673,7 @@ struct kvm_ppc_smmu_info {
668#define KVM_CAP_IRQ_XICS 92 673#define KVM_CAP_IRQ_XICS 92
669#define KVM_CAP_ARM_EL1_32BIT 93 674#define KVM_CAP_ARM_EL1_32BIT 93
670#define KVM_CAP_SPAPR_MULTITCE 94 675#define KVM_CAP_SPAPR_MULTITCE 94
676#define KVM_CAP_EXT_EMUL_CPUID 95
671 677
672#ifdef KVM_CAP_IRQ_ROUTING 678#ifdef KVM_CAP_IRQ_ROUTING
673 679
@@ -843,6 +849,10 @@ struct kvm_device_attr {
843#define KVM_DEV_TYPE_FSL_MPIC_20 1 849#define KVM_DEV_TYPE_FSL_MPIC_20 1
844#define KVM_DEV_TYPE_FSL_MPIC_42 2 850#define KVM_DEV_TYPE_FSL_MPIC_42 2
845#define KVM_DEV_TYPE_XICS 3 851#define KVM_DEV_TYPE_XICS 3
852#define KVM_DEV_TYPE_VFIO 4
853#define KVM_DEV_VFIO_GROUP 1
854#define KVM_DEV_VFIO_GROUP_ADD 1
855#define KVM_DEV_VFIO_GROUP_DEL 2
846 856
847/* 857/*
848 * ioctls for VM fds 858 * ioctls for VM fds
@@ -1012,6 +1022,7 @@ struct kvm_s390_ucas_mapping {
1012/* VM is being stopped by host */ 1022/* VM is being stopped by host */
1013#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) 1023#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
1014#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) 1024#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
1025#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
1015#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) 1026#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
1016 1027
1017#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 1028#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index 2944278a8ba7..77c60311a6c6 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -71,6 +71,6 @@
71#define USBDEVICE_SUPER_MAGIC 0x9fa2 71#define USBDEVICE_SUPER_MAGIC 0x9fa2
72#define MTD_INODE_FS_MAGIC 0x11307854 72#define MTD_INODE_FS_MAGIC 0x11307854
73#define ANON_INODE_FS_MAGIC 0x09041934 73#define ANON_INODE_FS_MAGIC 0x09041934
74 74#define BTRFS_TEST_MAGIC 0x73727279
75 75
76#endif /* __LINUX_MAGIC_H__ */ 76#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h
index 6a8ca98c9a96..620252e69b44 100644
--- a/include/uapi/linux/major.h
+++ b/include/uapi/linux/major.h
@@ -54,6 +54,7 @@
54#define ACSI_MAJOR 28 54#define ACSI_MAJOR 28
55#define AZTECH_CDROM_MAJOR 29 55#define AZTECH_CDROM_MAJOR 29
56#define FB_MAJOR 29 /* /dev/fb* framebuffers */ 56#define FB_MAJOR 29 /* /dev/fb* framebuffers */
57#define MTD_BLOCK_MAJOR 31
57#define CM206_CDROM_MAJOR 32 58#define CM206_CDROM_MAJOR 32
58#define IDE2_MAJOR 33 59#define IDE2_MAJOR 33
59#define IDE3_MAJOR 34 60#define IDE3_MAJOR 34
@@ -105,6 +106,7 @@
105#define IDE6_MAJOR 88 106#define IDE6_MAJOR 88
106#define IDE7_MAJOR 89 107#define IDE7_MAJOR 89
107#define IDE8_MAJOR 90 108#define IDE8_MAJOR 90
109#define MTD_CHAR_MAJOR 90
108#define IDE9_MAJOR 91 110#define IDE9_MAJOR 91
109 111
110#define DASD_MAJOR 94 112#define DASD_MAJOR 94
diff --git a/include/uapi/linux/mic_common.h b/include/uapi/linux/mic_common.h
new file mode 100644
index 000000000000..6eb40244e019
--- /dev/null
+++ b/include/uapi/linux/mic_common.h
@@ -0,0 +1,232 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC driver.
19 *
20 */
21#ifndef __MIC_COMMON_H_
22#define __MIC_COMMON_H_
23
24#include <linux/virtio_ring.h>
25
26#define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1))
27
28/**
29 * struct mic_device_desc: Virtio device information shared between the
30 * virtio driver and userspace backend
31 *
32 * @type: Device type: console/network/disk etc. Type 0/-1 terminates.
33 * @num_vq: Number of virtqueues.
34 * @feature_len: Number of bytes of feature bits. Multiply by 2: one for
35 host features and one for guest acknowledgements.
36 * @config_len: Number of bytes of the config array after virtqueues.
37 * @status: A status byte, written by the Guest.
38 * @config: Start of the following variable length config.
39 */
40struct mic_device_desc {
41 __s8 type;
42 __u8 num_vq;
43 __u8 feature_len;
44 __u8 config_len;
45 __u8 status;
46 __le64 config[0];
47} __attribute__ ((aligned(8)));
48
49/**
50 * struct mic_device_ctrl: Per virtio device information in the device page
51 * used internally by the host and card side drivers.
52 *
53 * @vdev: Used for storing MIC vdev information by the guest.
54 * @config_change: Set to 1 by host when a config change is requested.
55 * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset.
56 * @guest_ack: Set to 1 by guest to ack a command.
57 * @host_ack: Set to 1 by host to ack a command.
58 * @used_address_updated: Set to 1 by guest when the used address should be
59 * updated.
60 * @c2h_vdev_db: The doorbell number to be used by guest. Set by host.
61 * @h2c_vdev_db: The doorbell number to be used by host. Set by guest.
62 */
63struct mic_device_ctrl {
64 __le64 vdev;
65 __u8 config_change;
66 __u8 vdev_reset;
67 __u8 guest_ack;
68 __u8 host_ack;
69 __u8 used_address_updated;
70 __s8 c2h_vdev_db;
71 __s8 h2c_vdev_db;
72} __attribute__ ((aligned(8)));
73
74/**
75 * struct mic_bootparam: Virtio device independent information in device page
76 *
77 * @magic: A magic value used by the card to ensure it can see the host
78 * @c2h_shutdown_db: Card to Host shutdown doorbell set by host
79 * @h2c_shutdown_db: Host to Card shutdown doorbell set by card
80 * @h2c_config_db: Host to Card Virtio config doorbell set by card
81 * @shutdown_status: Card shutdown status set by card
82 * @shutdown_card: Set to 1 by the host when a card shutdown is initiated
83 */
84struct mic_bootparam {
85 __le32 magic;
86 __s8 c2h_shutdown_db;
87 __s8 h2c_shutdown_db;
88 __s8 h2c_config_db;
89 __u8 shutdown_status;
90 __u8 shutdown_card;
91} __attribute__ ((aligned(8)));
92
93/**
94 * struct mic_device_page: High level representation of the device page
95 *
96 * @bootparam: The bootparam structure is used for sharing information and
97 * status updates between MIC host and card drivers.
98 * @desc: Array of MIC virtio device descriptors.
99 */
100struct mic_device_page {
101 struct mic_bootparam bootparam;
102 struct mic_device_desc desc[0];
103};
104/**
105 * struct mic_vqconfig: This is how we expect the device configuration field
106 * for a virtqueue to be laid out in config space.
107 *
108 * @address: Guest/MIC physical address of the virtio ring
109 * (avail and desc rings)
110 * @used_address: Guest/MIC physical address of the used ring
111 * @num: The number of entries in the virtio_ring
112 */
113struct mic_vqconfig {
114 __le64 address;
115 __le64 used_address;
116 __le16 num;
117} __attribute__ ((aligned(8)));
118
119/*
120 * The alignment to use between consumer and producer parts of vring.
121 * This is pagesize for historical reasons.
122 */
123#define MIC_VIRTIO_RING_ALIGN 4096
124
125#define MIC_MAX_VRINGS 4
126#define MIC_VRING_ENTRIES 128
127
128/*
129 * Max vring entries (power of 2) to ensure desc and avail rings
130 * fit in a single page
131 */
132#define MIC_MAX_VRING_ENTRIES 128
133
134/**
135 * Max size of the desc block in bytes: includes:
136 * - struct mic_device_desc
137 * - struct mic_vqconfig (num_vq of these)
138 * - host and guest features
139 * - virtio device config space
140 */
141#define MIC_MAX_DESC_BLK_SIZE 256
142
143/**
144 * struct _mic_vring_info - Host vring info exposed to userspace backend
145 * for the avail index and magic for the card.
146 *
147 * @avail_idx: host avail idx
148 * @magic: A magic debug cookie.
149 */
150struct _mic_vring_info {
151 __u16 avail_idx;
152 __le32 magic;
153};
154
155/**
156 * struct mic_vring - Vring information.
157 *
158 * @vr: The virtio ring.
159 * @info: Host vring information exposed to the userspace backend for the
160 * avail index and magic for the card.
161 * @va: The va for the buffer allocated for vr and info.
162 * @len: The length of the buffer required for allocating vr and info.
163 */
164struct mic_vring {
165 struct vring vr;
166 struct _mic_vring_info *info;
167 void *va;
168 int len;
169};
170
171#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
172
173#ifndef INTEL_MIC_CARD
174static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
175{
176 return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig)
177 + desc->feature_len * 2 + desc->config_len;
178}
179
180static inline struct mic_vqconfig *
181mic_vq_config(const struct mic_device_desc *desc)
182{
183 return (struct mic_vqconfig *)(desc + 1);
184}
185
186static inline __u8 *mic_vq_features(const struct mic_device_desc *desc)
187{
188 return (__u8 *)(mic_vq_config(desc) + desc->num_vq);
189}
190
191static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
192{
193 return mic_vq_features(desc) + desc->feature_len * 2;
194}
195static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
196{
197 return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
198}
199#endif
200
201/* Device page size */
202#define MIC_DP_SIZE 4096
203
204#define MIC_MAGIC 0xc0ffee00
205
206/**
207 * enum mic_states - MIC states.
208 */
209enum mic_states {
210 MIC_OFFLINE = 0,
211 MIC_ONLINE,
212 MIC_SHUTTING_DOWN,
213 MIC_RESET_FAILED,
214 MIC_SUSPENDING,
215 MIC_SUSPENDED,
216 MIC_LAST
217};
218
219/**
220 * enum mic_status - MIC status reported by card after
221 * a host or card initiated shutdown or a card crash.
222 */
223enum mic_status {
224 MIC_NOP = 0,
225 MIC_CRASHED,
226 MIC_HALTED,
227 MIC_POWER_OFF,
228 MIC_RESTART,
229 MIC_STATUS_LAST
230};
231
232#endif
diff --git a/include/uapi/linux/mic_ioctl.h b/include/uapi/linux/mic_ioctl.h
new file mode 100644
index 000000000000..7fabba5059cf
--- /dev/null
+++ b/include/uapi/linux/mic_ioctl.h
@@ -0,0 +1,76 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC Host driver.
19 *
20 */
21#ifndef _MIC_IOCTL_H_
22#define _MIC_IOCTL_H_
23
24#include <linux/types.h>
25
26/*
27 * mic_copy - MIC virtio descriptor copy.
28 *
29 * @iov: An array of IOVEC structures containing user space buffers.
30 * @iovcnt: Number of IOVEC structures in iov.
31 * @vr_idx: The vring index.
32 * @update_used: A non zero value results in used index being updated.
33 * @out_len: The aggregate of the total length written to or read from
34 * the virtio device.
35 */
36struct mic_copy_desc {
37#ifdef __KERNEL__
38 struct iovec __user *iov;
39#else
40 struct iovec *iov;
41#endif
42 int iovcnt;
43 __u8 vr_idx;
44 __u8 update_used;
45 __u32 out_len;
46};
47
48/*
49 * Add a new virtio device
50 * The (struct mic_device_desc *) pointer points to a device page entry
51 * for the virtio device consisting of:
52 * - struct mic_device_desc
53 * - struct mic_vqconfig (num_vq of these)
54 * - host and guest features
55 * - virtio device config space
56 * The total size referenced by the pointer should equal the size returned
57 * by desc_size() in mic_common.h
58 */
59#define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
60
61/*
62 * Copy the number of entries in the iovec and update the used index
63 * if requested by the user.
64 */
65#define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *)
66
67/*
68 * Notify virtio device of a config change
69 * The (__u8 *) pointer points to config space values for the device
70 * as they should be written into the device page. The total size
71 * referenced by the pointer should equal the config_len field of struct
72 * mic_device_desc.
73 */
74#define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
75
76#endif
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 174915420d3f..17c3af2c4bb9 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -5,6 +5,8 @@ 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_tables.h
9header-y += nf_tables_compat.h
8header-y += nf_nat.h 10header-y += nf_nat.h
9header-y += nfnetlink.h 11header-y += nfnetlink.h
10header-y += nfnetlink_acct.h 12header-y += nfnetlink_acct.h
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index 8024cdf13b70..25d3b2f79c02 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -10,12 +10,14 @@
10#ifndef _UAPI_IP_SET_H 10#ifndef _UAPI_IP_SET_H
11#define _UAPI_IP_SET_H 11#define _UAPI_IP_SET_H
12 12
13
14#include <linux/types.h> 13#include <linux/types.h>
15 14
16/* The protocol version */ 15/* The protocol version */
17#define IPSET_PROTOCOL 6 16#define IPSET_PROTOCOL 6
18 17
18/* The maximum permissible comment length we will accept over netlink */
19#define IPSET_MAX_COMMENT_SIZE 255
20
19/* The max length of strings including NUL: set and type identifiers */ 21/* The max length of strings including NUL: set and type identifiers */
20#define IPSET_MAXNAMELEN 32 22#define IPSET_MAXNAMELEN 32
21 23
@@ -110,6 +112,7 @@ enum {
110 IPSET_ATTR_IFACE, 112 IPSET_ATTR_IFACE,
111 IPSET_ATTR_BYTES, 113 IPSET_ATTR_BYTES,
112 IPSET_ATTR_PACKETS, 114 IPSET_ATTR_PACKETS,
115 IPSET_ATTR_COMMENT,
113 __IPSET_ATTR_ADT_MAX, 116 __IPSET_ATTR_ADT_MAX,
114}; 117};
115#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) 118#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -140,6 +143,7 @@ enum ipset_errno {
140 IPSET_ERR_IPADDR_IPV4, 143 IPSET_ERR_IPADDR_IPV4,
141 IPSET_ERR_IPADDR_IPV6, 144 IPSET_ERR_IPADDR_IPV6,
142 IPSET_ERR_COUNTER, 145 IPSET_ERR_COUNTER,
146 IPSET_ERR_COMMENT,
143 147
144 /* Type specific error codes */ 148 /* Type specific error codes */
145 IPSET_ERR_TYPE_SPECIFIC = 4352, 149 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -176,6 +180,8 @@ enum ipset_cadt_flags {
176 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), 180 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
177 IPSET_FLAG_BIT_WITH_COUNTERS = 3, 181 IPSET_FLAG_BIT_WITH_COUNTERS = 3,
178 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), 182 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
183 IPSET_FLAG_BIT_WITH_COMMENT = 4,
184 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
179 IPSET_FLAG_CADT_MAX = 15, 185 IPSET_FLAG_CADT_MAX = 15,
180}; 186};
181 187
@@ -250,6 +256,14 @@ struct ip_set_req_get_set {
250#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ 256#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
251/* Uses ip_set_req_get_set */ 257/* Uses ip_set_req_get_set */
252 258
259#define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */
260struct ip_set_req_get_set_family {
261 unsigned int op;
262 unsigned int version;
263 unsigned int family;
264 union ip_set_name_index set;
265};
266
253#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ 267#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
254struct ip_set_req_version { 268struct ip_set_req_version {
255 unsigned int op; 269 unsigned int op;
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 8dd803818ebe..319f47128db8 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -25,6 +25,10 @@ enum ip_conntrack_info {
25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
26}; 26};
27 27
28#define NF_CT_STATE_INVALID_BIT (1 << 0)
29#define NF_CT_STATE_BIT(ctinfo) (1 << ((ctinfo) % IP_CT_IS_REPLY + 1))
30#define NF_CT_STATE_UNTRACKED_BIT (1 << (IP_CT_NUMBER + 1))
31
28/* Bitset representing status of connection. */ 32/* Bitset representing status of connection. */
29enum ip_conntrack_status { 33enum ip_conntrack_status {
30 /* It's an expected connection: bit 0 set. This bit never changed */ 34 /* It's an expected connection: bit 0 set. This bit never changed */
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
new file mode 100644
index 000000000000..fbfd229a8e99
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -0,0 +1,718 @@
1#ifndef _LINUX_NF_TABLES_H
2#define _LINUX_NF_TABLES_H
3
4#define NFT_CHAIN_MAXNAMELEN 32
5
6enum nft_registers {
7 NFT_REG_VERDICT,
8 NFT_REG_1,
9 NFT_REG_2,
10 NFT_REG_3,
11 NFT_REG_4,
12 __NFT_REG_MAX
13};
14#define NFT_REG_MAX (__NFT_REG_MAX - 1)
15
16/**
17 * enum nft_verdicts - nf_tables internal verdicts
18 *
19 * @NFT_CONTINUE: continue evaluation of the current rule
20 * @NFT_BREAK: terminate evaluation of the current rule
21 * @NFT_JUMP: push the current chain on the jump stack and jump to a chain
22 * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack
23 * @NFT_RETURN: return to the topmost chain on the jump stack
24 *
25 * The nf_tables verdicts share their numeric space with the netfilter verdicts.
26 */
27enum nft_verdicts {
28 NFT_CONTINUE = -1,
29 NFT_BREAK = -2,
30 NFT_JUMP = -3,
31 NFT_GOTO = -4,
32 NFT_RETURN = -5,
33};
34
35/**
36 * enum nf_tables_msg_types - nf_tables netlink message types
37 *
38 * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes)
39 * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes)
40 * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes)
41 * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes)
42 * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes)
43 * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes)
44 * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes)
45 * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes)
46 * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes)
47 * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes)
48 * @NFT_MSG_GETSET: get a set (enum nft_set_attributes)
49 * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes)
50 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
51 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
52 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
53 */
54enum nf_tables_msg_types {
55 NFT_MSG_NEWTABLE,
56 NFT_MSG_GETTABLE,
57 NFT_MSG_DELTABLE,
58 NFT_MSG_NEWCHAIN,
59 NFT_MSG_GETCHAIN,
60 NFT_MSG_DELCHAIN,
61 NFT_MSG_NEWRULE,
62 NFT_MSG_GETRULE,
63 NFT_MSG_DELRULE,
64 NFT_MSG_NEWSET,
65 NFT_MSG_GETSET,
66 NFT_MSG_DELSET,
67 NFT_MSG_NEWSETELEM,
68 NFT_MSG_GETSETELEM,
69 NFT_MSG_DELSETELEM,
70 NFT_MSG_MAX,
71};
72
73/**
74 * enum nft_list_attributes - nf_tables generic list netlink attributes
75 *
76 * @NFTA_LIST_ELEM: list element (NLA_NESTED)
77 */
78enum nft_list_attributes {
79 NFTA_LIST_UNPEC,
80 NFTA_LIST_ELEM,
81 __NFTA_LIST_MAX
82};
83#define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1)
84
85/**
86 * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes
87 *
88 * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32)
89 * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
90 */
91enum nft_hook_attributes {
92 NFTA_HOOK_UNSPEC,
93 NFTA_HOOK_HOOKNUM,
94 NFTA_HOOK_PRIORITY,
95 __NFTA_HOOK_MAX
96};
97#define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
98
99/**
100 * enum nft_table_flags - nf_tables table flags
101 *
102 * @NFT_TABLE_F_DORMANT: this table is not active
103 */
104enum nft_table_flags {
105 NFT_TABLE_F_DORMANT = 0x1,
106};
107
108/**
109 * enum nft_table_attributes - nf_tables table netlink attributes
110 *
111 * @NFTA_TABLE_NAME: name of the table (NLA_STRING)
112 * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32)
113 */
114enum nft_table_attributes {
115 NFTA_TABLE_UNSPEC,
116 NFTA_TABLE_NAME,
117 NFTA_TABLE_FLAGS,
118 __NFTA_TABLE_MAX
119};
120#define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1)
121
122/**
123 * enum nft_chain_attributes - nf_tables chain netlink attributes
124 *
125 * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING)
126 * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64)
127 * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING)
128 * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes)
129 * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32)
130 * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32)
131 * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING)
132 * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes)
133 */
134enum nft_chain_attributes {
135 NFTA_CHAIN_UNSPEC,
136 NFTA_CHAIN_TABLE,
137 NFTA_CHAIN_HANDLE,
138 NFTA_CHAIN_NAME,
139 NFTA_CHAIN_HOOK,
140 NFTA_CHAIN_POLICY,
141 NFTA_CHAIN_USE,
142 NFTA_CHAIN_TYPE,
143 NFTA_CHAIN_COUNTERS,
144 __NFTA_CHAIN_MAX
145};
146#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
147
148/**
149 * enum nft_rule_attributes - nf_tables rule netlink attributes
150 *
151 * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING)
152 * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING)
153 * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64)
154 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
155 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
156 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
157 */
158enum nft_rule_attributes {
159 NFTA_RULE_UNSPEC,
160 NFTA_RULE_TABLE,
161 NFTA_RULE_CHAIN,
162 NFTA_RULE_HANDLE,
163 NFTA_RULE_EXPRESSIONS,
164 NFTA_RULE_COMPAT,
165 NFTA_RULE_POSITION,
166 __NFTA_RULE_MAX
167};
168#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
169
170/**
171 * enum nft_rule_compat_flags - nf_tables rule compat flags
172 *
173 * @NFT_RULE_COMPAT_F_INV: invert the check result
174 */
175enum nft_rule_compat_flags {
176 NFT_RULE_COMPAT_F_INV = (1 << 1),
177 NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
178};
179
180/**
181 * enum nft_rule_compat_attributes - nf_tables rule compat attributes
182 *
183 * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32)
184 * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32)
185 */
186enum nft_rule_compat_attributes {
187 NFTA_RULE_COMPAT_UNSPEC,
188 NFTA_RULE_COMPAT_PROTO,
189 NFTA_RULE_COMPAT_FLAGS,
190 __NFTA_RULE_COMPAT_MAX
191};
192#define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1)
193
194/**
195 * enum nft_set_flags - nf_tables set flags
196 *
197 * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink
198 * @NFT_SET_CONSTANT: set contents may not change while bound
199 * @NFT_SET_INTERVAL: set contains intervals
200 * @NFT_SET_MAP: set is used as a dictionary
201 */
202enum nft_set_flags {
203 NFT_SET_ANONYMOUS = 0x1,
204 NFT_SET_CONSTANT = 0x2,
205 NFT_SET_INTERVAL = 0x4,
206 NFT_SET_MAP = 0x8,
207};
208
209/**
210 * enum nft_set_attributes - nf_tables set netlink attributes
211 *
212 * @NFTA_SET_TABLE: table name (NLA_STRING)
213 * @NFTA_SET_NAME: set name (NLA_STRING)
214 * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32)
215 * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32)
216 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
217 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
218 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
219 */
220enum nft_set_attributes {
221 NFTA_SET_UNSPEC,
222 NFTA_SET_TABLE,
223 NFTA_SET_NAME,
224 NFTA_SET_FLAGS,
225 NFTA_SET_KEY_TYPE,
226 NFTA_SET_KEY_LEN,
227 NFTA_SET_DATA_TYPE,
228 NFTA_SET_DATA_LEN,
229 __NFTA_SET_MAX
230};
231#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
232
233/**
234 * enum nft_set_elem_flags - nf_tables set element flags
235 *
236 * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval
237 */
238enum nft_set_elem_flags {
239 NFT_SET_ELEM_INTERVAL_END = 0x1,
240};
241
242/**
243 * enum nft_set_elem_attributes - nf_tables set element netlink attributes
244 *
245 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
246 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
247 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
248 */
249enum nft_set_elem_attributes {
250 NFTA_SET_ELEM_UNSPEC,
251 NFTA_SET_ELEM_KEY,
252 NFTA_SET_ELEM_DATA,
253 NFTA_SET_ELEM_FLAGS,
254 __NFTA_SET_ELEM_MAX
255};
256#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
257
258/**
259 * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes
260 *
261 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
262 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
263 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
264 */
265enum nft_set_elem_list_attributes {
266 NFTA_SET_ELEM_LIST_UNSPEC,
267 NFTA_SET_ELEM_LIST_TABLE,
268 NFTA_SET_ELEM_LIST_SET,
269 NFTA_SET_ELEM_LIST_ELEMENTS,
270 __NFTA_SET_ELEM_LIST_MAX
271};
272#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
273
274/**
275 * enum nft_data_types - nf_tables data types
276 *
277 * @NFT_DATA_VALUE: generic data
278 * @NFT_DATA_VERDICT: netfilter verdict
279 *
280 * The type of data is usually determined by the kernel directly and is not
281 * explicitly specified by userspace. The only difference are sets, where
282 * userspace specifies the key and mapping data types.
283 *
284 * The values 0xffffff00-0xffffffff are reserved for internally used types.
285 * The remaining range can be freely used by userspace to encode types, all
286 * values are equivalent to NFT_DATA_VALUE.
287 */
288enum nft_data_types {
289 NFT_DATA_VALUE,
290 NFT_DATA_VERDICT = 0xffffff00U,
291};
292
293#define NFT_DATA_RESERVED_MASK 0xffffff00U
294
295/**
296 * enum nft_data_attributes - nf_tables data netlink attributes
297 *
298 * @NFTA_DATA_VALUE: generic data (NLA_BINARY)
299 * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes)
300 */
301enum nft_data_attributes {
302 NFTA_DATA_UNSPEC,
303 NFTA_DATA_VALUE,
304 NFTA_DATA_VERDICT,
305 __NFTA_DATA_MAX
306};
307#define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
308
309/**
310 * enum nft_verdict_attributes - nf_tables verdict netlink attributes
311 *
312 * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts)
313 * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING)
314 */
315enum nft_verdict_attributes {
316 NFTA_VERDICT_UNSPEC,
317 NFTA_VERDICT_CODE,
318 NFTA_VERDICT_CHAIN,
319 __NFTA_VERDICT_MAX
320};
321#define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1)
322
323/**
324 * enum nft_expr_attributes - nf_tables expression netlink attributes
325 *
326 * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING)
327 * @NFTA_EXPR_DATA: type specific data (NLA_NESTED)
328 */
329enum nft_expr_attributes {
330 NFTA_EXPR_UNSPEC,
331 NFTA_EXPR_NAME,
332 NFTA_EXPR_DATA,
333 __NFTA_EXPR_MAX
334};
335#define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1)
336
337/**
338 * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes
339 *
340 * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32)
341 * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes)
342 */
343enum nft_immediate_attributes {
344 NFTA_IMMEDIATE_UNSPEC,
345 NFTA_IMMEDIATE_DREG,
346 NFTA_IMMEDIATE_DATA,
347 __NFTA_IMMEDIATE_MAX
348};
349#define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
350
351/**
352 * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes
353 *
354 * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers)
355 * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers)
356 * @NFTA_BITWISE_LEN: length of operands (NLA_U32)
357 * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
358 * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
359 *
360 * The bitwise expression performs the following operation:
361 *
362 * dreg = (sreg & mask) ^ xor
363 *
364 * which allow to express all bitwise operations:
365 *
366 * mask xor
367 * NOT: 1 1
368 * OR: 0 x
369 * XOR: 1 x
370 * AND: x 0
371 */
372enum nft_bitwise_attributes {
373 NFTA_BITWISE_UNSPEC,
374 NFTA_BITWISE_SREG,
375 NFTA_BITWISE_DREG,
376 NFTA_BITWISE_LEN,
377 NFTA_BITWISE_MASK,
378 NFTA_BITWISE_XOR,
379 __NFTA_BITWISE_MAX
380};
381#define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
382
383/**
384 * enum nft_byteorder_ops - nf_tables byteorder operators
385 *
386 * @NFT_BYTEORDER_NTOH: network to host operator
387 * @NFT_BYTEORDER_HTON: host to network opertaor
388 */
389enum nft_byteorder_ops {
390 NFT_BYTEORDER_NTOH,
391 NFT_BYTEORDER_HTON,
392};
393
394/**
395 * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes
396 *
397 * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers)
398 * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers)
399 * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops)
400 * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32)
401 * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4)
402 */
403enum nft_byteorder_attributes {
404 NFTA_BYTEORDER_UNSPEC,
405 NFTA_BYTEORDER_SREG,
406 NFTA_BYTEORDER_DREG,
407 NFTA_BYTEORDER_OP,
408 NFTA_BYTEORDER_LEN,
409 NFTA_BYTEORDER_SIZE,
410 __NFTA_BYTEORDER_MAX
411};
412#define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1)
413
414/**
415 * enum nft_cmp_ops - nf_tables relational operator
416 *
417 * @NFT_CMP_EQ: equal
418 * @NFT_CMP_NEQ: not equal
419 * @NFT_CMP_LT: less than
420 * @NFT_CMP_LTE: less than or equal to
421 * @NFT_CMP_GT: greater than
422 * @NFT_CMP_GTE: greater than or equal to
423 */
424enum nft_cmp_ops {
425 NFT_CMP_EQ,
426 NFT_CMP_NEQ,
427 NFT_CMP_LT,
428 NFT_CMP_LTE,
429 NFT_CMP_GT,
430 NFT_CMP_GTE,
431};
432
433/**
434 * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes
435 *
436 * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers)
437 * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops)
438 * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes)
439 */
440enum nft_cmp_attributes {
441 NFTA_CMP_UNSPEC,
442 NFTA_CMP_SREG,
443 NFTA_CMP_OP,
444 NFTA_CMP_DATA,
445 __NFTA_CMP_MAX
446};
447#define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1)
448
449/**
450 * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes
451 *
452 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
453 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
454 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
455 */
456enum nft_lookup_attributes {
457 NFTA_LOOKUP_UNSPEC,
458 NFTA_LOOKUP_SET,
459 NFTA_LOOKUP_SREG,
460 NFTA_LOOKUP_DREG,
461 __NFTA_LOOKUP_MAX
462};
463#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
464
465/**
466 * enum nft_payload_bases - nf_tables payload expression offset bases
467 *
468 * @NFT_PAYLOAD_LL_HEADER: link layer header
469 * @NFT_PAYLOAD_NETWORK_HEADER: network header
470 * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header
471 */
472enum nft_payload_bases {
473 NFT_PAYLOAD_LL_HEADER,
474 NFT_PAYLOAD_NETWORK_HEADER,
475 NFT_PAYLOAD_TRANSPORT_HEADER,
476};
477
478/**
479 * enum nft_payload_attributes - nf_tables payload expression netlink attributes
480 *
481 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
482 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
483 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
484 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
485 */
486enum nft_payload_attributes {
487 NFTA_PAYLOAD_UNSPEC,
488 NFTA_PAYLOAD_DREG,
489 NFTA_PAYLOAD_BASE,
490 NFTA_PAYLOAD_OFFSET,
491 NFTA_PAYLOAD_LEN,
492 __NFTA_PAYLOAD_MAX
493};
494#define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
495
496/**
497 * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes
498 *
499 * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
500 * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
501 * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
502 * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
503 */
504enum nft_exthdr_attributes {
505 NFTA_EXTHDR_UNSPEC,
506 NFTA_EXTHDR_DREG,
507 NFTA_EXTHDR_TYPE,
508 NFTA_EXTHDR_OFFSET,
509 NFTA_EXTHDR_LEN,
510 __NFTA_EXTHDR_MAX
511};
512#define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1)
513
514/**
515 * enum nft_meta_keys - nf_tables meta expression keys
516 *
517 * @NFT_META_LEN: packet length (skb->len)
518 * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
519 * @NFT_META_PRIORITY: packet priority (skb->priority)
520 * @NFT_META_MARK: packet mark (skb->mark)
521 * @NFT_META_IIF: packet input interface index (dev->ifindex)
522 * @NFT_META_OIF: packet output interface index (dev->ifindex)
523 * @NFT_META_IIFNAME: packet input interface name (dev->name)
524 * @NFT_META_OIFNAME: packet output interface name (dev->name)
525 * @NFT_META_IIFTYPE: packet input interface type (dev->type)
526 * @NFT_META_OIFTYPE: packet output interface type (dev->type)
527 * @NFT_META_SKUID: originating socket UID (fsuid)
528 * @NFT_META_SKGID: originating socket GID (fsgid)
529 * @NFT_META_NFTRACE: packet nftrace bit
530 * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
531 * @NFT_META_SECMARK: packet secmark (skb->secmark)
532 */
533enum nft_meta_keys {
534 NFT_META_LEN,
535 NFT_META_PROTOCOL,
536 NFT_META_PRIORITY,
537 NFT_META_MARK,
538 NFT_META_IIF,
539 NFT_META_OIF,
540 NFT_META_IIFNAME,
541 NFT_META_OIFNAME,
542 NFT_META_IIFTYPE,
543 NFT_META_OIFTYPE,
544 NFT_META_SKUID,
545 NFT_META_SKGID,
546 NFT_META_NFTRACE,
547 NFT_META_RTCLASSID,
548 NFT_META_SECMARK,
549};
550
551/**
552 * enum nft_meta_attributes - nf_tables meta expression netlink attributes
553 *
554 * @NFTA_META_DREG: destination register (NLA_U32)
555 * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
556 */
557enum nft_meta_attributes {
558 NFTA_META_UNSPEC,
559 NFTA_META_DREG,
560 NFTA_META_KEY,
561 __NFTA_META_MAX
562};
563#define NFTA_META_MAX (__NFTA_META_MAX - 1)
564
565/**
566 * enum nft_ct_keys - nf_tables ct expression keys
567 *
568 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
569 * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
570 * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
571 * @NFT_CT_MARK: conntrack mark value
572 * @NFT_CT_SECMARK: conntrack secmark value
573 * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
574 * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
575 * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
576 * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address)
577 * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address)
578 * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
579 * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
580 * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
581 */
582enum nft_ct_keys {
583 NFT_CT_STATE,
584 NFT_CT_DIRECTION,
585 NFT_CT_STATUS,
586 NFT_CT_MARK,
587 NFT_CT_SECMARK,
588 NFT_CT_EXPIRATION,
589 NFT_CT_HELPER,
590 NFT_CT_L3PROTOCOL,
591 NFT_CT_SRC,
592 NFT_CT_DST,
593 NFT_CT_PROTOCOL,
594 NFT_CT_PROTO_SRC,
595 NFT_CT_PROTO_DST,
596};
597
598/**
599 * enum nft_ct_attributes - nf_tables ct expression netlink attributes
600 *
601 * @NFTA_CT_DREG: destination register (NLA_U32)
602 * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
603 * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
604 */
605enum nft_ct_attributes {
606 NFTA_CT_UNSPEC,
607 NFTA_CT_DREG,
608 NFTA_CT_KEY,
609 NFTA_CT_DIRECTION,
610 __NFTA_CT_MAX
611};
612#define NFTA_CT_MAX (__NFTA_CT_MAX - 1)
613
614/**
615 * enum nft_limit_attributes - nf_tables limit expression netlink attributes
616 *
617 * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
618 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
619 */
620enum nft_limit_attributes {
621 NFTA_LIMIT_UNSPEC,
622 NFTA_LIMIT_RATE,
623 NFTA_LIMIT_UNIT,
624 __NFTA_LIMIT_MAX
625};
626#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
627
628/**
629 * enum nft_counter_attributes - nf_tables counter expression netlink attributes
630 *
631 * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
632 * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
633 */
634enum nft_counter_attributes {
635 NFTA_COUNTER_UNSPEC,
636 NFTA_COUNTER_BYTES,
637 NFTA_COUNTER_PACKETS,
638 __NFTA_COUNTER_MAX
639};
640#define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1)
641
642/**
643 * enum nft_log_attributes - nf_tables log expression netlink attributes
644 *
645 * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
646 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
647 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
648 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
649 */
650enum nft_log_attributes {
651 NFTA_LOG_UNSPEC,
652 NFTA_LOG_GROUP,
653 NFTA_LOG_PREFIX,
654 NFTA_LOG_SNAPLEN,
655 NFTA_LOG_QTHRESHOLD,
656 __NFTA_LOG_MAX
657};
658#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
659
660/**
661 * enum nft_reject_types - nf_tables reject expression reject types
662 *
663 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
664 * @NFT_REJECT_TCP_RST: reject using TCP RST
665 */
666enum nft_reject_types {
667 NFT_REJECT_ICMP_UNREACH,
668 NFT_REJECT_TCP_RST,
669};
670
671/**
672 * enum nft_reject_attributes - nf_tables reject expression netlink attributes
673 *
674 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
675 * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
676 */
677enum nft_reject_attributes {
678 NFTA_REJECT_UNSPEC,
679 NFTA_REJECT_TYPE,
680 NFTA_REJECT_ICMP_CODE,
681 __NFTA_REJECT_MAX
682};
683#define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1)
684
685/**
686 * enum nft_nat_types - nf_tables nat expression NAT types
687 *
688 * @NFT_NAT_SNAT: source NAT
689 * @NFT_NAT_DNAT: destination NAT
690 */
691enum nft_nat_types {
692 NFT_NAT_SNAT,
693 NFT_NAT_DNAT,
694};
695
696/**
697 * enum nft_nat_attributes - nf_tables nat expression netlink attributes
698 *
699 * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
700 * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
701 * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
702 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
703 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
704 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
705 */
706enum nft_nat_attributes {
707 NFTA_NAT_UNSPEC,
708 NFTA_NAT_TYPE,
709 NFTA_NAT_FAMILY,
710 NFTA_NAT_REG_ADDR_MIN,
711 NFTA_NAT_REG_ADDR_MAX,
712 NFTA_NAT_REG_PROTO_MIN,
713 NFTA_NAT_REG_PROTO_MAX,
714 __NFTA_NAT_MAX
715};
716#define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
717
718#endif /* _LINUX_NF_TABLES_H */
diff --git a/include/uapi/linux/netfilter/nf_tables_compat.h b/include/uapi/linux/netfilter/nf_tables_compat.h
new file mode 100644
index 000000000000..8310f5f76551
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_tables_compat.h
@@ -0,0 +1,38 @@
1#ifndef _NFT_COMPAT_NFNETLINK_H_
2#define _NFT_COMPAT_NFNETLINK_H_
3
4enum nft_target_attributes {
5 NFTA_TARGET_UNSPEC,
6 NFTA_TARGET_NAME,
7 NFTA_TARGET_REV,
8 NFTA_TARGET_INFO,
9 __NFTA_TARGET_MAX
10};
11#define NFTA_TARGET_MAX (__NFTA_TARGET_MAX - 1)
12
13enum nft_match_attributes {
14 NFTA_MATCH_UNSPEC,
15 NFTA_MATCH_NAME,
16 NFTA_MATCH_REV,
17 NFTA_MATCH_INFO,
18 __NFTA_MATCH_MAX
19};
20#define NFTA_MATCH_MAX (__NFTA_MATCH_MAX - 1)
21
22#define NFT_COMPAT_NAME_MAX 32
23
24enum {
25 NFNL_MSG_COMPAT_GET,
26 NFNL_MSG_COMPAT_MAX
27};
28
29enum {
30 NFTA_COMPAT_UNSPEC = 0,
31 NFTA_COMPAT_NAME,
32 NFTA_COMPAT_REV,
33 NFTA_COMPAT_TYPE,
34 __NFTA_COMPAT_MAX,
35};
36#define NFTA_COMPAT_MAX (__NFTA_COMPAT_MAX - 1)
37
38#endif
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
index 4a4efafad5f4..596ddd45253c 100644
--- a/include/uapi/linux/netfilter/nfnetlink.h
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -18,6 +18,8 @@ enum nfnetlink_groups {
18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE 18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
19 NFNLGRP_CONNTRACK_EXP_DESTROY, 19 NFNLGRP_CONNTRACK_EXP_DESTROY,
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY 20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 NFNLGRP_NFTABLES,
22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
21 __NFNLGRP_MAX, 23 __NFNLGRP_MAX,
22}; 24};
23#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 25#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
@@ -51,6 +53,12 @@ struct nfgenmsg {
51#define NFNL_SUBSYS_ACCT 7 53#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 54#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_CTHELPER 9 55#define NFNL_SUBSYS_CTHELPER 9
54#define NFNL_SUBSYS_COUNT 10 56#define NFNL_SUBSYS_NFTABLES 10
57#define NFNL_SUBSYS_NFT_COMPAT 11
58#define NFNL_SUBSYS_COUNT 12
59
60/* Reserved control nfnetlink messages */
61#define NFNL_MSG_BATCH_BEGIN NLMSG_MIN_TYPE
62#define NFNL_MSG_BATCH_END NLMSG_MIN_TYPE+1
55 63
56#endif /* _UAPI_NFNETLINK_H */ 64#endif /* _UAPI_NFNETLINK_H */
diff --git a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
index a2810a7c5e30..1ab0b97b3a1e 100644
--- a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
@@ -6,6 +6,8 @@ enum ctnl_timeout_msg_types {
6 IPCTNL_MSG_TIMEOUT_NEW, 6 IPCTNL_MSG_TIMEOUT_NEW,
7 IPCTNL_MSG_TIMEOUT_GET, 7 IPCTNL_MSG_TIMEOUT_GET,
8 IPCTNL_MSG_TIMEOUT_DELETE, 8 IPCTNL_MSG_TIMEOUT_DELETE,
9 IPCTNL_MSG_TIMEOUT_DEFAULT_SET,
10 IPCTNL_MSG_TIMEOUT_DEFAULT_GET,
9 11
10 IPCTNL_MSG_TIMEOUT_MAX 12 IPCTNL_MSG_TIMEOUT_MAX
11}; 13};
diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
index 4e31db4eea41..f2159d30d1f5 100644
--- a/include/uapi/linux/netlink_diag.h
+++ b/include/uapi/linux/netlink_diag.h
@@ -33,6 +33,7 @@ struct netlink_diag_ring {
33}; 33};
34 34
35enum { 35enum {
36 /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */
36 NETLINK_DIAG_MEMINFO, 37 NETLINK_DIAG_MEMINFO,
37 NETLINK_DIAG_GROUPS, 38 NETLINK_DIAG_GROUPS,
38 NETLINK_DIAG_RX_RING, 39 NETLINK_DIAG_RX_RING,
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 29bed72a4ac4..6ad6cc03ccd3 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -85,6 +85,7 @@
85 * a specific SE notifies us about the end of a transaction. The parameter 85 * a specific SE notifies us about the end of a transaction. The parameter
86 * for this event is the application ID (AID). 86 * for this event is the application ID (AID).
87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. 87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller.
88 * @NFC_CMD_SE_IO: Send/Receive APDUs to/from the selected secure element.
88 */ 89 */
89enum nfc_commands { 90enum nfc_commands {
90 NFC_CMD_UNSPEC, 91 NFC_CMD_UNSPEC,
@@ -114,6 +115,7 @@ enum nfc_commands {
114 NFC_EVENT_SE_CONNECTIVITY, 115 NFC_EVENT_SE_CONNECTIVITY,
115 NFC_EVENT_SE_TRANSACTION, 116 NFC_EVENT_SE_TRANSACTION,
116 NFC_CMD_GET_SE, 117 NFC_CMD_GET_SE,
118 NFC_CMD_SE_IO,
117/* private: internal use only */ 119/* private: internal use only */
118 __NFC_CMD_AFTER_LAST 120 __NFC_CMD_AFTER_LAST
119}; 121};
@@ -147,6 +149,7 @@ enum nfc_commands {
147 * @NFC_ATTR_SE_INDEX: Secure element index 149 * @NFC_ATTR_SE_INDEX: Secure element index
148 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) 150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
149 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status 151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status
152 * @NFC_ATTR_APDU: Secure element APDU
150 */ 153 */
151enum nfc_attrs { 154enum nfc_attrs {
152 NFC_ATTR_UNSPEC, 155 NFC_ATTR_UNSPEC,
@@ -174,6 +177,7 @@ enum nfc_attrs {
174 NFC_ATTR_SE_TYPE, 177 NFC_ATTR_SE_TYPE,
175 NFC_ATTR_SE_AID, 178 NFC_ATTR_SE_AID,
176 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, 179 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
180 NFC_ATTR_SE_APDU,
177/* private: internal use only */ 181/* private: internal use only */
178 __NFC_ATTR_AFTER_LAST 182 __NFC_ATTR_AFTER_LAST
179}; 183};
diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h
index 576bddd72e04..64b0f22f5c4c 100644
--- a/include/uapi/linux/nfs_mount.h
+++ b/include/uapi/linux/nfs_mount.h
@@ -60,7 +60,7 @@ struct nfs_mount_data {
60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ 60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
61#define NFS_MOUNT_NOACL 0x0800 /* 4 */ 61#define NFS_MOUNT_NOACL 0x0800 /* 4 */
62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */
64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ 64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ 65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
66#define NFS_MOUNT_FLAGMASK 0xFFFF 66#define NFS_MOUNT_FLAGMASK 0xFFFF
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fde2c021b26d..f752e9821e71 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -988,7 +988,7 @@ enum nl80211_commands {
988 * to query the CRDA to retrieve one regulatory domain. This attribute can 988 * to query the CRDA to retrieve one regulatory domain. This attribute can
989 * also be used by userspace to query the kernel for the currently set 989 * also be used by userspace to query the kernel for the currently set
990 * regulatory domain. We chose an alpha2 as that is also used by the 990 * regulatory domain. We chose an alpha2 as that is also used by the
991 * IEEE-802.11d country information element to identify a country. 991 * IEEE-802.11 country information element to identify a country.
992 * Users can also simply ask the wireless core to set regulatory domain 992 * Users can also simply ask the wireless core to set regulatory domain
993 * to a specific alpha2. 993 * to a specific alpha2.
994 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory 994 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
@@ -1496,6 +1496,18 @@ enum nl80211_commands {
1496 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. 1496 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
1497 * As specified in the &enum nl80211_rxmgmt_flags. 1497 * As specified in the &enum nl80211_rxmgmt_flags.
1498 * 1498 *
1499 * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
1500 *
1501 * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
1502 * supported operating classes.
1503 *
1504 * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space
1505 * controls DFS operation in IBSS mode. If the flag is included in
1506 * %NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS
1507 * channels and reports radar events to userspace. Userspace is required
1508 * to react to radar events, e.g. initiate a channel switch or leave the
1509 * IBSS network.
1510 *
1499 * @NL80211_ATTR_MAX: highest attribute number currently defined 1511 * @NL80211_ATTR_MAX: highest attribute number currently defined
1500 * @__NL80211_ATTR_AFTER_LAST: internal use 1512 * @__NL80211_ATTR_AFTER_LAST: internal use
1501 */ 1513 */
@@ -1806,6 +1818,12 @@ enum nl80211_attrs {
1806 1818
1807 NL80211_ATTR_RXMGMT_FLAGS, 1819 NL80211_ATTR_RXMGMT_FLAGS,
1808 1820
1821 NL80211_ATTR_STA_SUPPORTED_CHANNELS,
1822
1823 NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
1824
1825 NL80211_ATTR_HANDLE_DFS,
1826
1809 /* add attributes here, update the policy in nl80211.c */ 1827 /* add attributes here, update the policy in nl80211.c */
1810 1828
1811 __NL80211_ATTR_AFTER_LAST, 1829 __NL80211_ATTR_AFTER_LAST,
@@ -3860,13 +3878,12 @@ enum nl80211_radar_event {
3860 * 3878 *
3861 * Channel states used by the DFS code. 3879 * Channel states used by the DFS code.
3862 * 3880 *
3863 * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability 3881 * @NL80211_DFS_USABLE: The channel can be used, but channel availability
3864 * check (CAC) must be performed before using it for AP or IBSS. 3882 * check (CAC) must be performed before using it for AP or IBSS.
3865 * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it 3883 * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
3866 * is therefore marked as not available. 3884 * is therefore marked as not available.
3867 * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available. 3885 * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
3868 */ 3886 */
3869
3870enum nl80211_dfs_state { 3887enum nl80211_dfs_state {
3871 NL80211_DFS_USABLE, 3888 NL80211_DFS_USABLE,
3872 NL80211_DFS_UNAVAILABLE, 3889 NL80211_DFS_UNAVAILABLE,
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
new file mode 100644
index 000000000000..989c04e0c563
--- /dev/null
+++ b/include/uapi/linux/nvme.h
@@ -0,0 +1,477 @@
1/*
2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011-2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _UAPI_LINUX_NVME_H
20#define _UAPI_LINUX_NVME_H
21
22#include <linux/types.h>
23
24struct nvme_id_power_state {
25 __le16 max_power; /* centiwatts */
26 __u8 rsvd2;
27 __u8 flags;
28 __le32 entry_lat; /* microseconds */
29 __le32 exit_lat; /* microseconds */
30 __u8 read_tput;
31 __u8 read_lat;
32 __u8 write_tput;
33 __u8 write_lat;
34 __u8 rsvd16[16];
35};
36
37enum {
38 NVME_PS_FLAGS_MAX_POWER_SCALE = 1 << 0,
39 NVME_PS_FLAGS_NON_OP_STATE = 1 << 1,
40};
41
42struct nvme_id_ctrl {
43 __le16 vid;
44 __le16 ssvid;
45 char sn[20];
46 char mn[40];
47 char fr[8];
48 __u8 rab;
49 __u8 ieee[3];
50 __u8 mic;
51 __u8 mdts;
52 __u8 rsvd78[178];
53 __le16 oacs;
54 __u8 acl;
55 __u8 aerl;
56 __u8 frmw;
57 __u8 lpa;
58 __u8 elpe;
59 __u8 npss;
60 __u8 rsvd264[248];
61 __u8 sqes;
62 __u8 cqes;
63 __u8 rsvd514[2];
64 __le32 nn;
65 __le16 oncs;
66 __le16 fuses;
67 __u8 fna;
68 __u8 vwc;
69 __le16 awun;
70 __le16 awupf;
71 __u8 rsvd530[1518];
72 struct nvme_id_power_state psd[32];
73 __u8 vs[1024];
74};
75
76enum {
77 NVME_CTRL_ONCS_COMPARE = 1 << 0,
78 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
79 NVME_CTRL_ONCS_DSM = 1 << 2,
80};
81
82struct nvme_lbaf {
83 __le16 ms;
84 __u8 ds;
85 __u8 rp;
86};
87
88struct nvme_id_ns {
89 __le64 nsze;
90 __le64 ncap;
91 __le64 nuse;
92 __u8 nsfeat;
93 __u8 nlbaf;
94 __u8 flbas;
95 __u8 mc;
96 __u8 dpc;
97 __u8 dps;
98 __u8 rsvd30[98];
99 struct nvme_lbaf lbaf[16];
100 __u8 rsvd192[192];
101 __u8 vs[3712];
102};
103
104enum {
105 NVME_NS_FEAT_THIN = 1 << 0,
106 NVME_LBAF_RP_BEST = 0,
107 NVME_LBAF_RP_BETTER = 1,
108 NVME_LBAF_RP_GOOD = 2,
109 NVME_LBAF_RP_DEGRADED = 3,
110};
111
112struct nvme_smart_log {
113 __u8 critical_warning;
114 __u8 temperature[2];
115 __u8 avail_spare;
116 __u8 spare_thresh;
117 __u8 percent_used;
118 __u8 rsvd6[26];
119 __u8 data_units_read[16];
120 __u8 data_units_written[16];
121 __u8 host_reads[16];
122 __u8 host_writes[16];
123 __u8 ctrl_busy_time[16];
124 __u8 power_cycles[16];
125 __u8 power_on_hours[16];
126 __u8 unsafe_shutdowns[16];
127 __u8 media_errors[16];
128 __u8 num_err_log_entries[16];
129 __u8 rsvd192[320];
130};
131
132enum {
133 NVME_SMART_CRIT_SPARE = 1 << 0,
134 NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
135 NVME_SMART_CRIT_RELIABILITY = 1 << 2,
136 NVME_SMART_CRIT_MEDIA = 1 << 3,
137 NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
138};
139
140struct nvme_lba_range_type {
141 __u8 type;
142 __u8 attributes;
143 __u8 rsvd2[14];
144 __u64 slba;
145 __u64 nlb;
146 __u8 guid[16];
147 __u8 rsvd48[16];
148};
149
150enum {
151 NVME_LBART_TYPE_FS = 0x01,
152 NVME_LBART_TYPE_RAID = 0x02,
153 NVME_LBART_TYPE_CACHE = 0x03,
154 NVME_LBART_TYPE_SWAP = 0x04,
155
156 NVME_LBART_ATTRIB_TEMP = 1 << 0,
157 NVME_LBART_ATTRIB_HIDE = 1 << 1,
158};
159
160/* I/O commands */
161
162enum nvme_opcode {
163 nvme_cmd_flush = 0x00,
164 nvme_cmd_write = 0x01,
165 nvme_cmd_read = 0x02,
166 nvme_cmd_write_uncor = 0x04,
167 nvme_cmd_compare = 0x05,
168 nvme_cmd_dsm = 0x09,
169};
170
171struct nvme_common_command {
172 __u8 opcode;
173 __u8 flags;
174 __u16 command_id;
175 __le32 nsid;
176 __le32 cdw2[2];
177 __le64 metadata;
178 __le64 prp1;
179 __le64 prp2;
180 __le32 cdw10[6];
181};
182
183struct nvme_rw_command {
184 __u8 opcode;
185 __u8 flags;
186 __u16 command_id;
187 __le32 nsid;
188 __u64 rsvd2;
189 __le64 metadata;
190 __le64 prp1;
191 __le64 prp2;
192 __le64 slba;
193 __le16 length;
194 __le16 control;
195 __le32 dsmgmt;
196 __le32 reftag;
197 __le16 apptag;
198 __le16 appmask;
199};
200
201enum {
202 NVME_RW_LR = 1 << 15,
203 NVME_RW_FUA = 1 << 14,
204 NVME_RW_DSM_FREQ_UNSPEC = 0,
205 NVME_RW_DSM_FREQ_TYPICAL = 1,
206 NVME_RW_DSM_FREQ_RARE = 2,
207 NVME_RW_DSM_FREQ_READS = 3,
208 NVME_RW_DSM_FREQ_WRITES = 4,
209 NVME_RW_DSM_FREQ_RW = 5,
210 NVME_RW_DSM_FREQ_ONCE = 6,
211 NVME_RW_DSM_FREQ_PREFETCH = 7,
212 NVME_RW_DSM_FREQ_TEMP = 8,
213 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
214 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
215 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
216 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
217 NVME_RW_DSM_SEQ_REQ = 1 << 6,
218 NVME_RW_DSM_COMPRESSED = 1 << 7,
219};
220
221struct nvme_dsm_cmd {
222 __u8 opcode;
223 __u8 flags;
224 __u16 command_id;
225 __le32 nsid;
226 __u64 rsvd2[2];
227 __le64 prp1;
228 __le64 prp2;
229 __le32 nr;
230 __le32 attributes;
231 __u32 rsvd12[4];
232};
233
234enum {
235 NVME_DSMGMT_IDR = 1 << 0,
236 NVME_DSMGMT_IDW = 1 << 1,
237 NVME_DSMGMT_AD = 1 << 2,
238};
239
240struct nvme_dsm_range {
241 __le32 cattr;
242 __le32 nlb;
243 __le64 slba;
244};
245
246/* Admin commands */
247
248enum nvme_admin_opcode {
249 nvme_admin_delete_sq = 0x00,
250 nvme_admin_create_sq = 0x01,
251 nvme_admin_get_log_page = 0x02,
252 nvme_admin_delete_cq = 0x04,
253 nvme_admin_create_cq = 0x05,
254 nvme_admin_identify = 0x06,
255 nvme_admin_abort_cmd = 0x08,
256 nvme_admin_set_features = 0x09,
257 nvme_admin_get_features = 0x0a,
258 nvme_admin_async_event = 0x0c,
259 nvme_admin_activate_fw = 0x10,
260 nvme_admin_download_fw = 0x11,
261 nvme_admin_format_nvm = 0x80,
262 nvme_admin_security_send = 0x81,
263 nvme_admin_security_recv = 0x82,
264};
265
266enum {
267 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
268 NVME_CQ_IRQ_ENABLED = (1 << 1),
269 NVME_SQ_PRIO_URGENT = (0 << 1),
270 NVME_SQ_PRIO_HIGH = (1 << 1),
271 NVME_SQ_PRIO_MEDIUM = (2 << 1),
272 NVME_SQ_PRIO_LOW = (3 << 1),
273 NVME_FEAT_ARBITRATION = 0x01,
274 NVME_FEAT_POWER_MGMT = 0x02,
275 NVME_FEAT_LBA_RANGE = 0x03,
276 NVME_FEAT_TEMP_THRESH = 0x04,
277 NVME_FEAT_ERR_RECOVERY = 0x05,
278 NVME_FEAT_VOLATILE_WC = 0x06,
279 NVME_FEAT_NUM_QUEUES = 0x07,
280 NVME_FEAT_IRQ_COALESCE = 0x08,
281 NVME_FEAT_IRQ_CONFIG = 0x09,
282 NVME_FEAT_WRITE_ATOMIC = 0x0a,
283 NVME_FEAT_ASYNC_EVENT = 0x0b,
284 NVME_FEAT_SW_PROGRESS = 0x0c,
285 NVME_FWACT_REPL = (0 << 3),
286 NVME_FWACT_REPL_ACTV = (1 << 3),
287 NVME_FWACT_ACTV = (2 << 3),
288};
289
290struct nvme_identify {
291 __u8 opcode;
292 __u8 flags;
293 __u16 command_id;
294 __le32 nsid;
295 __u64 rsvd2[2];
296 __le64 prp1;
297 __le64 prp2;
298 __le32 cns;
299 __u32 rsvd11[5];
300};
301
302struct nvme_features {
303 __u8 opcode;
304 __u8 flags;
305 __u16 command_id;
306 __le32 nsid;
307 __u64 rsvd2[2];
308 __le64 prp1;
309 __le64 prp2;
310 __le32 fid;
311 __le32 dword11;
312 __u32 rsvd12[4];
313};
314
315struct nvme_create_cq {
316 __u8 opcode;
317 __u8 flags;
318 __u16 command_id;
319 __u32 rsvd1[5];
320 __le64 prp1;
321 __u64 rsvd8;
322 __le16 cqid;
323 __le16 qsize;
324 __le16 cq_flags;
325 __le16 irq_vector;
326 __u32 rsvd12[4];
327};
328
329struct nvme_create_sq {
330 __u8 opcode;
331 __u8 flags;
332 __u16 command_id;
333 __u32 rsvd1[5];
334 __le64 prp1;
335 __u64 rsvd8;
336 __le16 sqid;
337 __le16 qsize;
338 __le16 sq_flags;
339 __le16 cqid;
340 __u32 rsvd12[4];
341};
342
343struct nvme_delete_queue {
344 __u8 opcode;
345 __u8 flags;
346 __u16 command_id;
347 __u32 rsvd1[9];
348 __le16 qid;
349 __u16 rsvd10;
350 __u32 rsvd11[5];
351};
352
353struct nvme_download_firmware {
354 __u8 opcode;
355 __u8 flags;
356 __u16 command_id;
357 __u32 rsvd1[5];
358 __le64 prp1;
359 __le64 prp2;
360 __le32 numd;
361 __le32 offset;
362 __u32 rsvd12[4];
363};
364
365struct nvme_format_cmd {
366 __u8 opcode;
367 __u8 flags;
368 __u16 command_id;
369 __le32 nsid;
370 __u64 rsvd2[4];
371 __le32 cdw10;
372 __u32 rsvd11[5];
373};
374
375struct nvme_command {
376 union {
377 struct nvme_common_command common;
378 struct nvme_rw_command rw;
379 struct nvme_identify identify;
380 struct nvme_features features;
381 struct nvme_create_cq create_cq;
382 struct nvme_create_sq create_sq;
383 struct nvme_delete_queue delete_queue;
384 struct nvme_download_firmware dlfw;
385 struct nvme_format_cmd format;
386 struct nvme_dsm_cmd dsm;
387 };
388};
389
390enum {
391 NVME_SC_SUCCESS = 0x0,
392 NVME_SC_INVALID_OPCODE = 0x1,
393 NVME_SC_INVALID_FIELD = 0x2,
394 NVME_SC_CMDID_CONFLICT = 0x3,
395 NVME_SC_DATA_XFER_ERROR = 0x4,
396 NVME_SC_POWER_LOSS = 0x5,
397 NVME_SC_INTERNAL = 0x6,
398 NVME_SC_ABORT_REQ = 0x7,
399 NVME_SC_ABORT_QUEUE = 0x8,
400 NVME_SC_FUSED_FAIL = 0x9,
401 NVME_SC_FUSED_MISSING = 0xa,
402 NVME_SC_INVALID_NS = 0xb,
403 NVME_SC_CMD_SEQ_ERROR = 0xc,
404 NVME_SC_LBA_RANGE = 0x80,
405 NVME_SC_CAP_EXCEEDED = 0x81,
406 NVME_SC_NS_NOT_READY = 0x82,
407 NVME_SC_CQ_INVALID = 0x100,
408 NVME_SC_QID_INVALID = 0x101,
409 NVME_SC_QUEUE_SIZE = 0x102,
410 NVME_SC_ABORT_LIMIT = 0x103,
411 NVME_SC_ABORT_MISSING = 0x104,
412 NVME_SC_ASYNC_LIMIT = 0x105,
413 NVME_SC_FIRMWARE_SLOT = 0x106,
414 NVME_SC_FIRMWARE_IMAGE = 0x107,
415 NVME_SC_INVALID_VECTOR = 0x108,
416 NVME_SC_INVALID_LOG_PAGE = 0x109,
417 NVME_SC_INVALID_FORMAT = 0x10a,
418 NVME_SC_BAD_ATTRIBUTES = 0x180,
419 NVME_SC_WRITE_FAULT = 0x280,
420 NVME_SC_READ_ERROR = 0x281,
421 NVME_SC_GUARD_CHECK = 0x282,
422 NVME_SC_APPTAG_CHECK = 0x283,
423 NVME_SC_REFTAG_CHECK = 0x284,
424 NVME_SC_COMPARE_FAILED = 0x285,
425 NVME_SC_ACCESS_DENIED = 0x286,
426};
427
428struct nvme_completion {
429 __le32 result; /* Used by admin commands to return data */
430 __u32 rsvd;
431 __le16 sq_head; /* how much of this queue may be reclaimed */
432 __le16 sq_id; /* submission queue that generated this entry */
433 __u16 command_id; /* of the command which completed */
434 __le16 status; /* did the command fail, and if so, why? */
435};
436
437struct nvme_user_io {
438 __u8 opcode;
439 __u8 flags;
440 __u16 control;
441 __u16 nblocks;
442 __u16 rsvd;
443 __u64 metadata;
444 __u64 addr;
445 __u64 slba;
446 __u32 dsmgmt;
447 __u32 reftag;
448 __u16 apptag;
449 __u16 appmask;
450};
451
452struct nvme_admin_cmd {
453 __u8 opcode;
454 __u8 flags;
455 __u16 rsvd1;
456 __u32 nsid;
457 __u32 cdw2;
458 __u32 cdw3;
459 __u64 metadata;
460 __u64 addr;
461 __u32 metadata_len;
462 __u32 data_len;
463 __u32 cdw10;
464 __u32 cdw11;
465 __u32 cdw12;
466 __u32 cdw13;
467 __u32 cdw14;
468 __u32 cdw15;
469 __u32 timeout_ms;
470 __u32 result;
471};
472
473#define NVME_IOCTL_ID _IO('N', 0x40)
474#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
475#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
476
477#endif /* _UAPI_LINUX_NVME_H */
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index a74d375b439b..d120f9fe0017 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -63,15 +63,18 @@ enum ovs_datapath_cmd {
63 * not be sent. 63 * not be sent.
64 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the 64 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
65 * datapath. Always present in notifications. 65 * datapath. Always present in notifications.
66 * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the
67 * datapath. Always present in notifications.
66 * 68 *
67 * These attributes follow the &struct ovs_header within the Generic Netlink 69 * These attributes follow the &struct ovs_header within the Generic Netlink
68 * payload for %OVS_DP_* commands. 70 * payload for %OVS_DP_* commands.
69 */ 71 */
70enum ovs_datapath_attr { 72enum ovs_datapath_attr {
71 OVS_DP_ATTR_UNSPEC, 73 OVS_DP_ATTR_UNSPEC,
72 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ 74 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
73 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ 75 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
74 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ 76 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
77 OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */
75 __OVS_DP_ATTR_MAX 78 __OVS_DP_ATTR_MAX
76}; 79};
77 80
@@ -84,6 +87,14 @@ struct ovs_dp_stats {
84 __u64 n_flows; /* Number of flows present */ 87 __u64 n_flows; /* Number of flows present */
85}; 88};
86 89
90struct ovs_dp_megaflow_stats {
91 __u64 n_mask_hit; /* Number of masks used for flow lookups. */
92 __u32 n_masks; /* Number of masks for the datapath. */
93 __u32 pad0; /* Pad for future expension. */
94 __u64 pad1; /* Pad for future expension. */
95 __u64 pad2; /* Pad for future expension. */
96};
97
87struct ovs_vport_stats { 98struct ovs_vport_stats {
88 __u64 rx_packets; /* total packets received */ 99 __u64 rx_packets; /* total packets received */
89 __u64 tx_packets; /* total packets transmitted */ 100 __u64 tx_packets; /* total packets transmitted */
@@ -260,6 +271,7 @@ enum ovs_key_attr {
260 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 271 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
261 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 272 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
262 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ 273 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */
274 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */
263 275
264#ifdef __KERNEL__ 276#ifdef __KERNEL__
265 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */ 277 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h
index b2cc0cd9c4d9..d08c63f3dd6f 100644
--- a/include/uapi/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
@@ -29,6 +29,7 @@ struct packet_diag_msg {
29}; 29};
30 30
31enum { 31enum {
32 /* PACKET_DIAG_NONE, standard nl API requires this attribute! */
32 PACKET_DIAG_INFO, 33 PACKET_DIAG_INFO,
33 PACKET_DIAG_MCLIST, 34 PACKET_DIAG_MCLIST,
34 PACKET_DIAG_RX_RING, 35 PACKET_DIAG_RX_RING,
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index baa7852468ef..4a98e85438a7 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -13,10 +13,10 @@
13 * PCI to PCI Bridge Specification 13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide 14 * PCI System Design Guide
15 * 15 *
16 * For hypertransport information, please consult the following manuals 16 * For HyperTransport information, please consult the following manuals
17 * from http://www.hypertransport.org 17 * from http://www.hypertransport.org
18 * 18 *
19 * The Hypertransport I/O Link Specification 19 * The HyperTransport I/O Link Specification
20 */ 20 */
21 21
22#ifndef LINUX_PCI_REGS_H 22#ifndef LINUX_PCI_REGS_H
@@ -37,7 +37,7 @@
37#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ 37#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
38#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ 38#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
39#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ 39#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
40#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ 40#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
41#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ 41#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
42#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ 42#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
43#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ 43#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
@@ -45,7 +45,7 @@
45#define PCI_STATUS 0x06 /* 16 bits */ 45#define PCI_STATUS 0x06 /* 16 bits */
46#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ 46#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
47#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ 47#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
48#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ 48#define PCI_STATUS_66MHZ 0x20 /* Support 66 MHz PCI 2.1 bus */
49#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ 49#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
50#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ 50#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
51#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ 51#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
@@ -205,14 +205,14 @@
205#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 205#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
206#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 206#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
207#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ 207#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
208#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ 208#define PCI_CAP_ID_VNDR 0x09 /* Vendor-Specific */
209#define PCI_CAP_ID_DBG 0x0A /* Debug port */ 209#define PCI_CAP_ID_DBG 0x0A /* Debug port */
210#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ 210#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
211#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 211#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
212#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ 212#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
213#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ 213#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
214#define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ 214#define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */
215#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 215#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
216#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 216#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
217#define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ 217#define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */
218#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ 218#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
@@ -268,8 +268,8 @@
268#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ 268#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
269#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ 269#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
270#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ 270#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
271#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ 271#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
272#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ 272#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
273#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ 273#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
274#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ 274#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
275#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ 275#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
@@ -319,10 +319,9 @@
319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ 319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */
320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ 320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */
321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ 321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) /* deprecated */
323#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ 322#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
324 323
325/* MSI-X entry's format */ 324/* MSI-X Table entry format */
326#define PCI_MSIX_ENTRY_SIZE 16 325#define PCI_MSIX_ENTRY_SIZE 16
327#define PCI_MSIX_ENTRY_LOWER_ADDR 0 326#define PCI_MSIX_ENTRY_LOWER_ADDR 0
328#define PCI_MSIX_ENTRY_UPPER_ADDR 4 327#define PCI_MSIX_ENTRY_UPPER_ADDR 4
@@ -373,7 +372,7 @@
373#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ 372#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */
374#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ 373#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */
375#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ 374#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
376#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ 375#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
377#define PCI_X_STATUS 4 /* PCI-X capabilities */ 376#define PCI_X_STATUS 4 /* PCI-X capabilities */
378#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ 377#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
379#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ 378#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
@@ -408,8 +407,8 @@
408 407
409/* PCI Bridge Subsystem ID registers */ 408/* PCI Bridge Subsystem ID registers */
410 409
411#define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ 410#define PCI_SSVID_VENDOR_ID 4 /* PCI Bridge subsystem vendor ID */
412#define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */ 411#define PCI_SSVID_DEVICE_ID 6 /* PCI Bridge subsystem device ID */
413 412
414/* PCI Express capability registers */ 413/* PCI Express capability registers */
415 414
@@ -485,12 +484,12 @@
485#define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */ 484#define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */
486#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ 485#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
487#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ 486#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
488#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ 487#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Link Autonomous Bandwidth Interrupt Enable */
489#define PCI_EXP_LNKSTA 18 /* Link Status */ 488#define PCI_EXP_LNKSTA 18 /* Link Status */
490#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ 489#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
491#define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */ 490#define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */
492#define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ 491#define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */
493#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ 492#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */
494#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */ 493#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */
495#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ 494#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
496#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 495#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
@@ -558,7 +557,8 @@
558#define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */ 557#define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */
559#define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */ 558#define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */
560#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ 559#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
561#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ 560#define PCI_EXP_DEVCTL2_COMP_TIMEOUT 0x000f /* Completion Timeout Value */
561#define PCI_EXP_DEVCTL2_ARI 0x0020 /* Alternative Routing-ID */
562#define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */ 562#define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */
563#define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */ 563#define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */
564#define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */ 564#define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */
@@ -593,7 +593,7 @@
593#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ 593#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */
594#define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ 594#define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */
595#define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ 595#define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */
596#define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor Specific */ 596#define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor-Specific */
597#define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ 597#define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */
598#define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ 598#define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */
599#define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ 599#define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */
@@ -602,12 +602,12 @@
602#define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ 602#define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */
603#define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ 603#define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */
604#define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ 604#define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */
605#define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* reserved for AMD */ 605#define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* Reserved for AMD */
606#define PCI_EXT_CAP_ID_REBAR 0x15 /* resizable BAR */ 606#define PCI_EXT_CAP_ID_REBAR 0x15 /* Resizable BAR */
607#define PCI_EXT_CAP_ID_DPA 0x16 /* dynamic power alloc */ 607#define PCI_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */
608#define PCI_EXT_CAP_ID_TPH 0x17 /* TPH request */ 608#define PCI_EXT_CAP_ID_TPH 0x17 /* TPH Requester */
609#define PCI_EXT_CAP_ID_LTR 0x18 /* latency tolerance reporting */ 609#define PCI_EXT_CAP_ID_LTR 0x18 /* Latency Tolerance Reporting */
610#define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe */ 610#define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe Capability */
611#define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ 611#define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */
612#define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ 612#define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */
613#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID 613#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID
@@ -667,9 +667,9 @@
667#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ 667#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
668/* Multi ERR_COR Received */ 668/* Multi ERR_COR Received */
669#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 669#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002
670/* ERR_FATAL/NONFATAL Recevied */ 670/* ERR_FATAL/NONFATAL Received */
671#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 671#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004
672/* Multi ERR_FATAL/NONFATAL Recevied */ 672/* Multi ERR_FATAL/NONFATAL Received */
673#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 673#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008
674#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ 674#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
675#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ 675#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
@@ -678,7 +678,7 @@
678 678
679/* Virtual Channel */ 679/* Virtual Channel */
680#define PCI_VC_PORT_REG1 4 680#define PCI_VC_PORT_REG1 4
681#define PCI_VC_REG1_EVCC 0x7 /* extended vc count */ 681#define PCI_VC_REG1_EVCC 0x7 /* extended VC count */
682#define PCI_VC_PORT_REG2 8 682#define PCI_VC_PORT_REG2 8
683#define PCI_VC_REG2_32_PHASE 0x2 683#define PCI_VC_REG2_32_PHASE 0x2
684#define PCI_VC_REG2_64_PHASE 0x4 684#define PCI_VC_REG2_64_PHASE 0x4
@@ -711,7 +711,7 @@
711#define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff) 711#define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff)
712 712
713/* 713/*
714 * Hypertransport sub capability types 714 * HyperTransport sub capability types
715 * 715 *
716 * Unfortunately there are both 3 bit and 5 bit capability types defined 716 * Unfortunately there are both 3 bit and 5 bit capability types defined
717 * in the HT spec, catering for that is a little messy. You probably don't 717 * in the HT spec, catering for that is a little messy. You probably don't
@@ -739,8 +739,8 @@
739#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ 739#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */
740#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ 740#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */
741#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ 741#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */
742#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ 742#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 HyperTransport configuration */
743#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ 743#define HT_CAPTYPE_PM 0xE0 /* HyperTransport power management configuration */
744#define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ 744#define HT_CAP_SIZEOF_LONG 28 /* slave & primary */
745#define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ 745#define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */
746 746
@@ -777,14 +777,14 @@
777#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ 777#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */
778#define PCI_EXT_CAP_PRI_SIZEOF 16 778#define PCI_EXT_CAP_PRI_SIZEOF 16
779 779
780/* PASID capability */ 780/* Process Address Space ID */
781#define PCI_PASID_CAP 0x04 /* PASID feature register */ 781#define PCI_PASID_CAP 0x04 /* PASID feature register */
782#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */ 782#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */
783#define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */ 783#define PCI_PASID_CAP_PRIV 0x04 /* Privilege Mode Supported */
784#define PCI_PASID_CTRL 0x06 /* PASID control register */ 784#define PCI_PASID_CTRL 0x06 /* PASID control register */
785#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ 785#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */
786#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ 786#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */
787#define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ 787#define PCI_PASID_CTRL_PRIV 0x04 /* Privilege Mode Enable */
788#define PCI_EXT_CAP_PASID_SIZEOF 8 788#define PCI_EXT_CAP_PASID_SIZEOF 8
789 789
790/* Single Root I/O Virtualization */ 790/* Single Root I/O Virtualization */
@@ -839,22 +839,22 @@
839#define PCI_ACS_CTRL 0x06 /* ACS Control Register */ 839#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
840#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ 840#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
841 841
842#define PCI_VSEC_HDR 4 /* extended cap - vendor specific */ 842#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */
843#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ 843#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */
844 844
845/* sata capability */ 845/* SATA capability */
846#define PCI_SATA_REGS 4 /* SATA REGs specifier */ 846#define PCI_SATA_REGS 4 /* SATA REGs specifier */
847#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ 847#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */
848#define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ 848#define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */
849#define PCI_SATA_SIZEOF_SHORT 8 849#define PCI_SATA_SIZEOF_SHORT 8
850#define PCI_SATA_SIZEOF_LONG 16 850#define PCI_SATA_SIZEOF_LONG 16
851 851
852/* resizable BARs */ 852/* Resizable BARs */
853#define PCI_REBAR_CTRL 8 /* control register */ 853#define PCI_REBAR_CTRL 8 /* control register */
854#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ 854#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */
855#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ 855#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */
856 856
857/* dynamic power allocation */ 857/* Dynamic Power Allocation */
858#define PCI_DPA_CAP 4 /* capability register */ 858#define PCI_DPA_CAP 4 /* capability register */
859#define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ 859#define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */
860#define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ 860#define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index ca1d90bcb74d..e1802d6153ae 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -136,8 +136,9 @@ enum perf_event_sample_format {
136 PERF_SAMPLE_WEIGHT = 1U << 14, 136 PERF_SAMPLE_WEIGHT = 1U << 14,
137 PERF_SAMPLE_DATA_SRC = 1U << 15, 137 PERF_SAMPLE_DATA_SRC = 1U << 15,
138 PERF_SAMPLE_IDENTIFIER = 1U << 16, 138 PERF_SAMPLE_IDENTIFIER = 1U << 16,
139 PERF_SAMPLE_TRANSACTION = 1U << 17,
139 140
140 PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */ 141 PERF_SAMPLE_MAX = 1U << 18, /* non-ABI */
141}; 142};
142 143
143/* 144/*
@@ -181,6 +182,28 @@ enum perf_sample_regs_abi {
181}; 182};
182 183
183/* 184/*
185 * Values for the memory transaction event qualifier, mostly for
186 * abort events. Multiple bits can be set.
187 */
188enum {
189 PERF_TXN_ELISION = (1 << 0), /* From elision */
190 PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */
191 PERF_TXN_SYNC = (1 << 2), /* Instruction is related */
192 PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */
193 PERF_TXN_RETRY = (1 << 4), /* Retry possible */
194 PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */
195 PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */
196 PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */
197
198 PERF_TXN_MAX = (1 << 8), /* non-ABI */
199
200 /* bits 32..63 are reserved for the abort code */
201
202 PERF_TXN_ABORT_MASK = (0xffffffffULL << 32),
203 PERF_TXN_ABORT_SHIFT = 32,
204};
205
206/*
184 * The format of the data returned by read() on a perf event fd, 207 * The format of the data returned by read() on a perf event fd,
185 * as specified by attr.read_format: 208 * as specified by attr.read_format:
186 * 209 *
@@ -324,7 +347,7 @@ struct perf_event_attr {
324#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) 347#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
325#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) 348#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
326#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) 349#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
327#define PERF_EVENT_IOC_ID _IOR('$', 7, u64 *) 350#define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *)
328 351
329enum perf_event_ioc_flags { 352enum perf_event_ioc_flags {
330 PERF_IOC_FLAG_GROUP = 1U << 0, 353 PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -380,10 +403,13 @@ struct perf_event_mmap_page {
380 union { 403 union {
381 __u64 capabilities; 404 __u64 capabilities;
382 struct { 405 struct {
383 __u64 cap_usr_time : 1, 406 __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
384 cap_usr_rdpmc : 1, 407 cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */
385 cap_usr_time_zero : 1, 408
386 cap_____res : 61; 409 cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
410 cap_user_time : 1, /* The time_* fields are used */
411 cap_user_time_zero : 1, /* The time_zero field is used */
412 cap_____res : 59;
387 }; 413 };
388 }; 414 };
389 415
@@ -442,23 +468,26 @@ struct perf_event_mmap_page {
442 * ((rem * time_mult) >> time_shift); 468 * ((rem * time_mult) >> time_shift);
443 */ 469 */
444 __u64 time_zero; 470 __u64 time_zero;
471 __u32 size; /* Header size up to __reserved[] fields. */
445 472
446 /* 473 /*
447 * Hole for extension of the self monitor capabilities 474 * Hole for extension of the self monitor capabilities
448 */ 475 */
449 476
450 __u64 __reserved[119]; /* align to 1k */ 477 __u8 __reserved[118*8+4]; /* align to 1k. */
451 478
452 /* 479 /*
453 * Control data for the mmap() data buffer. 480 * Control data for the mmap() data buffer.
454 * 481 *
455 * User-space reading the @data_head value should issue an rmb(), on 482 * User-space reading the @data_head value should issue an smp_rmb(),
456 * SMP capable platforms, after reading this value -- see 483 * after reading this value.
457 * perf_event_wakeup().
458 * 484 *
459 * When the mapping is PROT_WRITE the @data_tail value should be 485 * When the mapping is PROT_WRITE the @data_tail value should be
460 * written by userspace to reflect the last read data. In this case 486 * written by userspace to reflect the last read data, after issueing
461 * the kernel will not over-write unread data. 487 * an smp_mb() to separate the data read from the ->data_tail store.
488 * In this case the kernel will not over-write unread data.
489 *
490 * See perf_output_put_handle() for the data ordering.
462 */ 491 */
463 __u64 data_head; /* head in the data section */ 492 __u64 data_head; /* head in the data section */
464 __u64 data_tail; /* user-space written tail */ 493 __u64 data_tail; /* user-space written tail */
@@ -528,6 +557,7 @@ enum perf_event_type {
528 * u64 len; 557 * u64 len;
529 * u64 pgoff; 558 * u64 pgoff;
530 * char filename[]; 559 * char filename[];
560 * struct sample_id sample_id;
531 * }; 561 * };
532 */ 562 */
533 PERF_RECORD_MMAP = 1, 563 PERF_RECORD_MMAP = 1,
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 082eafaf026b..25731dfb3fcc 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -388,6 +388,20 @@ enum {
388 388
389#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) 389#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
390 390
391/* BPF classifier */
392
393enum {
394 TCA_BPF_UNSPEC,
395 TCA_BPF_ACT,
396 TCA_BPF_POLICE,
397 TCA_BPF_CLASSID,
398 TCA_BPF_OPS_LEN,
399 TCA_BPF_OPS,
400 __TCA_BPF_MAX,
401};
402
403#define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
404
391/* Extended Matches */ 405/* Extended Matches */
392 406
393struct tcf_ematch_tree_hdr { 407struct tcf_ematch_tree_hdr {
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 9b829134d422..a806687ad98f 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -171,6 +171,8 @@ enum {
171 TCA_TBF_PARMS, 171 TCA_TBF_PARMS,
172 TCA_TBF_RTAB, 172 TCA_TBF_RTAB,
173 TCA_TBF_PTAB, 173 TCA_TBF_PTAB,
174 TCA_TBF_RATE64,
175 TCA_TBF_PRATE64,
174 __TCA_TBF_MAX, 176 __TCA_TBF_MAX,
175}; 177};
176 178
@@ -357,6 +359,8 @@ enum {
357 TCA_HTB_CTAB, 359 TCA_HTB_CTAB,
358 TCA_HTB_RTAB, 360 TCA_HTB_RTAB,
359 TCA_HTB_DIRECT_QLEN, 361 TCA_HTB_DIRECT_QLEN,
362 TCA_HTB_RATE64,
363 TCA_HTB_CEIL64,
360 __TCA_HTB_MAX, 364 __TCA_HTB_MAX,
361}; 365};
362 366
@@ -759,13 +763,14 @@ enum {
759 763
760 TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ 764 TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */
761 765
762 TCA_FQ_FLOW_DEFAULT_RATE,/* for sockets with unspecified sk_rate, 766 TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */
763 * use the following rate
764 */
765 767
766 TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ 768 TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */
767 769
768 TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ 770 TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */
771
772 TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */
773
769 __TCA_FQ_MAX 774 __TCA_FQ_MAX
770}; 775};
771 776
diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
index fe1a5406d4d9..f7cf7f351144 100644
--- a/include/uapi/linux/raid/md_p.h
+++ b/include/uapi/linux/raid/md_p.h
@@ -16,6 +16,7 @@
16#define _MD_P_H 16#define _MD_P_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h>
19 20
20/* 21/*
21 * RAID superblock. 22 * RAID superblock.
diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h
index 7471b5b3b8ba..fff3528a078f 100644
--- a/include/uapi/linux/random.h
+++ b/include/uapi/linux/random.h
@@ -40,11 +40,4 @@ struct rand_pool_info {
40 __u32 buf[0]; 40 __u32 buf[0];
41}; 41};
42 42
43struct rnd_state {
44 __u32 s1, s2, s3;
45};
46
47/* Exported functions */
48
49
50#endif /* _UAPI_LINUX_RANDOM_H */ 43#endif /* _UAPI_LINUX_RANDOM_H */
diff --git a/include/uapi/linux/reiserfs_xattr.h b/include/uapi/linux/reiserfs_xattr.h
index d8ce17c2459a..38fdd648be21 100644
--- a/include/uapi/linux/reiserfs_xattr.h
+++ b/include/uapi/linux/reiserfs_xattr.h
@@ -16,7 +16,7 @@ struct reiserfs_xattr_header {
16}; 16};
17 17
18struct reiserfs_security_handle { 18struct reiserfs_security_handle {
19 char *name; 19 const char *name;
20 void *value; 20 void *value;
21 size_t length; 21 size_t length;
22}; 22};
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index e40ebe124ced..b47dba2c1e6f 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -235,4 +235,7 @@
235/* ST ASC type numbers */ 235/* ST ASC type numbers */
236#define PORT_ASC 105 236#define PORT_ASC 105
237 237
238/* Tilera TILE-Gx UART */
239#define PORT_TILEGX 106
240
238#endif /* _UAPILINUX_SERIAL_CORE_H */ 241#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 0623ec4e728f..56f121605c99 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -1,5 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += tc_csum.h 2header-y += tc_csum.h
3header-y += tc_defact.h
3header-y += tc_gact.h 4header-y += tc_gact.h
4header-y += tc_ipt.h 5header-y += tc_ipt.h
5header-y += tc_mirred.h 6header-y += tc_mirred.h
diff --git a/include/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h
index 6f65d07c7ce2..17dddb40f740 100644
--- a/include/linux/tc_act/tc_defact.h
+++ b/include/uapi/linux/tc_act/tc_defact.h
@@ -6,7 +6,7 @@
6struct tc_defact { 6struct tc_defact {
7 tc_gen; 7 tc_gen;
8}; 8};
9 9
10enum { 10enum {
11 TCA_DEF_UNSPEC, 11 TCA_DEF_UNSPEC,
12 TCA_DEF_TM, 12 TCA_DEF_TM,
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h
index b9e2a6a7446f..1eb0b8dd1830 100644
--- a/include/uapi/linux/unix_diag.h
+++ b/include/uapi/linux/unix_diag.h
@@ -31,6 +31,7 @@ struct unix_diag_msg {
31}; 31};
32 32
33enum { 33enum {
34 /* UNIX_DIAG_NONE, standard nl API requires this attribute! */
34 UNIX_DIAG_NAME, 35 UNIX_DIAG_NAME,
35 UNIX_DIAG_VFS, 36 UNIX_DIAG_VFS,
36 UNIX_DIAG_PEER, 37 UNIX_DIAG_PEER,
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 083bb5a5aae2..1666aabbbb86 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -160,6 +160,10 @@ enum v4l2_colorfx {
160 * of controls. Total of 16 controls is reserved for this driver */ 160 * of controls. Total of 16 controls is reserved for this driver */
161#define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1040) 161#define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1040)
162 162
163/* The base for the TI VPE driver controls. Total of 16 controls is reserved for
164 * this driver */
165#define V4L2_CID_USER_TI_VPE_BASE (V4L2_CID_USER_BASE + 0x1050)
166
163/* MPEG-class control IDs */ 167/* MPEG-class control IDs */
164/* The MPEG controls are applicable to all codec controls 168/* The MPEG controls are applicable to all codec controls
165 * and the 'MPEG' part of the define is historical */ 169 * and the 'MPEG' part of the define is historical */
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 916e444e6f74..0fd47f5bc146 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -324,6 +324,44 @@ enum {
324 VFIO_PCI_NUM_IRQS 324 VFIO_PCI_NUM_IRQS
325}; 325};
326 326
327/**
328 * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12,
329 * struct vfio_pci_hot_reset_info)
330 *
331 * Return: 0 on success, -errno on failure:
332 * -enospc = insufficient buffer, -enodev = unsupported for device.
333 */
334struct vfio_pci_dependent_device {
335 __u32 group_id;
336 __u16 segment;
337 __u8 bus;
338 __u8 devfn; /* Use PCI_SLOT/PCI_FUNC */
339};
340
341struct vfio_pci_hot_reset_info {
342 __u32 argsz;
343 __u32 flags;
344 __u32 count;
345 struct vfio_pci_dependent_device devices[];
346};
347
348#define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
349
350/**
351 * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13,
352 * struct vfio_pci_hot_reset)
353 *
354 * Return: 0 on success, -errno on failure.
355 */
356struct vfio_pci_hot_reset {
357 __u32 argsz;
358 __u32 flags;
359 __u32 count;
360 __s32 group_fds[];
361};
362
363#define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13)
364
327/* -------- API for Type1 VFIO IOMMU -------- */ 365/* -------- API for Type1 VFIO IOMMU -------- */
328 366
329/** 367/**
diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index 36eace03b2ac..e272ea060e38 100644
--- a/include/uapi/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
@@ -94,10 +94,10 @@ struct mtd_write_req {
94#define MTD_RAM 1 94#define MTD_RAM 1
95#define MTD_ROM 2 95#define MTD_ROM 2
96#define MTD_NORFLASH 3 96#define MTD_NORFLASH 3
97#define MTD_NANDFLASH 4 97#define MTD_NANDFLASH 4 /* SLC NAND */
98#define MTD_DATAFLASH 6 98#define MTD_DATAFLASH 6
99#define MTD_UBIVOLUME 7 99#define MTD_UBIVOLUME 7
100#define MTD_MLCNANDFLASH 8 100#define MTD_MLCNANDFLASH 8 /* MLC NAND (including TLC) */
101 101
102#define MTD_WRITEABLE 0x400 /* Device is writeable */ 102#define MTD_WRITEABLE 0x400 /* Device is writeable */
103#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 103#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
@@ -275,4 +275,9 @@ enum mtd_file_modes {
275 MTD_FILE_MODE_RAW, 275 MTD_FILE_MODE_RAW,
276}; 276};
277 277
278static inline int mtd_type_is_nand_user(const struct mtd_info_user *mtd)
279{
280 return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH;
281}
282
278#endif /* __MTD_ABI_H__ */ 283#endif /* __MTD_ABI_H__ */
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 0b233c56b0e4..cbfdd4ca9510 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -87,8 +87,11 @@ enum {
87 IB_USER_VERBS_CMD_CLOSE_XRCD, 87 IB_USER_VERBS_CMD_CLOSE_XRCD,
88 IB_USER_VERBS_CMD_CREATE_XSRQ, 88 IB_USER_VERBS_CMD_CREATE_XSRQ,
89 IB_USER_VERBS_CMD_OPEN_QP, 89 IB_USER_VERBS_CMD_OPEN_QP,
90 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, 90};
91 IB_USER_VERBS_CMD_DESTROY_FLOW 91
92enum {
93 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
94 IB_USER_VERBS_EX_CMD_DESTROY_FLOW
92}; 95};
93 96
94/* 97/*
@@ -120,16 +123,20 @@ struct ib_uverbs_comp_event_desc {
120 * the rest of the command struct based on these value. 123 * the rest of the command struct based on these value.
121 */ 124 */
122 125
126#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
127#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
128#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
129
130#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
131
123struct ib_uverbs_cmd_hdr { 132struct ib_uverbs_cmd_hdr {
124 __u32 command; 133 __u32 command;
125 __u16 in_words; 134 __u16 in_words;
126 __u16 out_words; 135 __u16 out_words;
127}; 136};
128 137
129struct ib_uverbs_cmd_hdr_ex { 138struct ib_uverbs_ex_cmd_hdr {
130 __u32 command; 139 __u64 response;
131 __u16 in_words;
132 __u16 out_words;
133 __u16 provider_in_words; 140 __u16 provider_in_words;
134 __u16 provider_out_words; 141 __u16 provider_out_words;
135 __u32 cmd_hdr_reserved; 142 __u32 cmd_hdr_reserved;
@@ -696,61 +703,71 @@ struct ib_uverbs_detach_mcast {
696 __u64 driver_data[0]; 703 __u64 driver_data[0];
697}; 704};
698 705
699struct ib_kern_eth_filter { 706struct ib_uverbs_flow_spec_hdr {
707 __u32 type;
708 __u16 size;
709 __u16 reserved;
710 /* followed by flow_spec */
711 __u64 flow_spec_data[0];
712};
713
714struct ib_uverbs_flow_eth_filter {
700 __u8 dst_mac[6]; 715 __u8 dst_mac[6];
701 __u8 src_mac[6]; 716 __u8 src_mac[6];
702 __be16 ether_type; 717 __be16 ether_type;
703 __be16 vlan_tag; 718 __be16 vlan_tag;
704}; 719};
705 720
706struct ib_kern_spec_eth { 721struct ib_uverbs_flow_spec_eth {
707 __u32 type; 722 union {
708 __u16 size; 723 struct ib_uverbs_flow_spec_hdr hdr;
709 __u16 reserved; 724 struct {
710 struct ib_kern_eth_filter val; 725 __u32 type;
711 struct ib_kern_eth_filter mask; 726 __u16 size;
727 __u16 reserved;
728 };
729 };
730 struct ib_uverbs_flow_eth_filter val;
731 struct ib_uverbs_flow_eth_filter mask;
712}; 732};
713 733
714struct ib_kern_ipv4_filter { 734struct ib_uverbs_flow_ipv4_filter {
715 __be32 src_ip; 735 __be32 src_ip;
716 __be32 dst_ip; 736 __be32 dst_ip;
717}; 737};
718 738
719struct ib_kern_spec_ipv4 { 739struct ib_uverbs_flow_spec_ipv4 {
720 __u32 type; 740 union {
721 __u16 size; 741 struct ib_uverbs_flow_spec_hdr hdr;
722 __u16 reserved; 742 struct {
723 struct ib_kern_ipv4_filter val; 743 __u32 type;
724 struct ib_kern_ipv4_filter mask; 744 __u16 size;
745 __u16 reserved;
746 };
747 };
748 struct ib_uverbs_flow_ipv4_filter val;
749 struct ib_uverbs_flow_ipv4_filter mask;
725}; 750};
726 751
727struct ib_kern_tcp_udp_filter { 752struct ib_uverbs_flow_tcp_udp_filter {
728 __be16 dst_port; 753 __be16 dst_port;
729 __be16 src_port; 754 __be16 src_port;
730}; 755};
731 756
732struct ib_kern_spec_tcp_udp { 757struct ib_uverbs_flow_spec_tcp_udp {
733 __u32 type;
734 __u16 size;
735 __u16 reserved;
736 struct ib_kern_tcp_udp_filter val;
737 struct ib_kern_tcp_udp_filter mask;
738};
739
740struct ib_kern_spec {
741 union { 758 union {
759 struct ib_uverbs_flow_spec_hdr hdr;
742 struct { 760 struct {
743 __u32 type; 761 __u32 type;
744 __u16 size; 762 __u16 size;
745 __u16 reserved; 763 __u16 reserved;
746 }; 764 };
747 struct ib_kern_spec_eth eth;
748 struct ib_kern_spec_ipv4 ipv4;
749 struct ib_kern_spec_tcp_udp tcp_udp;
750 }; 765 };
766 struct ib_uverbs_flow_tcp_udp_filter val;
767 struct ib_uverbs_flow_tcp_udp_filter mask;
751}; 768};
752 769
753struct ib_kern_flow_attr { 770struct ib_uverbs_flow_attr {
754 __u32 type; 771 __u32 type;
755 __u16 size; 772 __u16 size;
756 __u16 priority; 773 __u16 priority;
@@ -762,13 +779,13 @@ struct ib_kern_flow_attr {
762 * struct ib_flow_spec_xxx 779 * struct ib_flow_spec_xxx
763 * struct ib_flow_spec_yyy 780 * struct ib_flow_spec_yyy
764 */ 781 */
782 struct ib_uverbs_flow_spec_hdr flow_specs[0];
765}; 783};
766 784
767struct ib_uverbs_create_flow { 785struct ib_uverbs_create_flow {
768 __u32 comp_mask; 786 __u32 comp_mask;
769 __u64 response;
770 __u32 qp_handle; 787 __u32 qp_handle;
771 struct ib_kern_flow_attr flow_attr; 788 struct ib_uverbs_flow_attr flow_attr;
772}; 789};
773 790
774struct ib_uverbs_create_flow_resp { 791struct ib_uverbs_create_flow_resp {
diff --git a/include/uapi/sound/Kbuild b/include/uapi/sound/Kbuild
index 0f7d279ebde3..a7f27704f980 100644
--- a/include/uapi/sound/Kbuild
+++ b/include/uapi/sound/Kbuild
@@ -5,6 +5,7 @@ header-y += asound_fm.h
5header-y += compress_offload.h 5header-y += compress_offload.h
6header-y += compress_params.h 6header-y += compress_params.h
7header-y += emu10k1.h 7header-y += emu10k1.h
8header-y += firewire.h
8header-y += hdsp.h 9header-y += hdsp.h
9header-y += hdspm.h 10header-y += hdspm.h
10header-y += sb16_csp.h 11header-y += sb16_csp.h
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 041203f20f6d..9fc6219d3848 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -93,9 +93,10 @@ enum {
93 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ 93 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
94 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 94 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
95 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ 95 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
96 SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
96 97
97 /* Don't forget to change the following: */ 98 /* Don't forget to change the following: */
98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM 99 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_DICE
99}; 100};
100 101
101struct snd_hwdep_info { 102struct snd_hwdep_info {
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index d630163b9a2e..5759810e1c1b 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -30,7 +30,7 @@
30#include <sound/compress_params.h> 30#include <sound/compress_params.h>
31 31
32 32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1) 33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
34/** 34/**
35 * struct snd_compressed_buffer: compressed buffer 35 * struct snd_compressed_buffer: compressed buffer
36 * @fragment_size: size of buffer fragment in bytes 36 * @fragment_size: size of buffer fragment in bytes
@@ -67,8 +67,8 @@ struct snd_compr_params {
67struct snd_compr_tstamp { 67struct snd_compr_tstamp {
68 __u32 byte_offset; 68 __u32 byte_offset;
69 __u32 copied_total; 69 __u32 copied_total;
70 snd_pcm_uframes_t pcm_frames; 70 __u32 pcm_frames;
71 snd_pcm_uframes_t pcm_io_frames; 71 __u32 pcm_io_frames;
72 __u32 sampling_rate; 72 __u32 sampling_rate;
73}; 73};
74 74
diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h
new file mode 100644
index 000000000000..59f5961302bf
--- /dev/null
+++ b/include/uapi/sound/firewire.h
@@ -0,0 +1,51 @@
1#ifndef _UAPI_SOUND_FIREWIRE_H_INCLUDED
2#define _UAPI_SOUND_FIREWIRE_H_INCLUDED
3
4#include <linux/ioctl.h>
5
6/* events can be read() from the hwdep device */
7
8#define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc
9#define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e
10
11struct snd_firewire_event_common {
12 unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */
13};
14
15struct snd_firewire_event_lock_status {
16 unsigned int type;
17 unsigned int status; /* 0/1 = unlocked/locked */
18};
19
20struct snd_firewire_event_dice_notification {
21 unsigned int type;
22 unsigned int notification; /* DICE-specific bits */
23};
24
25union snd_firewire_event {
26 struct snd_firewire_event_common common;
27 struct snd_firewire_event_lock_status lock_status;
28 struct snd_firewire_event_dice_notification dice_notification;
29};
30
31
32#define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info)
33#define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9)
34#define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa)
35
36#define SNDRV_FIREWIRE_TYPE_DICE 1
37/* Fireworks, AV/C, RME, MOTU, ... */
38
39struct snd_firewire_get_info {
40 unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */
41 unsigned int card; /* same as fw_cdev_get_info.card */
42 unsigned char guid[8];
43 char device_name[16]; /* device node in /dev */
44};
45
46/*
47 * SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming.
48 * Returns -EBUSY if the driver is already streaming.
49 */
50
51#endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 0f5a2fc69af9..c79f38131926 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -31,39 +31,20 @@
31#define ATMEL_LCDC_WIRING_BGR 0 31#define ATMEL_LCDC_WIRING_BGR 0
32#define ATMEL_LCDC_WIRING_RGB 1 32#define ATMEL_LCDC_WIRING_RGB 1
33 33
34struct atmel_lcdfb_config;
35 34
36 /* LCD Controller info data structure, stored in device platform_data */ 35 /* LCD Controller info data structure, stored in device platform_data */
37struct atmel_lcdfb_info { 36struct atmel_lcdfb_pdata {
38 spinlock_t lock;
39 struct fb_info *info;
40 void __iomem *mmio;
41 int irq_base;
42 struct work_struct task;
43
44 unsigned int guard_time; 37 unsigned int guard_time;
45 unsigned int smem_len;
46 struct platform_device *pdev;
47 struct clk *bus_clk;
48 struct clk *lcdc_clk;
49
50#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
51 struct backlight_device *backlight;
52 u8 bl_power;
53#endif
54 bool lcdcon_is_backlight; 38 bool lcdcon_is_backlight;
55 bool lcdcon_pol_negative; 39 bool lcdcon_pol_negative;
56 u8 saved_lcdcon;
57
58 u8 default_bpp; 40 u8 default_bpp;
59 u8 lcd_wiring_mode; 41 u8 lcd_wiring_mode;
60 unsigned int default_lcdcon2; 42 unsigned int default_lcdcon2;
61 unsigned int default_dmacon; 43 unsigned int default_dmacon;
62 void (*atmel_lcdfb_power_control)(int on); 44 void (*atmel_lcdfb_power_control)(struct atmel_lcdfb_pdata *pdata, int on);
63 struct fb_monspecs *default_monspecs; 45 struct fb_monspecs *default_monspecs;
64 u32 pseudo_palette[16];
65 46
66 struct atmel_lcdfb_config *config; 47 struct list_head pwr_gpios;
67}; 48};
68 49
69#define ATMEL_LCDC_DMABADDR1 0x00 50#define ATMEL_LCDC_DMABADDR1 0x00
diff --git a/include/video/exynos_dp.h b/include/video/exynos_dp.h
deleted file mode 100644
index bd8cabd344db..000000000000
--- a/include/video/exynos_dp.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Samsung SoC DP device support
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EXYNOS_DP_H
13#define _EXYNOS_DP_H
14
15#define DP_TIMEOUT_LOOP_COUNT 100
16#define MAX_CR_LOOP 5
17#define MAX_EQ_LOOP 5
18
19enum link_rate_type {
20 LINK_RATE_1_62GBPS = 0x06,
21 LINK_RATE_2_70GBPS = 0x0a
22};
23
24enum link_lane_count_type {
25 LANE_COUNT1 = 1,
26 LANE_COUNT2 = 2,
27 LANE_COUNT4 = 4
28};
29
30enum link_training_state {
31 START,
32 CLOCK_RECOVERY,
33 EQUALIZER_TRAINING,
34 FINISHED,
35 FAILED
36};
37
38enum voltage_swing_level {
39 VOLTAGE_LEVEL_0,
40 VOLTAGE_LEVEL_1,
41 VOLTAGE_LEVEL_2,
42 VOLTAGE_LEVEL_3,
43};
44
45enum pre_emphasis_level {
46 PRE_EMPHASIS_LEVEL_0,
47 PRE_EMPHASIS_LEVEL_1,
48 PRE_EMPHASIS_LEVEL_2,
49 PRE_EMPHASIS_LEVEL_3,
50};
51
52enum pattern_set {
53 PRBS7,
54 D10_2,
55 TRAINING_PTN1,
56 TRAINING_PTN2,
57 DP_NONE
58};
59
60enum color_space {
61 COLOR_RGB,
62 COLOR_YCBCR422,
63 COLOR_YCBCR444
64};
65
66enum color_depth {
67 COLOR_6,
68 COLOR_8,
69 COLOR_10,
70 COLOR_12
71};
72
73enum color_coefficient {
74 COLOR_YCBCR601,
75 COLOR_YCBCR709
76};
77
78enum dynamic_range {
79 VESA,
80 CEA
81};
82
83enum pll_status {
84 PLL_UNLOCKED,
85 PLL_LOCKED
86};
87
88enum clock_recovery_m_value_type {
89 CALCULATED_M,
90 REGISTER_M
91};
92
93enum video_timing_recognition_type {
94 VIDEO_TIMING_FROM_CAPTURE,
95 VIDEO_TIMING_FROM_REGISTER
96};
97
98enum analog_power_block {
99 AUX_BLOCK,
100 CH0_BLOCK,
101 CH1_BLOCK,
102 CH2_BLOCK,
103 CH3_BLOCK,
104 ANALOG_TOTAL,
105 POWER_ALL
106};
107
108struct video_info {
109 char *name;
110
111 bool h_sync_polarity;
112 bool v_sync_polarity;
113 bool interlaced;
114
115 enum color_space color_space;
116 enum dynamic_range dynamic_range;
117 enum color_coefficient ycbcr_coeff;
118 enum color_depth color_depth;
119
120 enum link_rate_type link_rate;
121 enum link_lane_count_type lane_count;
122};
123
124struct exynos_dp_platdata {
125 struct video_info *video_info;
126
127 void (*phy_init)(void);
128 void (*phy_exit)(void);
129};
130
131#endif /* _EXYNOS_DP_H */
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
index 89dc88a171af..6a578f8a1b3e 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -216,6 +216,7 @@ struct mipi_dsim_config {
216 * automatically. 216 * automatically.
217 * @e_clk_src: select byte clock source. 217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data. 218 * @pd: pointer to MIPI-DSI driver platform data.
219 * @phy: pointer to the MIPI-DSI PHY
219 */ 220 */
220struct mipi_dsim_device { 221struct mipi_dsim_device {
221 struct device *dev; 222 struct device *dev;
@@ -236,6 +237,7 @@ struct mipi_dsim_device {
236 bool suspended; 237 bool suspended;
237 238
238 struct mipi_dsim_platform_data *pd; 239 struct mipi_dsim_platform_data *pd;
240 struct phy *phy;
239}; 241};
240 242
241/* 243/*
@@ -248,7 +250,6 @@ struct mipi_dsim_device {
248 * @enabled: indicate whether mipi controller got enabled or not. 250 * @enabled: indicate whether mipi controller got enabled or not.
249 * @lcd_panel_info: pointer for lcd panel specific structure. 251 * @lcd_panel_info: pointer for lcd panel specific structure.
250 * this structure specifies width, height, timing and polarity and so on. 252 * this structure specifies width, height, timing and polarity and so on.
251 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
252 */ 253 */
253struct mipi_dsim_platform_data { 254struct mipi_dsim_platform_data {
254 char lcd_panel_name[PANEL_NAME_SIZE]; 255 char lcd_panel_name[PANEL_NAME_SIZE];
@@ -256,8 +257,6 @@ struct mipi_dsim_platform_data {
256 struct mipi_dsim_config *dsim_config; 257 struct mipi_dsim_config *dsim_config;
257 unsigned int enabled; 258 unsigned int enabled;
258 void *lcd_panel_info; 259 void *lcd_panel_info;
259
260 int (*phy_enable)(struct platform_device *pdev, bool on);
261}; 260};
262 261
263/* 262/*
diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h
index b9dd1fbb0082..9fd9398368d5 100644
--- a/include/video/mmp_disp.h
+++ b/include/video/mmp_disp.h
@@ -91,6 +91,11 @@ struct mmp_win {
91 u16 up_crop; 91 u16 up_crop;
92 u16 bottom_crop; 92 u16 bottom_crop;
93 int pix_fmt; 93 int pix_fmt;
94 /*
95 * pitch[0]: graphics/video layer line length or y pitch
96 * pitch[1]/pitch[2]: video u/v pitch if non-zero
97 */
98 u32 pitch[3];
94}; 99};
95 100
96struct mmp_addr { 101struct mmp_addr {
@@ -334,6 +339,7 @@ struct mmp_mach_path_config {
334 int output_type; 339 int output_type;
335 u32 path_config; 340 u32 path_config;
336 u32 link_config; 341 u32 link_config;
342 u32 dsi_rbswap;
337}; 343};
338 344
339struct mmp_mach_plat_info { 345struct mmp_mach_plat_info {
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
index f7ac8d972af0..69279c013ac4 100644
--- a/include/video/omap-panel-data.h
+++ b/include/video/omap-panel-data.h
@@ -238,4 +238,17 @@ struct panel_nec_nl8048hl11_platform_data {
238 int qvga_gpio; 238 int qvga_gpio;
239}; 239};
240 240
241/**
242 * panel-tpo-td028ttec1 platform data
243 * @name: name for display entity
244 * @source: name of the display entity used as a video source
245 * @data_lines: number of DPI datalines
246 */
247struct panel_tpo_td028ttec1_platform_data {
248 const char *name;
249 const char *source;
250
251 int data_lines;
252};
253
241#endif /* __OMAP_PANEL_DATA_H */ 254#endif /* __OMAP_PANEL_DATA_H */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index eb262e3324d2..c50061db6098 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -51,6 +51,20 @@
51 */ 51 */
52 52
53/* 53/*
54 * "feature-no-csum-offload" should be used to turn IPv4 TCP/UDP checksum
55 * offload off or on. If it is missing then the feature is assumed to be on.
56 * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
57 * offload on or off. If it is missing then the feature is assumed to be off.
58 */
59
60/*
61 * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
62 * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
63 * frontends nor backends are assumed to be capable unless the flags are
64 * present.
65 */
66
67/*
54 * This is the 'wire' format for packets: 68 * This is the 'wire' format for packets:
55 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) 69 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
56 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info) 70 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
@@ -95,8 +109,10 @@ struct xen_netif_tx_request {
95#define _XEN_NETIF_EXTRA_FLAG_MORE (0) 109#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
96#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 110#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
97 111
98/* GSO types - only TCPv4 currently supported. */ 112/* GSO types */
113#define XEN_NETIF_GSO_TYPE_NONE (0)
99#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 114#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
115#define XEN_NETIF_GSO_TYPE_TCPV6 (2)
100 116
101/* 117/*
102 * This structure needs to fit within both netif_tx_request and 118 * This structure needs to fit within both netif_tx_request and
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 7000bb1f6e96..42721d13a106 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -231,6 +231,17 @@ struct physdev_get_free_pirq {
231#define XEN_PCI_DEV_VIRTFN 0x2 231#define XEN_PCI_DEV_VIRTFN 0x2
232#define XEN_PCI_DEV_PXM 0x4 232#define XEN_PCI_DEV_PXM 0x4
233 233
234#define XEN_PCI_MMCFG_RESERVED 0x1
235
236#define PHYSDEVOP_pci_mmcfg_reserved 24
237struct physdev_pci_mmcfg_reserved {
238 uint64_t address;
239 uint16_t segment;
240 uint8_t start_bus;
241 uint8_t end_bus;
242 uint32_t flags;
243};
244
234#define PHYSDEVOP_pci_device_add 25 245#define PHYSDEVOP_pci_device_add 25
235struct physdev_pci_device_add { 246struct physdev_pci_device_add {
236 /* IN */ 247 /* IN */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index de8bcc641c49..8b2eb93ae8ba 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -1,6 +1,7 @@
1#ifndef __LINUX_SWIOTLB_XEN_H 1#ifndef __LINUX_SWIOTLB_XEN_H
2#define __LINUX_SWIOTLB_XEN_H 2#define __LINUX_SWIOTLB_XEN_H
3 3
4#include <linux/dma-direction.h>
4#include <linux/swiotlb.h> 5#include <linux/swiotlb.h>
5 6
6extern int xen_swiotlb_init(int verbose, bool early); 7extern int xen_swiotlb_init(int verbose, bool early);
@@ -55,4 +56,6 @@ xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
55extern int 56extern int
56xen_swiotlb_dma_supported(struct device *hwdev, u64 mask); 57xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
57 58
59extern int
60xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
58#endif /* __LINUX_SWIOTLB_XEN_H */ 61#endif /* __LINUX_SWIOTLB_XEN_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index d6fe062cad6b..fb2ea8f26552 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -19,10 +19,11 @@ void xen_arch_resume(void);
19int xen_setup_shutdown_event(void); 19int xen_setup_shutdown_event(void);
20 20
21extern unsigned long *xen_contiguous_bitmap; 21extern unsigned long *xen_contiguous_bitmap;
22int xen_create_contiguous_region(unsigned long vstart, unsigned int order, 22int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
23 unsigned int address_bits); 23 unsigned int address_bits,
24 dma_addr_t *dma_handle);
24 25
25void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 26void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
26 27
27struct vm_area_struct; 28struct vm_area_struct;
28int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 29int xen_remap_domain_mfn_range(struct vm_area_struct *vma,