aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acexcep.h8
-rw-r--r--include/acpi/acnames.h26
-rw-r--r--include/acpi/acpi_bus.h21
-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/gpio.h235
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h1
-rw-r--r--include/clocksource/arm_arch_timer.h10
-rw-r--r--include/drm/drmP.h111
-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.h12
-rw-r--r--include/drm/i915_drm.h4
-rw-r--r--include/drm/i915_pciids.h25
-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/mfd/as3722.h52
-rw-r--r--include/dt-bindings/pinctrl/at91.h2
-rw-r--r--include/linux/acpi.h84
-rw-r--r--include/linux/acpi_gpio.h31
-rw-r--r--include/linux/amba/bus.h4
-rw-r--r--include/linux/amba/serial.h2
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/ata.h7
-rw-r--r--include/linux/backing-dev.h4
-rw-r--r--include/linux/backlight.h4
-rw-r--r--include/linux/binfmts.h6
-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.h60
-rw-r--r--include/linux/blktrace_api.h4
-rw-r--r--include/linux/cgroup.h37
-rw-r--r--include/linux/clk-provider.h1
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cmdline-parser.h2
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/completion.h28
-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/cpufreq.h83
-rw-r--r--include/linux/cpuidle.h8
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/crc32.h40
-rw-r--r--include/linux/dcache.h104
-rw-r--r--include/linux/devfreq.h8
-rw-r--r--include/linux/dma-mapping.h31
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/edac.h2
-rw-r--r--include/linux/efi.h58
-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/export.h4
-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/fs.h106
-rw-r--r--include/linux/ftrace.h5
-rw-r--r--include/linux/ftrace_event.h25
-rw-r--r--include/linux/genalloc.h2
-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.h184
-rw-r--r--include/linux/hashtable.h15
-rw-r--r--include/linux/hippidevice.h10
-rw-r--r--include/linux/host1x.h284
-rw-r--r--include/linux/huge_mm.h17
-rw-r--r--include/linux/hugetlb.h26
-rw-r--r--include/linux/hwmon-vid.h2
-rw-r--r--include/linux/hwmon.h10
-rw-r--r--include/linux/i2c.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/inetdevice.h28
-rw-r--r--include/linux/init.h6
-rw-r--r--include/linux/init_task.h8
-rw-r--r--include/linux/interrupt.h22
-rw-r--r--include/linux/iommu.h2
-rw-r--r--include/linux/ipv6.h76
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/irqchip/arm-gic.h7
-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.h2
-rw-r--r--include/linux/kfifo.h47
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kvm_host.h42
-rw-r--r--include/linux/lglock.h10
-rw-r--r--include/linux/list.h79
-rw-r--r--include/linux/llist.h2
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/lockref.h7
-rw-r--r--include/linux/memblock.h24
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mempolicy.h5
-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/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/rtsx_pci.h53
-rw-r--r--include/linux/mfd/samsung/core.h1
-rw-r--r--include/linux/mfd/samsung/rtc.h11
-rw-r--r--include/linux/mfd/si476x-core.h2
-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.h8
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h20
-rw-r--r--include/linux/mfd/wm8994/core.h47
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h6
-rw-r--r--include/linux/mlx4/device.h25
-rw-r--r--include/linux/mlx5/device.h13
-rw-r--r--include/linux/mlx5/driver.h18
-rw-r--r--include/linux/mm.h157
-rw-r--r--include/linux/mm_types.h21
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mmc/card.h7
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/dw_mmc.h4
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/msi.h2
-rw-r--r--include/linux/mtd/bbm.h2
-rw-r--r--include/linux/mtd/map.h4
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mutex.h2
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/net.h109
-rw-r--r--include/linux/netdev_features.h6
-rw-r--r--include/linux/netdevice.h508
-rw-r--r--include/linux/netfilter.h24
-rw-r--r--include/linux/netfilter/ipset/ip_set.h161
-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/nfs4.h3
-rw-r--r--include/linux/of.h35
-rw-r--r--include/linux/of_address.h39
-rw-r--r--include/linux/of_fdt.h19
-rw-r--r--include/linux/of_gpio.h29
-rw-r--r--include/linux/of_irq.h47
-rw-r--r--include/linux/of_mtd.h21
-rw-r--r--include/linux/of_pci.h5
-rw-r--r--include/linux/oom.h5
-rw-r--r--include/linux/opp.h134
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/pci.h19
-rw-r--r--include/linux/percpu.h32
-rw-r--r--include/linux/percpu_ida.h23
-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/davinci_asp.h2
-rw-r--r--include/linux/platform_data/leds-lp55xx.h7
-rw-r--r--include/linux/platform_data/leds-pca9685.h35
-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/mmc-esdhc-imx.h5
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h18
-rw-r--r--include/linux/platform_data/pinctrl-adi2.h40
-rw-r--r--include/linux/platform_data/zforce_ts.h26
-rw-r--r--include/linux/pm_opp.h139
-rw-r--r--include/linux/power/bq24735-charger.h39
-rw-r--r--include/linux/powercap.h325
-rw-r--r--include/linux/preempt_mask.h41
-rw-r--r--include/linux/pwm_backlight.h5
-rw-r--r--include/linux/random.h14
-rw-r--r--include/linux/rbtree.h16
-rw-r--r--include/linux/regmap.h53
-rw-r--r--include/linux/regulator/consumer.h79
-rw-r--r--include/linux/regulator/driver.h18
-rw-r--r--include/linux/regulator/machine.h7
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/sched.h23
-rw-r--r--include/linux/sched/sysctl.h2
-rw-r--r--include/linux/sched_clock.h4
-rw-r--r--include/linux/seq_file.h15
-rw-r--r--include/linux/seqlock.h79
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/sfi.h3
-rw-r--r--include/linux/skbuff.h359
-rw-r--r--include/linux/smp.h16
-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/swapops.h7
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/thinkpad_acpi.h15
-rw-r--r--include/linux/u64_stats_sync.h7
-rw-r--r--include/linux/usb/cdc_ncm.h33
-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.h1
-rw-r--r--include/linux/writeback.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.h4
-rw-r--r--include/media/videobuf2-dma-sg.h10
-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.h155
-rw-r--r--include/net/bluetooth/hci_core.h193
-rw-r--r--include/net/bluetooth/l2cap.h37
-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/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.h25
-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.h189
-rw-r--r--include/net/ip6_checksum.h4
-rw-r--r--include/net/ip6_fib.h51
-rw-r--r--include/net/ip6_route.h98
-rw-r--r--include/net/ip_fib.h61
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/ip_vs.h283
-rw-r--r--include/net/ipv6.h271
-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/mrp.h26
-rw-r--r--include/net/ndisc.h61
-rw-r--r--include/net/net_namespace.h32
-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.h4
-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.h4
-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/secure_seq.h26
-rw-r--r--include/net/sock.h276
-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_host.h5
-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.h5
-rw-r--r--include/sound/rcar_snd.h1
-rw-r--r--include/sound/soc-dai.h17
-rw-r--r--include/sound/soc-dapm.h4
-rw-r--r--include/sound/soc.h100
-rw-r--r--include/trace/events/asoc.h1
-rw-r--r--include/trace/events/bcache.h47
-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/sched.h19
-rw-r--r--include/trace/events/spi.h156
-rw-r--r--include/trace/events/swiotlb.h46
-rw-r--r--include/trace/events/writeback.h6
-rw-r--r--include/trace/ftrace.h7
-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.h45
-rw-r--r--include/uapi/drm/i915_drm.h8
-rw-r--r--include/uapi/drm/tegra_drm.h29
-rw-r--r--include/uapi/linux/audit.h1
-rw-r--r--include/uapi/linux/bcache.h373
-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/dm-ioctl.h15
-rw-r--r--include/uapi/linux/elf-em.h1
-rw-r--r--include/uapi/linux/genetlink.h1
-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.h24
-rw-r--r--include/uapi/linux/in.h5
-rw-r--r--include/uapi/linux/ip_vs.h2
-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/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/nfc.h4
-rw-r--r--include/uapi/linux/nl80211.h27
-rw-r--r--include/uapi/linux/openvswitch.h18
-rw-r--r--include/uapi/linux/pci_regs.h4
-rw-r--r--include/uapi/linux/pkt_cls.h14
-rw-r--r--include/uapi/linux/pkt_sched.h11
-rw-r--r--include/uapi/linux/random.h7
-rw-r--r--include/uapi/linux/v4l2-controls.h4
-rw-r--r--include/uapi/mtd/mtd-abi.h9
-rw-r--r--include/uapi/rdma/ib_user_verbs.h95
-rw-r--r--include/uapi/sound/Kbuild1
-rw-r--r--include/uapi/sound/asound.h3
-rw-r--r--include/uapi/sound/firewire.h51
-rw-r--r--include/video/atmel_lcdc.h25
-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
460 files changed, 12824 insertions, 5794 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 1c16f821434f..d98c67001840 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -100,7 +100,9 @@
100 * ACPI PM timer 100 * ACPI PM timer
101 * FACS table (Waking vectors and Global Lock) 101 * FACS table (Waking vectors and Global Lock)
102 */ 102 */
103#ifndef ACPI_REDUCED_HARDWARE
103#define ACPI_REDUCED_HARDWARE FALSE 104#define ACPI_REDUCED_HARDWARE FALSE
105#endif
104 106
105/****************************************************************************** 107/******************************************************************************
106 * 108 *
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 d9019821aa60..89c60b0f6408 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -222,7 +222,8 @@ struct acpi_device_power_flags {
222 u32 power_resources:1; /* Power resources */ 222 u32 power_resources:1; /* Power resources */
223 u32 inrush_current:1; /* Serialize Dx->D0 */ 223 u32 inrush_current:1; /* Serialize Dx->D0 */
224 u32 power_removed:1; /* Optimize Dx->D0 */ 224 u32 power_removed:1; /* Optimize Dx->D0 */
225 u32 reserved:28; 225 u32 ignore_parent:1; /* Power is independent of parent power state */
226 u32 reserved:27;
226}; 227};
227 228
228struct acpi_device_power_state { 229struct acpi_device_power_state {
@@ -338,20 +339,6 @@ struct acpi_bus_event {
338 u32 data; 339 u32 data;
339}; 340};
340 341
341struct acpi_eject_event {
342 struct acpi_device *device;
343 u32 event;
344};
345
346struct acpi_hp_work {
347 struct work_struct work;
348 acpi_handle handle;
349 u32 type;
350 void *context;
351};
352void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
353 void (*func)(struct work_struct *work));
354
355extern struct kobject *acpi_kobj; 342extern struct kobject *acpi_kobj;
356extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 343extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
357void acpi_bus_private_data_handler(acpi_handle, void *); 344void acpi_bus_private_data_handler(acpi_handle, void *);
@@ -390,7 +377,6 @@ int acpi_scan_add_handler(struct acpi_scan_handler *handler);
390int acpi_bus_register_driver(struct acpi_driver *driver); 377int acpi_bus_register_driver(struct acpi_driver *driver);
391void acpi_bus_unregister_driver(struct acpi_driver *driver); 378void acpi_bus_unregister_driver(struct acpi_driver *driver);
392int acpi_bus_scan(acpi_handle handle); 379int acpi_bus_scan(acpi_handle handle);
393void acpi_bus_hot_remove_device(void *context);
394void acpi_bus_trim(struct acpi_device *start); 380void acpi_bus_trim(struct acpi_device *start);
395acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 381acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
396int acpi_match_device_ids(struct acpi_device *device, 382int acpi_match_device_ids(struct acpi_device *device,
@@ -398,6 +384,9 @@ int acpi_match_device_ids(struct acpi_device *device,
398int acpi_create_dir(struct acpi_device *); 384int acpi_create_dir(struct acpi_device *);
399void acpi_remove_dir(struct acpi_device *); 385void acpi_remove_dir(struct acpi_device *);
400 386
387typedef void (*acpi_hp_callback)(void *data, u32 src);
388
389acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src);
401 390
402/** 391/**
403 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver 392 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
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..d8f9457755b4 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 0x20130927
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/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/memory_model.h b/include/asm-generic/memory_model.h
index aea9e45efce6..14909b0b9cae 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -53,7 +53,7 @@
53 53
54#elif defined(CONFIG_SPARSEMEM) 54#elif defined(CONFIG_SPARSEMEM)
55/* 55/*
56 * Note: section's mem_map is encorded to reflect its start_pfn. 56 * Note: section's mem_map is encoded to reflect its start_pfn.
57 * section[i].section_mem_map == mem_map's address - start_pfn; 57 * section[i].section_mem_map == mem_map's address - start_pfn;
58 */ 58 */
59#define __page_to_pfn(pg) \ 59#define __page_to_pfn(pg) \
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/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/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/drm/drmP.h b/include/drm/drmP.h
index b46fb45f2cca..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,
@@ -1454,7 +1436,6 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1454extern void drm_master_put(struct drm_master **master); 1436extern void drm_master_put(struct drm_master **master);
1455 1437
1456extern void drm_put_dev(struct drm_device *dev); 1438extern void drm_put_dev(struct drm_device *dev);
1457extern int drm_put_minor(struct drm_minor **minor);
1458extern void drm_unplug_dev(struct drm_device *dev); 1439extern void drm_unplug_dev(struct drm_device *dev);
1459extern unsigned int drm_debug; 1440extern unsigned int drm_debug;
1460extern unsigned int drm_rnodes; 1441extern unsigned int drm_rnodes;
@@ -1474,10 +1455,11 @@ extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1474#if defined(CONFIG_DEBUG_FS) 1455#if defined(CONFIG_DEBUG_FS)
1475extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, 1456extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1476 struct dentry *root); 1457 struct dentry *root);
1477extern int drm_debugfs_create_files(struct drm_info_list *files, int count, 1458extern int drm_debugfs_create_files(const struct drm_info_list *files,
1478 struct dentry *root, struct drm_minor *minor); 1459 int count, struct dentry *root,
1479extern int drm_debugfs_remove_files(struct drm_info_list *files, int count, 1460 struct drm_minor *minor);
1480 struct drm_minor *minor); 1461extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1462 int count, struct drm_minor *minor);
1481extern int drm_debugfs_cleanup(struct drm_minor *minor); 1463extern int drm_debugfs_cleanup(struct drm_minor *minor);
1482#endif 1464#endif
1483 1465
@@ -1556,8 +1538,6 @@ int drm_gem_init(struct drm_device *dev);
1556void drm_gem_destroy(struct drm_device *dev); 1538void drm_gem_destroy(struct drm_device *dev);
1557void drm_gem_object_release(struct drm_gem_object *obj); 1539void drm_gem_object_release(struct drm_gem_object *obj);
1558void drm_gem_object_free(struct kref *kref); 1540void drm_gem_object_free(struct kref *kref);
1559struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1560 size_t size);
1561int drm_gem_object_init(struct drm_device *dev, 1541int drm_gem_object_init(struct drm_device *dev,
1562 struct drm_gem_object *obj, size_t size); 1542 struct drm_gem_object *obj, size_t size);
1563void drm_gem_private_object_init(struct drm_device *dev, 1543void drm_gem_private_object_init(struct drm_device *dev,
@@ -1645,10 +1625,11 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1645 1625
1646#include <drm/drm_mem_util.h> 1626#include <drm/drm_mem_util.h>
1647 1627
1648extern int drm_fill_in_dev(struct drm_device *dev, 1628struct drm_device *drm_dev_alloc(struct drm_driver *driver,
1649 const struct pci_device_id *ent, 1629 struct device *parent);
1650 struct drm_driver *driver); 1630void drm_dev_free(struct drm_device *dev);
1651int 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);
1652/*@}*/ 1633/*@}*/
1653 1634
1654/* 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 3d79e513c0b3..87578c109e48 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -261,6 +261,18 @@
261 {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}, \
262 {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}, \
263 {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}, \
264 {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}, \
265 {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}, \
266 {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 3abfa6ea226e..97d5497debc1 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -49,6 +49,10 @@ extern bool i915_gpu_turbo_disable(void);
49#define SNB_GMCH_GGMS_MASK 0x3 49#define SNB_GMCH_GGMS_MASK 0x3
50#define SNB_GMCH_GMS_SHIFT 3 /* Graphics Mode Select */ 50#define SNB_GMCH_GMS_SHIFT 3 /* Graphics Mode Select */
51#define SNB_GMCH_GMS_MASK 0x1f 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
52 56
53#define I830_GMCH_CTRL 0x52 57#define I830_GMCH_CTRL 0x52
54 58
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 8a10f5c354e6..940ece4934ba 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -208,4 +208,29 @@
208#define INTEL_VLV_D_IDS(info) \ 208#define INTEL_VLV_D_IDS(info) \
209 INTEL_VGA_DEVICE(0x0155, info) 209 INTEL_VGA_DEVICE(0x0155, info)
210 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
211#endif /* _I915_PCIIDS_H */ 236#endif /* _I915_PCIIDS_H */
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/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/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/linux/acpi.h b/include/linux/acpi.h
index a5db4aeefa36..b0972c4ce81c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,7 +116,7 @@ void acpi_numa_arch_fixup(void);
116 116
117#ifdef CONFIG_ACPI_HOTPLUG_CPU 117#ifdef CONFIG_ACPI_HOTPLUG_CPU
118/* Arch dependent functions for cpu hotplug support */ 118/* Arch dependent functions for cpu hotplug support */
119int acpi_map_lsapic(acpi_handle handle, int *pcpu); 119int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu);
120int acpi_unmap_lsapic(int cpu); 120int acpi_unmap_lsapic(int cpu);
121#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 121#endif /* CONFIG_ACPI_HOTPLUG_CPU */
122 122
@@ -294,58 +294,52 @@ void __init acpi_nvs_nosave_s3(void);
294#endif /* CONFIG_PM_SLEEP */ 294#endif /* CONFIG_PM_SLEEP */
295 295
296struct acpi_osc_context { 296struct acpi_osc_context {
297 char *uuid_str; /* uuid string */ 297 char *uuid_str; /* UUID string */
298 int rev; 298 int rev;
299 struct acpi_buffer cap; /* arg2/arg3 */ 299 struct acpi_buffer cap; /* list of DWORD capabilities */
300 struct acpi_buffer ret; /* free by caller if success */ 300 struct acpi_buffer ret; /* free by caller if success */
301}; 301};
302 302
303#define OSC_QUERY_TYPE 0 303acpi_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); 304acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
315 305
316/* platform-wide _OSC bits */ 306/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
317#define OSC_SB_PAD_SUPPORT 1 307#define OSC_QUERY_DWORD 0 /* DWORD 1 */
318#define OSC_SB_PPC_OST_SUPPORT 2 308#define OSC_SUPPORT_DWORD 1 /* DWORD 2 */
319#define OSC_SB_PR3_SUPPORT 4 309#define OSC_CONTROL_DWORD 2 /* DWORD 3 */
320#define OSC_SB_HOTPLUG_OST_SUPPORT 8 310
321#define OSC_SB_APEI_SUPPORT 16 311/* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */
312#define OSC_QUERY_ENABLE 0x00000001 /* input */
313#define OSC_REQUEST_ERROR 0x00000002 /* return */
314#define OSC_INVALID_UUID_ERROR 0x00000004 /* return */
315#define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */
316#define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */
317
318/* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */
319#define OSC_SB_PAD_SUPPORT 0x00000001
320#define OSC_SB_PPC_OST_SUPPORT 0x00000002
321#define OSC_SB_PR3_SUPPORT 0x00000004
322#define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008
323#define OSC_SB_APEI_SUPPORT 0x00000010
324#define OSC_SB_CPC_SUPPORT 0x00000020
322 325
323extern bool osc_sb_apei_support_acked; 326extern bool osc_sb_apei_support_acked;
324 327
325/* PCI defined _OSC bits */ 328/* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
326/* _OSC DW1 Definition (OS Support Fields) */ 329#define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001
327#define OSC_EXT_PCI_CONFIG_SUPPORT 1 330#define OSC_PCI_ASPM_SUPPORT 0x00000002
328#define OSC_ACTIVE_STATE_PWR_SUPPORT 2 331#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
329#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 332#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
330#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 333#define OSC_PCI_MSI_SUPPORT 0x00000010
331#define OSC_MSI_SUPPORT 16 334#define OSC_PCI_SUPPORT_MASKS 0x0000001f
332#define OSC_PCI_SUPPORT_MASKS 0x1f 335
333 336/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
334/* _OSC DW1 Definition (OS Control Fields) */ 337#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
335#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 338#define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002
336#define OSC_SHPC_NATIVE_HP_CONTROL 2 339#define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004
337#define OSC_PCI_EXPRESS_PME_CONTROL 4 340#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
338#define OSC_PCI_EXPRESS_AER_CONTROL 8 341#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
339#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 342#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 343
350extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 344extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
351 u32 *mask, u32 req); 345 u32 *mask, u32 req);
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/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/serial.h b/include/linux/amba/serial.h
index 62d9303c2837..0ddb5c02ad8b 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -40,7 +40,7 @@
40#define UART010_LCRL 0x10 /* Line control register, low byte. */ 40#define UART010_LCRL 0x10 /* Line control register, low byte. */
41#define UART010_CR 0x14 /* Control register. */ 41#define UART010_CR 0x14 /* Control register. */
42#define UART01x_FR 0x18 /* Flag register (Read only). */ 42#define UART01x_FR 0x18 /* Flag register (Read only). */
43#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */ 43#define UART010_IIR 0x1C /* Interrupt identification register (Read). */
44#define UART010_ICR 0x1C /* Interrupt clear register (Write). */ 44#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
45#define ST_UART011_LCRH_RX 0x1C /* Rx line control register. */ 45#define ST_UART011_LCRH_RX 0x1C /* Rx line control register. */
46#define UART01x_ILPR 0x20 /* IrDA low power counter register. */ 46#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index cf573c22b81e..8013a45242fe 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -13,9 +13,6 @@ struct file_operations;
13struct file *anon_inode_getfile(const char *name, 13struct file *anon_inode_getfile(const char *name,
14 const struct file_operations *fops, 14 const struct file_operations *fops,
15 void *priv, int flags); 15 void *priv, int flags);
16struct file *anon_inode_getfile_private(const char *name,
17 const struct file_operations *fops,
18 void *priv, int flags);
19int anon_inode_getfd(const char *name, const struct file_operations *fops, 16int anon_inode_getfd(const char *name, const struct file_operations *fops,
20 void *priv, int flags); 17 void *priv, int flags);
21 18
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/backing-dev.h b/include/linux/backing-dev.h
index 5f66d519a726..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);
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/binfmts.h b/include/linux/binfmts.h
index e8112ae50531..fd8bf3219ef7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -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 0e6f765aa1f5..f26ec20f6354 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,6 +498,7 @@ 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) | \
@@ -539,6 +571,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) 571#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) 572#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) 573#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags)
574#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) 575#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
543#define blk_queue_noxmerges(q) \ 576#define blk_queue_noxmerges(q) \
544 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 577 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
@@ -570,7 +603,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
570 603
571#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 604#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
572 605
573#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 606#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0)
574 607
575static inline unsigned int blk_queue_cluster(struct request_queue *q) 608static inline unsigned int blk_queue_cluster(struct request_queue *q)
576{ 609{
@@ -1013,6 +1046,7 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
1013struct blk_plug { 1046struct blk_plug {
1014 unsigned long magic; /* detect uninitialized use-cases */ 1047 unsigned long magic; /* detect uninitialized use-cases */
1015 struct list_head list; /* requests */ 1048 struct list_head list; /* requests */
1049 struct list_head mq_list; /* blk-mq requests */
1016 struct list_head cb_list; /* md requires an unplug callback */ 1050 struct list_head cb_list; /* md requires an unplug callback */
1017}; 1051};
1018#define BLK_MAX_REQUEST_COUNT 16 1052#define BLK_MAX_REQUEST_COUNT 16
@@ -1050,7 +1084,10 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1050{ 1084{
1051 struct blk_plug *plug = tsk->plug; 1085 struct blk_plug *plug = tsk->plug;
1052 1086
1053 return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); 1087 return plug &&
1088 (!list_empty(&plug->list) ||
1089 !list_empty(&plug->mq_list) ||
1090 !list_empty(&plug->cb_list));
1054} 1091}
1055 1092
1056/* 1093/*
@@ -1325,6 +1362,7 @@ static inline void put_dev_sector(Sector p)
1325 1362
1326struct work_struct; 1363struct work_struct;
1327int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1364int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1365int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
1328 1366
1329#ifdef CONFIG_BLK_CGROUP 1367#ifdef CONFIG_BLK_CGROUP
1330/* 1368/*
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/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-provider.h b/include/linux/clk-provider.h
index 73bdb69f0c08..7e59253b8603 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -472,6 +472,7 @@ void of_clk_del_provider(struct device_node *np);
472struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 472struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
473 void *data); 473 void *data);
474struct 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);
475const 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);
476 477
477void of_clk_init(const struct of_device_id *matches); 478void of_clk_init(const struct of_device_id *matches);
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
index 98e892ef6d5a..a0f9280421ec 100644
--- a/include/linux/cmdline-parser.h
+++ b/include/linux/cmdline-parser.h
@@ -8,6 +8,8 @@
8#define CMDLINEPARSEH 8#define CMDLINEPARSEH
9 9
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/fs.h>
12#include <linux/slab.h>
11 13
12/* partition flags */ 14/* partition flags */
13#define PF_RDONLY 0x01 /* Device is read only */ 15#define PF_RDONLY 0x01 /* Device is read only */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 345da00a86e0..eb8a49d75ab3 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -41,14 +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__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\ 47 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
47 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ 48 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
48 { \ 49 { \
49 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ 50 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
50 } \ 51 } \
51 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
52 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__))
53 53
54#ifndef compat_user_stack_pointer 54#ifndef compat_user_stack_pointer
@@ -362,7 +362,7 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
362long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 362long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
363 unsigned long bitmap_size); 363 unsigned long bitmap_size);
364int 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);
365int 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);
366int get_compat_sigevent(struct sigevent *event, 366int get_compat_sigevent(struct sigevent *event,
367 const struct compat_sigevent __user *u_event); 367 const struct compat_sigevent __user *u_event);
368long 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/completion.h b/include/linux/completion.h
index 22c33e35bcb2..5d5aaae3af43 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.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/cpufreq.h b/include/linux/cpufreq.h
index fcabc42d66ab..dc196bbcf227 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -85,6 +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
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;
88}; 102};
89 103
90/* Only for ACPI */ 104/* Only for ACPI */
@@ -93,8 +107,16 @@ struct cpufreq_policy {
93#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 */
94#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*/
95 109
110#ifdef CONFIG_CPU_FREQ
96struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 111struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
97void 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
98 120
99static inline bool policy_is_shared(struct cpufreq_policy *policy) 121static inline bool policy_is_shared(struct cpufreq_policy *policy)
100{ 122{
@@ -180,13 +202,6 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
180struct cpufreq_driver { 202struct cpufreq_driver {
181 char name[CPUFREQ_NAME_LEN]; 203 char name[CPUFREQ_NAME_LEN];
182 u8 flags; 204 u8 flags;
183 /*
184 * This should be set by platforms having multiple clock-domains, i.e.
185 * supporting multiple policies. With this sysfs directories of governor
186 * would be created in cpu/cpu<num>/cpufreq/ directory and so they can
187 * use the same governor with different tunables for different clusters.
188 */
189 bool have_governor_per_policy;
190 205
191 /* needed by all drivers */ 206 /* needed by all drivers */
192 int (*init) (struct cpufreq_policy *policy); 207 int (*init) (struct cpufreq_policy *policy);
@@ -194,9 +209,11 @@ struct cpufreq_driver {
194 209
195 /* define one out of two */ 210 /* define one out of two */
196 int (*setpolicy) (struct cpufreq_policy *policy); 211 int (*setpolicy) (struct cpufreq_policy *policy);
197 int (*target) (struct cpufreq_policy *policy, 212 int (*target) (struct cpufreq_policy *policy, /* Deprecated */
198 unsigned int target_freq, 213 unsigned int target_freq,
199 unsigned int relation); 214 unsigned int relation);
215 int (*target_index) (struct cpufreq_policy *policy,
216 unsigned int index);
200 217
201 /* should be defined, if possible */ 218 /* should be defined, if possible */
202 unsigned int (*get) (unsigned int cpu); 219 unsigned int (*get) (unsigned int cpu);
@@ -211,13 +228,29 @@ struct cpufreq_driver {
211}; 228};
212 229
213/* flags */ 230/* flags */
214#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 231#define CPUFREQ_STICKY (1 << 0) /* driver isn't removed even if
215 * all ->init() calls failed */ 232 all ->init() calls failed */
216#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 233#define CPUFREQ_CONST_LOOPS (1 << 1) /* loops_per_jiffy or other
217 * "constants" aren't affected by 234 kernel "constants" aren't
218 * frequency transitions */ 235 affected by frequency
219#define CPUFREQ_PM_NO_WARN 0x04 /* don't warn on suspend/resume speed 236 transitions */
220 * 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)
221 254
222int cpufreq_register_driver(struct cpufreq_driver *driver_data); 255int cpufreq_register_driver(struct cpufreq_driver *driver_data);
223int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 256int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
@@ -240,6 +273,13 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
240 return; 273 return;
241} 274}
242 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
243/********************************************************************* 283/*********************************************************************
244 * CPUFREQ NOTIFIER INTERFACE * 284 * CPUFREQ NOTIFIER INTERFACE *
245 *********************************************************************/ 285 *********************************************************************/
@@ -392,6 +432,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
392 432
393int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, 433int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
394 struct cpufreq_frequency_table *table); 434 struct cpufreq_frequency_table *table);
435int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy);
395 436
396int cpufreq_frequency_table_target(struct cpufreq_policy *policy, 437int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
397 struct cpufreq_frequency_table *table, 438 struct cpufreq_frequency_table *table,
@@ -407,8 +448,20 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
407 448
408/* the following are really really optional */ 449/* the following are really really optional */
409extern 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[];
410void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 452void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
411 unsigned int cpu); 453 unsigned int cpu);
412void 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}
413 466
414#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/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 59066e0b4ff1..57e87e749a48 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -169,13 +169,13 @@ struct dentry_operations {
169 */ 169 */
170 170
171/* d_flags entries */ 171/* d_flags entries */
172#define DCACHE_OP_HASH 0x0001 172#define DCACHE_OP_HASH 0x00000001
173#define DCACHE_OP_COMPARE 0x0002 173#define DCACHE_OP_COMPARE 0x00000002
174#define DCACHE_OP_REVALIDATE 0x0004 174#define DCACHE_OP_REVALIDATE 0x00000004
175#define DCACHE_OP_DELETE 0x0008 175#define DCACHE_OP_DELETE 0x00000008
176#define DCACHE_OP_PRUNE 0x0010 176#define DCACHE_OP_PRUNE 0x00000010
177 177
178#define DCACHE_DISCONNECTED 0x0020 178#define DCACHE_DISCONNECTED 0x00000020
179 /* This dentry is possibly not currently connected to the dcache tree, in 179 /* 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 180 * 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 181 * well. nfsd will not use a dentry with this bit set, but will first
@@ -186,30 +186,38 @@ struct dentry_operations {
186 * dentry into place and return that dentry rather than the passed one, 186 * dentry into place and return that dentry rather than the passed one,
187 * typically using d_splice_alias. */ 187 * typically using d_splice_alias. */
188 188
189#define DCACHE_REFERENCED 0x0040 /* Recently used, don't discard. */ 189#define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */
190#define DCACHE_RCUACCESS 0x0080 /* Entry has ever been RCU-visible */ 190#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */
191 191
192#define DCACHE_CANT_MOUNT 0x0100 192#define DCACHE_CANT_MOUNT 0x00000100
193#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x00000200
194#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x00000400
195 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800 196#define DCACHE_OP_WEAK_REVALIDATE 0x00000800
197 197
198#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x00001000
199 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
200 * dput() */ 200 * dput() */
201#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */ 201#define DCACHE_COOKIE 0x00002000 /* For use by dcookie subsystem */
202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000 202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x00004000
203 /* Parent inode is watched by some fsnotify listener */ 203 /* Parent inode is watched by some fsnotify listener */
204 204
205#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 205#define DCACHE_DENTRY_KILLED 0x00008000
206#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 206
207#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 207#define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */
208#define DCACHE_NEED_AUTOMOUNT 0x00020000 /* handle automount on this dir */
209#define DCACHE_MANAGE_TRANSIT 0x00040000 /* manage transit from this dirent */
208#define DCACHE_MANAGED_DENTRY \ 210#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 211 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 212
211#define DCACHE_LRU_LIST 0x80000 213#define DCACHE_LRU_LIST 0x00080000
212#define DCACHE_DENTRY_KILLED 0x100000 214
215#define DCACHE_ENTRY_TYPE 0x00700000
216#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry */
217#define DCACHE_DIRECTORY_TYPE 0x00100000 /* Normal directory */
218#define DCACHE_AUTODIR_TYPE 0x00200000 /* Lookupless directory (presumed automount) */
219#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
220#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
213 221
214extern seqlock_t rename_lock; 222extern seqlock_t rename_lock;
215 223
@@ -224,6 +232,7 @@ static inline int dname_external(const struct dentry *dentry)
224extern void d_instantiate(struct dentry *, struct inode *); 232extern void d_instantiate(struct dentry *, struct inode *);
225extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 233extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
226extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 234extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
235extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
227extern void __d_drop(struct dentry *dentry); 236extern void __d_drop(struct dentry *dentry);
228extern void d_drop(struct dentry *dentry); 237extern void d_drop(struct dentry *dentry);
229extern void d_delete(struct dentry *); 238extern void d_delete(struct dentry *);
@@ -393,6 +402,61 @@ static inline bool d_mountpoint(const struct dentry *dentry)
393 return dentry->d_flags & DCACHE_MOUNTED; 402 return dentry->d_flags & DCACHE_MOUNTED;
394} 403}
395 404
405/*
406 * Directory cache entry type accessor functions.
407 */
408static inline void __d_set_type(struct dentry *dentry, unsigned type)
409{
410 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
411}
412
413static inline void __d_clear_type(struct dentry *dentry)
414{
415 __d_set_type(dentry, DCACHE_MISS_TYPE);
416}
417
418static inline void d_set_type(struct dentry *dentry, unsigned type)
419{
420 spin_lock(&dentry->d_lock);
421 __d_set_type(dentry, type);
422 spin_unlock(&dentry->d_lock);
423}
424
425static inline unsigned __d_entry_type(const struct dentry *dentry)
426{
427 return dentry->d_flags & DCACHE_ENTRY_TYPE;
428}
429
430static inline bool d_is_directory(const struct dentry *dentry)
431{
432 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
433}
434
435static inline bool d_is_autodir(const struct dentry *dentry)
436{
437 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
438}
439
440static inline bool d_is_symlink(const struct dentry *dentry)
441{
442 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
443}
444
445static inline bool d_is_file(const struct dentry *dentry)
446{
447 return __d_entry_type(dentry) == DCACHE_FILE_TYPE;
448}
449
450static inline bool d_is_negative(const struct dentry *dentry)
451{
452 return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
453}
454
455static inline bool d_is_positive(const struct dentry *dentry)
456{
457 return !d_is_negative(dentry);
458}
459
396extern int sysctl_vfs_cache_pressure; 460extern int sysctl_vfs_cache_pressure;
397 461
398static inline unsigned long vfs_pressure_ratio(unsigned long val) 462static inline unsigned long vfs_pressure_ratio(unsigned long val)
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 5f1ab92107e6..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
@@ -168,7 +168,7 @@ struct devfreq {
168 unsigned long max_freq; 168 unsigned long max_freq;
169 bool stop_polling; 169 bool stop_polling;
170 170
171 /* information for device freqeuncy transition */ 171 /* information for device frequency transition */
172 unsigned int total_trans; 172 unsigned int total_trans;
173 unsigned int *trans_table; 173 unsigned int *trans_table;
174 unsigned long *time_in_state; 174 unsigned long *time_in_state;
@@ -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/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/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..bc5687d0f315 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);
@@ -784,6 +803,13 @@ struct efivar_entry {
784 struct kobject kobj; 803 struct kobject kobj;
785}; 804};
786 805
806
807struct efi_simple_text_output_protocol {
808 void *reset;
809 efi_status_t (*output_string)(void *, void *);
810 void *test_string;
811};
812
787extern struct list_head efivar_sysfs_list; 813extern struct list_head efivar_sysfs_list;
788 814
789static inline void 815static inline void
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/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/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/fs.h b/include/linux/fs.h
index 955dff5da56a..bf5d574ebdf4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -623,10 +623,13 @@ static inline int inode_unhashed(struct inode *inode)
623 * 0: the object of the current VFS operation 623 * 0: the object of the current VFS operation
624 * 1: parent 624 * 1: parent
625 * 2: child/target 625 * 2: child/target
626 * 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.
627 * 630 *
628 * The locking order between these classes is 631 * The locking order between these classes is
629 * parent -> child -> normal -> xattr -> quota 632 * parent -> child -> normal -> xattr -> second non-directory
630 */ 633 */
631enum inode_i_mutex_lock_class 634enum inode_i_mutex_lock_class
632{ 635{
@@ -634,9 +637,12 @@ enum inode_i_mutex_lock_class
634 I_MUTEX_PARENT, 637 I_MUTEX_PARENT,
635 I_MUTEX_CHILD, 638 I_MUTEX_CHILD,
636 I_MUTEX_XATTR, 639 I_MUTEX_XATTR,
637 I_MUTEX_QUOTA 640 I_MUTEX_NONDIR2
638}; 641};
639 642
643void lock_two_nondirectories(struct inode *, struct inode*);
644void unlock_two_nondirectories(struct inode *, struct inode*);
645
640/* 646/*
641 * NOTE: in a 32bit arch with a preemptable kernel and 647 * NOTE: in a 32bit arch with a preemptable kernel and
642 * an UP compile the i_size_read/write must be atomic 648 * an UP compile the i_size_read/write must be atomic
@@ -764,12 +770,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
764#define FILE_MNT_WRITE_RELEASED 2 770#define FILE_MNT_WRITE_RELEASED 2
765 771
766struct file { 772struct file {
767 /*
768 * fu_list becomes invalid after file_free is called and queued via
769 * fu_rcuhead for RCU freeing
770 */
771 union { 773 union {
772 struct list_head fu_list;
773 struct llist_node fu_llist; 774 struct llist_node fu_llist;
774 struct rcu_head fu_rcuhead; 775 struct rcu_head fu_rcuhead;
775 } f_u; 776 } f_u;
@@ -783,9 +784,6 @@ struct file {
783 * Must not be taken from IRQ context. 784 * Must not be taken from IRQ context.
784 */ 785 */
785 spinlock_t f_lock; 786 spinlock_t f_lock;
786#ifdef CONFIG_SMP
787 int f_sb_list_cpu;
788#endif
789 atomic_long_t f_count; 787 atomic_long_t f_count;
790 unsigned int f_flags; 788 unsigned int f_flags;
791 fmode_t f_mode; 789 fmode_t f_mode;
@@ -882,6 +880,7 @@ static inline int file_check_writeable(struct file *filp)
882 880
883#define FL_POSIX 1 881#define FL_POSIX 1
884#define FL_FLOCK 2 882#define FL_FLOCK 2
883#define FL_DELEG 4 /* NFSv4 delegation */
885#define FL_ACCESS 8 /* not trying to lock, just looking */ 884#define FL_ACCESS 8 /* not trying to lock, just looking */
886#define FL_EXISTS 16 /* when unlocking, test for existence */ 885#define FL_EXISTS 16 /* when unlocking, test for existence */
887#define FL_LEASE 32 /* lease held on this file */ 886#define FL_LEASE 32 /* lease held on this file */
@@ -1023,7 +1022,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
1023extern 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 *);
1024extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1025extern 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);
1026extern int __break_lease(struct inode *inode, unsigned int flags); 1025extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
1027extern void lease_get_mtime(struct inode *, struct timespec *time); 1026extern void lease_get_mtime(struct inode *, struct timespec *time);
1028extern int generic_setlease(struct file *, long, struct file_lock **); 1027extern int generic_setlease(struct file *, long, struct file_lock **);
1029extern int vfs_setlease(struct file *, long, struct file_lock **); 1028extern int vfs_setlease(struct file *, long, struct file_lock **);
@@ -1132,7 +1131,7 @@ static inline int flock_lock_file_wait(struct file *filp,
1132 return -ENOLCK; 1131 return -ENOLCK;
1133} 1132}
1134 1133
1135static inline int __break_lease(struct inode *inode, unsigned int mode) 1134static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
1136{ 1135{
1137 return 0; 1136 return 0;
1138} 1137}
@@ -1264,11 +1263,6 @@ struct super_block {
1264 1263
1265 struct list_head s_inodes; /* all inodes */ 1264 struct list_head s_inodes; /* all inodes */
1266 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ 1265 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
1267#ifdef CONFIG_SMP
1268 struct list_head __percpu *s_files;
1269#else
1270 struct list_head s_files;
1271#endif
1272 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 */
1273 struct block_device *s_bdev; 1267 struct block_device *s_bdev;
1274 struct backing_dev_info *s_bdi; 1268 struct backing_dev_info *s_bdi;
@@ -1330,6 +1324,7 @@ struct super_block {
1330 */ 1324 */
1331 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1325 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1332 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1326 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1327 struct rcu_head rcu;
1333}; 1328};
1334 1329
1335extern struct timespec current_fs_time(struct super_block *sb); 1330extern struct timespec current_fs_time(struct super_block *sb);
@@ -1458,10 +1453,10 @@ extern int vfs_create(struct inode *, struct dentry *, umode_t, bool);
1458extern int vfs_mkdir(struct inode *, struct dentry *, umode_t); 1453extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1459extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); 1454extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1460extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1455extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1461extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1456extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);
1462extern int vfs_rmdir(struct inode *, struct dentry *); 1457extern int vfs_rmdir(struct inode *, struct dentry *);
1463extern int vfs_unlink(struct inode *, struct dentry *); 1458extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1464extern 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 **);
1465 1460
1466/* 1461/*
1467 * VFS dentry helper functions. 1462 * VFS dentry helper functions.
@@ -1875,6 +1870,17 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1875 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1870 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
1876#define fops_put(fops) \ 1871#define fops_put(fops) \
1877 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)
1878 1884
1879extern int register_filesystem(struct file_system_type *); 1885extern int register_filesystem(struct file_system_type *);
1880extern int unregister_filesystem(struct file_system_type *); 1886extern int unregister_filesystem(struct file_system_type *);
@@ -1899,6 +1905,9 @@ extern bool fs_fully_visible(struct file_system_type *);
1899 1905
1900extern int current_umask(void); 1906extern int current_umask(void);
1901 1907
1908extern void ihold(struct inode * inode);
1909extern void iput(struct inode *);
1910
1902/* /sys/fs */ 1911/* /sys/fs */
1903extern struct kobject *fs_kobj; 1912extern struct kobject *fs_kobj;
1904 1913
@@ -1955,9 +1964,39 @@ static inline int locks_verify_truncate(struct inode *inode,
1955static inline int break_lease(struct inode *inode, unsigned int mode) 1964static inline int break_lease(struct inode *inode, unsigned int mode)
1956{ 1965{
1957 if (inode->i_flock) 1966 if (inode->i_flock)
1958 return __break_lease(inode, mode); 1967 return __break_lease(inode, mode, FL_LEASE);
1968 return 0;
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);
1959 return 0; 1975 return 0;
1960} 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
1961#else /* !CONFIG_FILE_LOCKING */ 2000#else /* !CONFIG_FILE_LOCKING */
1962static inline int locks_mandatory_locked(struct inode *inode) 2001static inline int locks_mandatory_locked(struct inode *inode)
1963{ 2002{
@@ -1997,6 +2036,22 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1997 return 0; 2036 return 0;
1998} 2037}
1999 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
2000#endif /* CONFIG_FILE_LOCKING */ 2055#endif /* CONFIG_FILE_LOCKING */
2001 2056
2002/* fs/open.c */ 2057/* fs/open.c */
@@ -2223,7 +2278,7 @@ extern void emergency_remount(void);
2223#ifdef CONFIG_BLOCK 2278#ifdef CONFIG_BLOCK
2224extern sector_t bmap(struct inode *, sector_t); 2279extern sector_t bmap(struct inode *, sector_t);
2225#endif 2280#endif
2226extern int notify_change(struct dentry *, struct iattr *); 2281extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2227extern int inode_permission(struct inode *, int); 2282extern int inode_permission(struct inode *, int);
2228extern int generic_permission(struct inode *, int); 2283extern int generic_permission(struct inode *, int);
2229 2284
@@ -2337,8 +2392,6 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2337extern int inode_init_always(struct super_block *, struct inode *); 2392extern int inode_init_always(struct super_block *, struct inode *);
2338extern void inode_init_once(struct inode *); 2393extern void inode_init_once(struct inode *);
2339extern void address_space_init_once(struct address_space *mapping); 2394extern void address_space_init_once(struct address_space *mapping);
2340extern void ihold(struct inode * inode);
2341extern void iput(struct inode *);
2342extern struct inode * igrab(struct inode *); 2395extern struct inode * igrab(struct inode *);
2343extern ino_t iunique(struct super_block *, ino_t); 2396extern ino_t iunique(struct super_block *, ino_t);
2344extern int inode_needs_sync(struct inode *inode); 2397extern int inode_needs_sync(struct inode *inode);
@@ -2507,8 +2560,10 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
2507 int nofs); 2560 int nofs);
2508extern int page_symlink(struct inode *inode, const char *symname, int len); 2561extern int page_symlink(struct inode *inode, const char *symname, int len);
2509extern 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 *);
2510extern int generic_readlink(struct dentry *, char __user *, int); 2564extern int generic_readlink(struct dentry *, char __user *, int);
2511extern 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);
2512extern int vfs_getattr(struct path *, struct kstat *); 2567extern int vfs_getattr(struct path *, struct kstat *);
2513void __inode_add_bytes(struct inode *inode, loff_t bytes); 2568void __inode_add_bytes(struct inode *inode, loff_t bytes);
2514void inode_add_bytes(struct inode *inode, loff_t bytes); 2569void inode_add_bytes(struct inode *inode, loff_t bytes);
@@ -2567,6 +2622,7 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
2567extern int simple_write_end(struct file *file, struct address_space *mapping, 2622extern int simple_write_end(struct file *file, struct address_space *mapping,
2568 loff_t pos, unsigned len, unsigned copied, 2623 loff_t pos, unsigned len, unsigned copied,
2569 struct page *page, void *fsdata); 2624 struct page *page, void *fsdata);
2625extern struct inode *alloc_anon_inode(struct super_block *);
2570 2626
2571extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2627extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
2572extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 2628extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
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..9abbe630c456 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,6 +241,7 @@ 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
@@ -253,6 +257,8 @@ struct ftrace_subsystem_dir;
253enum { 257enum {
254 FTRACE_EVENT_FL_ENABLED_BIT, 258 FTRACE_EVENT_FL_ENABLED_BIT,
255 FTRACE_EVENT_FL_RECORDED_CMD_BIT, 259 FTRACE_EVENT_FL_RECORDED_CMD_BIT,
260 FTRACE_EVENT_FL_FILTERED_BIT,
261 FTRACE_EVENT_FL_NO_SET_FILTER_BIT,
256 FTRACE_EVENT_FL_SOFT_MODE_BIT, 262 FTRACE_EVENT_FL_SOFT_MODE_BIT,
257 FTRACE_EVENT_FL_SOFT_DISABLED_BIT, 263 FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
258}; 264};
@@ -261,6 +267,8 @@ enum {
261 * Ftrace event file flags: 267 * Ftrace event file flags:
262 * ENABLED - The event is enabled 268 * ENABLED - The event is enabled
263 * RECORDED_CMD - The comms should be recorded at sched_switch 269 * RECORDED_CMD - The comms should be recorded at sched_switch
270 * FILTERED - The event has a filter attached
271 * NO_SET_FILTER - Set when filter has error and is to be ignored
264 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED 272 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED
265 * SOFT_DISABLED - When set, do not trace the event (even though its 273 * SOFT_DISABLED - When set, do not trace the event (even though its
266 * tracepoint may be enabled) 274 * tracepoint may be enabled)
@@ -268,6 +276,8 @@ enum {
268enum { 276enum {
269 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT), 277 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
270 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT), 278 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
279 FTRACE_EVENT_FL_FILTERED = (1 << FTRACE_EVENT_FL_FILTERED_BIT),
280 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), 281 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), 282 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
273}; 283};
@@ -275,6 +285,7 @@ enum {
275struct ftrace_event_file { 285struct ftrace_event_file {
276 struct list_head list; 286 struct list_head list;
277 struct ftrace_event_call *event_call; 287 struct ftrace_event_call *event_call;
288 struct event_filter *filter;
278 struct dentry *dir; 289 struct dentry *dir;
279 struct trace_array *tr; 290 struct trace_array *tr;
280 struct ftrace_subsystem_dir *system; 291 struct ftrace_subsystem_dir *system;
@@ -310,12 +321,16 @@ struct ftrace_event_file {
310 321
311#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 322#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
312 323
313extern void destroy_preds(struct ftrace_event_call *call); 324extern void destroy_preds(struct ftrace_event_file *file);
325extern void destroy_call_preds(struct ftrace_event_call *call);
314extern int filter_match_preds(struct event_filter *filter, void *rec); 326extern int filter_match_preds(struct event_filter *filter, void *rec);
315extern int filter_current_check_discard(struct ring_buffer *buffer, 327
316 struct ftrace_event_call *call, 328extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
317 void *rec, 329 struct ring_buffer *buffer,
318 struct ring_buffer_event *event); 330 struct ring_buffer_event *event);
331extern int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
332 struct ring_buffer *buffer,
333 struct ring_buffer_event *event);
319 334
320enum { 335enum {
321 FILTER_OTHER = 0, 336 FILTER_OTHER = 0,
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index f8d41cb1cbe0..1eda33d7cb10 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -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..656a27efb2c8
--- /dev/null
+++ b/include/linux/gpio/driver.h
@@ -0,0 +1,184 @@
1#ifndef __LINUX_GPIO_DRIVER_H
2#define __LINUX_GPIO_DRIVER_H
3
4#include <linux/types.h>
5
6struct device;
7struct gpio_desc;
8struct seq_file;
9
10/**
11 * struct gpio_chip - abstract a GPIO controller
12 * @label: for diagnostics
13 * @dev: optional device providing the GPIOs
14 * @owner: helps prevent removal of modules exporting active GPIOs
15 * @list: links gpio_chips together for traversal
16 * @request: optional hook for chip-specific activation, such as
17 * enabling module power and clock; may sleep
18 * @free: optional hook for chip-specific deactivation, such as
19 * disabling module power and clock; may sleep
20 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
21 * (same as GPIOF_DIR_XXX), or negative error
22 * @direction_input: configures signal "offset" as input, or returns error
23 * @direction_output: configures signal "offset" as output, or returns error
24 * @get: returns value for signal "offset"; for output signals this
25 * returns either the value actually sensed, or zero
26 * @set: assigns output value for signal "offset"
27 * @set_debounce: optional hook for setting debounce time for specified gpio in
28 * interrupt triggered gpio chips
29 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
30 * implementation may not sleep
31 * @dbg_show: optional routine to show contents in debugfs; default code
32 * will be used when this is omitted, but custom code can show extra
33 * state (such as pullup/pulldown configuration).
34 * @base: identifies the first GPIO number handled by this chip; or, if
35 * negative during registration, requests dynamic ID allocation.
36 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
37 * handled is (base + ngpio - 1).
38 * @desc: array of ngpio descriptors. Private.
39 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
40 * must while accessing GPIO expander chips over I2C or SPI
41 * @names: if set, must be an array of strings to use as alternative
42 * names for the GPIOs in this chip. Any entry in the array
43 * may be NULL if there is no alias for the GPIO, however the
44 * array must be @ngpio entries long. A name can include a single printk
45 * format specifier for an unsigned int. It is substituted by the actual
46 * number of the gpio.
47 *
48 * A gpio_chip can help platforms abstract various sources of GPIOs so
49 * they can all be accessed through a common programing interface.
50 * Example sources would be SOC controllers, FPGAs, multifunction
51 * chips, dedicated GPIO expanders, and so on.
52 *
53 * Each chip controls a number of signals, identified in method calls
54 * by "offset" values in the range 0..(@ngpio - 1). When those signals
55 * are referenced through calls like gpio_get_value(gpio), the offset
56 * is calculated by subtracting @base from the gpio number.
57 */
58struct gpio_chip {
59 const char *label;
60 struct device *dev;
61 struct module *owner;
62 struct list_head list;
63
64 int (*request)(struct gpio_chip *chip,
65 unsigned offset);
66 void (*free)(struct gpio_chip *chip,
67 unsigned offset);
68 int (*get_direction)(struct gpio_chip *chip,
69 unsigned offset);
70 int (*direction_input)(struct gpio_chip *chip,
71 unsigned offset);
72 int (*direction_output)(struct gpio_chip *chip,
73 unsigned offset, int value);
74 int (*get)(struct gpio_chip *chip,
75 unsigned offset);
76 void (*set)(struct gpio_chip *chip,
77 unsigned offset, int value);
78 int (*set_debounce)(struct gpio_chip *chip,
79 unsigned offset,
80 unsigned debounce);
81
82 int (*to_irq)(struct gpio_chip *chip,
83 unsigned offset);
84
85 void (*dbg_show)(struct seq_file *s,
86 struct gpio_chip *chip);
87 int base;
88 u16 ngpio;
89 struct gpio_desc *desc;
90 const char *const *names;
91 unsigned can_sleep:1;
92 unsigned exported:1;
93
94#if defined(CONFIG_OF_GPIO)
95 /*
96 * If CONFIG_OF is enabled, then all GPIO controllers described in the
97 * device tree automatically may have an OF translation
98 */
99 struct device_node *of_node;
100 int of_gpio_n_cells;
101 int (*of_xlate)(struct gpio_chip *gc,
102 const struct of_phandle_args *gpiospec, u32 *flags);
103#endif
104#ifdef CONFIG_PINCTRL
105 /*
106 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
107 * describe the actual pin range which they serve in an SoC. This
108 * information would be used by pinctrl subsystem to configure
109 * corresponding pins for gpio usage.
110 */
111 struct list_head pin_ranges;
112#endif
113};
114
115extern const char *gpiochip_is_requested(struct gpio_chip *chip,
116 unsigned offset);
117
118/* add/remove chips */
119extern int gpiochip_add(struct gpio_chip *chip);
120extern int __must_check gpiochip_remove(struct gpio_chip *chip);
121extern struct gpio_chip *gpiochip_find(void *data,
122 int (*match)(struct gpio_chip *chip, void *data));
123
124/* lock/unlock as IRQ */
125int gpiod_lock_as_irq(struct gpio_desc *desc);
126void gpiod_unlock_as_irq(struct gpio_desc *desc);
127
128/**
129 * Lookup table for associating GPIOs to specific devices and functions using
130 * platform data.
131 */
132struct gpiod_lookup {
133 struct list_head list;
134 /*
135 * name of the chip the GPIO belongs to
136 */
137 const char *chip_label;
138 /*
139 * hardware number (i.e. relative to the chip) of the GPIO
140 */
141 u16 chip_hwnum;
142 /*
143 * name of device that can claim this GPIO
144 */
145 const char *dev_id;
146 /*
147 * name of the GPIO from the device's point of view
148 */
149 const char *con_id;
150 /*
151 * index of the GPIO in case several GPIOs share the same name
152 */
153 unsigned int idx;
154 /*
155 * mask of GPIOF_* values
156 */
157 unsigned long flags;
158};
159
160/*
161 * Simple definition of a single GPIO under a con_id
162 */
163#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _dev_id, _con_id, _flags) \
164 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, 0, _flags)
165
166/*
167 * Use this macro if you need to have several GPIOs under the same con_id.
168 * Each GPIO needs to use a different index and can be accessed using
169 * gpiod_get_index()
170 */
171#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, _idx, \
172 _flags) \
173{ \
174 .chip_label = _chip_label, \
175 .chip_hwnum = _chip_hwnum, \
176 .dev_id = _dev_id, \
177 .con_id = _con_id, \
178 .idx = _idx, \
179 .flags = _flags, \
180}
181
182void gpiod_add_table(struct gpiod_lookup *table, size_t size);
183
184#endif
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/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 3935428c57cf..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)
@@ -129,15 +130,15 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma,
129 unsigned long start, 130 unsigned long start,
130 unsigned long end, 131 unsigned long end,
131 long adjust_next); 132 long adjust_next);
132extern int __pmd_trans_huge_lock(pmd_t *pmd, 133extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
133 struct vm_area_struct *vma); 134 spinlock_t **ptl);
134/* mmap_sem must be held on entry */ 135/* mmap_sem must be held on entry */
135static inline int pmd_trans_huge_lock(pmd_t *pmd, 136static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
136 struct vm_area_struct *vma) 137 spinlock_t **ptl)
137{ 138{
138 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 139 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem));
139 if (pmd_trans_huge(*pmd)) 140 if (pmd_trans_huge(*pmd))
140 return __pmd_trans_huge_lock(pmd, vma); 141 return __pmd_trans_huge_lock(pmd, vma, ptl);
141 else 142 else
142 return 0; 143 return 0;
143} 144}
@@ -215,8 +216,8 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
215 long adjust_next) 216 long adjust_next)
216{ 217{
217} 218}
218static inline int pmd_trans_huge_lock(pmd_t *pmd, 219static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
219 struct vm_area_struct *vma) 220 spinlock_t **ptl)
220{ 221{
221 return 0; 222 return 0;
222} 223}
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0393270466c3..acd2010328f3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -392,6 +392,15 @@ static inline int hugepage_migration_support(struct hstate *h)
392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT); 392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
393} 393}
394 394
395static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
396 struct mm_struct *mm, pte_t *pte)
397{
398 if (huge_page_size(h) == PMD_SIZE)
399 return pmd_lockptr(mm, (pmd_t *) pte);
400 VM_BUG_ON(huge_page_size(h) == PAGE_SIZE);
401 return &mm->page_table_lock;
402}
403
395#else /* CONFIG_HUGETLB_PAGE */ 404#else /* CONFIG_HUGETLB_PAGE */
396struct hstate {}; 405struct hstate {};
397#define alloc_huge_page_node(h, nid) NULL 406#define alloc_huge_page_node(h, nid) NULL
@@ -401,6 +410,7 @@ struct hstate {};
401#define hstate_sizelog(s) NULL 410#define hstate_sizelog(s) NULL
402#define hstate_vma(v) NULL 411#define hstate_vma(v) NULL
403#define hstate_inode(i) NULL 412#define hstate_inode(i) NULL
413#define page_hstate(page) NULL
404#define huge_page_size(h) PAGE_SIZE 414#define huge_page_size(h) PAGE_SIZE
405#define huge_page_mask(h) PAGE_MASK 415#define huge_page_mask(h) PAGE_MASK
406#define vma_kernel_pagesize(v) PAGE_SIZE 416#define vma_kernel_pagesize(v) PAGE_SIZE
@@ -421,6 +431,22 @@ static inline pgoff_t basepage_index(struct page *page)
421#define dissolve_free_huge_pages(s, e) do {} while (0) 431#define dissolve_free_huge_pages(s, e) do {} while (0)
422#define pmd_huge_support() 0 432#define pmd_huge_support() 0
423#define hugepage_migration_support(h) 0 433#define hugepage_migration_support(h) 0
434
435static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
436 struct mm_struct *mm, pte_t *pte)
437{
438 return &mm->page_table_lock;
439}
424#endif /* CONFIG_HUGETLB_PAGE */ 440#endif /* CONFIG_HUGETLB_PAGE */
425 441
442static inline spinlock_t *huge_pte_lock(struct hstate *h,
443 struct mm_struct *mm, pte_t *pte)
444{
445 spinlock_t *ptl;
446
447 ptl = huge_pte_lockptr(h, mm, pte);
448 spin_lock(ptl);
449 return ptl;
450}
451
426#endif /* _LINUX_HUGETLB_H */ 452#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/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/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/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 f1c27a71d03c..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
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/interrupt.h b/include/linux/interrupt.h
index c9e831dc80bc..db43b58a3355 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,8 +11,6 @@
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>
@@ -392,15 +390,6 @@ extern void __raise_softirq_irqoff(unsigned int nr);
392extern void raise_softirq_irqoff(unsigned int nr); 390extern void raise_softirq_irqoff(unsigned int nr);
393extern void raise_softirq(unsigned int nr); 391extern void raise_softirq(unsigned int nr);
394 392
395/* This is the worklist that queues up per-cpu softirq work.
396 *
397 * send_remote_sendirq() adds work to these lists, and
398 * the softirq handler itself dequeues from them. The queues
399 * are protected by disabling local cpu interrupts and they must
400 * only be accessed by the local cpu that they are for.
401 */
402DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
403
404DECLARE_PER_CPU(struct task_struct *, ksoftirqd); 393DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
405 394
406static inline struct task_struct *this_cpu_ksoftirqd(void) 395static inline struct task_struct *this_cpu_ksoftirqd(void)
@@ -408,17 +397,6 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
408 return this_cpu_read(ksoftirqd); 397 return this_cpu_read(ksoftirqd);
409} 398}
410 399
411/* Try to send a softirq to a remote cpu. If this cannot be done, the
412 * work will be queued to the local cpu.
413 */
414extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
415
416/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
417 * and compute the current cpu, passed in as 'this_cpu'.
418 */
419extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
420 int this_cpu, int softirq);
421
422/* Tasklets --- multithreaded analogue of BHs. 400/* Tasklets --- multithreaded analogue of BHs.
423 401
424 Main feature differing them of generic softirqs: tasklet 402 Main feature differing them of generic softirqs: tasklet
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7ea319e95b47..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)
@@ -227,6 +228,7 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
227 ret = domain->handler(domain, dev, iova, flags, 228 ret = domain->handler(domain, dev, iova, flags,
228 domain->handler_token); 229 domain->handler_token);
229 230
231 trace_io_page_fault(dev, iova, flags);
230 return ret; 232 return ret;
231} 233}
232 234
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 28ea38439313..5d89d1b808a6 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -21,13 +21,11 @@ struct ipv6_devconf {
21 __s32 force_mld_version; 21 __s32 force_mld_version;
22 __s32 mldv1_unsolicited_report_interval; 22 __s32 mldv1_unsolicited_report_interval;
23 __s32 mldv2_unsolicited_report_interval; 23 __s32 mldv2_unsolicited_report_interval;
24#ifdef CONFIG_IPV6_PRIVACY
25 __s32 use_tempaddr; 24 __s32 use_tempaddr;
26 __s32 temp_valid_lft; 25 __s32 temp_valid_lft;
27 __s32 temp_prefered_lft; 26 __s32 temp_prefered_lft;
28 __s32 regen_max_retry; 27 __s32 regen_max_retry;
29 __s32 max_desync_factor; 28 __s32 max_desync_factor;
30#endif
31 __s32 max_addresses; 29 __s32 max_addresses;
32 __s32 accept_ra_defrtr; 30 __s32 accept_ra_defrtr;
33 __s32 accept_ra_pinfo; 31 __s32 accept_ra_pinfo;
@@ -115,16 +113,8 @@ static inline int inet6_iif(const struct sk_buff *skb)
115 return IP6CB(skb)->iif; 113 return IP6CB(skb)->iif;
116} 114}
117 115
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 { 116struct tcp6_request_sock {
126 struct tcp_request_sock tcp6rsk_tcp; 117 struct tcp_request_sock tcp6rsk_tcp;
127 struct inet6_request_sock tcp6rsk_inet6;
128}; 118};
129 119
130struct ipv6_mc_socklist; 120struct ipv6_mc_socklist;
@@ -141,8 +131,6 @@ struct ipv6_fl_socklist;
141 */ 131 */
142struct ipv6_pinfo { 132struct ipv6_pinfo {
143 struct in6_addr saddr; 133 struct in6_addr saddr;
144 struct in6_addr rcv_saddr;
145 struct in6_addr daddr;
146 struct in6_pktinfo sticky_pktinfo; 134 struct in6_pktinfo sticky_pktinfo;
147 const struct in6_addr *daddr_cache; 135 const struct in6_addr *daddr_cache;
148#ifdef CONFIG_IPV6_SUBTREES 136#ifdef CONFIG_IPV6_SUBTREES
@@ -256,48 +244,22 @@ struct tcp6_sock {
256 244
257extern int inet6_sk_rebuild_header(struct sock *sk); 245extern int inet6_sk_rebuild_header(struct sock *sk);
258 246
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 { 247struct tcp6_timewait_sock {
265 struct tcp_timewait_sock tcp6tw_tcp; 248 struct tcp_timewait_sock tcp6tw_tcp;
266 struct inet6_timewait_sock tcp6tw_inet6;
267}; 249};
268 250
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) 251#if IS_ENABLED(CONFIG_IPV6)
276static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 252static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
277{ 253{
278 return inet_sk(__sk)->pinet6; 254 return inet_sk(__sk)->pinet6;
279} 255}
280 256
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) 257static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
294{ 258{
295 struct request_sock *req = reqsk_alloc(ops); 259 struct request_sock *req = reqsk_alloc(ops);
296 260
297 if (req != NULL) { 261 if (req)
298 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); 262 inet_rsk(req)->pktopts = NULL;
299 inet6_rsk(req)->pktopts = NULL;
300 }
301 263
302 return req; 264 return req;
303} 265}
@@ -321,21 +283,11 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
321#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 283#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
322#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 284#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
323 285
324static inline u16 inet6_tw_offset(const struct proto *prot) 286static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
325{ 287{
326 return prot->twsk_prot->twsk_obj_size - 288 if (sk->sk_family == AF_INET6)
327 sizeof(struct inet6_timewait_sock); 289 return &sk->sk_v6_rcv_saddr;
328} 290 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} 291}
340 292
341static inline int inet_v6_ipv6only(const struct sock *sk) 293static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -363,28 +315,18 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
363 return NULL; 315 return NULL;
364} 316}
365 317
366#define __inet6_rcv_saddr(__sk) NULL
367#define inet6_rcv_saddr(__sk) NULL 318#define inet6_rcv_saddr(__sk) NULL
368#define tcp_twsk_ipv6only(__sk) 0 319#define tcp_twsk_ipv6only(__sk) 0
369#define inet_v6_ipv6only(__sk) 0 320#define inet_v6_ipv6only(__sk) 0
370#endif /* IS_ENABLED(CONFIG_IPV6) */ 321#endif /* IS_ENABLED(CONFIG_IPV6) */
371 322
372#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ 323#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
373 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 324 (((__sk)->sk_portpair == (__ports)) && \
374 ((__sk)->sk_family == AF_INET6) && \ 325 ((__sk)->sk_family == AF_INET6) && \
375 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 326 ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \
376 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 327 ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \
377 (!(__sk)->sk_bound_dev_if || \ 328 (!(__sk)->sk_bound_dev_if || \
378 ((__sk)->sk_bound_dev_if == (__dif))) && \ 329 ((__sk)->sk_bound_dev_if == (__dif))) && \
379 net_eq(sock_net(__sk), (__net))) 330 net_eq(sock_net(__sk), (__net)))
380 331
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 */ 332#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 56bb0dc8b7d4..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
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 0e5d9ecdb2b6..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
@@ -74,6 +76,11 @@ static inline void gic_init(unsigned int nr, int start,
74 gic_init_bases(nr, start, dist, cpu, 0, NULL); 76 gic_init_bases(nr, start, dist, cpu, 0, NULL);
75} 77}
76 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
77#endif /* __ASSEMBLY */ 84#endif /* __ASSEMBLY */
78 85
79#endif 86#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 672ddc4de4af..d4e98d13eff4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -501,7 +501,6 @@ void tracing_snapshot_alloc(void);
501 501
502extern void tracing_start(void); 502extern void tracing_start(void);
503extern void tracing_stop(void); 503extern void tracing_stop(void);
504extern void ftrace_off_permanent(void);
505 504
506static inline __printf(1, 2) 505static inline __printf(1, 2)
507void ____trace_printk_check_format(const char *fmt, ...) 506void ____trace_printk_check_format(const char *fmt, ...)
@@ -639,7 +638,6 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
639#else 638#else
640static inline void tracing_start(void) { } 639static inline void tracing_start(void) { }
641static inline void tracing_stop(void) { } 640static inline void tracing_stop(void) { }
642static inline void ftrace_off_permanent(void) { }
643static inline void trace_dump_stack(int skip) { } 641static inline void trace_dump_stack(int skip) { }
644 642
645static inline void tracing_on(void) { } 643static inline void tracing_on(void) { }
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/kvm_host.h b/include/linux/kvm_host.h
index 0fbbc7aa02cb..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,
@@ -671,6 +671,25 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
671} 671}
672#endif 672#endif
673 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
674static 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)
675{ 694{
676#ifdef __KVM_HAVE_ARCH_WQP 695#ifdef __KVM_HAVE_ARCH_WQP
@@ -747,9 +766,6 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
747int kvm_request_irq_source_id(struct kvm *kvm); 766int kvm_request_irq_source_id(struct kvm *kvm);
748void 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);
749 768
750/* For vcpu->arch.iommu_flags */
751#define KVM_IOMMU_CACHE_COHERENCY 0x1
752
753#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT 769#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
754int 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);
755void 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);
@@ -789,7 +805,7 @@ static inline void kvm_guest_enter(void)
789 805
790 /* 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
791 * 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
792 * 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
793 * 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
794 * 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
795 * we do with user-mode execution. 811 * we do with user-mode execution.
@@ -842,13 +858,6 @@ static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
842 return gfn_to_memslot(kvm, gfn)->id; 858 return gfn_to_memslot(kvm, gfn)->id;
843} 859}
844 860
845static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
846{
847 /* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
848 return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
849 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
850}
851
852static inline gfn_t 861static inline gfn_t
853hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot) 862hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot)
854{ 863{
@@ -1066,6 +1075,7 @@ struct kvm_device *kvm_device_from_filp(struct file *filp);
1066 1075
1067extern struct kvm_device_ops kvm_mpic_ops; 1076extern struct kvm_device_ops kvm_mpic_ops;
1068extern struct kvm_device_ops kvm_xics_ops; 1077extern struct kvm_device_ops kvm_xics_ops;
1078extern struct kvm_device_ops kvm_vfio_ops;
1069 1079
1070#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1080#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1071 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/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 13dfd36a3294..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 {
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 31e95acddb4d..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;
@@ -148,6 +149,29 @@ phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
148 149
149phys_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);
150 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
151/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 175/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
152#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 176#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
153#define MEMBLOCK_ALLOC_ACCESSIBLE 0 177#define MEMBLOCK_ALLOC_ACCESSIBLE 0
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 ea4d2495c646..9fe426b30a41 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -169,7 +169,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
169extern int mpol_parse_str(char *str, struct mempolicy **mpol); 169extern int mpol_parse_str(char *str, struct mempolicy **mpol);
170#endif 170#endif
171 171
172extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); 172extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
173 173
174/* Check if a vma is migratable */ 174/* Check if a vma is migratable */
175static inline int vma_migratable(struct vm_area_struct *vma) 175static inline int vma_migratable(struct vm_area_struct *vma)
@@ -307,9 +307,8 @@ static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
307} 307}
308#endif 308#endif
309 309
310static 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)
311{ 311{
312 return 0;
313} 312}
314 313
315static 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/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/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index d1382dfbeff0..0ce772105508 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -756,6 +756,59 @@
756#define PCR_SETTING_REG2 0x814 756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747 757#define PCR_SETTING_REG3 0x747
758 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
759#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 812#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
760 813
761struct rtsx_pcr; 814struct rtsx_pcr;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 378ae8a04c6a..2d0c9071bcfb 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -51,6 +51,7 @@ struct sec_pmic_dev {
51 int ono; 51 int ono;
52 int type; 52 int type;
53 bool wakeup; 53 bool wakeup;
54 bool wtsr_smpl;
54}; 55};
55 56
56int sec_irq_init(struct sec_pmic_dev *sec_pmic); 57int 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/si476x-core.h b/include/linux/mfd/si476x-core.h
index ba89b94e4a56..674b45d5a757 100644
--- a/include/linux/mfd/si476x-core.h
+++ b/include/linux/mfd/si476x-core.h
@@ -316,7 +316,7 @@ enum si476x_smoothmetrics {
316 * response to 'FM_RD_STATUS' command 316 * response to 'FM_RD_STATUS' command
317 * @rdstpptyint: Traffic program flag(TP) and/or program type(PTY) 317 * @rdstpptyint: Traffic program flag(TP) and/or program type(PTY)
318 * code has changed. 318 * code has changed.
319 * @rdspiint: Program indentifiaction(PI) code has changed. 319 * @rdspiint: Program identification(PI) code has changed.
320 * @rdssyncint: RDS synchronization has changed. 320 * @rdssyncint: RDS synchronization has changed.
321 * @rdsfifoint: RDS was received and the RDS FIFO has at least 321 * @rdsfifoint: RDS was received and the RDS FIFO has at least
322 * 'FM_RDS_INTERRUPT_FIFO_COUNT' elements in it. 322 * 'FM_RDS_INTERRUPT_FIFO_COUNT' elements in it.
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 7086b2248c8f..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)
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 08cce7f96ab9..d498d98f0c2c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -134,13 +134,18 @@
134#define FIFO1_THRESHOLD 19 134#define FIFO1_THRESHOLD 19
135 135
136/* 136/*
137* ADC runs at 3MHz, and it takes 137 * time in us for processing a single channel, calculated as follows:
138* 15 cycles to latch one data output. 138 *
139* Hence the idle time for ADC to 139 * num cycles = open delay + (sample delay + conv time) * averaging
140* process one sample data would be 140 *
141* around 5 micro seconds. 141 * num cycles: 152 + (1 + 13) * 16 = 376
142*/ 142 *
143#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 */
144 149
145#define TSCADC_CELLS 2 150#define TSCADC_CELLS 2
146 151
@@ -155,6 +160,7 @@ struct ti_tscadc_dev {
155 struct mfd_cell cells[TSCADC_CELLS]; 160 struct mfd_cell cells[TSCADC_CELLS];
156 u32 reg_se_cache; 161 u32 reg_se_cache;
157 spinlock_t reg_lock; 162 spinlock_t reg_lock;
163 unsigned int clk_div;
158 164
159 /* tsc device */ 165 /* tsc device */
160 struct titsc *tsc; 166 struct titsc *tsc;
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/miscdevice.h b/include/linux/miscdevice.h
index cb358355ef43..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
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 5eb4e31af22b..da78875807fc 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -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
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 6b8c496572c8..554548cd3dd4 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -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,6 +754,11 @@ 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_MR_CACHE = (u64)1 << 1, 764 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 1,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 81443d557a2e..0548eb201e05 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
@@ -297,12 +301,26 @@ static inline int put_page_testzero(struct page *page)
297/* 301/*
298 * 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
299 * 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.
300 */ 306 */
301static inline int get_page_unless_zero(struct page *page) 307static inline int get_page_unless_zero(struct page *page)
302{ 308{
303 return atomic_inc_not_zero(&page->_count); 309 return atomic_inc_not_zero(&page->_count);
304} 310}
305 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
306extern int page_is_ram(unsigned long pfn); 324extern int page_is_ram(unsigned long pfn);
307 325
308/* Support for virtually mapped pages */ 326/* Support for virtually mapped pages */
@@ -1298,32 +1316,85 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
1298} 1316}
1299#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ 1317#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
1300 1318
1301#if USE_SPLIT_PTLOCKS 1319#if USE_SPLIT_PTE_PTLOCKS
1302/* 1320#if BLOATED_SPINLOCKS
1303 * We tuck a spinlock to guard each pagetable page into its struct page, 1321void __init ptlock_cache_init(void);
1304 * at page->private, with BUILD_BUG_ON to make sure that this will not 1322extern bool ptlock_alloc(struct page *page);
1305 * overflow into the next struct page (as it might with DEBUG_SPINLOCK). 1323extern void ptlock_free(struct page *page);
1306 * When freeing, reset page->mapping so free_pages_check won't complain. 1324
1307 */ 1325static inline spinlock_t *ptlock_ptr(struct page *page)
1308#define __pte_lockptr(page) &((page)->ptl) 1326{
1309#define pte_lock_init(_page) do { \ 1327 return page->ptl;
1310 spin_lock_init(__pte_lockptr(_page)); \ 1328}
1311} while (0) 1329#else /* BLOATED_SPINLOCKS */
1312#define pte_lock_deinit(page) ((page)->mapping = NULL) 1330static inline void ptlock_cache_init(void) {}
1313#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) 1331static inline bool ptlock_alloc(struct page *page)
1314#else /* !USE_SPLIT_PTLOCKS */ 1332{
1333 return true;
1334}
1335
1336static inline void ptlock_free(struct page *page)
1337{
1338}
1339
1340static inline spinlock_t *ptlock_ptr(struct page *page)
1341{
1342 return &page->ptl;
1343}
1344#endif /* BLOATED_SPINLOCKS */
1345
1346static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
1347{
1348 return ptlock_ptr(pmd_page(*pmd));
1349}
1350
1351static inline bool ptlock_init(struct page *page)
1352{
1353 /*
1354 * prep_new_page() initialize page->private (and therefore page->ptl)
1355 * with 0. Make sure nobody took it in use in between.
1356 *
1357 * It can happen if arch try to use slab for page table allocation:
1358 * slab code uses page->slab_cache and page->first_page (for tail
1359 * pages), which share storage with page->ptl.
1360 */
1361 VM_BUG_ON(*(unsigned long *)&page->ptl);
1362 if (!ptlock_alloc(page))
1363 return false;
1364 spin_lock_init(ptlock_ptr(page));
1365 return true;
1366}
1367
1368/* Reset page->mapping so free_pages_check won't complain. */
1369static inline void pte_lock_deinit(struct page *page)
1370{
1371 page->mapping = NULL;
1372 ptlock_free(page);
1373}
1374
1375#else /* !USE_SPLIT_PTE_PTLOCKS */
1315/* 1376/*
1316 * We use mm->page_table_lock to guard all pagetable pages of the mm. 1377 * We use mm->page_table_lock to guard all pagetable pages of the mm.
1317 */ 1378 */
1318#define pte_lock_init(page) do {} while (0) 1379static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
1319#define pte_lock_deinit(page) do {} while (0) 1380{
1320#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) 1381 return &mm->page_table_lock;
1321#endif /* USE_SPLIT_PTLOCKS */ 1382}
1383static inline void ptlock_cache_init(void) {}
1384static inline bool ptlock_init(struct page *page) { return true; }
1385static inline void pte_lock_deinit(struct page *page) {}
1386#endif /* USE_SPLIT_PTE_PTLOCKS */
1322 1387
1323static inline void pgtable_page_ctor(struct page *page) 1388static inline void pgtable_init(void)
1389{
1390 ptlock_cache_init();
1391 pgtable_cache_init();
1392}
1393
1394static inline bool pgtable_page_ctor(struct page *page)
1324{ 1395{
1325 pte_lock_init(page);
1326 inc_zone_page_state(page, NR_PAGETABLE); 1396 inc_zone_page_state(page, NR_PAGETABLE);
1397 return ptlock_init(page);
1327} 1398}
1328 1399
1329static inline void pgtable_page_dtor(struct page *page) 1400static inline void pgtable_page_dtor(struct page *page)
@@ -1360,6 +1431,52 @@ static inline void pgtable_page_dtor(struct page *page)
1360 ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \ 1431 ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
1361 NULL: pte_offset_kernel(pmd, address)) 1432 NULL: pte_offset_kernel(pmd, address))
1362 1433
1434#if USE_SPLIT_PMD_PTLOCKS
1435
1436static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
1437{
1438 return ptlock_ptr(virt_to_page(pmd));
1439}
1440
1441static inline bool pgtable_pmd_page_ctor(struct page *page)
1442{
1443#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1444 page->pmd_huge_pte = NULL;
1445#endif
1446 return ptlock_init(page);
1447}
1448
1449static inline void pgtable_pmd_page_dtor(struct page *page)
1450{
1451#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1452 VM_BUG_ON(page->pmd_huge_pte);
1453#endif
1454 ptlock_free(page);
1455}
1456
1457#define pmd_huge_pte(mm, pmd) (virt_to_page(pmd)->pmd_huge_pte)
1458
1459#else
1460
1461static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
1462{
1463 return &mm->page_table_lock;
1464}
1465
1466static inline bool pgtable_pmd_page_ctor(struct page *page) { return true; }
1467static inline void pgtable_pmd_page_dtor(struct page *page) {}
1468
1469#define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte)
1470
1471#endif
1472
1473static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd)
1474{
1475 spinlock_t *ptl = pmd_lockptr(mm, pmd);
1476 spin_lock(ptl);
1477 return ptl;
1478}
1479
1363extern void free_area_init(unsigned long * zones_size); 1480extern void free_area_init(unsigned long * zones_size);
1364extern void free_area_init_node(int nid, unsigned long * zones_size, 1481extern void free_area_init_node(int nid, unsigned long * zones_size,
1365 unsigned long zone_start_pfn, unsigned long *zholes_size); 1482 unsigned long zone_start_pfn, unsigned long *zholes_size);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index a3198e5aaf4e..10f5a7272b80 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
@@ -63,6 +65,9 @@ struct page {
63 * this page is only used to 65 * this page is only used to
64 * free other pages. 66 * free other pages.
65 */ 67 */
68#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS
69 pgtable_t pmd_huge_pte; /* protected by page->ptl */
70#endif
66 }; 71 };
67 72
68 union { 73 union {
@@ -141,9 +146,13 @@ struct page {
141 * indicates order in the buddy 146 * indicates order in the buddy
142 * system if PG_buddy is set. 147 * system if PG_buddy is set.
143 */ 148 */
144#if USE_SPLIT_PTLOCKS 149#if USE_SPLIT_PTE_PTLOCKS
150#if BLOATED_SPINLOCKS
151 spinlock_t *ptl;
152#else
145 spinlock_t ptl; 153 spinlock_t ptl;
146#endif 154#endif
155#endif
147 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */ 156 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
148 struct page *first_page; /* Compound tail pages */ 157 struct page *first_page; /* Compound tail pages */
149 }; 158 };
@@ -309,14 +318,14 @@ enum {
309 NR_MM_COUNTERS 318 NR_MM_COUNTERS
310}; 319};
311 320
312#if USE_SPLIT_PTLOCKS && defined(CONFIG_MMU) 321#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU)
313#define SPLIT_RSS_COUNTING 322#define SPLIT_RSS_COUNTING
314/* per-thread cached information, */ 323/* per-thread cached information, */
315struct task_rss_stat { 324struct task_rss_stat {
316 int events; /* for synchronization threshold */ 325 int events; /* for synchronization threshold */
317 int count[NR_MM_COUNTERS]; 326 int count[NR_MM_COUNTERS];
318}; 327};
319#endif /* USE_SPLIT_PTLOCKS */ 328#endif /* USE_SPLIT_PTE_PTLOCKS */
320 329
321struct mm_rss_stat { 330struct mm_rss_stat {
322 atomic_long_t count[NR_MM_COUNTERS]; 331 atomic_long_t count[NR_MM_COUNTERS];
@@ -339,6 +348,7 @@ struct mm_struct {
339 pgd_t * pgd; 348 pgd_t * pgd;
340 atomic_t mm_users; /* How many users with user space? */ 349 atomic_t mm_users; /* How many users with user space? */
341 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 350 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
351 atomic_long_t nr_ptes; /* Page table pages */
342 int map_count; /* number of VMAs */ 352 int map_count; /* number of VMAs */
343 353
344 spinlock_t page_table_lock; /* Protects page tables and some counters */ 354 spinlock_t page_table_lock; /* Protects page tables and some counters */
@@ -360,7 +370,6 @@ struct mm_struct {
360 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */ 370 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */
361 unsigned long stack_vm; /* VM_GROWSUP/DOWN */ 371 unsigned long stack_vm; /* VM_GROWSUP/DOWN */
362 unsigned long def_flags; 372 unsigned long def_flags;
363 unsigned long nr_ptes; /* Page table pages */
364 unsigned long start_code, end_code, start_data, end_data; 373 unsigned long start_code, end_code, start_data, end_data;
365 unsigned long start_brk, brk, start_stack; 374 unsigned long start_brk, brk, start_stack;
366 unsigned long arg_start, arg_end, env_start, env_end; 375 unsigned long arg_start, arg_end, env_start, env_end;
@@ -406,7 +415,7 @@ struct mm_struct {
406#ifdef CONFIG_MMU_NOTIFIER 415#ifdef CONFIG_MMU_NOTIFIER
407 struct mmu_notifier_mm *mmu_notifier_mm; 416 struct mmu_notifier_mm *mmu_notifier_mm;
408#endif 417#endif
409#ifdef CONFIG_TRANSPARENT_HUGEPAGE 418#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
410 pgtable_t pmd_huge_pte; /* protected by page_table_lock */ 419 pgtable_t pmd_huge_pte; /* protected by page_table_lock */
411#endif 420#endif
412#ifdef CONFIG_CPUMASK_OFFSTACK 421#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 da51bec578c3..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);
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/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 38cd98f112a0..371d346fa270 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -49,6 +49,8 @@ struct mnt_namespace;
49 49
50#define MNT_LOCK_READONLY 0x400000 50#define MNT_LOCK_READONLY 0x400000
51#define MNT_LOCKED 0x800000 51#define MNT_LOCKED 0x800000
52#define MNT_DOOMED 0x1000000
53#define MNT_SYNC_UMOUNT 0x2000000
52 54
53struct vfsmount { 55struct vfsmount {
54 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 b17ead818aec..87cce50bd121 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -64,6 +64,8 @@ void arch_restore_msi_irqs(struct pci_dev *dev, int irq);
64 64
65void default_teardown_msi_irqs(struct pci_dev *dev); 65void default_teardown_msi_irqs(struct pci_dev *dev);
66void default_restore_msi_irqs(struct pci_dev *dev, int irq); 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);
67 69
68struct msi_chip { 70struct msi_chip {
69 struct module *owner; 71 struct module *owner;
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 95fc482cef36..36bb6a503f19 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -91,8 +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/* Write bbt if neccecary */ 94/* Write bbt if neccecary */
97#define NAND_BBT_WRITE 0x00002000 95#define NAND_BBT_WRITE 0x00002000
98/* 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/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 f9bfe526d310..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
@@ -354,6 +351,11 @@ static inline int mtd_has_oob(const struct mtd_info *mtd)
354 return mtd->_read_oob && mtd->_write_oob; 351 return mtd->_read_oob && mtd->_write_oob;
355} 352}
356 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
357static inline int mtd_can_have_bb(const struct mtd_info *mtd) 359static inline int mtd_can_have_bb(const struct mtd_info *mtd)
358{ 360{
359 return !!mtd->_block_isbad; 361 return !!mtd->_block_isbad;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ac8e89d5a792..9e6c8f9f306e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -198,6 +198,7 @@ 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;
@@ -477,7 +478,7 @@ struct nand_buffers {
477 * @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
478 * bad block marker position; i.e., BBM == 11110111b is 479 * bad block marker position; i.e., BBM == 11110111b is
479 * not bad when badblockbits == 7 480 * not bad when badblockbits == 7
480 * @cellinfo: [INTERN] MLC/multichip data from chip ident 481 * @bits_per_cell: [INTERN] number of bits per cell. i.e., 1 means SLC.
481 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet. 482 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet.
482 * Minimum amount of bit errors per @ecc_step_ds guaranteed 483 * Minimum amount of bit errors per @ecc_step_ds guaranteed
483 * to be correctable. If unknown, set to zero. 484 * to be correctable. If unknown, set to zero.
@@ -498,7 +499,6 @@ struct nand_buffers {
498 * supported, 0 otherwise. 499 * supported, 0 otherwise.
499 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand 500 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
500 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand 501 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
501 * @ecclayout: [REPLACEABLE] the default ECC placement scheme
502 * @bbt: [INTERN] bad block table pointer 502 * @bbt: [INTERN] bad block table pointer
503 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 503 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
504 * lookup. 504 * lookup.
@@ -559,7 +559,7 @@ struct nand_chip {
559 int pagebuf; 559 int pagebuf;
560 unsigned int pagebuf_bitflips; 560 unsigned int pagebuf_bitflips;
561 int subpagesize; 561 int subpagesize;
562 uint8_t cellinfo; 562 uint8_t bits_per_cell;
563 uint16_t ecc_strength_ds; 563 uint16_t ecc_strength_ds;
564 uint16_t ecc_step_ds; 564 uint16_t ecc_step_ds;
565 int badblockpos; 565 int badblockpos;
@@ -572,7 +572,6 @@ struct nand_chip {
572 572
573 uint8_t *oob_poi; 573 uint8_t *oob_poi;
574 struct nand_hw_control *controller; 574 struct nand_hw_control *controller;
575 struct nand_ecclayout *ecclayout;
576 575
577 struct nand_ecc_ctrl ecc; 576 struct nand_ecc_ctrl ecc;
578 struct nand_buffers *buffers; 577 struct nand_buffers *buffers;
@@ -797,4 +796,13 @@ static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
797 return le16_to_cpu(chip->onfi_params.src_sync_timing_mode); 796 return le16_to_cpu(chip->onfi_params.src_sync_timing_mode);
798} 797}
799 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}
800#endif /* __LINUX_MTD_NAND_H */ 808#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index bab49da8a0f0..d3181936c138 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -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
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 8e47bc7a1665..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];
diff --git a/include/linux/net.h b/include/linux/net.h
index 4f27575ce1d6..b292a0435571 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;
@@ -195,27 +196,23 @@ enum {
195 SOCK_WAKE_URG, 196 SOCK_WAKE_URG,
196}; 197};
197 198
198extern int sock_wake_async(struct socket *sk, int how, int band); 199int sock_wake_async(struct socket *sk, int how, int band);
199extern int sock_register(const struct net_proto_family *fam); 200int sock_register(const struct net_proto_family *fam);
200extern void sock_unregister(int family); 201void sock_unregister(int family);
201extern int __sock_create(struct net *net, int family, int type, int proto, 202int __sock_create(struct net *net, int family, int type, int proto,
202 struct socket **res, int kern); 203 struct socket **res, int kern);
203extern int sock_create(int family, int type, int proto, 204int sock_create(int family, int type, int proto, struct socket **res);
204 struct socket **res); 205int sock_create_kern(int family, int type, int proto, struct socket **res);
205extern int sock_create_kern(int family, int type, int proto, 206int sock_create_lite(int family, int type, int proto, struct socket **res);
206 struct socket **res); 207void sock_release(struct socket *sock);
207extern int sock_create_lite(int family, int type, int proto, 208int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
208 struct socket **res); 209int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
209extern void sock_release(struct socket *sock); 210 int flags);
210extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, 211struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
211 size_t len); 212struct socket *sockfd_lookup(int fd, int *err);
212extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, 213struct 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) 214#define sockfd_put(sock) fput(sock->file)
218extern int net_ratelimit(void); 215int net_ratelimit(void);
219 216
220#define net_ratelimited_function(function, ...) \ 217#define net_ratelimited_function(function, ...) \
221do { \ 218do { \
@@ -243,32 +240,52 @@ do { \
243#define net_random() prandom_u32() 240#define net_random() prandom_u32()
244#define net_srandom(seed) prandom_seed((__force u32)(seed)) 241#define net_srandom(seed) prandom_seed((__force u32)(seed))
245 242
246extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 243bool __net_get_random_once(void *buf, int nbytes, bool *done,
247 struct kvec *vec, size_t num, size_t len); 244 struct static_key *done_key);
248extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg, 245
249 struct kvec *vec, size_t num, 246#ifdef HAVE_JUMP_LABEL
250 size_t len, int flags); 247#define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \
251 248 { .enabled = ATOMIC_INIT(0), .entries = (void *)1 })
252extern int kernel_bind(struct socket *sock, struct sockaddr *addr, 249#else /* !HAVE_JUMP_LABEL */
253 int addrlen); 250#define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
254extern int kernel_listen(struct socket *sock, int backlog); 251#endif /* HAVE_JUMP_LABEL */
255extern int kernel_accept(struct socket *sock, struct socket **newsock, 252
256 int flags); 253#define net_get_random_once(buf, nbytes) \
257extern int kernel_connect(struct socket *sock, struct sockaddr *addr, 254 ({ \
258 int addrlen, int flags); 255 bool ___ret = false; \
259extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr, 256 static bool ___done = false; \
260 int *addrlen); 257 static struct static_key ___done_key = \
261extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr, 258 ___NET_RANDOM_STATIC_KEY_INIT; \
262 int *addrlen); 259 if (!static_key_true(&___done_key)) \
263extern int kernel_getsockopt(struct socket *sock, int level, int optname, 260 ___ret = __net_get_random_once(buf, \
264 char *optval, int *optlen); 261 nbytes, \
265extern int kernel_setsockopt(struct socket *sock, int level, int optname, 262 &___done, \
266 char *optval, unsigned int optlen); 263 &___done_key); \
267extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 264 ___ret; \
268 size_t size, int flags); 265 })
269extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 266
270extern int kernel_sock_shutdown(struct socket *sock, 267int kernel_sendmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec,
271 enum sock_shutdown_cmd how); 268 size_t num, size_t len);
269int kernel_recvmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec,
270 size_t num, size_t len, int flags);
271
272int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen);
273int kernel_listen(struct socket *sock, int backlog);
274int kernel_accept(struct socket *sock, struct socket **newsock, int flags);
275int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen,
276 int flags);
277int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
278 int *addrlen);
279int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
280 int *addrlen);
281int kernel_getsockopt(struct socket *sock, int level, int optname, char *optval,
282 int *optlen);
283int kernel_setsockopt(struct socket *sock, int level, int optname, char *optval,
284 unsigned int optlen);
285int kernel_sendpage(struct socket *sock, struct page *page, int offset,
286 size_t size, int flags);
287int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
288int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how);
272 289
273#define MODULE_ALIAS_NETPROTO(proto) \ 290#define MODULE_ALIAS_NETPROTO(proto) \
274 MODULE_ALIAS("net-pf-" __stringify(proto)) 291 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 adf4070586d6..7f0ed423a360 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. */
@@ -961,6 +962,25 @@ struct netdev_phys_port_id {
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);
@@ -1097,6 +1117,15 @@ struct net_device_ops {
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 __be16 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;
@@ -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
@@ -1546,7 +1587,7 @@ static inline void *netdev_priv(const struct net_device *dev)
1546#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 1587#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
1547 1588
1548/* Set the sysfs device type for the network logical device to allow 1589/* Set the sysfs device type for the network logical device to allow
1549 * fin grained indentification of different network device types. For 1590 * fine-grained identification of different network device types. For
1550 * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc. 1591 * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
1551 */ 1592 */
1552#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) 1593#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
@@ -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{
@@ -2264,9 +2304,8 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2264} 2304}
2265 2305
2266#ifdef CONFIG_XPS 2306#ifdef CONFIG_XPS
2267extern int netif_set_xps_queue(struct net_device *dev, 2307int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2268 const struct cpumask *mask, 2308 u16 index);
2269 u16 index);
2270#else 2309#else
2271static inline int netif_set_xps_queue(struct net_device *dev, 2310static inline int netif_set_xps_queue(struct net_device *dev,
2272 const struct cpumask *mask, 2311 const struct cpumask *mask,
@@ -2297,12 +2336,10 @@ static inline bool netif_is_multiqueue(const struct net_device *dev)
2297 return dev->num_tx_queues > 1; 2336 return dev->num_tx_queues > 1;
2298} 2337}
2299 2338
2300extern 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);
2301 unsigned int txq);
2302 2340
2303#ifdef CONFIG_RPS 2341#ifdef CONFIG_RPS
2304extern 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);
2305 unsigned int rxq);
2306#else 2343#else
2307static 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,
2308 unsigned int rxq) 2345 unsigned int rxq)
@@ -2329,28 +2366,27 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2329} 2366}
2330 2367
2331#define DEFAULT_MAX_NUM_RSS_QUEUES (8) 2368#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
2332extern int netif_get_num_default_rss_queues(void); 2369int netif_get_num_default_rss_queues(void);
2333 2370
2334/* Use this variant when it is known for sure that it 2371/* Use this variant when it is known for sure that it
2335 * is executing from hardware interrupt context or with hardware interrupts 2372 * is executing from hardware interrupt context or with hardware interrupts
2336 * disabled. 2373 * disabled.
2337 */ 2374 */
2338extern void dev_kfree_skb_irq(struct sk_buff *skb); 2375void dev_kfree_skb_irq(struct sk_buff *skb);
2339 2376
2340/* Use this variant in places where it could be invoked 2377/* Use this variant in places where it could be invoked
2341 * from either hardware interrupt or other context, with hardware interrupts 2378 * from either hardware interrupt or other context, with hardware interrupts
2342 * either disabled or enabled. 2379 * either disabled or enabled.
2343 */ 2380 */
2344extern void dev_kfree_skb_any(struct sk_buff *skb); 2381void dev_kfree_skb_any(struct sk_buff *skb);
2345 2382
2346extern int netif_rx(struct sk_buff *skb); 2383int netif_rx(struct sk_buff *skb);
2347extern int netif_rx_ni(struct sk_buff *skb); 2384int netif_rx_ni(struct sk_buff *skb);
2348extern int netif_receive_skb(struct sk_buff *skb); 2385int netif_receive_skb(struct sk_buff *skb);
2349extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2386gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2350 struct sk_buff *skb); 2387void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2351extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2388struct sk_buff *napi_get_frags(struct napi_struct *napi);
2352extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2389gro_result_t napi_gro_frags(struct napi_struct *napi);
2353extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2354 2390
2355static inline void napi_free_frags(struct napi_struct *napi) 2391static inline void napi_free_frags(struct napi_struct *napi)
2356{ 2392{
@@ -2358,40 +2394,36 @@ static inline void napi_free_frags(struct napi_struct *napi)
2358 napi->skb = NULL; 2394 napi->skb = NULL;
2359} 2395}
2360 2396
2361extern int netdev_rx_handler_register(struct net_device *dev, 2397int netdev_rx_handler_register(struct net_device *dev,
2362 rx_handler_func_t *rx_handler, 2398 rx_handler_func_t *rx_handler,
2363 void *rx_handler_data); 2399 void *rx_handler_data);
2364extern void netdev_rx_handler_unregister(struct net_device *dev); 2400void netdev_rx_handler_unregister(struct net_device *dev);
2365 2401
2366extern bool dev_valid_name(const char *name); 2402bool dev_valid_name(const char *name);
2367extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2403int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2368extern int dev_ethtool(struct net *net, struct ifreq *); 2404int dev_ethtool(struct net *net, struct ifreq *);
2369extern unsigned int dev_get_flags(const struct net_device *); 2405unsigned int dev_get_flags(const struct net_device *);
2370extern int __dev_change_flags(struct net_device *, unsigned int flags); 2406int __dev_change_flags(struct net_device *, unsigned int flags);
2371extern int dev_change_flags(struct net_device *, unsigned int); 2407int dev_change_flags(struct net_device *, unsigned int);
2372extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2408void __dev_notify_flags(struct net_device *, unsigned int old_flags,
2373extern int dev_change_name(struct net_device *, const char *); 2409 unsigned int gchanges);
2374extern int dev_set_alias(struct net_device *, const char *, size_t); 2410int dev_change_name(struct net_device *, const char *);
2375extern int dev_change_net_namespace(struct net_device *, 2411int dev_set_alias(struct net_device *, const char *, size_t);
2376 struct net *, const char *); 2412int dev_change_net_namespace(struct net_device *, struct net *, const char *);
2377extern int dev_set_mtu(struct net_device *, int); 2413int dev_set_mtu(struct net_device *, int);
2378extern void dev_set_group(struct net_device *, int); 2414void dev_set_group(struct net_device *, int);
2379extern int dev_set_mac_address(struct net_device *, 2415int dev_set_mac_address(struct net_device *, struct sockaddr *);
2380 struct sockaddr *); 2416int dev_change_carrier(struct net_device *, bool new_carrier);
2381extern int dev_change_carrier(struct net_device *, 2417int dev_get_phys_port_id(struct net_device *dev,
2382 bool new_carrier); 2418 struct netdev_phys_port_id *ppid);
2383extern int dev_get_phys_port_id(struct net_device *dev, 2419int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2384 struct netdev_phys_port_id *ppid); 2420 struct netdev_queue *txq, void *accel_priv);
2385extern int dev_hard_start_xmit(struct sk_buff *skb, 2421int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2386 struct net_device *dev,
2387 struct netdev_queue *txq);
2388extern int dev_forward_skb(struct net_device *dev,
2389 struct sk_buff *skb);
2390 2422
2391extern int netdev_budget; 2423extern int netdev_budget;
2392 2424
2393/* Called by rtnetlink.c:rtnl_unlock() */ 2425/* Called by rtnetlink.c:rtnl_unlock() */
2394extern void netdev_run_todo(void); 2426void netdev_run_todo(void);
2395 2427
2396/** 2428/**
2397 * dev_put - release reference to device 2429 * dev_put - release reference to device
@@ -2424,9 +2456,9 @@ static inline void dev_hold(struct net_device *dev)
2424 * kind of lower layer not just hardware media. 2456 * kind of lower layer not just hardware media.
2425 */ 2457 */
2426 2458
2427extern void linkwatch_init_dev(struct net_device *dev); 2459void linkwatch_init_dev(struct net_device *dev);
2428extern void linkwatch_fire_event(struct net_device *dev); 2460void linkwatch_fire_event(struct net_device *dev);
2429extern void linkwatch_forget_dev(struct net_device *dev); 2461void linkwatch_forget_dev(struct net_device *dev);
2430 2462
2431/** 2463/**
2432 * netif_carrier_ok - test if carrier present 2464 * netif_carrier_ok - test if carrier present
@@ -2439,13 +2471,13 @@ static inline bool netif_carrier_ok(const struct net_device *dev)
2439 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2471 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2440} 2472}
2441 2473
2442extern unsigned long dev_trans_start(struct net_device *dev); 2474unsigned long dev_trans_start(struct net_device *dev);
2443 2475
2444extern void __netdev_watchdog_up(struct net_device *dev); 2476void __netdev_watchdog_up(struct net_device *dev);
2445 2477
2446extern void netif_carrier_on(struct net_device *dev); 2478void netif_carrier_on(struct net_device *dev);
2447 2479
2448extern void netif_carrier_off(struct net_device *dev); 2480void netif_carrier_off(struct net_device *dev);
2449 2481
2450/** 2482/**
2451 * netif_dormant_on - mark device as dormant. 2483 * netif_dormant_on - mark device as dormant.
@@ -2513,9 +2545,9 @@ static inline bool netif_device_present(struct net_device *dev)
2513 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2545 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2514} 2546}
2515 2547
2516extern void netif_device_detach(struct net_device *dev); 2548void netif_device_detach(struct net_device *dev);
2517 2549
2518extern void netif_device_attach(struct net_device *dev); 2550void netif_device_attach(struct net_device *dev);
2519 2551
2520/* 2552/*
2521 * Network interface message level settings 2553 * Network interface message level settings
@@ -2724,119 +2756,138 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
2724 2756
2725/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 2757/* These functions live elsewhere (drivers/net/net_init.c, but related) */
2726 2758
2727extern void ether_setup(struct net_device *dev); 2759void ether_setup(struct net_device *dev);
2728 2760
2729/* Support for loadable net-drivers */ 2761/* Support for loadable net-drivers */
2730extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 2762struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
2731 void (*setup)(struct net_device *), 2763 void (*setup)(struct net_device *),
2732 unsigned int txqs, unsigned int rxqs); 2764 unsigned int txqs, unsigned int rxqs);
2733#define alloc_netdev(sizeof_priv, name, setup) \ 2765#define alloc_netdev(sizeof_priv, name, setup) \
2734 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 2766 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
2735 2767
2736#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 2768#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
2737 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 2769 alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
2738 2770
2739extern int register_netdev(struct net_device *dev); 2771int register_netdev(struct net_device *dev);
2740extern void unregister_netdev(struct net_device *dev); 2772void unregister_netdev(struct net_device *dev);
2741 2773
2742/* General hardware address lists handling functions */ 2774/* General hardware address lists handling functions */
2743extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, 2775int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2744 struct netdev_hw_addr_list *from_list, 2776 struct netdev_hw_addr_list *from_list,
2745 int addr_len, unsigned char addr_type); 2777 int addr_len, unsigned char addr_type);
2746extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, 2778void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2747 struct netdev_hw_addr_list *from_list, 2779 struct netdev_hw_addr_list *from_list,
2748 int addr_len, unsigned char addr_type); 2780 int addr_len, unsigned char addr_type);
2749extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, 2781int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2750 struct netdev_hw_addr_list *from_list, 2782 struct netdev_hw_addr_list *from_list, int addr_len);
2751 int addr_len); 2783void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2752extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 2784 struct netdev_hw_addr_list *from_list, int addr_len);
2753 struct netdev_hw_addr_list *from_list, 2785void __hw_addr_flush(struct netdev_hw_addr_list *list);
2754 int addr_len); 2786void __hw_addr_init(struct netdev_hw_addr_list *list);
2755extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2756extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2757 2787
2758/* Functions used for device addresses handling */ 2788/* Functions used for device addresses handling */
2759extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, 2789int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2760 unsigned char addr_type); 2790 unsigned char addr_type);
2761extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, 2791int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2762 unsigned char addr_type); 2792 unsigned char addr_type);
2763extern int dev_addr_add_multiple(struct net_device *to_dev, 2793int dev_addr_add_multiple(struct net_device *to_dev,
2764 struct net_device *from_dev, 2794 struct net_device *from_dev, unsigned char addr_type);
2765 unsigned char addr_type); 2795int dev_addr_del_multiple(struct net_device *to_dev,
2766extern int dev_addr_del_multiple(struct net_device *to_dev, 2796 struct net_device *from_dev, unsigned char addr_type);
2767 struct net_device *from_dev, 2797void dev_addr_flush(struct net_device *dev);
2768 unsigned char addr_type); 2798int dev_addr_init(struct net_device *dev);
2769extern void dev_addr_flush(struct net_device *dev);
2770extern int dev_addr_init(struct net_device *dev);
2771 2799
2772/* Functions used for unicast addresses handling */ 2800/* Functions used for unicast addresses handling */
2773extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); 2801int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2774extern 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);
2775extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2803int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2776extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2804int dev_uc_sync(struct net_device *to, struct net_device *from);
2777extern 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);
2778extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2806void dev_uc_unsync(struct net_device *to, struct net_device *from);
2779extern void dev_uc_flush(struct net_device *dev); 2807void dev_uc_flush(struct net_device *dev);
2780extern void dev_uc_init(struct net_device *dev); 2808void dev_uc_init(struct net_device *dev);
2781 2809
2782/* Functions used for multicast addresses handling */ 2810/* Functions used for multicast addresses handling */
2783extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); 2811int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2784extern 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);
2785extern 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);
2786extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2814int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2787extern 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);
2788extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2816int dev_mc_sync(struct net_device *to, struct net_device *from);
2789extern 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);
2790extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2818void dev_mc_unsync(struct net_device *to, struct net_device *from);
2791extern void dev_mc_flush(struct net_device *dev); 2819void dev_mc_flush(struct net_device *dev);
2792extern void dev_mc_init(struct net_device *dev); 2820void dev_mc_init(struct net_device *dev);
2793 2821
2794/* Functions used for secondary unicast and multicast support */ 2822/* Functions used for secondary unicast and multicast support */
2795extern void dev_set_rx_mode(struct net_device *dev); 2823void dev_set_rx_mode(struct net_device *dev);
2796extern void __dev_set_rx_mode(struct net_device *dev); 2824void __dev_set_rx_mode(struct net_device *dev);
2797extern int dev_set_promiscuity(struct net_device *dev, int inc); 2825int dev_set_promiscuity(struct net_device *dev, int inc);
2798extern int dev_set_allmulti(struct net_device *dev, int inc); 2826int dev_set_allmulti(struct net_device *dev, int inc);
2799extern void netdev_state_change(struct net_device *dev); 2827void netdev_state_change(struct net_device *dev);
2800extern void netdev_notify_peers(struct net_device *dev); 2828void netdev_notify_peers(struct net_device *dev);
2801extern void netdev_features_change(struct net_device *dev); 2829void netdev_features_change(struct net_device *dev);
2802/* Load a device via the kmod */ 2830/* Load a device via the kmod */
2803extern void dev_load(struct net *net, const char *name); 2831void dev_load(struct net *net, const char *name);
2804extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2832struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2805 struct rtnl_link_stats64 *storage); 2833 struct rtnl_link_stats64 *storage);
2806extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2834void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2807 const struct net_device_stats *netdev_stats); 2835 const struct net_device_stats *netdev_stats);
2808 2836
2809extern int netdev_max_backlog; 2837extern int netdev_max_backlog;
2810extern int netdev_tstamp_prequeue; 2838extern int netdev_tstamp_prequeue;
2811extern int weight_p; 2839extern int weight_p;
2812extern int bpf_jit_enable; 2840extern int bpf_jit_enable;
2813 2841
2814extern bool netdev_has_upper_dev(struct net_device *dev, 2842bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
2815 struct net_device *upper_dev); 2843bool netdev_has_any_upper_dev(struct net_device *dev);
2816extern bool netdev_has_any_upper_dev(struct net_device *dev); 2844struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
2817extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, 2845 struct list_head **iter);
2818 struct list_head **iter);
2819 2846
2820/* iterate through upper list, must be called under RCU read lock */ 2847/* iterate through upper list, must be called under RCU read lock */
2821#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \ 2848#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
2822 for (iter = &(dev)->upper_dev_list, \ 2849 for (iter = &(dev)->all_adj_list.upper, \
2823 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ 2850 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
2824 upper; \ 2851 updev; \
2825 upper = netdev_upper_get_next_dev_rcu(dev, &(iter))) 2852 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
2826 2853
2827extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2854void *netdev_lower_get_next_private(struct net_device *dev,
2828extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2855 struct list_head **iter);
2829extern 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,
2830 struct net_device *upper_dev); 2876 struct net_device *upper_dev);
2831extern int netdev_master_upper_dev_link(struct net_device *dev, 2877int netdev_master_upper_dev_link_private(struct net_device *dev,
2832 struct net_device *upper_dev); 2878 struct net_device *upper_dev,
2833extern void netdev_upper_dev_unlink(struct net_device *dev, 2879 void *private);
2834 struct net_device *upper_dev); 2880void netdev_upper_dev_unlink(struct net_device *dev,
2835extern int skb_checksum_help(struct sk_buff *skb); 2881 struct net_device *upper_dev);
2836extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 2882void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
2837 netdev_features_t features, bool tx_path); 2883 struct net_device *lower_dev);
2838extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 2884void *netdev_lower_dev_get_private(struct net_device *dev,
2839 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);
2840 2891
2841static inline 2892static inline
2842struct 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)
@@ -2858,26 +2909,26 @@ static inline bool can_checksum_protocol(netdev_features_t features,
2858} 2909}
2859 2910
2860#ifdef CONFIG_BUG 2911#ifdef CONFIG_BUG
2861extern void netdev_rx_csum_fault(struct net_device *dev); 2912void netdev_rx_csum_fault(struct net_device *dev);
2862#else 2913#else
2863static inline void netdev_rx_csum_fault(struct net_device *dev) 2914static inline void netdev_rx_csum_fault(struct net_device *dev)
2864{ 2915{
2865} 2916}
2866#endif 2917#endif
2867/* rx skb timestamps */ 2918/* rx skb timestamps */
2868extern void net_enable_timestamp(void); 2919void net_enable_timestamp(void);
2869extern void net_disable_timestamp(void); 2920void net_disable_timestamp(void);
2870 2921
2871#ifdef CONFIG_PROC_FS 2922#ifdef CONFIG_PROC_FS
2872extern int __init dev_proc_init(void); 2923int __init dev_proc_init(void);
2873#else 2924#else
2874#define dev_proc_init() 0 2925#define dev_proc_init() 0
2875#endif 2926#endif
2876 2927
2877extern int netdev_class_create_file_ns(struct class_attribute *class_attr, 2928int netdev_class_create_file_ns(struct class_attribute *class_attr,
2878 const void *ns); 2929 const void *ns);
2879extern void netdev_class_remove_file_ns(struct class_attribute *class_attr, 2930void netdev_class_remove_file_ns(struct class_attribute *class_attr,
2880 const void *ns); 2931 const void *ns);
2881 2932
2882static inline int netdev_class_create_file(struct class_attribute *class_attr) 2933static inline int netdev_class_create_file(struct class_attribute *class_attr)
2883{ 2934{
@@ -2891,9 +2942,9 @@ static inline void netdev_class_remove_file(struct class_attribute *class_attr)
2891 2942
2892extern struct kobj_ns_type_operations net_ns_type_operations; 2943extern struct kobj_ns_type_operations net_ns_type_operations;
2893 2944
2894extern const char *netdev_drivername(const struct net_device *dev); 2945const char *netdev_drivername(const struct net_device *dev);
2895 2946
2896extern void linkwatch_run_queue(void); 2947void linkwatch_run_queue(void);
2897 2948
2898static inline netdev_features_t netdev_get_wanted_features( 2949static inline netdev_features_t netdev_get_wanted_features(
2899 struct net_device *dev) 2950 struct net_device *dev)
@@ -2957,6 +3008,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2957 dev->gso_max_size = size; 3008 dev->gso_max_size = size;
2958} 3009}
2959 3010
3011static inline bool netif_is_macvlan(struct net_device *dev)
3012{
3013 return dev->priv_flags & IFF_MACVLAN;
3014}
3015
2960static inline bool netif_is_bond_master(struct net_device *dev) 3016static inline bool netif_is_bond_master(struct net_device *dev)
2961{ 3017{
2962 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3018 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
@@ -2985,22 +3041,22 @@ static inline const char *netdev_name(const struct net_device *dev)
2985 return dev->name; 3041 return dev->name;
2986} 3042}
2987 3043
2988extern __printf(3, 4) 3044__printf(3, 4)
2989int netdev_printk(const char *level, const struct net_device *dev, 3045int netdev_printk(const char *level, const struct net_device *dev,
2990 const char *format, ...); 3046 const char *format, ...);
2991extern __printf(2, 3) 3047__printf(2, 3)
2992int netdev_emerg(const struct net_device *dev, const char *format, ...); 3048int netdev_emerg(const struct net_device *dev, const char *format, ...);
2993extern __printf(2, 3) 3049__printf(2, 3)
2994int netdev_alert(const struct net_device *dev, const char *format, ...); 3050int netdev_alert(const struct net_device *dev, const char *format, ...);
2995extern __printf(2, 3) 3051__printf(2, 3)
2996int netdev_crit(const struct net_device *dev, const char *format, ...); 3052int netdev_crit(const struct net_device *dev, const char *format, ...);
2997extern __printf(2, 3) 3053__printf(2, 3)
2998int netdev_err(const struct net_device *dev, const char *format, ...); 3054int netdev_err(const struct net_device *dev, const char *format, ...);
2999extern __printf(2, 3) 3055__printf(2, 3)
3000int netdev_warn(const struct net_device *dev, const char *format, ...); 3056int netdev_warn(const struct net_device *dev, const char *format, ...);
3001extern __printf(2, 3) 3057__printf(2, 3)
3002int netdev_notice(const struct net_device *dev, const char *format, ...); 3058int netdev_notice(const struct net_device *dev, const char *format, ...);
3003extern __printf(2, 3) 3059__printf(2, 3)
3004int netdev_info(const struct net_device *dev, const char *format, ...); 3060int netdev_info(const struct net_device *dev, const char *format, ...);
3005 3061
3006#define MODULE_ALIAS_NETDEV(device) \ 3062#define MODULE_ALIAS_NETDEV(device) \
@@ -3041,7 +3097,7 @@ do { \
3041 * file/line information and a backtrace. 3097 * file/line information and a backtrace.
3042 */ 3098 */
3043#define netdev_WARN(dev, format, args...) \ 3099#define netdev_WARN(dev, format, args...) \
3044 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); 3100 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
3045 3101
3046/* netif printk helpers, similar to netdev_printk */ 3102/* netif printk helpers, similar to netdev_printk */
3047 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 9ac9fbde7b61..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
@@ -389,13 +471,40 @@ bitmap_bytes(u32 a, u32 b)
389} 471}
390 472
391#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}
392 496
393#define IP_SET_INIT_KEXT(skb, opt, map) \ 497#define IP_SET_INIT_KEXT(skb, opt, set) \
394 { .bytes = (skb)->len, .packets = 1, \ 498 { .bytes = (skb)->len, .packets = 1, \
395 .timeout = ip_set_adt_opt_timeout(opt, map) } 499 .timeout = ip_set_adt_opt_timeout(opt, set) }
396 500
397#define IP_SET_INIT_UEXT(map) \ 501#define IP_SET_INIT_UEXT(set) \
398 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \ 502 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \
399 .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)
400 509
401#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/nfs4.h b/include/linux/nfs4.h
index c6f41b616965..c1637062c1ce 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,
diff --git a/include/linux/of.h b/include/linux/of.h
index f95aee391e30..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,6 +290,7 @@ 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);
@@ -364,6 +380,9 @@ static inline bool of_have_populated_dt(void)
364#define for_each_child_of_node(parent, child) \ 380#define for_each_child_of_node(parent, child) \
365 while (0) 381 while (0)
366 382
383#define for_each_available_child_of_node(parent, child) \
384 while (0)
385
367static inline struct device_node *of_get_child_by_name( 386static inline struct device_node *of_get_child_by_name(
368 const struct device_node *node, 387 const struct device_node *node,
369 const char *name) 388 const char *name)
@@ -376,6 +395,11 @@ static inline int of_get_child_count(const struct device_node *np)
376 return 0; 395 return 0;
377} 396}
378 397
398static inline int of_get_available_child_count(const struct device_node *np)
399{
400 return 0;
401}
402
379static inline int of_device_is_compatible(const struct device_node *device, 403static inline int of_device_is_compatible(const struct device_node *device,
380 const char *name) 404 const char *name)
381{ 405{
@@ -534,13 +558,10 @@ static inline const char *of_prop_next_string(struct property *prop,
534#define of_match_node(_matches, _node) NULL 558#define of_match_node(_matches, _node) NULL
535#endif /* CONFIG_OF */ 559#endif /* CONFIG_OF */
536 560
537#ifndef of_node_to_nid 561#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
538static inline int of_node_to_nid(struct device_node *np) 562extern int of_node_to_nid(struct device_node *np);
539{ 563#else
540 return numa_node_id(); 564static inline int of_node_to_nid(struct device_node *device) { return 0; }
541}
542
543#define of_node_to_nid of_node_to_nid
544#endif 565#endif
545 566
546/** 567/**
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 a478c62a2aab..0beaee9dac1f 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -96,31 +96,30 @@ extern int of_scan_flat_dt_by_path(const char *path,
96 96
97extern 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,
98 int depth, void *data); 98 int depth, void *data);
99extern void early_init_dt_check_for_initrd(unsigned long node);
100extern 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,
101 int depth, void *data); 100 int depth, void *data);
102extern void early_init_dt_add_memory_arch(u64 base, u64 size); 101extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
104extern u64 dt_mem_next_cell(int s, __be32 **cellp); 103extern u64 dt_mem_next_cell(int s, __be32 **cellp);
105 104
106/*
107 * If BLK_DEV_INITRD, the fdt early init code will call this function,
108 * to be provided by the arch code. start and end are specified as
109 * physical addresses.
110 */
111#ifdef CONFIG_BLK_DEV_INITRD
112extern void early_init_dt_setup_initrd_arch(u64 start, u64 end);
113#endif
114
115/* Early flat tree scan hooks */ 105/* Early flat tree scan hooks */
116extern 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,
117 int depth, void *data); 107 int depth, void *data);
118 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
119/* Other Prototypes */ 115/* Other Prototypes */
120extern void unflatten_device_tree(void); 116extern void unflatten_device_tree(void);
117extern void unflatten_and_copy_device_tree(void);
121extern void early_init_devtree(void *); 118extern void early_init_devtree(void *);
122#else /* CONFIG_OF_FLATTREE */ 119#else /* CONFIG_OF_FLATTREE */
120static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
123static inline void unflatten_device_tree(void) {} 121static inline void unflatten_device_tree(void) {}
122static inline void unflatten_and_copy_device_tree(void) {}
124#endif /* CONFIG_OF_FLATTREE */ 123#endif /* CONFIG_OF_FLATTREE */
125 124
126#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 fcd63baee5f2..3f23b4472c31 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -8,22 +8,6 @@
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/of.h> 9#include <linux/of.h>
10 10
11/**
12 * of_irq - container for device_node/irq_specifier pair for an irq controller
13 * @controller: pointer to interrupt controller device tree node
14 * @size: size of interrupt specifier
15 * @specifier: array of cells @size long specifing the specific interrupt
16 *
17 * This structure is returned when an interrupt is mapped. The controller
18 * field needs to be put() after use
19 */
20#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
21struct of_irq {
22 struct device_node *controller; /* Interrupt controller node */
23 u32 size; /* Specifier size */
24 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
25};
26
27typedef 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 *);
28 12
29/* 13/*
@@ -35,35 +19,38 @@ typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
35#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 19#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
36extern unsigned int of_irq_workarounds; 20extern unsigned int of_irq_workarounds;
37extern struct device_node *of_irq_dflt_pic; 21extern struct device_node *of_irq_dflt_pic;
38extern int of_irq_map_oldworld(struct device_node *device, int index, 22extern int of_irq_parse_oldworld(struct device_node *device, int index,
39 struct of_irq *out_irq); 23 struct of_phandle_args *out_irq);
40#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 24#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
41#define of_irq_workarounds (0) 25#define of_irq_workarounds (0)
42#define of_irq_dflt_pic (NULL) 26#define of_irq_dflt_pic (NULL)
43static 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,
44 struct of_irq *out_irq) 28 struct of_phandle_args *out_irq)
45{ 29{
46 return -EINVAL; 30 return -EINVAL;
47} 31}
48#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 32#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
49 33
50 34extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
51extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 35extern int of_irq_parse_one(struct device_node *device, int index,
52 u32 ointsize, const __be32 *addr, 36 struct of_phandle_args *out_irq);
53 struct of_irq *out_irq); 37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
54extern int of_irq_map_one(struct device_node *device, int index,
55 struct of_irq *out_irq);
56extern unsigned int irq_create_of_mapping(struct device_node *controller,
57 const u32 *intspec,
58 unsigned int intsize);
59extern int of_irq_to_resource(struct device_node *dev, int index, 38extern int of_irq_to_resource(struct device_node *dev, int index,
60 struct resource *r); 39 struct resource *r);
61extern int of_irq_count(struct device_node *dev);
62extern int of_irq_to_resource_table(struct device_node *dev, 40extern int of_irq_to_resource_table(struct device_node *dev,
63 struct resource *res, int nr_irqs); 41 struct resource *res, int nr_irqs);
64 42
65extern void of_irq_init(const struct of_device_id *matches); 43extern void of_irq_init(const struct of_device_id *matches);
66 44
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
67#if defined(CONFIG_OF) 54#if defined(CONFIG_OF)
68/* 55/*
69 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC 56 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
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_pci.h b/include/linux/of_pci.h
index fd9c408631a0..1a1f5ffd5288 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -5,8 +5,9 @@
5#include <linux/msi.h> 5#include <linux/msi.h>
6 6
7struct pci_dev; 7struct pci_dev;
8struct of_irq; 8struct of_phandle_args;
9int 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);
10 11
11struct device_node; 12struct device_node;
12struct device_node *of_pci_find_child_device(struct device_node *parent, 13struct device_node *of_pci_find_child_device(struct device_node *parent,
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/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.h b/include/linux/pci.h
index da172f956ad6..835ec7bf6c05 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -330,8 +330,6 @@ struct pci_dev {
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;
@@ -472,12 +470,25 @@ struct pci_bus {
472/* 470/*
473 * Returns true if the pci bus is root (behind host-pci bridge), 471 * Returns true if the pci bus is root (behind host-pci bridge),
474 * false otherwise 472 * false otherwise
473 *
474 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
475 * This is incorrect because "virtual" buses added for SR-IOV (via
476 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses.
475 */ 477 */
476static inline bool pci_is_root_bus(struct pci_bus *pbus) 478static inline bool pci_is_root_bus(struct pci_bus *pbus)
477{ 479{
478 return !(pbus->parent); 480 return !(pbus->parent);
479} 481}
480 482
483static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
484{
485 dev = pci_physfn(dev);
486 if (pci_is_root_bus(dev->bus))
487 return NULL;
488
489 return dev->bus->self;
490}
491
481#ifdef CONFIG_PCI_MSI 492#ifdef CONFIG_PCI_MSI
482static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 493static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
483{ 494{
@@ -1749,11 +1760,11 @@ static inline int pci_pcie_cap(struct pci_dev *dev)
1749 * 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
1750 * @dev: PCI device 1761 * @dev: PCI device
1751 * 1762 *
1752 * 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.
1753 */ 1764 */
1754static inline bool pci_is_pcie(struct pci_dev *dev) 1765static inline bool pci_is_pcie(struct pci_dev *dev)
1755{ 1766{
1756 return !!pci_pcie_cap(dev); 1767 return pci_pcie_cap(dev);
1757} 1768}
1758 1769
1759/** 1770/**
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index c74088ab103b..9e4761caa80c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -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__; \
@@ -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); \
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h
index 0b23edbee309..1900bd0fa639 100644
--- a/include/linux/percpu_ida.h
+++ b/include/linux/percpu_ida.h
@@ -16,6 +16,8 @@ struct percpu_ida {
16 * percpu_ida_init() 16 * percpu_ida_init()
17 */ 17 */
18 unsigned nr_tags; 18 unsigned nr_tags;
19 unsigned percpu_max_size;
20 unsigned percpu_batch_size;
19 21
20 struct percpu_ida_cpu __percpu *tag_cpu; 22 struct percpu_ida_cpu __percpu *tag_cpu;
21 23
@@ -51,10 +53,29 @@ struct percpu_ida {
51 } ____cacheline_aligned_in_smp; 53 } ____cacheline_aligned_in_smp;
52}; 54};
53 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
54int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp); 64int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
55void percpu_ida_free(struct percpu_ida *pool, unsigned tag); 65void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
56 66
57void percpu_ida_destroy(struct percpu_ida *pool); 67void percpu_ida_destroy(struct percpu_ida *pool);
58int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags); 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);
59 79
80unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu);
60#endif /* __PERCPU_IDA_H__ */ 81#endif /* __PERCPU_IDA_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/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/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
index 51a2ff579d60..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;
@@ -66,10 +67,8 @@ struct lp55xx_platform_data {
66 /* Clock configuration */ 67 /* Clock configuration */
67 u8 clock_mode; 68 u8 clock_mode;
68 69
69 /* Platform specific functions */ 70 /* optional enable GPIO */
70 int (*setup_resources)(void); 71 int enable_gpio;
71 void (*release_resources)(void);
72 void (*enable)(bool state);
73 72
74 /* Predefined pattern data */ 73 /* Predefined pattern data */
75 struct lp55xx_predef_pattern *patterns; 74 struct lp55xx_predef_pattern *patterns;
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/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/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/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/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/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/bq24735-charger.h b/include/linux/power/bq24735-charger.h
new file mode 100644
index 000000000000..f536164a6069
--- /dev/null
+++ b/include/linux/power/bq24735-charger.h
@@ -0,0 +1,39 @@
1/*
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18#ifndef __CHARGER_BQ24735_H_
19#define __CHARGER_BQ24735_H_
20
21#include <linux/types.h>
22#include <linux/power_supply.h>
23
24struct bq24735_platform {
25 uint32_t charge_current;
26 uint32_t charge_voltage;
27 uint32_t input_current;
28
29 const char *name;
30
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/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_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/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/random.h b/include/linux/random.h
index 6312dd9ba449..4002b3df4c85 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -29,8 +29,13 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
29u32 prandom_u32(void); 29u32 prandom_u32(void);
30void prandom_bytes(void *buf, int nbytes); 30void prandom_bytes(void *buf, int nbytes);
31void prandom_seed(u32 seed); 31void prandom_seed(u32 seed);
32void prandom_reseed_late(void);
32 33
33u32 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);
34void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 39void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
35 40
36/* 41/*
@@ -50,9 +55,10 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
50{ 55{
51 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 56 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
52 57
53 state->s1 = __seed(i, 1); 58 state->s1 = __seed(i, 2U);
54 state->s2 = __seed(i, 7); 59 state->s2 = __seed(i, 8U);
55 state->s3 = __seed(i, 15); 60 state->s3 = __seed(i, 16U);
61 state->s4 = __seed(i, 128U);
56} 62}
57 63
58#ifdef CONFIG_ARCH_RANDOM 64#ifdef CONFIG_ARCH_RANDOM
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index aa870a4ddf54..57e75ae9910f 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -85,6 +85,11 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
85 *rb_link = node; 85 *rb_link = node;
86} 86}
87 87
88#define rb_entry_safe(ptr, type, member) \
89 ({ typeof(ptr) ____ptr = (ptr); \
90 ____ptr ? rb_entry(____ptr, type, member) : NULL; \
91 })
92
88/** 93/**
89 * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of 94 * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
90 * given type safe against removal of rb_node entry 95 * given type safe against removal of rb_node entry
@@ -95,12 +100,9 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
95 * @field: the name of the rb_node field within 'type'. 100 * @field: the name of the rb_node field within 'type'.
96 */ 101 */
97#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \ 102#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
98 for (pos = rb_entry(rb_first_postorder(root), typeof(*pos), field),\ 103 for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \
99 n = rb_entry(rb_next_postorder(&pos->field), \ 104 pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \
100 typeof(*pos), field); \ 105 typeof(*pos), field); 1; }); \
101 &pos->field; \ 106 pos = n)
102 pos = n, \
103 n = rb_entry(rb_next_postorder(&pos->field), \
104 typeof(*pos), field))
105 107
106#endif /* _LINUX_RBTREE_H */ 108#endif /* _LINUX_RBTREE_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 9bdad43ad228..9370e65348a4 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -46,19 +46,26 @@ enum regulator_status {
46 * regulator_list_linear_range(). 46 * regulator_list_linear_range().
47 * 47 *
48 * @min_uV: Lowest voltage in range 48 * @min_uV: Lowest voltage in range
49 * @max_uV: Highest voltage in range
50 * @min_sel: Lowest selector for range 49 * @min_sel: Lowest selector for range
51 * @max_sel: Highest selector for range 50 * @max_sel: Highest selector for range
52 * @uV_step: Step size 51 * @uV_step: Step size
53 */ 52 */
54struct regulator_linear_range { 53struct regulator_linear_range {
55 unsigned int min_uV; 54 unsigned int min_uV;
56 unsigned int max_uV;
57 unsigned int min_sel; 55 unsigned int min_sel;
58 unsigned int max_sel; 56 unsigned int max_sel;
59 unsigned int uV_step; 57 unsigned int uV_step;
60}; 58};
61 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
62/** 69/**
63 * struct regulator_ops - regulator operations. 70 * struct regulator_ops - regulator operations.
64 * 71 *
@@ -209,6 +216,7 @@ enum regulator_type {
209 * @min_uV: Voltage given by the lowest selector (if linear mapping) 216 * @min_uV: Voltage given by the lowest selector (if linear mapping)
210 * @uV_step: Voltage increase with each selector (if linear mapping) 217 * @uV_step: Voltage increase with each selector (if linear mapping)
211 * @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.
212 * @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)
213 * @volt_table: Voltage mapping table (if table based mapping) 221 * @volt_table: Voltage mapping table (if table based mapping)
214 * 222 *
@@ -241,6 +249,7 @@ struct regulator_desc {
241 unsigned int min_uV; 249 unsigned int min_uV;
242 unsigned int uV_step; 250 unsigned int uV_step;
243 unsigned int linear_min_sel; 251 unsigned int linear_min_sel;
252 int fixed_uV;
244 unsigned int ramp_delay; 253 unsigned int ramp_delay;
245 254
246 const struct regulator_linear_range *linear_ranges; 255 const struct regulator_linear_range *linear_ranges;
@@ -336,7 +345,12 @@ struct regulator_dev {
336struct regulator_dev * 345struct regulator_dev *
337regulator_register(const struct regulator_desc *regulator_desc, 346regulator_register(const struct regulator_desc *regulator_desc,
338 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);
339void regulator_unregister(struct regulator_dev *rdev); 352void regulator_unregister(struct regulator_dev *rdev);
353void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev);
340 354
341int regulator_notifier_call_chain(struct regulator_dev *rdev, 355int regulator_notifier_call_chain(struct regulator_dev *rdev,
342 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/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 045b0d227846..7e35d4b9e14a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -22,7 +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.h> 25#include <linux/preempt_mask.h>
26 26
27#include <asm/page.h> 27#include <asm/page.h>
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -286,6 +286,14 @@ static inline void lockup_detector_init(void)
286} 286}
287#endif 287#endif
288 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
289/* Attach to any functions which should be ignored in wchan output. */ 297/* Attach to any functions which should be ignored in wchan output. */
290#define __sched __attribute__((__section__(".sched.text"))) 298#define __sched __attribute__((__section__(".sched.text")))
291 299
@@ -323,6 +331,10 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
323extern void set_dumpable(struct mm_struct *mm, int value); 331extern void set_dumpable(struct mm_struct *mm, int value);
324extern int get_dumpable(struct mm_struct *mm); 332extern int get_dumpable(struct mm_struct *mm);
325 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
326/* mm flags */ 338/* mm flags */
327/* dumpable bits */ 339/* dumpable bits */
328#define MMF_DUMPABLE 0 /* core dump is permitted */ 340#define MMF_DUMPABLE 0 /* core dump is permitted */
@@ -1062,15 +1074,6 @@ struct task_struct {
1062 struct hlist_head preempt_notifiers; 1074 struct hlist_head preempt_notifiers;
1063#endif 1075#endif
1064 1076
1065 /*
1066 * fpu_counter contains the number of consecutive context switches
1067 * that the FPU is used. If this is over a threshold, the lazy fpu
1068 * saving becomes unlazy to save the trap. This is an unsigned char
1069 * so that after 256 times the counter wraps and the behavior turns
1070 * lazy again; this to deal with bursty apps that only use FPU for
1071 * a short time
1072 */
1073 unsigned char fpu_counter;
1074#ifdef CONFIG_BLK_DEV_IO_TRACE 1077#ifdef CONFIG_BLK_DEV_IO_TRACE
1075 unsigned int btrace_seq; 1078 unsigned int btrace_seq;
1076#endif 1079#endif
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 10d16c4fbe89..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,
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/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 21a209336e79..1e8a8b6e837d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -34,6 +34,7 @@
34 34
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/preempt.h> 36#include <linux/preempt.h>
37#include <linux/lockdep.h>
37#include <asm/processor.h> 38#include <asm/processor.h>
38 39
39/* 40/*
@@ -44,10 +45,50 @@
44 */ 45 */
45typedef struct seqcount { 46typedef struct seqcount {
46 unsigned sequence; 47 unsigned sequence;
48#ifdef CONFIG_DEBUG_LOCK_ALLOC
49 struct lockdep_map dep_map;
50#endif
47} seqcount_t; 51} seqcount_t;
48 52
49#define SEQCNT_ZERO { 0 } 53static inline void __seqcount_init(seqcount_t *s, const char *name,
50#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
51 92
52/** 93/**
53 * __read_seqcount_begin - begin a seq-read critical section (without barrier) 94 * __read_seqcount_begin - begin a seq-read critical section (without barrier)
@@ -76,6 +117,22 @@ repeat:
76} 117}
77 118
78/** 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/**
79 * read_seqcount_begin - begin a seq-read critical section 136 * read_seqcount_begin - begin a seq-read critical section
80 * @s: pointer to seqcount_t 137 * @s: pointer to seqcount_t
81 * Returns: count to be passed to read_seqcount_retry 138 * Returns: count to be passed to read_seqcount_retry
@@ -86,9 +143,8 @@ repeat:
86 */ 143 */
87static inline unsigned read_seqcount_begin(const seqcount_t *s) 144static inline unsigned read_seqcount_begin(const seqcount_t *s)
88{ 145{
89 unsigned ret = __read_seqcount_begin(s); 146 seqcount_lockdep_reader_access(s);
90 smp_rmb(); 147 return read_seqcount_begin_no_lockdep(s);
91 return ret;
92} 148}
93 149
94/** 150/**
@@ -108,6 +164,8 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
108static inline unsigned raw_seqcount_begin(const seqcount_t *s) 164static inline unsigned raw_seqcount_begin(const seqcount_t *s)
109{ 165{
110 unsigned ret = ACCESS_ONCE(s->sequence); 166 unsigned ret = ACCESS_ONCE(s->sequence);
167
168 seqcount_lockdep_reader_access(s);
111 smp_rmb(); 169 smp_rmb();
112 return ret & ~1; 170 return ret & ~1;
113} 171}
@@ -152,14 +210,21 @@ static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
152 * Sequence counter only version assumes that callers are using their 210 * Sequence counter only version assumes that callers are using their
153 * own mutexing. 211 * own mutexing.
154 */ 212 */
155static inline void write_seqcount_begin(seqcount_t *s) 213static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass)
156{ 214{
157 s->sequence++; 215 s->sequence++;
158 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);
159} 223}
160 224
161static inline void write_seqcount_end(seqcount_t *s) 225static inline void write_seqcount_end(seqcount_t *s)
162{ 226{
227 seqcount_release(&s->dep_map, 1, _RET_IP_);
163 smp_wmb(); 228 smp_wmb();
164 s->sequence++; 229 s->sequence++;
165} 230}
@@ -188,7 +253,7 @@ typedef struct {
188 */ 253 */
189#define __SEQLOCK_UNLOCKED(lockname) \ 254#define __SEQLOCK_UNLOCKED(lockname) \
190 { \ 255 { \
191 .seqcount = SEQCNT_ZERO, \ 256 .seqcount = SEQCNT_ZERO(lockname), \
192 .lock = __SPIN_LOCK_UNLOCKED(lockname) \ 257 .lock = __SPIN_LOCK_UNLOCKED(lockname) \
193 } 258 }
194 259
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/skbuff.h b/include/linux/skbuff.h
index c2d89335f637..bec1cc7d5e3c 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
@@ -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
@@ -2271,24 +2263,6 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
2271 2263
2272unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); 2264unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2273 2265
2274/**
2275 * pskb_trim_rcsum - trim received skb and update checksum
2276 * @skb: buffer to trim
2277 * @len: new length
2278 *
2279 * This is exactly the same as pskb_trim except that it ensures the
2280 * checksum of received packets are still valid after the operation.
2281 */
2282
2283static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
2284{
2285 if (likely(len >= skb->len))
2286 return 0;
2287 if (skb->ip_summed == CHECKSUM_COMPLETE)
2288 skb->ip_summed = CHECKSUM_NONE;
2289 return __pskb_trim(skb, len);
2290}
2291
2292#define skb_queue_walk(queue, skb) \ 2266#define skb_queue_walk(queue, skb) \
2293 for (skb = (queue)->next; \ 2267 for (skb = (queue)->next; \
2294 skb != (struct sk_buff *)(queue); \ 2268 skb != (struct sk_buff *)(queue); \
@@ -2342,60 +2316,70 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
2342#define skb_walk_frags(skb, iter) \ 2316#define skb_walk_frags(skb, iter) \
2343 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2317 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2344 2318
2345extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2319struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2346 int *peeked, int *off, int *err); 2320 int *peeked, int *off, int *err);
2347extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 2321struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
2348 int noblock, int *err); 2322 int *err);
2349extern unsigned int datagram_poll(struct file *file, struct socket *sock, 2323unsigned int datagram_poll(struct file *file, struct socket *sock,
2350 struct poll_table_struct *wait); 2324 struct poll_table_struct *wait);
2351extern int skb_copy_datagram_iovec(const struct sk_buff *from, 2325int skb_copy_datagram_iovec(const struct sk_buff *from, int offset,
2352 int offset, struct iovec *to, 2326 struct iovec *to, int size);
2353 int size); 2327int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen,
2354extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, 2328 struct iovec *iov);
2355 int hlen, 2329int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset,
2356 struct iovec *iov); 2330 const struct iovec *from, int from_offset,
2357extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 2331 int len);
2358 int offset, 2332int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *frm,
2359 const struct iovec *from, 2333 int offset, size_t count);
2360 int from_offset, 2334int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset,
2361 int len); 2335 const struct iovec *to, int to_offset,
2362extern int zerocopy_sg_from_iovec(struct sk_buff *skb, 2336 int size);
2363 const struct iovec *frm, 2337void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2364 int offset, 2338void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2365 size_t count); 2339int 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, 2340int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
2367 int offset, 2341int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
2368 const struct iovec *to, 2342__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
2369 int to_offset, 2343 int len, __wsum csum);
2370 int size); 2344int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
2371extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 2345 struct pipe_inode_info *pipe, unsigned int len,
2372extern void skb_free_datagram_locked(struct sock *sk, 2346 unsigned int flags);
2373 struct sk_buff *skb); 2347void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2374extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 2348void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2375 unsigned int flags); 2349int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2376extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 2350void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2377 int len, __wsum csum); 2351struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2378extern int skb_copy_bits(const struct sk_buff *skb, int offset, 2352
2379 void *to, int len); 2353struct skb_checksum_ops {
2380extern int skb_store_bits(struct sk_buff *skb, int offset, 2354 __wsum (*update)(const void *mem, int len, __wsum wsum);
2381 const void *from, int len); 2355 __wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
2382extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 2356};
2383 int offset, u8 *to, int len, 2357
2384 __wsum csum); 2358__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2385extern int skb_splice_bits(struct sk_buff *skb, 2359 __wsum csum, const struct skb_checksum_ops *ops);
2386 unsigned int offset, 2360__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2387 struct pipe_inode_info *pipe, 2361 __wsum csum);
2388 unsigned int len, 2362
2389 unsigned int flags); 2363/**
2390extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 2364 * pskb_trim_rcsum - trim received skb and update checksum
2391extern void skb_split(struct sk_buff *skb, 2365 * @skb: buffer to trim
2392 struct sk_buff *skb1, const u32 len); 2366 * @len: new length
2393extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2367 *
2394 int shiftlen); 2368 * This is exactly the same as pskb_trim except that it ensures the
2395extern void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2369 * checksum of received packets are still valid after the operation.
2396 2370 */
2397extern struct sk_buff *skb_segment(struct sk_buff *skb, 2371
2398 netdev_features_t features); 2372static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
2373{
2374 if (likely(len >= skb->len))
2375 return 0;
2376 if (skb->ip_summed == CHECKSUM_COMPLETE) {
2377 __wsum adj = skb_checksum(skb, len, skb->len - len, 0);
2378
2379 skb->csum = csum_sub(skb->csum, adj);
2380 }
2381 return __pskb_trim(skb, len);
2382}
2399 2383
2400static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2384static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2401 int len, void *buffer) 2385 int len, void *buffer)
@@ -2440,7 +2424,7 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
2440 memcpy(skb->data + offset, from, len); 2424 memcpy(skb->data + offset, from, len);
2441} 2425}
2442 2426
2443extern void skb_init(void); 2427void skb_init(void);
2444 2428
2445static inline ktime_t skb_get_ktime(const struct sk_buff *skb) 2429static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
2446{ 2430{
@@ -2483,12 +2467,12 @@ static inline ktime_t net_invalid_timestamp(void)
2483 return ktime_set(0, 0); 2467 return ktime_set(0, 0);
2484} 2468}
2485 2469
2486extern void skb_timestamping_init(void); 2470void skb_timestamping_init(void);
2487 2471
2488#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2472#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2489 2473
2490extern void skb_clone_tx_timestamp(struct sk_buff *skb); 2474void skb_clone_tx_timestamp(struct sk_buff *skb);
2491extern bool skb_defer_rx_timestamp(struct sk_buff *skb); 2475bool skb_defer_rx_timestamp(struct sk_buff *skb);
2492 2476
2493#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ 2477#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
2494 2478
@@ -2529,8 +2513,8 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
2529 * generates a software time stamp (otherwise), then queues the clone 2513 * generates a software time stamp (otherwise), then queues the clone
2530 * to the error queue of the socket. Errors are silently ignored. 2514 * to the error queue of the socket. Errors are silently ignored.
2531 */ 2515 */
2532extern void skb_tstamp_tx(struct sk_buff *orig_skb, 2516void skb_tstamp_tx(struct sk_buff *orig_skb,
2533 struct skb_shared_hwtstamps *hwtstamps); 2517 struct skb_shared_hwtstamps *hwtstamps);
2534 2518
2535static inline void sw_tx_timestamp(struct sk_buff *skb) 2519static inline void sw_tx_timestamp(struct sk_buff *skb)
2536{ 2520{
@@ -2562,8 +2546,8 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2562 */ 2546 */
2563void skb_complete_wifi_ack(struct sk_buff *skb, bool acked); 2547void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2564 2548
2565extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2549__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2566extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2550__sum16 __skb_checksum_complete(struct sk_buff *skb);
2567 2551
2568static inline int skb_csum_unnecessary(const struct sk_buff *skb) 2552static inline int skb_csum_unnecessary(const struct sk_buff *skb)
2569{ 2553{
@@ -2593,7 +2577,7 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2593} 2577}
2594 2578
2595#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2579#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2596extern void nf_conntrack_destroy(struct nf_conntrack *nfct); 2580void nf_conntrack_destroy(struct nf_conntrack *nfct);
2597static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2581static inline void nf_conntrack_put(struct nf_conntrack *nfct)
2598{ 2582{
2599 if (nfct && atomic_dec_and_test(&nfct->use)) 2583 if (nfct && atomic_dec_and_test(&nfct->use))
@@ -2605,18 +2589,6 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2605 atomic_inc(&nfct->use); 2589 atomic_inc(&nfct->use);
2606} 2590}
2607#endif 2591#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 2592#ifdef CONFIG_BRIDGE_NETFILTER
2621static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 2593static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2622{ 2594{
@@ -2635,10 +2607,6 @@ static inline void nf_reset(struct sk_buff *skb)
2635 nf_conntrack_put(skb->nfct); 2607 nf_conntrack_put(skb->nfct);
2636 skb->nfct = NULL; 2608 skb->nfct = NULL;
2637#endif 2609#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 2610#ifdef CONFIG_BRIDGE_NETFILTER
2643 nf_bridge_put(skb->nf_bridge); 2611 nf_bridge_put(skb->nf_bridge);
2644 skb->nf_bridge = NULL; 2612 skb->nf_bridge = NULL;
@@ -2660,10 +2628,6 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2660 nf_conntrack_get(src->nfct); 2628 nf_conntrack_get(src->nfct);
2661 dst->nfctinfo = src->nfctinfo; 2629 dst->nfctinfo = src->nfctinfo;
2662#endif 2630#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 2631#ifdef CONFIG_BRIDGE_NETFILTER
2668 dst->nf_bridge = src->nf_bridge; 2632 dst->nf_bridge = src->nf_bridge;
2669 nf_bridge_get(src->nf_bridge); 2633 nf_bridge_get(src->nf_bridge);
@@ -2675,9 +2639,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) 2639#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2676 nf_conntrack_put(dst->nfct); 2640 nf_conntrack_put(dst->nfct);
2677#endif 2641#endif
2678#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2679 nf_conntrack_put_reasm(dst->nfct_reasm);
2680#endif
2681#ifdef CONFIG_BRIDGE_NETFILTER 2642#ifdef CONFIG_BRIDGE_NETFILTER
2682 nf_bridge_put(dst->nf_bridge); 2643 nf_bridge_put(dst->nf_bridge);
2683#endif 2644#endif
@@ -2732,28 +2693,27 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
2732 return skb->queue_mapping != 0; 2693 return skb->queue_mapping != 0;
2733} 2694}
2734 2695
2735extern u16 __skb_tx_hash(const struct net_device *dev, 2696u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb,
2736 const struct sk_buff *skb, 2697 unsigned int num_tx_queues);
2737 unsigned int num_tx_queues);
2738 2698
2739#ifdef CONFIG_XFRM
2740static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2699static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2741{ 2700{
2701#ifdef CONFIG_XFRM
2742 return skb->sp; 2702 return skb->sp;
2743}
2744#else 2703#else
2745static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2746{
2747 return NULL; 2704 return NULL;
2748}
2749#endif 2705#endif
2706}
2750 2707
2751/* Keeps track of mac header offset relative to skb->head. 2708/* Keeps track of mac header offset relative to skb->head.
2752 * It is useful for TSO of Tunneling protocol. e.g. GRE. 2709 * It is useful for TSO of Tunneling protocol. e.g. GRE.
2753 * For non-tunnel skb it points to skb_mac_header() and for 2710 * For non-tunnel skb it points to skb_mac_header() and for
2754 * tunnel skb it points to outer mac header. */ 2711 * tunnel skb it points to outer mac header.
2712 * Keeps track of level of encapsulation of network headers.
2713 */
2755struct skb_gso_cb { 2714struct skb_gso_cb {
2756 int mac_offset; 2715 int mac_offset;
2716 int encap_level;
2757}; 2717};
2758#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) 2718#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2759 2719
@@ -2783,12 +2743,13 @@ static inline bool skb_is_gso(const struct sk_buff *skb)
2783 return skb_shinfo(skb)->gso_size; 2743 return skb_shinfo(skb)->gso_size;
2784} 2744}
2785 2745
2746/* Note: Should be called only if skb_is_gso(skb) is true */
2786static inline bool skb_is_gso_v6(const struct sk_buff *skb) 2747static inline bool skb_is_gso_v6(const struct sk_buff *skb)
2787{ 2748{
2788 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 2749 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
2789} 2750}
2790 2751
2791extern void __skb_warn_lro_forwarding(const struct sk_buff *skb); 2752void __skb_warn_lro_forwarding(const struct sk_buff *skb);
2792 2753
2793static inline bool skb_warn_if_lro(const struct sk_buff *skb) 2754static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2794{ 2755{
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 731f5237d5f4..5da22ee42e16 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -49,6 +49,9 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
49 smp_call_func_t func, void *info, bool wait, 49 smp_call_func_t func, void *info, bool wait,
50 gfp_t gfp_flags); 50 gfp_t gfp_flags);
51 51
52void __smp_call_function_single(int cpuid, struct call_single_data *data,
53 int wait);
54
52#ifdef CONFIG_SMP 55#ifdef CONFIG_SMP
53 56
54#include <linux/preempt.h> 57#include <linux/preempt.h>
@@ -95,9 +98,6 @@ int smp_call_function(smp_call_func_t func, void *info, int wait);
95void smp_call_function_many(const struct cpumask *mask, 98void smp_call_function_many(const struct cpumask *mask,
96 smp_call_func_t func, void *info, bool wait); 99 smp_call_func_t func, void *info, bool wait);
97 100
98void __smp_call_function_single(int cpuid, struct call_single_data *data,
99 int wait);
100
101int smp_call_function_any(const struct cpumask *mask, 101int smp_call_function_any(const struct cpumask *mask,
102 smp_call_func_t func, void *info, int wait); 102 smp_call_func_t func, void *info, int wait);
103 103
@@ -106,14 +106,10 @@ void kick_all_cpus_sync(void);
106/* 106/*
107 * Generic and arch helpers 107 * Generic and arch helpers
108 */ 108 */
109#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
110void __init call_function_init(void); 109void __init call_function_init(void);
111void generic_smp_call_function_single_interrupt(void); 110void generic_smp_call_function_single_interrupt(void);
112#define generic_smp_call_function_interrupt \ 111#define generic_smp_call_function_interrupt \
113 generic_smp_call_function_single_interrupt 112 generic_smp_call_function_single_interrupt
114#else
115static inline void call_function_init(void) { }
116#endif
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
@@ -155,12 +151,6 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
155 151
156static inline void kick_all_cpus_sync(void) { } 152static inline void kick_all_cpus_sync(void) { }
157 153
158static inline void __smp_call_function_single(int cpuid,
159 struct call_single_data *data, int wait)
160{
161 on_each_cpu(data->func, data->info, wait);
162}
163
164#endif /* !SMP */ 154#endif /* !SMP */
165 155
166/* 156/*
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/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 7fac04e7ff6e..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,7 +184,8 @@ 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__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 190 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
190 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 191 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
@@ -194,7 +195,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
194 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ 195 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
195 return ret; \ 196 return ret; \
196 } \ 197 } \
197 SYSCALL_ALIAS(sys##name, SyS##name); \
198 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 198 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
199 199
200asmlinkage long sys_time(time_t __user *tloc); 200asmlinkage long sys_time(time_t __user *tloc);
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/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/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/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 1855f0a22add..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,
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 021b8a319b9e..fc0e4320aa6d 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -97,7 +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);
101void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 101void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
102void inode_wait_for_writeback(struct inode *inode); 102void inode_wait_for_writeback(struct inode *inode);
103 103
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..bd8218b15009 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -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/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 15f10841e2b5..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 {
@@ -109,18 +115,22 @@ enum {
109 HCI_PAIRABLE, 115 HCI_PAIRABLE,
110 HCI_SERVICE_CACHE, 116 HCI_SERVICE_CACHE,
111 HCI_DEBUG_KEYS, 117 HCI_DEBUG_KEYS,
118 HCI_DUT_MODE,
112 HCI_UNREGISTER, 119 HCI_UNREGISTER,
120 HCI_USER_CHANNEL,
113 121
114 HCI_LE_SCAN, 122 HCI_LE_SCAN,
115 HCI_SSP_ENABLED, 123 HCI_SSP_ENABLED,
116 HCI_HS_ENABLED, 124 HCI_HS_ENABLED,
117 HCI_LE_ENABLED, 125 HCI_LE_ENABLED,
118 HCI_LE_PERIPHERAL, 126 HCI_ADVERTISING,
119 HCI_CONNECTABLE, 127 HCI_CONNECTABLE,
120 HCI_DISCOVERABLE, 128 HCI_DISCOVERABLE,
129 HCI_LIMITED_DISCOVERABLE,
121 HCI_LINK_SECURITY, 130 HCI_LINK_SECURITY,
122 HCI_PERIODIC_INQ, 131 HCI_PERIODIC_INQ,
123 HCI_FAST_CONNECTABLE, 132 HCI_FAST_CONNECTABLE,
133 HCI_BREDR_ENABLED,
124}; 134};
125 135
126/* 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
@@ -624,6 +634,24 @@ struct hci_rp_logical_link_cancel {
624 __u8 flow_spec_id; 634 __u8 flow_spec_id;
625} __packed; 635} __packed;
626 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
627#define HCI_OP_SNIFF_MODE 0x0803 655#define HCI_OP_SNIFF_MODE 0x0803
628struct hci_cp_sniff_mode { 656struct hci_cp_sniff_mode {
629 __le16 handle; 657 __le16 handle;
@@ -694,9 +722,6 @@ struct hci_cp_sniff_subrate {
694} __packed; 722} __packed;
695 723
696#define HCI_OP_SET_EVENT_MASK 0x0c01 724#define HCI_OP_SET_EVENT_MASK 0x0c01
697struct hci_cp_set_event_mask {
698 __u8 mask[8];
699} __packed;
700 725
701#define HCI_OP_RESET 0x0c03 726#define HCI_OP_RESET 0x0c03
702 727
@@ -792,6 +817,20 @@ struct hci_cp_host_buffer_size {
792 __le16 sco_max_pkt; 817 __le16 sco_max_pkt;
793} __packed; 818} __packed;
794 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
795#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 834#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
796 835
797#define HCI_MAX_EIR_LENGTH 240 836#define HCI_MAX_EIR_LENGTH 240
@@ -826,6 +865,10 @@ struct hci_rp_read_inq_rsp_tx_power {
826 __s8 tx_power; 865 __s8 tx_power;
827} __packed; 866} __packed;
828 867
868#define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63
869
870#define HCI_OP_READ_LOCATION_DATA 0x0c64
871
829#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 872#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
830struct hci_rp_read_flow_control_mode { 873struct hci_rp_read_flow_control_mode {
831 __u8 status; 874 __u8 status;
@@ -838,6 +881,50 @@ struct hci_cp_write_le_host_supported {
838 __u8 simul; 881 __u8 simul;
839} __packed; 882} __packed;
840 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
841#define HCI_OP_READ_LOCAL_VERSION 0x1001 928#define HCI_OP_READ_LOCAL_VERSION 0x1001
842struct hci_rp_read_local_version { 929struct hci_rp_read_local_version {
843 __u8 status; 930 __u8 status;
@@ -957,6 +1044,10 @@ struct hci_rp_write_remote_amp_assoc {
957 __u8 phy_handle; 1044 __u8 phy_handle;
958} __packed; 1045} __packed;
959 1046
1047#define HCI_OP_ENABLE_DUT_MODE 0x1803
1048
1049#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
1050
960#define HCI_OP_LE_SET_EVENT_MASK 0x2001 1051#define HCI_OP_LE_SET_EVENT_MASK 0x2001
961struct hci_cp_le_set_event_mask { 1052struct hci_cp_le_set_event_mask {
962 __u8 mask[8]; 1053 __u8 mask[8];
@@ -975,6 +1066,20 @@ struct hci_rp_le_read_local_features {
975 __u8 features[8]; 1066 __u8 features[8];
976} __packed; 1067} __packed;
977 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
978#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1083#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
979struct hci_rp_le_read_adv_tx_power { 1084struct hci_rp_le_read_adv_tx_power {
980 __u8 status; 1085 __u8 status;
@@ -989,6 +1094,12 @@ struct hci_cp_le_set_adv_data {
989 __u8 data[HCI_MAX_AD_LENGTH]; 1094 __u8 data[HCI_MAX_AD_LENGTH];
990} __packed; 1095} __packed;
991 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
992#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1103#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
993 1104
994#define LE_SCAN_PASSIVE 0x00 1105#define LE_SCAN_PASSIVE 0x00
@@ -1438,6 +1549,13 @@ struct hci_ev_num_comp_blocks {
1438 struct hci_comp_blocks_info handles[0]; 1549 struct hci_comp_blocks_info handles[0];
1439} __packed; 1550} __packed;
1440 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
1441/* Low energy meta events */ 1559/* Low energy meta events */
1442#define LE_CONN_ROLE_MASTER 0x00 1560#define LE_CONN_ROLE_MASTER 0x00
1443 1561
@@ -1462,11 +1580,11 @@ struct hci_ev_le_ltk_req {
1462} __packed; 1580} __packed;
1463 1581
1464/* Advertising report event types */ 1582/* Advertising report event types */
1465#define ADV_IND 0x00 1583#define LE_ADV_IND 0x00
1466#define ADV_DIRECT_IND 0x01 1584#define LE_ADV_DIRECT_IND 0x01
1467#define ADV_SCAN_IND 0x02 1585#define LE_ADV_SCAN_IND 0x02
1468#define ADV_NONCONN_IND 0x03 1586#define LE_ADV_NONCONN_IND 0x03
1469#define ADV_SCAN_RSP 0x04 1587#define LE_ADV_SCAN_RSP 0x04
1470 1588
1471#define ADDR_LE_DEV_PUBLIC 0x00 1589#define ADDR_LE_DEV_PUBLIC 0x00
1472#define ADDR_LE_DEV_RANDOM 0x01 1590#define ADDR_LE_DEV_RANDOM 0x01
@@ -1571,6 +1689,7 @@ struct sockaddr_hci {
1571#define HCI_DEV_NONE 0xffff 1689#define HCI_DEV_NONE 0xffff
1572 1690
1573#define HCI_CHANNEL_RAW 0 1691#define HCI_CHANNEL_RAW 0
1692#define HCI_CHANNEL_USER 1
1574#define HCI_CHANNEL_MONITOR 2 1693#define HCI_CHANNEL_MONITOR 2
1575#define HCI_CHANNEL_CONTROL 3 1694#define HCI_CHANNEL_CONTROL 3
1576 1695
@@ -1673,6 +1792,4 @@ struct hci_inquiry_req {
1673}; 1792};
1674#define IREQ_CACHE_FLUSH 0x0001 1793#define IREQ_CACHE_FLUSH 0x0001
1675 1794
1676extern bool enable_hs;
1677
1678#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 1a966afbbfa8..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,8 +238,9 @@ 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 indentifier */ 243/* channel identifier */
242#define L2CAP_CID_SIGNALING 0x0001 244#define L2CAP_CID_SIGNALING 0x0001
243#define L2CAP_CID_CONN_LESS 0x0002 245#define L2CAP_CID_CONN_LESS 0x0002
244#define L2CAP_CID_A2MP 0x0003 246#define L2CAP_CID_A2MP 0x0003
@@ -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/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 3c4c944096c9..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 {
@@ -486,9 +485,9 @@ static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
486} 485}
487 486
488#else 487#else
489extern 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,
490 const struct flowi *fl, struct sock *sk, 489 const struct flowi *fl, struct sock *sk,
491 int flags); 490 int flags);
492 491
493/* skb attached with this dst needs transformation if dst->xfrm is valid */ 492/* skb attached with this dst needs transformation if dst->xfrm is valid */
494static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 493static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
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..ace4abf118d7 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,54 @@ 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 (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 if (group >= family->n_mcgrps)
287 return -EINVAL;
288 group = family->mcgrp_offset + group;
289 return genlmsg_multicast_netns(family, &init_net, skb,
290 portid, group, flags);
253} 291}
254 292
255/** 293/**
256 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 294 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
295 * @family: the generic netlink family
257 * @skb: netlink message as socket buffer 296 * @skb: netlink message as socket buffer
258 * @portid: own netlink portid to avoid sending to yourself 297 * @portid: own netlink portid to avoid sending to yourself
259 * @group: multicast group id 298 * @group: offset of multicast group in groups array
260 * @flags: allocation flags 299 * @flags: allocation flags
261 * 300 *
262 * This function must hold the RTNL or rcu_read_lock(). 301 * This function must hold the RTNL or rcu_read_lock().
263 */ 302 */
264int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid, 303int genlmsg_multicast_allns(struct genl_family *family,
304 struct sk_buff *skb, u32 portid,
265 unsigned int group, gfp_t flags); 305 unsigned int group, gfp_t flags);
266 306
267/** 307/**
@@ -332,5 +372,22 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
332 return nlmsg_new(genlmsg_total_size(payload), flags); 372 return nlmsg_new(genlmsg_total_size(payload), flags);
333} 373}
334 374
375/**
376 * genl_set_err - report error to genetlink broadcast listeners
377 * @family: the generic netlink family
378 * @net: the network namespace to report the error to
379 * @portid: the PORTID of a process that we want to skip (if any)
380 * @group: the broadcast group that will notice the error
381 * (this is the offset of the multicast group in the groups array)
382 * @code: error code, must be negative (as usual in kernelspace)
383 *
384 * This function returns the number of broadcast listeners that have set the
385 * NETLINK_RECV_NO_ENOBUFS socket option.
386 */
387static inline int genl_set_err(struct genl_family *family, struct net *net,
388 u32 portid, u32 group, int code)
389{
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 5e5268807a1c..217bc5bfc6c6 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,7 +269,7 @@ 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 sk_buff *skb, 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{
@@ -367,7 +374,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
367 struct ipv6_pinfo *np = inet6_sk(sk); 374 struct ipv6_pinfo *np = inet6_sk(sk);
368 375
369 memset(&np->saddr, 0, sizeof(np->saddr)); 376 memset(&np->saddr, 0, sizeof(np->saddr));
370 memset(&np->rcv_saddr, 0, sizeof(np->rcv_saddr)); 377 memset(&sk->sk_v6_rcv_saddr, 0, sizeof(sk->sk_v6_rcv_saddr));
371 } 378 }
372#endif 379#endif
373} 380}
@@ -390,7 +397,7 @@ static inline int sk_mc_loop(struct sock *sk)
390 return 1; 397 return 1;
391} 398}
392 399
393extern bool ip_call_ra_chain(struct sk_buff *skb); 400bool ip_call_ra_chain(struct sk_buff *skb);
394 401
395/* 402/*
396 * Functions provided by ip_fragment.c 403 * Functions provided by ip_fragment.c
@@ -428,50 +435,52 @@ int ip_frag_nqueues(struct net *net);
428 * Functions provided by ip_forward.c 435 * Functions provided by ip_forward.c
429 */ 436 */
430 437
431extern int ip_forward(struct sk_buff *skb); 438int ip_forward(struct sk_buff *skb);
432 439
433/* 440/*
434 * Functions provided by ip_options.c 441 * Functions provided by ip_options.c
435 */ 442 */
436 443
437extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, 444void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
438 __be32 daddr, struct rtable *rt, int is_frag); 445 __be32 daddr, struct rtable *rt, int is_frag);
439extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 446int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
440extern void ip_options_fragment(struct sk_buff *skb); 447void ip_options_fragment(struct sk_buff *skb);
441extern int ip_options_compile(struct net *net, 448int ip_options_compile(struct net *net, struct ip_options *opt,
442 struct ip_options *opt, struct sk_buff *skb); 449 struct sk_buff *skb);
443extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, 450int ip_options_get(struct net *net, struct ip_options_rcu **optp,
444 unsigned char *data, int optlen); 451 unsigned char *data, int optlen);
445extern 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,
446 unsigned char __user *data, int optlen); 453 unsigned char __user *data, int optlen);
447extern void ip_options_undo(struct ip_options * opt); 454void ip_options_undo(struct ip_options *opt);
448extern void ip_forward_options(struct sk_buff *skb); 455void ip_forward_options(struct sk_buff *skb);
449extern int ip_options_rcv_srr(struct sk_buff *skb); 456int ip_options_rcv_srr(struct sk_buff *skb);
450 457
451/* 458/*
452 * Functions provided by ip_sockglue.c 459 * Functions provided by ip_sockglue.c
453 */ 460 */
454 461
455extern void ipv4_pktinfo_prepare(struct sk_buff *skb); 462void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
456extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 463void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
457extern int ip_cmsg_send(struct net *net, 464int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc);
458 struct msghdr *msg, struct ipcm_cookie *ipc); 465int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
459extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); 466 unsigned int optlen);
460extern 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,
461extern int compat_ip_setsockopt(struct sock *sk, int level, 468 int __user *optlen);
462 int optname, char __user *optval, unsigned int optlen); 469int compat_ip_setsockopt(struct sock *sk, int level, int optname,
463extern int compat_ip_getsockopt(struct sock *sk, int level, 470 char __user *optval, unsigned int optlen);
464 int optname, char __user *optval, int __user *optlen); 471int compat_ip_getsockopt(struct sock *sk, int level, int optname,
465extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 472 char __user *optval, int __user *optlen);
466 473int ip_ra_control(struct sock *sk, unsigned char on,
467extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 474 void (*destructor)(struct sock *));
468extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 475
469 __be16 port, u32 info, u8 *payload); 476int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
470extern 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,
471 u32 info); 478 u32 info, u8 *payload);
479void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
480 u32 info);
472 481
473#ifdef CONFIG_PROC_FS 482#ifdef CONFIG_PROC_FS
474extern int ip_misc_proc_init(void); 483int ip_misc_proc_init(void);
475#endif 484#endif
476 485
477#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 5e661a979694..2182525e4d74 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -268,48 +268,39 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
268 * exported functions 268 * exported functions
269 */ 269 */
270 270
271extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 271struct fib6_table *fib6_get_table(struct net *net, u32 id);
272extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 272struct fib6_table *fib6_new_table(struct net *net, u32 id);
273extern struct dst_entry *fib6_rule_lookup(struct net *net, 273struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
274 struct flowi6 *fl6, int flags, 274 int flags, pol_lookup_t lookup);
275 pol_lookup_t lookup);
276 275
277extern struct fib6_node *fib6_lookup(struct fib6_node *root, 276struct fib6_node *fib6_lookup(struct fib6_node *root,
278 const struct in6_addr *daddr, 277 const struct in6_addr *daddr,
279 const struct in6_addr *saddr); 278 const struct in6_addr *saddr);
280 279
281struct fib6_node *fib6_locate(struct fib6_node *root, 280struct fib6_node *fib6_locate(struct fib6_node *root,
282 const struct in6_addr *daddr, int dst_len, 281 const struct in6_addr *daddr, int dst_len,
283 const struct in6_addr *saddr, int src_len); 282 const struct in6_addr *saddr, int src_len);
284 283
285extern void fib6_clean_all_ro(struct net *net, 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
286 int (*func)(struct rt6_info *, void *arg), 285 int prune, void *arg);
287 int prune, void *arg);
288 286
289extern void fib6_clean_all(struct net *net, 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info);
290 int (*func)(struct rt6_info *, void *arg),
291 int prune, void *arg);
292 288
293extern int fib6_add(struct fib6_node *root, 289int fib6_del(struct rt6_info *rt, struct nl_info *info);
294 struct rt6_info *rt,
295 struct nl_info *info);
296 290
297extern int fib6_del(struct rt6_info *rt, 291void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info);
298 struct nl_info *info);
299 292
300extern void inet6_rt_notify(int event, struct rt6_info *rt, 293void fib6_run_gc(unsigned long expires, struct net *net, bool force);
301 struct nl_info *info);
302 294
303extern void fib6_run_gc(unsigned long expires, 295void fib6_gc_cleanup(void);
304 struct net *net, bool force);
305 296
306extern void fib6_gc_cleanup(void); 297int fib6_init(void);
307 298
308extern int fib6_init(void); 299int ipv6_route_open(struct inode *inode, struct file *file);
309 300
310#ifdef CONFIG_IPV6_MULTIPLE_TABLES 301#ifdef CONFIG_IPV6_MULTIPLE_TABLES
311extern int fib6_rules_init(void); 302int fib6_rules_init(void);
312extern void fib6_rules_cleanup(void); 303void fib6_rules_cleanup(void);
313#else 304#else
314static inline int fib6_rules_init(void) 305static inline int fib6_rules_init(void)
315{ 306{
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 2b786b7e3585..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/*
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 9c4d37ec45a1..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, 119static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer, 120 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh) 121 const struct ip_vs_iphdr *ipvsh)
129{ 122{
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); 123 return skb_header_pointer(skb, offset, len, buffer);
135} 124}
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,
142 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh)
144{
145 return skb_header_pointer(skb, offset, len, buffer);
146}
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;
@@ -1173,8 +1143,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1173 * IPVS core functions 1143 * IPVS core functions
1174 * (from ip_vs_core.c) 1144 * (from ip_vs_core.c)
1175 */ 1145 */
1176extern const char *ip_vs_proto_name(unsigned int proto); 1146const char *ip_vs_proto_name(unsigned int proto);
1177extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1147void ip_vs_init_hash_table(struct list_head *table, int rows);
1178#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)))
1179 1149
1180#define IP_VS_APP_TYPE_FTP 1 1150#define IP_VS_APP_TYPE_FTP 1
@@ -1237,22 +1207,22 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1237 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic_dec();
1238 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1239} 1209}
1240extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
1241extern 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);
1242 1212
1243struct 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,
1244 const union nf_inet_addr *daddr, 1214 const union nf_inet_addr *daddr,
1245 __be16 dport, unsigned int flags, 1215 __be16 dport, unsigned int flags,
1246 struct ip_vs_dest *dest, __u32 fwmark); 1216 struct ip_vs_dest *dest, __u32 fwmark);
1247extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1217void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1248 1218
1249extern const char * ip_vs_state_name(__u16 proto, int state); 1219const char *ip_vs_state_name(__u16 proto, int state);
1250 1220
1251extern 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);
1252extern int ip_vs_check_template(struct ip_vs_conn *ct); 1222int ip_vs_check_template(struct ip_vs_conn *ct);
1253extern void ip_vs_random_dropentry(struct net *net); 1223void ip_vs_random_dropentry(struct net *net);
1254extern int ip_vs_conn_init(void); 1224int ip_vs_conn_init(void);
1255extern void ip_vs_conn_cleanup(void); 1225void ip_vs_conn_cleanup(void);
1256 1226
1257static inline void ip_vs_control_del(struct ip_vs_conn *cp) 1227static inline void ip_vs_control_del(struct ip_vs_conn *cp)
1258{ 1228{
@@ -1317,37 +1287,36 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1317/* 1287/*
1318 * IPVS netns init & cleanup functions 1288 * IPVS netns init & cleanup functions
1319 */ 1289 */
1320extern int ip_vs_estimator_net_init(struct net *net); 1290int ip_vs_estimator_net_init(struct net *net);
1321extern int ip_vs_control_net_init(struct net *net); 1291int ip_vs_control_net_init(struct net *net);
1322extern int ip_vs_protocol_net_init(struct net *net); 1292int ip_vs_protocol_net_init(struct net *net);
1323extern int ip_vs_app_net_init(struct net *net); 1293int ip_vs_app_net_init(struct net *net);
1324extern int ip_vs_conn_net_init(struct net *net); 1294int ip_vs_conn_net_init(struct net *net);
1325extern int ip_vs_sync_net_init(struct net *net); 1295int ip_vs_sync_net_init(struct net *net);
1326extern void ip_vs_conn_net_cleanup(struct net *net); 1296void ip_vs_conn_net_cleanup(struct net *net);
1327extern void ip_vs_app_net_cleanup(struct net *net); 1297void ip_vs_app_net_cleanup(struct net *net);
1328extern void ip_vs_protocol_net_cleanup(struct net *net); 1298void ip_vs_protocol_net_cleanup(struct net *net);
1329extern void ip_vs_control_net_cleanup(struct net *net); 1299void ip_vs_control_net_cleanup(struct net *net);
1330extern void ip_vs_estimator_net_cleanup(struct net *net); 1300void ip_vs_estimator_net_cleanup(struct net *net);
1331extern void ip_vs_sync_net_cleanup(struct net *net); 1301void ip_vs_sync_net_cleanup(struct net *net);
1332extern void ip_vs_service_net_cleanup(struct net *net); 1302void ip_vs_service_net_cleanup(struct net *net);
1333 1303
1334/* 1304/*
1335 * IPVS application functions 1305 * IPVS application functions
1336 * (from ip_vs_app.c) 1306 * (from ip_vs_app.c)
1337 */ 1307 */
1338#define IP_VS_APP_MAX_PORTS 8 1308#define IP_VS_APP_MAX_PORTS 8
1339extern 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);
1340 struct ip_vs_app *app); 1310void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1341extern 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);
1342extern 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);
1343extern 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,
1344extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, 1314 __u16 port);
1345 __u16 proto, __u16 port); 1315int ip_vs_app_inc_get(struct ip_vs_app *inc);
1346extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 1316void ip_vs_app_inc_put(struct ip_vs_app *inc);
1347extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 1317
1348 1318int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1349extern 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);
1350extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1351 1320
1352int register_ip_vs_pe(struct ip_vs_pe *pe); 1321int register_ip_vs_pe(struct ip_vs_pe *pe);
1353int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1322int unregister_ip_vs_pe(struct ip_vs_pe *pe);
@@ -1368,17 +1337,15 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1368/* 1337/*
1369 * IPVS protocol functions (from ip_vs_proto.c) 1338 * IPVS protocol functions (from ip_vs_proto.c)
1370 */ 1339 */
1371extern int ip_vs_protocol_init(void); 1340int ip_vs_protocol_init(void);
1372extern void ip_vs_protocol_cleanup(void); 1341void ip_vs_protocol_cleanup(void);
1373extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1342void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
1374extern int *ip_vs_create_timeout_table(int *table, int size); 1343int *ip_vs_create_timeout_table(int *table, int size);
1375extern int 1344int ip_vs_set_state_timeout(int *table, int num, const char *const *names,
1376ip_vs_set_state_timeout(int *table, int num, const char *const *names, 1345 const char *name, int to);
1377 const char *name, int to); 1346void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
1378extern void 1347 const struct sk_buff *skb, int offset,
1379ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, 1348 const char *msg);
1380 const struct sk_buff *skb,
1381 int offset, const char *msg);
1382 1349
1383extern struct ip_vs_protocol ip_vs_protocol_tcp; 1350extern struct ip_vs_protocol ip_vs_protocol_tcp;
1384extern struct ip_vs_protocol ip_vs_protocol_udp; 1351extern struct ip_vs_protocol ip_vs_protocol_udp;
@@ -1391,22 +1358,22 @@ extern struct ip_vs_protocol ip_vs_protocol_sctp;
1391 * Registering/unregistering scheduler functions 1358 * Registering/unregistering scheduler functions
1392 * (from ip_vs_sched.c) 1359 * (from ip_vs_sched.c)
1393 */ 1360 */
1394extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1361int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1395extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1362int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1396extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1363int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1397 struct ip_vs_scheduler *scheduler); 1364 struct ip_vs_scheduler *scheduler);
1398extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, 1365void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1399 struct ip_vs_scheduler *sched); 1366 struct ip_vs_scheduler *sched);
1400extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1367struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1401extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1368void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1402extern struct ip_vs_conn * 1369struct ip_vs_conn *
1403ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1370ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1404 struct ip_vs_proto_data *pd, int *ignored, 1371 struct ip_vs_proto_data *pd, int *ignored,
1405 struct ip_vs_iphdr *iph); 1372 struct ip_vs_iphdr *iph);
1406extern 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,
1407 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); 1374 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1408 1375
1409extern 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);
1410 1377
1411 1378
1412/* 1379/*
@@ -1415,25 +1382,24 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1415extern struct ip_vs_stats ip_vs_stats; 1382extern struct ip_vs_stats ip_vs_stats;
1416extern int sysctl_ip_vs_sync_ver; 1383extern int sysctl_ip_vs_sync_ver;
1417 1384
1418extern struct ip_vs_service * 1385struct ip_vs_service *
1419ip_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,
1420 const union nf_inet_addr *vaddr, __be16 vport); 1387 const union nf_inet_addr *vaddr, __be16 vport);
1421 1388
1422extern bool 1389bool ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1423ip_vs_has_real_service(struct net *net, int af, __u16 protocol, 1390 const union nf_inet_addr *daddr, __be16 dport);
1424 const union nf_inet_addr *daddr, __be16 dport); 1391
1425 1392int ip_vs_use_count_inc(void);
1426extern int ip_vs_use_count_inc(void); 1393void ip_vs_use_count_dec(void);
1427extern void ip_vs_use_count_dec(void); 1394int ip_vs_register_nl_ioctl(void);
1428extern int ip_vs_register_nl_ioctl(void); 1395void ip_vs_unregister_nl_ioctl(void);
1429extern void ip_vs_unregister_nl_ioctl(void); 1396int ip_vs_control_init(void);
1430extern int ip_vs_control_init(void); 1397void ip_vs_control_cleanup(void);
1431extern void ip_vs_control_cleanup(void); 1398struct ip_vs_dest *
1432extern struct ip_vs_dest *
1433ip_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,
1434 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1400 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1435 __u16 protocol, __u32 fwmark, __u32 flags); 1401 __u16 protocol, __u32 fwmark, __u32 flags);
1436extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1402void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1437 1403
1438static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) 1404static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1439{ 1405{
@@ -1446,60 +1412,59 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1446 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1447} 1413}
1448 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
1449/* 1421/*
1450 * IPVS sync daemon data and function prototypes 1422 * IPVS sync daemon data and function prototypes
1451 * (from ip_vs_sync.c) 1423 * (from ip_vs_sync.c)
1452 */ 1424 */
1453extern 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);
1454 __u8 syncid); 1426int stop_sync_thread(struct net *net, int state);
1455extern int stop_sync_thread(struct net *net, int state); 1427void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1456extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1457
1458 1428
1459/* 1429/*
1460 * IPVS rate estimator prototypes (from ip_vs_est.c) 1430 * IPVS rate estimator prototypes (from ip_vs_est.c)
1461 */ 1431 */
1462extern 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);
1463extern 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);
1464extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1434void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1465extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1435void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1466 struct ip_vs_stats *stats); 1436 struct ip_vs_stats *stats);
1467 1437
1468/* 1438/*
1469 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1439 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1470 */ 1440 */
1471extern 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,
1472 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1442 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1473extern 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,
1474 struct ip_vs_protocol *pp, 1444 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1475 struct ip_vs_iphdr *iph); 1445int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1476extern 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);
1477 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1447int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1478extern 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);
1479 struct ip_vs_protocol *pp, 1449int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1480 struct ip_vs_iphdr *iph); 1450 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1481extern 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,
1482 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1452 struct ip_vs_protocol *pp, int offset,
1483extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1453 unsigned int hooknum, struct ip_vs_iphdr *iph);
1484 struct ip_vs_protocol *pp, int offset, 1454void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1485 unsigned int hooknum, struct ip_vs_iphdr *iph);
1486extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1487 1455
1488#ifdef CONFIG_IP_VS_IPV6 1456#ifdef CONFIG_IP_VS_IPV6
1489extern 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,
1490 struct ip_vs_protocol *pp, 1458 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1491 struct ip_vs_iphdr *iph); 1459int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1492extern 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);
1493 struct ip_vs_protocol *pp, 1461int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1494 struct ip_vs_iphdr *iph); 1462 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1495extern 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,
1496 struct ip_vs_protocol *pp, 1464 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1497 struct ip_vs_iphdr *iph); 1465int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1498extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1466 struct ip_vs_protocol *pp, int offset,
1499 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1467 unsigned int hooknum, struct ip_vs_iphdr *iph);
1500extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1501 struct ip_vs_protocol *pp, int offset,
1502 unsigned int hooknum, struct ip_vs_iphdr *iph);
1503#endif 1468#endif
1504 1469
1505#ifdef CONFIG_SYSCTL 1470#ifdef CONFIG_SYSCTL
@@ -1548,15 +1513,15 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
1548 return fwd; 1513 return fwd;
1549} 1514}
1550 1515
1551extern 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,
1552 struct ip_vs_conn *cp, int dir); 1517 struct ip_vs_conn *cp, int dir);
1553 1518
1554#ifdef CONFIG_IP_VS_IPV6 1519#ifdef CONFIG_IP_VS_IPV6
1555extern 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,
1556 struct ip_vs_conn *cp, int dir); 1521 struct ip_vs_conn *cp, int dir);
1557#endif 1522#endif
1558 1523
1559extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 1524__sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
1560 1525
1561static 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)
1562{ 1527{
@@ -1615,13 +1580,13 @@ static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1615#endif 1580#endif
1616} 1581}
1617 1582
1618extern 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,
1619 int outin); 1584 int outin);
1620extern int ip_vs_confirm_conntrack(struct sk_buff *skb); 1585int ip_vs_confirm_conntrack(struct sk_buff *skb);
1621extern 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,
1622 struct ip_vs_conn *cp, u_int8_t proto, 1587 struct ip_vs_conn *cp, u_int8_t proto,
1623 const __be16 port, int from_rs); 1588 const __be16 port, int from_rs);
1624extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); 1589void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1625 1590
1626#else 1591#else
1627 1592
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index bbf1c8fb8511..2a5f668cd683 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -244,14 +244,15 @@ struct ipv6_fl_socklist {
244 struct rcu_head rcu; 244 struct rcu_head rcu;
245}; 245};
246 246
247extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 247struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
248extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 248struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
249 struct ip6_flowlabel * fl, 249 struct ip6_flowlabel *fl,
250 struct ipv6_txoptions * fopt); 250 struct ipv6_txoptions *fopt);
251extern void fl6_free_socklist(struct sock *sk); 251void fl6_free_socklist(struct sock *sk);
252extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); 252int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
253extern int ip6_flowlabel_init(void); 253int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq);
254extern void ip6_flowlabel_cleanup(void); 254int ip6_flowlabel_init(void);
255void ip6_flowlabel_cleanup(void);
255 256
256static inline void fl6_sock_release(struct ip6_flowlabel *fl) 257static inline void fl6_sock_release(struct ip6_flowlabel *fl)
257{ 258{
@@ -259,7 +260,7 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
259 atomic_dec(&fl->users); 260 atomic_dec(&fl->users);
260} 261}
261 262
262extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 263void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
263 264
264int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, 265int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
265 struct icmp6hdr *thdr, int len); 266 struct icmp6hdr *thdr, int len);
@@ -267,19 +268,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, 268struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
268 struct sock *sk, struct flowi6 *fl6); 269 struct sock *sk, struct flowi6 *fl6);
269 270
270extern int ip6_ra_control(struct sock *sk, int sel); 271int ip6_ra_control(struct sock *sk, int sel);
271 272
272extern int ipv6_parse_hopopts(struct sk_buff *skb); 273int ipv6_parse_hopopts(struct sk_buff *skb);
273 274
274extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 275struct ipv6_txoptions *ipv6_dup_options(struct sock *sk,
275extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 276 struct ipv6_txoptions *opt);
276 int newtype, 277struct ipv6_txoptions *ipv6_renew_options(struct sock *sk,
277 struct ipv6_opt_hdr __user *newopt, 278 struct ipv6_txoptions *opt,
278 int newoptlen); 279 int newtype,
280 struct ipv6_opt_hdr __user *newopt,
281 int newoptlen);
279struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 282struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
280 struct ipv6_txoptions *opt); 283 struct ipv6_txoptions *opt);
281 284
282extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 285bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
283 286
284static inline bool ipv6_accept_ra(struct inet6_dev *idev) 287static inline bool ipv6_accept_ra(struct inet6_dev *idev)
285{ 288{
@@ -306,7 +309,7 @@ static inline int ip6_frag_mem(struct net *net)
306#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ 309#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
307#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 310#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
308 311
309extern int __ipv6_addr_type(const struct in6_addr *addr); 312int __ipv6_addr_type(const struct in6_addr *addr);
310static inline int ipv6_addr_type(const struct in6_addr *addr) 313static inline int ipv6_addr_type(const struct in6_addr *addr)
311{ 314{
312 return __ipv6_addr_type(addr) & 0xffff; 315 return __ipv6_addr_type(addr) & 0xffff;
@@ -537,14 +540,14 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
537} 540}
538 541
539/* more secured version of ipv6_addr_hash() */ 542/* more secured version of ipv6_addr_hash() */
540static inline u32 ipv6_addr_jhash(const struct in6_addr *a) 543static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
541{ 544{
542 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; 545 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
543 546
544 return jhash_3words(v, 547 return jhash_3words(v,
545 (__force u32)a->s6_addr32[2], 548 (__force u32)a->s6_addr32[2],
546 (__force u32)a->s6_addr32[3], 549 (__force u32)a->s6_addr32[3],
547 ipv6_hash_secret); 550 initval);
548} 551}
549 552
550static inline bool ipv6_addr_loopback(const struct in6_addr *a) 553static inline bool ipv6_addr_loopback(const struct in6_addr *a)
@@ -656,9 +659,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)); 659 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
657} 660}
658 661
659extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 662void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
660 663
661extern int ip6_dst_hoplimit(struct dst_entry *dst); 664int ip6_dst_hoplimit(struct dst_entry *dst);
662 665
663/* 666/*
664 * Header manipulation 667 * Header manipulation
@@ -682,83 +685,65 @@ static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
682 * rcv function (called from netdevice level) 685 * rcv function (called from netdevice level)
683 */ 686 */
684 687
685extern int ipv6_rcv(struct sk_buff *skb, 688int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
686 struct net_device *dev, 689 struct packet_type *pt, struct net_device *orig_dev);
687 struct packet_type *pt,
688 struct net_device *orig_dev);
689 690
690extern int ip6_rcv_finish(struct sk_buff *skb); 691int ip6_rcv_finish(struct sk_buff *skb);
691 692
692/* 693/*
693 * upper-layer output functions 694 * upper-layer output functions
694 */ 695 */
695extern int ip6_xmit(struct sock *sk, 696int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
696 struct sk_buff *skb, 697 struct ipv6_txoptions *opt, int tclass);
697 struct flowi6 *fl6, 698
698 struct ipv6_txoptions *opt, 699int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
699 int tclass); 700
700 701int ip6_append_data(struct sock *sk,
701extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 702 int getfrag(void *from, char *to, int offset, int len,
702 703 int odd, struct sk_buff *skb),
703extern int ip6_append_data(struct sock *sk, 704 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), 705 int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
705 void *from, 706 struct rt6_info *rt, unsigned int flags, int dontfrag);
706 int length, 707
707 int transhdrlen, 708int ip6_push_pending_frames(struct sock *sk);
708 int hlimit, 709
709 int tclass, 710void ip6_flush_pending_frames(struct sock *sk);
710 struct ipv6_txoptions *opt, 711
711 struct flowi6 *fl6, 712int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
712 struct rt6_info *rt, 713struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
713 unsigned int flags, 714 const struct in6_addr *final_dst,
714 int dontfrag); 715 bool can_sleep);
715 716struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
716extern int ip6_push_pending_frames(struct sock *sk); 717 const struct in6_addr *final_dst,
717 718 bool can_sleep);
718extern void ip6_flush_pending_frames(struct sock *sk); 719struct dst_entry *ip6_blackhole_route(struct net *net,
719 720 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 721
734/* 722/*
735 * skb processing functions 723 * skb processing functions
736 */ 724 */
737 725
738extern int ip6_output(struct sk_buff *skb); 726int ip6_output(struct sk_buff *skb);
739extern int ip6_forward(struct sk_buff *skb); 727int ip6_forward(struct sk_buff *skb);
740extern int ip6_input(struct sk_buff *skb); 728int ip6_input(struct sk_buff *skb);
741extern int ip6_mc_input(struct sk_buff *skb); 729int ip6_mc_input(struct sk_buff *skb);
742 730
743extern int __ip6_local_out(struct sk_buff *skb); 731int __ip6_local_out(struct sk_buff *skb);
744extern int ip6_local_out(struct sk_buff *skb); 732int ip6_local_out(struct sk_buff *skb);
745 733
746/* 734/*
747 * Extension header (options) processing 735 * Extension header (options) processing
748 */ 736 */
749 737
750extern void ipv6_push_nfrag_opts(struct sk_buff *skb, 738void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
751 struct ipv6_txoptions *opt, 739 u8 *proto, struct in6_addr **daddr_p);
752 u8 *proto, 740void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
753 struct in6_addr **daddr_p); 741 u8 *proto);
754extern void ipv6_push_frag_opts(struct sk_buff *skb,
755 struct ipv6_txoptions *opt,
756 u8 *proto);
757 742
758extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 743int ipv6_skip_exthdr(const struct sk_buff *, int start, u8 *nexthdrp,
759 u8 *nexthdrp, __be16 *frag_offp); 744 __be16 *frag_offp);
760 745
761extern bool ipv6_ext_hdr(u8 nexthdr); 746bool ipv6_ext_hdr(u8 nexthdr);
762 747
763enum { 748enum {
764 IP6_FH_F_FRAG = (1 << 0), 749 IP6_FH_F_FRAG = (1 << 0),
@@ -767,57 +752,44 @@ enum {
767}; 752};
768 753
769/* find specified header and get offset to it */ 754/* find specified header and get offset to it */
770extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 755int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, int target,
771 int target, unsigned short *fragoff, int *fragflg); 756 unsigned short *fragoff, int *fragflg);
772 757
773extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 758int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
774 759
775extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 760struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
776 const struct ipv6_txoptions *opt, 761 const struct ipv6_txoptions *opt,
777 struct in6_addr *orig); 762 struct in6_addr *orig);
778 763
779/* 764/*
780 * socket options (ipv6_sockglue.c) 765 * socket options (ipv6_sockglue.c)
781 */ 766 */
782 767
783extern int ipv6_setsockopt(struct sock *sk, int level, 768int ipv6_setsockopt(struct sock *sk, int level, int optname,
784 int optname, 769 char __user *optval, unsigned int optlen);
785 char __user *optval, 770int ipv6_getsockopt(struct sock *sk, int level, int optname,
786 unsigned int optlen); 771 char __user *optval, int __user *optlen);
787extern int ipv6_getsockopt(struct sock *sk, int level, 772int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
788 int optname, 773 char __user *optval, unsigned int optlen);
789 char __user *optval, 774int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
790 int __user *optlen); 775 char __user *optval, int __user *optlen);
791extern int compat_ipv6_setsockopt(struct sock *sk, 776
792 int level, 777int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
793 int optname, 778
794 char __user *optval, 779int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
795 unsigned int optlen); 780int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
796extern int compat_ipv6_getsockopt(struct sock *sk, 781void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
797 int level, 782 u32 info, u8 *payload);
798 int optname, 783void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
799 char __user *optval, 784void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
800 int __user *optlen); 785
801 786int inet6_release(struct socket *sock);
802extern int ip6_datagram_connect(struct sock *sk, 787int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
803 struct sockaddr *addr, int addr_len); 788int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
804 789 int peer);
805extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 790int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
806extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 791
807extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 792int inet6_hash_connect(struct inet_timewait_death_row *death_row,
808 u32 info, u8 *payload);
809extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
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); 793 struct sock *sk);
822 794
823/* 795/*
@@ -829,30 +801,27 @@ extern const struct proto_ops inet6_dgram_ops;
829struct group_source_req; 801struct group_source_req;
830struct group_filter; 802struct group_filter;
831 803
832extern int ip6_mc_source(int add, int omode, struct sock *sk, 804int ip6_mc_source(int add, int omode, struct sock *sk,
833 struct group_source_req *pgsr); 805 struct group_source_req *pgsr);
834extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); 806int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
835extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, 807int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
836 struct group_filter __user *optval, 808 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 809
841#ifdef CONFIG_PROC_FS 810#ifdef CONFIG_PROC_FS
842extern int ac6_proc_init(struct net *net); 811int ac6_proc_init(struct net *net);
843extern void ac6_proc_exit(struct net *net); 812void ac6_proc_exit(struct net *net);
844extern int raw6_proc_init(void); 813int raw6_proc_init(void);
845extern void raw6_proc_exit(void); 814void raw6_proc_exit(void);
846extern int tcp6_proc_init(struct net *net); 815int tcp6_proc_init(struct net *net);
847extern void tcp6_proc_exit(struct net *net); 816void tcp6_proc_exit(struct net *net);
848extern int udp6_proc_init(struct net *net); 817int udp6_proc_init(struct net *net);
849extern void udp6_proc_exit(struct net *net); 818void udp6_proc_exit(struct net *net);
850extern int udplite6_proc_init(void); 819int udplite6_proc_init(void);
851extern void udplite6_proc_exit(void); 820void udplite6_proc_exit(void);
852extern int ipv6_misc_proc_init(void); 821int ipv6_misc_proc_init(void);
853extern void ipv6_misc_proc_exit(void); 822void ipv6_misc_proc_exit(void);
854extern int snmp6_register_dev(struct inet6_dev *idev); 823int snmp6_register_dev(struct inet6_dev *idev);
855extern int snmp6_unregister_dev(struct inet6_dev *idev); 824int snmp6_unregister_dev(struct inet6_dev *idev);
856 825
857#else 826#else
858static inline int ac6_proc_init(struct net *net) { return 0; } 827static inline int ac6_proc_init(struct net *net) { return 0; }
@@ -865,10 +834,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
865extern struct ctl_table ipv6_route_table_template[]; 834extern struct ctl_table ipv6_route_table_template[];
866extern struct ctl_table ipv6_icmp_table_template[]; 835extern struct ctl_table ipv6_icmp_table_template[];
867 836
868extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 837struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
869extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 838struct ctl_table *ipv6_route_sysctl_init(struct net *net);
870extern int ipv6_sysctl_register(void); 839int ipv6_sysctl_register(void);
871extern void ipv6_sysctl_unregister(void); 840void ipv6_sysctl_unregister(void);
872#endif 841#endif
873 842
874#endif /* _NET_IPV6_H */ 843#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/mrp.h b/include/net/mrp.h
index 0f7558b638ae..31912c3be772 100644
--- a/include/net/mrp.h
+++ b/include/net/mrp.h
@@ -126,19 +126,17 @@ struct mrp_port {
126 struct rcu_head rcu; 126 struct rcu_head rcu;
127}; 127};
128 128
129extern int mrp_register_application(struct mrp_application *app); 129int mrp_register_application(struct mrp_application *app);
130extern void mrp_unregister_application(struct mrp_application *app); 130void mrp_unregister_application(struct mrp_application *app);
131 131
132extern int mrp_init_applicant(struct net_device *dev, 132int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
133 struct mrp_application *app); 133void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
134extern void mrp_uninit_applicant(struct net_device *dev, 134
135 struct mrp_application *app); 135int mrp_request_join(const struct net_device *dev,
136 136 const struct mrp_application *app,
137extern int mrp_request_join(const struct net_device *dev, 137 const void *value, u8 len, u8 type);
138 const struct mrp_application *app, 138void mrp_request_leave(const struct net_device *dev,
139 const void *value, u8 len, u8 type); 139 const struct mrp_application *app,
140extern void mrp_request_leave(const struct net_device *dev, 140 const void *value, u8 len, u8 type);
141 const struct mrp_application *app,
142 const void *value, u8 len, u8 type);
143 141
144#endif /* _NET_MRP_H */ 142#endif /* _NET_MRP_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ea0cc26ab70e..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,60 +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);
193extern int ndisc_late_init(void); 193int ndisc_late_init(void);
194 194
195extern void ndisc_late_cleanup(void); 195void ndisc_late_cleanup(void);
196extern void ndisc_cleanup(void); 196void ndisc_cleanup(void);
197 197
198extern int ndisc_rcv(struct sk_buff *skb); 198int ndisc_rcv(struct sk_buff *skb);
199 199
200extern void ndisc_send_ns(struct net_device *dev, 200void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
201 struct neighbour *neigh, 201 const struct in6_addr *solicit,
202 const struct in6_addr *solicit, 202 const struct in6_addr *daddr, const struct in6_addr *saddr);
203 const struct in6_addr *daddr,
204 const struct in6_addr *saddr);
205 203
206extern void ndisc_send_rs(struct net_device *dev, 204void ndisc_send_rs(struct net_device *dev,
207 const struct in6_addr *saddr, 205 const struct in6_addr *saddr, const struct in6_addr *daddr);
208 const struct in6_addr *daddr); 206void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
209extern void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, 207 const struct in6_addr *daddr,
210 const struct in6_addr *daddr, 208 const struct in6_addr *solicited_addr,
211 const struct in6_addr *solicited_addr, 209 bool router, bool solicited, bool override, bool inc_opt);
212 bool router, bool solicited, bool override,
213 bool inc_opt);
214 210
215extern void ndisc_send_redirect(struct sk_buff *skb, 211void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target);
216 const struct in6_addr *target);
217 212
218extern 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,
219 struct net_device *dev, int dir); 214 int dir);
220 215
221 216
222/* 217/*
223 * IGMP 218 * IGMP
224 */ 219 */
225extern int igmp6_init(void); 220int igmp6_init(void);
226 221
227extern void igmp6_cleanup(void); 222void igmp6_cleanup(void);
228 223
229extern int igmp6_event_query(struct sk_buff *skb); 224int igmp6_event_query(struct sk_buff *skb);
230 225
231extern int igmp6_event_report(struct sk_buff *skb); 226int igmp6_event_report(struct sk_buff *skb);
232 227
233 228
234#ifdef CONFIG_SYSCTL 229#ifdef CONFIG_SYSCTL
235extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 230int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
236 int write, 231 void __user *buffer, size_t *lenp, loff_t *ppos);
237 void __user *buffer,
238 size_t *lenp,
239 loff_t *ppos);
240int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, 232int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
241 void __user *oldval, size_t __user *oldlenp, 233 void __user *oldval, size_t __user *oldlenp,
242 void __user *newval, size_t newlen); 234 void __user *newval, size_t newlen);
243#endif 235#endif
244 236
245extern void inet6_ifinfo_notify(int event, 237void inet6_ifinfo_notify(int event, struct inet6_dev *idev);
246 struct inet6_dev *idev);
247 238
248#endif 239#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 9d22f08896c6..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;
@@ -101,6 +102,9 @@ struct net {
101#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 102#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
102 struct netns_ct ct; 103 struct netns_ct ct;
103#endif 104#endif
105#if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
106 struct netns_nftables nft;
107#endif
104#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 108#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
105 struct netns_nf_frag nf_frag; 109 struct netns_nf_frag nf_frag;
106#endif 110#endif
@@ -137,8 +141,8 @@ struct net {
137extern struct net init_net; 141extern struct net init_net;
138 142
139#ifdef CONFIG_NET_NS 143#ifdef CONFIG_NET_NS
140extern struct net *copy_net_ns(unsigned long flags, 144struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
141 struct user_namespace *user_ns, struct net *old_net); 145 struct net *old_net);
142 146
143#else /* CONFIG_NET_NS */ 147#else /* CONFIG_NET_NS */
144#include <linux/sched.h> 148#include <linux/sched.h>
@@ -155,11 +159,11 @@ static inline struct net *copy_net_ns(unsigned long flags,
155 159
156extern struct list_head net_namespace_list; 160extern struct list_head net_namespace_list;
157 161
158extern struct net *get_net_ns_by_pid(pid_t pid); 162struct net *get_net_ns_by_pid(pid_t pid);
159extern struct net *get_net_ns_by_fd(int pid); 163struct net *get_net_ns_by_fd(int pid);
160 164
161#ifdef CONFIG_NET_NS 165#ifdef CONFIG_NET_NS
162extern void __put_net(struct net *net); 166void __put_net(struct net *net);
163 167
164static inline struct net *get_net(struct net *net) 168static inline struct net *get_net(struct net *net)
165{ 169{
@@ -191,7 +195,7 @@ int net_eq(const struct net *net1, const struct net *net2)
191 return net1 == net2; 195 return net1 == net2;
192} 196}
193 197
194extern void net_drop_ns(void *); 198void net_drop_ns(void *);
195 199
196#else 200#else
197 201
@@ -308,19 +312,19 @@ struct pernet_operations {
308 * device which caused kernel oops, and panics during network 312 * device which caused kernel oops, and panics during network
309 * namespace cleanup. So please don't get this wrong. 313 * namespace cleanup. So please don't get this wrong.
310 */ 314 */
311extern int register_pernet_subsys(struct pernet_operations *); 315int register_pernet_subsys(struct pernet_operations *);
312extern void unregister_pernet_subsys(struct pernet_operations *); 316void unregister_pernet_subsys(struct pernet_operations *);
313extern int register_pernet_device(struct pernet_operations *); 317int register_pernet_device(struct pernet_operations *);
314extern void unregister_pernet_device(struct pernet_operations *); 318void unregister_pernet_device(struct pernet_operations *);
315 319
316struct ctl_table; 320struct ctl_table;
317struct ctl_table_header; 321struct ctl_table_header;
318 322
319#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
320extern int net_sysctl_init(void); 324int net_sysctl_init(void);
321extern struct ctl_table_header *register_net_sysctl(struct net *net, 325struct ctl_table_header *register_net_sysctl(struct net *net, const char *path,
322 const char *path, struct ctl_table *table); 326 struct ctl_table *table);
323extern void unregister_net_sysctl_table(struct ctl_table_header *header); 327void unregister_net_sysctl_table(struct ctl_table_header *header);
324#else 328#else
325static inline int net_sysctl_init(void) { return 0; } 329static inline int net_sysctl_init(void) { return 0; }
326static 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 88a1d4060d52..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)
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 f572f313d6f1..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 bool 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..3f67704f3747 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -103,8 +103,8 @@ void ping_seq_stop(struct seq_file *seq, void *v);
103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo); 103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo);
104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo); 104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo);
105 105
106extern int __init ping_proc_init(void); 106int __init ping_proc_init(void);
107extern void ping_proc_exit(void); 107void ping_proc_exit(void);
108#endif 108#endif
109 109
110void __init ping_init(void); 110void __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/secure_seq.h b/include/net/secure_seq.h
index c2e542b27a5a..f257486f17be 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,18 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern __u32 secure_ip_id(__be32 daddr); 6__u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ipv6_id(const __be32 daddr[4]); 7__u32 secure_ipv6_id(const __be32 daddr[4]);
8extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10 __be16 dport); 10 __be16 dport);
11extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, 11__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
12 __be16 sport, __be16 dport); 12 __be16 sport, __be16 dport);
13extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, 13__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
14 __be16 sport, __be16 dport); 14 __be16 sport, __be16 dport);
15extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, 15u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
16 __be16 sport, __be16 dport); 16 __be16 sport, __be16 dport);
17extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, 17u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
18 __be16 sport, __be16 dport); 18 __be16 sport, __be16 dport);
19 19
20#endif /* _NET_SECURE_SEQ */ 20#endif /* _NET_SECURE_SEQ */
diff --git a/include/net/sock.h b/include/net/sock.h
index 808cbc2ec6c1..e3a18ff0c38b 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;
@@ -751,7 +768,7 @@ static inline int sk_stream_wspace(const struct sock *sk)
751 return sk->sk_sndbuf - sk->sk_wmem_queued; 768 return sk->sk_sndbuf - sk->sk_wmem_queued;
752} 769}
753 770
754extern void sk_stream_write_space(struct sock *sk); 771void sk_stream_write_space(struct sock *sk);
755 772
756/* OOB backlog add */ 773/* OOB backlog add */
757static 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)
@@ -793,7 +810,7 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
793 return 0; 810 return 0;
794} 811}
795 812
796extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb); 813int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
797 814
798static 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)
799{ 816{
@@ -858,15 +875,15 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
858 __rc; \ 875 __rc; \
859 }) 876 })
860 877
861extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); 878int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
862extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); 879int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
863extern void sk_stream_wait_close(struct sock *sk, long timeo_p); 880void sk_stream_wait_close(struct sock *sk, long timeo_p);
864extern int sk_stream_error(struct sock *sk, int flags, int err); 881int sk_stream_error(struct sock *sk, int flags, int err);
865extern void sk_stream_kill_queues(struct sock *sk); 882void sk_stream_kill_queues(struct sock *sk);
866extern void sk_set_memalloc(struct sock *sk); 883void sk_set_memalloc(struct sock *sk);
867extern void sk_clear_memalloc(struct sock *sk); 884void sk_clear_memalloc(struct sock *sk);
868 885
869extern int sk_wait_data(struct sock *sk, long *timeo); 886int sk_wait_data(struct sock *sk, long *timeo);
870 887
871struct request_sock_ops; 888struct request_sock_ops;
872struct timewait_sock_ops; 889struct timewait_sock_ops;
@@ -1019,10 +1036,10 @@ enum cg_proto_flags {
1019 1036
1020struct cg_proto { 1037struct cg_proto {
1021 void (*enter_memory_pressure)(struct sock *sk); 1038 void (*enter_memory_pressure)(struct sock *sk);
1022 struct res_counter *memory_allocated; /* Current allocated memory. */ 1039 struct res_counter memory_allocated; /* Current allocated memory. */
1023 struct percpu_counter *sockets_allocated; /* Current number of sockets. */ 1040 struct percpu_counter sockets_allocated; /* Current number of sockets. */
1024 int *memory_pressure; 1041 int memory_pressure;
1025 long *sysctl_mem; 1042 long sysctl_mem[3];
1026 unsigned long flags; 1043 unsigned long flags;
1027 /* 1044 /*
1028 * memcg field is used to find which memcg we belong directly 1045 * memcg field is used to find which memcg we belong directly
@@ -1036,8 +1053,8 @@ struct cg_proto {
1036 struct mem_cgroup *memcg; 1053 struct mem_cgroup *memcg;
1037}; 1054};
1038 1055
1039extern int proto_register(struct proto *prot, int alloc_slab); 1056int proto_register(struct proto *prot, int alloc_slab);
1040extern void proto_unregister(struct proto *prot); 1057void proto_unregister(struct proto *prot);
1041 1058
1042static inline bool memcg_proto_active(struct cg_proto *cg_proto) 1059static inline bool memcg_proto_active(struct cg_proto *cg_proto)
1043{ 1060{
@@ -1118,7 +1135,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk)
1118 return false; 1135 return false;
1119 1136
1120 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1137 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1121 return !!*sk->sk_cgrp->memory_pressure; 1138 return !!sk->sk_cgrp->memory_pressure;
1122 1139
1123 return !!*sk->sk_prot->memory_pressure; 1140 return !!*sk->sk_prot->memory_pressure;
1124} 1141}
@@ -1138,8 +1155,8 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
1138 struct proto *prot = sk->sk_prot; 1155 struct proto *prot = sk->sk_prot;
1139 1156
1140 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1157 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1141 if (*cg_proto->memory_pressure) 1158 if (cg_proto->memory_pressure)
1142 *cg_proto->memory_pressure = 0; 1159 cg_proto->memory_pressure = 0;
1143 } 1160 }
1144 1161
1145} 1162}
@@ -1175,7 +1192,7 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1175 struct res_counter *fail; 1192 struct res_counter *fail;
1176 int ret; 1193 int ret;
1177 1194
1178 ret = res_counter_charge_nofail(prot->memory_allocated, 1195 ret = res_counter_charge_nofail(&prot->memory_allocated,
1179 amt << PAGE_SHIFT, &fail); 1196 amt << PAGE_SHIFT, &fail);
1180 if (ret < 0) 1197 if (ret < 0)
1181 *parent_status = OVER_LIMIT; 1198 *parent_status = OVER_LIMIT;
@@ -1184,13 +1201,13 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1184static inline void memcg_memory_allocated_sub(struct cg_proto *prot, 1201static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1185 unsigned long amt) 1202 unsigned long amt)
1186{ 1203{
1187 res_counter_uncharge(prot->memory_allocated, amt << PAGE_SHIFT); 1204 res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT);
1188} 1205}
1189 1206
1190static inline u64 memcg_memory_allocated_read(struct cg_proto *prot) 1207static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1191{ 1208{
1192 u64 ret; 1209 u64 ret;
1193 ret = res_counter_read_u64(prot->memory_allocated, RES_USAGE); 1210 ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE);
1194 return ret >> PAGE_SHIFT; 1211 return ret >> PAGE_SHIFT;
1195} 1212}
1196 1213
@@ -1238,7 +1255,7 @@ static inline void sk_sockets_allocated_dec(struct sock *sk)
1238 struct cg_proto *cg_proto = sk->sk_cgrp; 1255 struct cg_proto *cg_proto = sk->sk_cgrp;
1239 1256
1240 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1257 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1241 percpu_counter_dec(cg_proto->sockets_allocated); 1258 percpu_counter_dec(&cg_proto->sockets_allocated);
1242 } 1259 }
1243 1260
1244 percpu_counter_dec(prot->sockets_allocated); 1261 percpu_counter_dec(prot->sockets_allocated);
@@ -1252,7 +1269,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk)
1252 struct cg_proto *cg_proto = sk->sk_cgrp; 1269 struct cg_proto *cg_proto = sk->sk_cgrp;
1253 1270
1254 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1271 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1255 percpu_counter_inc(cg_proto->sockets_allocated); 1272 percpu_counter_inc(&cg_proto->sockets_allocated);
1256 } 1273 }
1257 1274
1258 percpu_counter_inc(prot->sockets_allocated); 1275 percpu_counter_inc(prot->sockets_allocated);
@@ -1264,7 +1281,7 @@ sk_sockets_allocated_read_positive(struct sock *sk)
1264 struct proto *prot = sk->sk_prot; 1281 struct proto *prot = sk->sk_prot;
1265 1282
1266 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1283 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1267 return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); 1284 return percpu_counter_read_positive(&sk->sk_cgrp->sockets_allocated);
1268 1285
1269 return percpu_counter_read_positive(prot->sockets_allocated); 1286 return percpu_counter_read_positive(prot->sockets_allocated);
1270} 1287}
@@ -1292,8 +1309,8 @@ proto_memory_pressure(struct proto *prot)
1292 1309
1293#ifdef CONFIG_PROC_FS 1310#ifdef CONFIG_PROC_FS
1294/* Called with local bh disabled */ 1311/* Called with local bh disabled */
1295extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); 1312void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
1296extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1313int sock_prot_inuse_get(struct net *net, struct proto *proto);
1297#else 1314#else
1298static inline void sock_prot_inuse_add(struct net *net, struct proto *prot, 1315static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1299 int inc) 1316 int inc)
@@ -1369,8 +1386,8 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
1369/* 1386/*
1370 * Functions for memory accounting 1387 * Functions for memory accounting
1371 */ 1388 */
1372extern int __sk_mem_schedule(struct sock *sk, int size, int kind); 1389int __sk_mem_schedule(struct sock *sk, int size, int kind);
1373extern void __sk_mem_reclaim(struct sock *sk); 1390void __sk_mem_reclaim(struct sock *sk);
1374 1391
1375#define SK_MEM_QUANTUM ((int)PAGE_SIZE) 1392#define SK_MEM_QUANTUM ((int)PAGE_SIZE)
1376#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) 1393#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
@@ -1478,14 +1495,14 @@ do { \
1478 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1495 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1479} while (0) 1496} while (0)
1480 1497
1481extern void lock_sock_nested(struct sock *sk, int subclass); 1498void lock_sock_nested(struct sock *sk, int subclass);
1482 1499
1483static inline void lock_sock(struct sock *sk) 1500static inline void lock_sock(struct sock *sk)
1484{ 1501{
1485 lock_sock_nested(sk, 0); 1502 lock_sock_nested(sk, 0);
1486} 1503}
1487 1504
1488extern void release_sock(struct sock *sk); 1505void release_sock(struct sock *sk);
1489 1506
1490/* BH context may only use the following locking interface. */ 1507/* BH context may only use the following locking interface. */
1491#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 1508#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
@@ -1494,7 +1511,7 @@ extern void release_sock(struct sock *sk);
1494 SINGLE_DEPTH_NESTING) 1511 SINGLE_DEPTH_NESTING)
1495#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1512#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
1496 1513
1497extern bool lock_sock_fast(struct sock *sk); 1514bool lock_sock_fast(struct sock *sk);
1498/** 1515/**
1499 * unlock_sock_fast - complement of lock_sock_fast 1516 * unlock_sock_fast - complement of lock_sock_fast
1500 * @sk: socket 1517 * @sk: socket
@@ -1512,108 +1529,84 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
1512} 1529}
1513 1530
1514 1531
1515extern struct sock *sk_alloc(struct net *net, int family, 1532struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1516 gfp_t priority, 1533 struct proto *prot);
1517 struct proto *prot); 1534void sk_free(struct sock *sk);
1518extern void sk_free(struct sock *sk); 1535void sk_release_kernel(struct sock *sk);
1519extern void sk_release_kernel(struct sock *sk); 1536struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1520extern struct sock *sk_clone_lock(const struct sock *sk, 1537
1521 const gfp_t priority); 1538struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1522 1539 gfp_t priority);
1523extern struct sk_buff *sock_wmalloc(struct sock *sk, 1540struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1524 unsigned long size, int force, 1541 gfp_t priority);
1525 gfp_t priority); 1542void sock_wfree(struct sk_buff *skb);
1526extern struct sk_buff *sock_rmalloc(struct sock *sk, 1543void skb_orphan_partial(struct sk_buff *skb);
1527 unsigned long size, int force, 1544void sock_rfree(struct sk_buff *skb);
1528 gfp_t priority); 1545void sock_edemux(struct sk_buff *skb);
1529extern void sock_wfree(struct sk_buff *skb); 1546
1530extern void skb_orphan_partial(struct sk_buff *skb); 1547int sock_setsockopt(struct socket *sock, int level, int op,
1531extern void sock_rfree(struct sk_buff *skb); 1548 char __user *optval, unsigned int optlen);
1532extern void sock_edemux(struct sk_buff *skb); 1549
1533 1550int sock_getsockopt(struct socket *sock, int level, int op,
1534extern int sock_setsockopt(struct socket *sock, int level, 1551 char __user *optval, int __user *optlen);
1535 int op, char __user *optval, 1552struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1536 unsigned int optlen); 1553 int noblock, int *errcode);
1537 1554struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1538extern int sock_getsockopt(struct socket *sock, int level, 1555 unsigned long data_len, int noblock,
1539 int op, char __user *optval, 1556 int *errcode, int max_page_order);
1540 int __user *optlen); 1557void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1541extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1558void sock_kfree_s(struct sock *sk, void *mem, int size);
1542 unsigned long size, 1559void sk_send_sigurg(struct sock *sk);
1543 int noblock,
1544 int *errcode);
1545extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1546 unsigned long header_len,
1547 unsigned long data_len,
1548 int noblock,
1549 int *errcode,
1550 int max_page_order);
1551extern void *sock_kmalloc(struct sock *sk, int size,
1552 gfp_t priority);
1553extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1554extern void sk_send_sigurg(struct sock *sk);
1555 1560
1556/* 1561/*
1557 * Functions to fill in entries in struct proto_ops when a protocol 1562 * Functions to fill in entries in struct proto_ops when a protocol
1558 * does not implement a particular function. 1563 * does not implement a particular function.
1559 */ 1564 */
1560extern int sock_no_bind(struct socket *, 1565int sock_no_bind(struct socket *, struct sockaddr *, int);
1561 struct sockaddr *, int); 1566int sock_no_connect(struct socket *, struct sockaddr *, int, int);
1562extern int sock_no_connect(struct socket *, 1567int sock_no_socketpair(struct socket *, struct socket *);
1563 struct sockaddr *, int, int); 1568int sock_no_accept(struct socket *, struct socket *, int);
1564extern int sock_no_socketpair(struct socket *, 1569int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1565 struct socket *); 1570unsigned int sock_no_poll(struct file *, struct socket *,
1566extern int sock_no_accept(struct socket *, 1571 struct poll_table_struct *);
1567 struct socket *, int); 1572int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1568extern int sock_no_getname(struct socket *, 1573int sock_no_listen(struct socket *, int);
1569 struct sockaddr *, int *, int); 1574int sock_no_shutdown(struct socket *, int);
1570extern unsigned int sock_no_poll(struct file *, struct socket *, 1575int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1571 struct poll_table_struct *); 1576int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1572extern int sock_no_ioctl(struct socket *, unsigned int, 1577int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t);
1573 unsigned long); 1578int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t,
1574extern int sock_no_listen(struct socket *, int); 1579 int);
1575extern int sock_no_shutdown(struct socket *, int); 1580int sock_no_mmap(struct file *file, struct socket *sock,
1576extern int sock_no_getsockopt(struct socket *, int , int, 1581 struct vm_area_struct *vma);
1577 char __user *, int __user *); 1582ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1578extern int sock_no_setsockopt(struct socket *, int, int, 1583 size_t size, int flags);
1579 char __user *, unsigned int);
1580extern int sock_no_sendmsg(struct kiocb *, struct socket *,
1581 struct msghdr *, size_t);
1582extern int sock_no_recvmsg(struct kiocb *, struct socket *,
1583 struct msghdr *, size_t, int);
1584extern int sock_no_mmap(struct file *file,
1585 struct socket *sock,
1586 struct vm_area_struct *vma);
1587extern ssize_t sock_no_sendpage(struct socket *sock,
1588 struct page *page,
1589 int offset, size_t size,
1590 int flags);
1591 1584
1592/* 1585/*
1593 * Functions to fill in entries in struct proto_ops when a protocol 1586 * Functions to fill in entries in struct proto_ops when a protocol
1594 * uses the inet style. 1587 * uses the inet style.
1595 */ 1588 */
1596extern int sock_common_getsockopt(struct socket *sock, int level, int optname, 1589int sock_common_getsockopt(struct socket *sock, int level, int optname,
1597 char __user *optval, int __user *optlen); 1590 char __user *optval, int __user *optlen);
1598extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1591int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1599 struct msghdr *msg, size_t size, int flags); 1592 struct msghdr *msg, size_t size, int flags);
1600extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1593int sock_common_setsockopt(struct socket *sock, int level, int optname,
1601 char __user *optval, unsigned int optlen); 1594 char __user *optval, unsigned int optlen);
1602extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1595int compat_sock_common_getsockopt(struct socket *sock, int level,
1603 int optname, char __user *optval, int __user *optlen); 1596 int optname, char __user *optval, int __user *optlen);
1604extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1597int compat_sock_common_setsockopt(struct socket *sock, int level,
1605 int optname, char __user *optval, unsigned int optlen); 1598 int optname, char __user *optval, unsigned int optlen);
1606 1599
1607extern void sk_common_release(struct sock *sk); 1600void sk_common_release(struct sock *sk);
1608 1601
1609/* 1602/*
1610 * Default socket callbacks and setup code 1603 * Default socket callbacks and setup code
1611 */ 1604 */
1612 1605
1613/* Initialise core socket variables */ 1606/* Initialise core socket variables */
1614extern void sock_init_data(struct socket *sock, struct sock *sk); 1607void sock_init_data(struct socket *sock, struct sock *sk);
1615 1608
1616extern void sk_filter_release_rcu(struct rcu_head *rcu); 1609void sk_filter_release_rcu(struct rcu_head *rcu);
1617 1610
1618/** 1611/**
1619 * sk_filter_release - release a socket filter 1612 * sk_filter_release - release a socket filter
@@ -1671,9 +1664,12 @@ static inline void sock_put(struct sock *sk)
1671 if (atomic_dec_and_test(&sk->sk_refcnt)) 1664 if (atomic_dec_and_test(&sk->sk_refcnt))
1672 sk_free(sk); 1665 sk_free(sk);
1673} 1666}
1667/* Generic version of sock_put(), dealing with all sockets
1668 * (TCP_TIMEWAIT, ESTABLISHED...)
1669 */
1670void sock_gen_put(struct sock *sk);
1674 1671
1675extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, 1672int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested);
1676 const int nested);
1677 1673
1678static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) 1674static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
1679{ 1675{
@@ -1727,8 +1723,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1727 write_unlock_bh(&sk->sk_callback_lock); 1723 write_unlock_bh(&sk->sk_callback_lock);
1728} 1724}
1729 1725
1730extern kuid_t sock_i_uid(struct sock *sk); 1726kuid_t sock_i_uid(struct sock *sk);
1731extern unsigned long sock_i_ino(struct sock *sk); 1727unsigned long sock_i_ino(struct sock *sk);
1732 1728
1733static inline struct dst_entry * 1729static inline struct dst_entry *
1734__sk_dst_get(struct sock *sk) 1730__sk_dst_get(struct sock *sk)
@@ -1750,8 +1746,6 @@ sk_dst_get(struct sock *sk)
1750 return dst; 1746 return dst;
1751} 1747}
1752 1748
1753extern void sk_reset_txq(struct sock *sk);
1754
1755static inline void dst_negative_advice(struct sock *sk) 1749static inline void dst_negative_advice(struct sock *sk)
1756{ 1750{
1757 struct dst_entry *ndst, *dst = __sk_dst_get(sk); 1751 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
@@ -1761,7 +1755,7 @@ static inline void dst_negative_advice(struct sock *sk)
1761 1755
1762 if (ndst != dst) { 1756 if (ndst != dst) {
1763 rcu_assign_pointer(sk->sk_dst_cache, ndst); 1757 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1764 sk_reset_txq(sk); 1758 sk_tx_queue_clear(sk);
1765 } 1759 }
1766 } 1760 }
1767} 1761}
@@ -1803,16 +1797,16 @@ sk_dst_reset(struct sock *sk)
1803 spin_unlock(&sk->sk_dst_lock); 1797 spin_unlock(&sk->sk_dst_lock);
1804} 1798}
1805 1799
1806extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1800struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1807 1801
1808extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1802struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1809 1803
1810static inline bool sk_can_gso(const struct sock *sk) 1804static inline bool sk_can_gso(const struct sock *sk)
1811{ 1805{
1812 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1806 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1813} 1807}
1814 1808
1815extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1809void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1816 1810
1817static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) 1811static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
1818{ 1812{
@@ -2025,14 +2019,14 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2025 sk_mem_charge(sk, skb->truesize); 2019 sk_mem_charge(sk, skb->truesize);
2026} 2020}
2027 2021
2028extern void sk_reset_timer(struct sock *sk, struct timer_list *timer, 2022void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2029 unsigned long expires); 2023 unsigned long expires);
2030 2024
2031extern void sk_stop_timer(struct sock *sk, struct timer_list *timer); 2025void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2032 2026
2033extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 2027int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2034 2028
2035extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); 2029int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2036 2030
2037/* 2031/*
2038 * Recover an error report and clear atomically 2032 * Recover an error report and clear atomically
@@ -2100,7 +2094,7 @@ static inline struct page_frag *sk_page_frag(struct sock *sk)
2100 return &sk->sk_frag; 2094 return &sk->sk_frag;
2101} 2095}
2102 2096
2103extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); 2097bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2104 2098
2105/* 2099/*
2106 * Default write policy as shown to user space via poll/select/SIGIO 2100 * Default write policy as shown to user space via poll/select/SIGIO
@@ -2138,10 +2132,10 @@ static inline int sock_intr_errno(long timeo)
2138 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 2132 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2139} 2133}
2140 2134
2141extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 2135void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2142 struct sk_buff *skb); 2136 struct sk_buff *skb);
2143extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2137void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2144 struct sk_buff *skb); 2138 struct sk_buff *skb);
2145 2139
2146static inline void 2140static inline void
2147sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 2141sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -2174,8 +2168,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2174 __sock_recv_wifi_status(msg, sk, skb); 2168 __sock_recv_wifi_status(msg, sk, skb);
2175} 2169}
2176 2170
2177extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2171void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2178 struct sk_buff *skb); 2172 struct sk_buff *skb);
2179 2173
2180static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2174static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2181 struct sk_buff *skb) 2175 struct sk_buff *skb)
@@ -2200,7 +2194,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2200 * 2194 *
2201 * Currently only depends on SOCK_TIMESTAMPING* flags. 2195 * Currently only depends on SOCK_TIMESTAMPING* flags.
2202 */ 2196 */
2203extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2197void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2204 2198
2205/** 2199/**
2206 * sk_eat_skb - Release a skb if it is no longer needed 2200 * sk_eat_skb - Release a skb if it is no longer needed
@@ -2264,11 +2258,11 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2264 return NULL; 2258 return NULL;
2265} 2259}
2266 2260
2267extern void sock_enable_timestamp(struct sock *sk, int flag); 2261void sock_enable_timestamp(struct sock *sk, int flag);
2268extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2262int sock_get_timestamp(struct sock *, struct timeval __user *);
2269extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2263int sock_get_timestampns(struct sock *, struct timespec __user *);
2270extern int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, 2264int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2271 int level, int type); 2265 int type);
2272 2266
2273/* 2267/*
2274 * Enable debug/info messages 2268 * 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_host.h b/include/scsi/scsi_host.h
index 755243572219..546084964d55 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -598,9 +598,12 @@ struct Scsi_Host {
598 unsigned int host_eh_scheduled; /* EH scheduled without command */ 598 unsigned int host_eh_scheduled; /* EH scheduled without command */
599 599
600 unsigned int host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ 600 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 */ 601
602 /* next two fields are used to bound the time spent in error handling */
603 int eh_deadline;
602 unsigned long last_reset; 604 unsigned long last_reset;
603 605
606
604 /* 607 /*
605 * These three parameters can be used to allow for wide scsi, 608 * These three parameters can be used to allow for wide scsi,
606 * and for host adapters that support multiple busses 609 * and for host adapters that support multiple busses
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..af9983970417 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
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index fb0a312bcb81..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
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..2037c45adfe6 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -286,6 +286,8 @@ struct device;
286 .info = snd_soc_info_volsw, \ 286 .info = snd_soc_info_volsw, \
287 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 287 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
288 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) } 288 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
289#define SOC_DAPM_SINGLE_VIRT(xname, max) \
290 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0)
289#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 291#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
290{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 292{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
291 .info = snd_soc_info_volsw, \ 293 .info = snd_soc_info_volsw, \
@@ -300,6 +302,8 @@ struct device;
300 .tlv.p = (tlv_array), \ 302 .tlv.p = (tlv_array), \
301 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 303 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
302 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 304 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
305#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \
306 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)
303#define SOC_DAPM_ENUM(xname, xenum) \ 307#define SOC_DAPM_ENUM(xname, xenum) \
304{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 308{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
305 .info = snd_soc_info_enum_double, \ 309 .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/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/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 d0c613476620..aece1346ceb7 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -267,14 +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 int change_ownership),
273 272
274 TP_ARGS(page, 273 TP_ARGS(page,
275 alloc_order, fallback_order, 274 alloc_order, fallback_order,
276 alloc_migratetype, fallback_migratetype, 275 alloc_migratetype, fallback_migratetype, new_migratetype),
277 change_ownership),
278 276
279 TP_STRUCT__entry( 277 TP_STRUCT__entry(
280 __field( struct page *, page ) 278 __field( struct page *, page )
@@ -291,7 +289,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
291 __entry->fallback_order = fallback_order; 289 __entry->fallback_order = fallback_order;
292 __entry->alloc_migratetype = alloc_migratetype; 290 __entry->alloc_migratetype = alloc_migratetype;
293 __entry->fallback_migratetype = fallback_migratetype; 291 __entry->fallback_migratetype = fallback_migratetype;
294 __entry->change_ownership = change_ownership; 292 __entry->change_ownership = (new_migratetype == alloc_migratetype);
295 ), 293 ),
296 294
297 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",
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/sched.h b/include/trace/events/sched.h
index 613381bcde40..04c308413a5d 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -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/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/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..52594b20179e 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -437,9 +437,8 @@ static inline notrace int ftrace_get_offsets_##call( \
437 * { <assign>; } <-- Here we assign the entries by the __field and 437 * { <assign>; } <-- Here we assign the entries by the __field and
438 * __array macros. 438 * __array macros.
439 * 439 *
440 * if (!filter_current_check_discard(buffer, event_call, entry, event)) 440 * if (!filter_check_discard(ftrace_file, entry, buffer, event))
441 * trace_nowake_buffer_unlock_commit(buffer, 441 * trace_buffer_unlock_commit(buffer, event, irq_flags, pc);
442 * event, irq_flags, pc);
443 * } 442 * }
444 * 443 *
445 * static struct trace_event ftrace_event_type_<call> = { 444 * static struct trace_event ftrace_event_type_<call> = {
@@ -553,7 +552,7 @@ ftrace_raw_event_##call(void *__data, proto) \
553 \ 552 \
554 { assign; } \ 553 { assign; } \
555 \ 554 \
556 if (!filter_current_check_discard(buffer, event_call, entry, event)) \ 555 if (!filter_check_discard(ftrace_file, entry, buffer, event)) \
557 trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \ 556 trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \
558} 557}
559/* 558/*
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 28acbaf4a81e..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
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/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/audit.h b/include/uapi/linux/audit.h
index 75cef3fd97ad..db0b825b4810 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -329,7 +329,6 @@ enum {
329#define AUDIT_ARCH_ARMEB (EM_ARM) 329#define AUDIT_ARCH_ARMEB (EM_ARM)
330#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) 330#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
331#define AUDIT_ARCH_FRV (EM_FRV) 331#define AUDIT_ARCH_FRV (EM_FRV)
332#define AUDIT_ARCH_H8300 (EM_H8_300)
333#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 332#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
334#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 333#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
335#define AUDIT_ARCH_M32R (EM_M32R) 334#define AUDIT_ARCH_M32R (EM_M32R)
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/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/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index f1e12bd40b3b..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 26 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-08-15)" 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/elf-em.h b/include/uapi/linux/elf-em.h
index 59c17a2d38ad..01529bd96438 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -31,7 +31,6 @@
31#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ 31#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
32#define EM_V850 87 /* NEC v850 */ 32#define EM_V850 87 /* NEC v850 */
33#define EM_M32R 88 /* Renesas M32R */ 33#define EM_M32R 88 /* Renesas M32R */
34#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
35#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
37#define EM_TI_C6000 140 /* TI C6X DSPs */ 36#define EM_TI_C6000 140 /* TI C6X DSPs */
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
index c880a417d8a9..1af72d8228e0 100644
--- a/include/uapi/linux/genetlink.h
+++ b/include/uapi/linux/genetlink.h
@@ -27,6 +27,7 @@ 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)
30 31
31/************************************************************************** 32/**************************************************************************
32 * Controller 33 * Controller
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..b78566f59aba 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,17 @@ 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,
492 __IFLA_HSR_MAX,
493};
494
495#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
496
473#endif /* _UAPI_LINUX_IF_LINK_H */ 497#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/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/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/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/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/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/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/pci_regs.h b/include/uapi/linux/pci_regs.h
index baa7852468ef..0890556f779e 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -319,7 +319,6 @@
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 entry's format */
@@ -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 */
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/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/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/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 e3ddd86c90a6..cbfdd4ca9510 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -87,10 +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#ifdef CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING 90};
91 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, 91
92 IB_USER_VERBS_CMD_DESTROY_FLOW 92enum {
93#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */ 93 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
94 IB_USER_VERBS_EX_CMD_DESTROY_FLOW
94}; 95};
95 96
96/* 97/*
@@ -122,22 +123,24 @@ struct ib_uverbs_comp_event_desc {
122 * the rest of the command struct based on these value. 123 * the rest of the command struct based on these value.
123 */ 124 */
124 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
125struct ib_uverbs_cmd_hdr { 132struct ib_uverbs_cmd_hdr {
126 __u32 command; 133 __u32 command;
127 __u16 in_words; 134 __u16 in_words;
128 __u16 out_words; 135 __u16 out_words;
129}; 136};
130 137
131#ifdef CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING 138struct ib_uverbs_ex_cmd_hdr {
132struct ib_uverbs_cmd_hdr_ex { 139 __u64 response;
133 __u32 command;
134 __u16 in_words;
135 __u16 out_words;
136 __u16 provider_in_words; 140 __u16 provider_in_words;
137 __u16 provider_out_words; 141 __u16 provider_out_words;
138 __u32 cmd_hdr_reserved; 142 __u32 cmd_hdr_reserved;
139}; 143};
140#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */
141 144
142struct ib_uverbs_get_context { 145struct ib_uverbs_get_context {
143 __u64 response; 146 __u64 response;
@@ -700,62 +703,71 @@ struct ib_uverbs_detach_mcast {
700 __u64 driver_data[0]; 703 __u64 driver_data[0];
701}; 704};
702 705
703#ifdef CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING 706struct ib_uverbs_flow_spec_hdr {
704struct ib_kern_eth_filter { 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 {
705 __u8 dst_mac[6]; 715 __u8 dst_mac[6];
706 __u8 src_mac[6]; 716 __u8 src_mac[6];
707 __be16 ether_type; 717 __be16 ether_type;
708 __be16 vlan_tag; 718 __be16 vlan_tag;
709}; 719};
710 720
711struct ib_kern_spec_eth { 721struct ib_uverbs_flow_spec_eth {
712 __u32 type; 722 union {
713 __u16 size; 723 struct ib_uverbs_flow_spec_hdr hdr;
714 __u16 reserved; 724 struct {
715 struct ib_kern_eth_filter val; 725 __u32 type;
716 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;
717}; 732};
718 733
719struct ib_kern_ipv4_filter { 734struct ib_uverbs_flow_ipv4_filter {
720 __be32 src_ip; 735 __be32 src_ip;
721 __be32 dst_ip; 736 __be32 dst_ip;
722}; 737};
723 738
724struct ib_kern_spec_ipv4 { 739struct ib_uverbs_flow_spec_ipv4 {
725 __u32 type; 740 union {
726 __u16 size; 741 struct ib_uverbs_flow_spec_hdr hdr;
727 __u16 reserved; 742 struct {
728 struct ib_kern_ipv4_filter val; 743 __u32 type;
729 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;
730}; 750};
731 751
732struct ib_kern_tcp_udp_filter { 752struct ib_uverbs_flow_tcp_udp_filter {
733 __be16 dst_port; 753 __be16 dst_port;
734 __be16 src_port; 754 __be16 src_port;
735}; 755};
736 756
737struct ib_kern_spec_tcp_udp { 757struct ib_uverbs_flow_spec_tcp_udp {
738 __u32 type;
739 __u16 size;
740 __u16 reserved;
741 struct ib_kern_tcp_udp_filter val;
742 struct ib_kern_tcp_udp_filter mask;
743};
744
745struct ib_kern_spec {
746 union { 758 union {
759 struct ib_uverbs_flow_spec_hdr hdr;
747 struct { 760 struct {
748 __u32 type; 761 __u32 type;
749 __u16 size; 762 __u16 size;
750 __u16 reserved; 763 __u16 reserved;
751 }; 764 };
752 struct ib_kern_spec_eth eth;
753 struct ib_kern_spec_ipv4 ipv4;
754 struct ib_kern_spec_tcp_udp tcp_udp;
755 }; 765 };
766 struct ib_uverbs_flow_tcp_udp_filter val;
767 struct ib_uverbs_flow_tcp_udp_filter mask;
756}; 768};
757 769
758struct ib_kern_flow_attr { 770struct ib_uverbs_flow_attr {
759 __u32 type; 771 __u32 type;
760 __u16 size; 772 __u16 size;
761 __u16 priority; 773 __u16 priority;
@@ -767,13 +779,13 @@ struct ib_kern_flow_attr {
767 * struct ib_flow_spec_xxx 779 * struct ib_flow_spec_xxx
768 * struct ib_flow_spec_yyy 780 * struct ib_flow_spec_yyy
769 */ 781 */
782 struct ib_uverbs_flow_spec_hdr flow_specs[0];
770}; 783};
771 784
772struct ib_uverbs_create_flow { 785struct ib_uverbs_create_flow {
773 __u32 comp_mask; 786 __u32 comp_mask;
774 __u64 response;
775 __u32 qp_handle; 787 __u32 qp_handle;
776 struct ib_kern_flow_attr flow_attr; 788 struct ib_uverbs_flow_attr flow_attr;
777}; 789};
778 790
779struct ib_uverbs_create_flow_resp { 791struct ib_uverbs_create_flow_resp {
@@ -785,7 +797,6 @@ struct ib_uverbs_destroy_flow {
785 __u32 comp_mask; 797 __u32 comp_mask;
786 __u32 flow_handle; 798 __u32 flow_handle;
787}; 799};
788#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */
789 800
790struct ib_uverbs_create_srq { 801struct ib_uverbs_create_srq {
791 __u64 response; 802 __u64 response;
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/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/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,