aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h7
-rw-r--r--include/acpi/actbl1.h14
-rw-r--r--include/acpi/ghes.h2
-rw-r--r--include/asm-generic/bitops/find.h12
-rw-r--r--include/asm-generic/gpio.h235
-rw-r--r--include/asm-generic/hugetlb.h4
-rw-r--r--include/asm-generic/preempt.h105
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-generic/vtime.h1
-rw-r--r--include/clocksource/arm_arch_timer.h10
-rw-r--r--include/drm/drmP.h7
-rw-r--r--include/drm/drm_pciids.h3
-rw-r--r--include/dt-bindings/clock/efm32-cmu.h42
-rw-r--r--include/dt-bindings/mfd/dbx500-prcmu.h83
-rw-r--r--include/dt-bindings/pinctrl/am43xx.h31
-rw-r--r--include/dt-bindings/pinctrl/at91.h2
-rw-r--r--include/dt-bindings/pinctrl/dra.h50
-rw-r--r--include/dt-bindings/pinctrl/omap.h4
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/acpi_gpio.h31
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/ata.h7
-rw-r--r--include/linux/atmel_serial.h1
-rw-r--r--include/linux/balloon_compaction.h25
-rw-r--r--include/linux/bcma/bcma_driver_pci.h1
-rw-r--r--include/linux/binfmts.h6
-rw-r--r--include/linux/bitops.h8
-rw-r--r--include/linux/blkdev.h11
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--include/linux/cgroup.h37
-rw-r--r--include/linux/clk-provider.h1
-rw-r--r--include/linux/clk/mxs.h2
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/compiler-gcc4.h15
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/coredump.h10
-rw-r--r--include/linux/cper.h13
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/crc32.h40
-rw-r--r--include/linux/dcache.h104
-rw-r--r--include/linux/debugfs.h12
-rw-r--r--include/linux/device-mapper.h3
-rw-r--r--include/linux/device.h64
-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/extcon.h72
-rw-r--r--include/linux/extcon/extcon-adc-jack.h42
-rw-r--r--include/linux/extcon/extcon-gpio.h20
-rw-r--r--include/linux/fcdevice.h2
-rw-r--r--include/linux/fddidevice.h7
-rw-r--r--include/linux/filter.h15
-rw-r--r--include/linux/fs.h111
-rw-r--r--include/linux/fscache-cache.h50
-rw-r--r--include/linux/fscache.h113
-rw-r--r--include/linux/genalloc.h2
-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/hardirq.h8
-rw-r--r--include/linux/hashtable.h15
-rw-r--r--include/linux/hid-sensor-hub.h18
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/hippidevice.h10
-rw-r--r--include/linux/hwmon-vid.h2
-rw-r--r--include/linux/hwmon.h10
-rw-r--r--include/linux/hyperv.h44
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h24
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_vlan.h101
-rw-r--r--include/linux/iio/buffer.h61
-rw-r--r--include/linux/iio/common/st_sensors.h6
-rw-r--r--include/linux/iio/consumer.h2
-rw-r--r--include/linux/iio/events.h14
-rw-r--r--include/linux/iio/iio.h93
-rw-r--r--include/linux/iio/sysfs.h15
-rw-r--r--include/linux/iio/types.h20
-rw-r--r--include/linux/inetdevice.h28
-rw-r--r--include/linux/init.h6
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h11
-rw-r--r--include/linux/ipc_namespace.h6
-rw-r--r--include/linux/ipv6.h76
-rw-r--r--include/linux/irqchip/bcm2835.h29
-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.h11
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kobj_completion.h18
-rw-r--r--include/linux/kobject.h1
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/lglock.h10
-rw-r--r--include/linux/list.h79
-rw-r--r--include/linux/lockref.h6
-rw-r--r--include/linux/memblock.h24
-rw-r--r--include/linux/memcontrol.h105
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mempolicy.h6
-rw-r--r--include/linux/mfd/core.h6
-rw-r--r--include/linux/mfd/dbx500-prcmu.h70
-rw-r--r--include/linux/mfd/mc13xxx.h7
-rw-r--r--include/linux/mfd/samsung/core.h1
-rw-r--r--include/linux/mfd/samsung/rtc.h11
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h5
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h9
-rw-r--r--include/linux/migrate.h7
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/cmd.h6
-rw-r--r--include/linux/mlx4/device.h25
-rw-r--r--include/linux/mlx5/device.h4
-rw-r--r--include/linux/mlx5/driver.h6
-rw-r--r--include/linux/mm.h136
-rw-r--r--include/linux/mm_types.h17
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/mutex.h6
-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.h523
-rw-r--r--include/linux/netfilter.h24
-rw-r--r--include/linux/netfilter/ipset/ip_set.h167
-rw-r--r--include/linux/netfilter/ipset/ip_set_comment.h57
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h14
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h162
-rw-r--r--include/linux/netfilter/nfnetlink.h29
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h6
-rw-r--r--include/linux/netfilter/x_tables.h128
-rw-r--r--include/linux/netfilter_bridge.h4
-rw-r--r--include/linux/netfilter_ipv4.h6
-rw-r--r--include/linux/netfilter_ipv6.h10
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nfs4.h5
-rw-r--r--include/linux/nfs_fs.h8
-rw-r--r--include/linux/nfs_fs_sb.h10
-rw-r--r--include/linux/nfs_xdr.h27
-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.h67
-rw-r--r--include/linux/of_pci.h5
-rw-r--r--include/linux/of_reserved_mem.h14
-rw-r--r--include/linux/oom.h5
-rw-r--r--include/linux/page-flags-layout.h28
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/percpu.h40
-rw-r--r--include/linux/perf_event.h29
-rw-r--r--include/linux/phy/phy.h270
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/platform_data/clk-nomadik.h2
-rw-r--r--include/linux/platform_data/clk-ux500.h3
-rw-r--r--include/linux/platform_data/davinci_asp.h2
-rw-r--r--include/linux/platform_data/dma-s3c24xx.h46
-rw-r--r--include/linux/platform_data/gpio-davinci.h60
-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/mipi-csis.h9
-rw-r--r--include/linux/platform_data/pinctrl-adi2.h40
-rw-r--r--include/linux/platform_data/pinctrl-single.h12
-rw-r--r--include/linux/platform_data/usb-ehci-s5p.h21
-rw-r--r--include/linux/platform_data/usb-ohci-exynos.h21
-rw-r--r--include/linux/platform_data/usb-rcar-gen2-phy.h22
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/preempt.h112
-rw-r--r--include/linux/printk.h16
-rw-r--r--include/linux/random.h15
-rw-r--r--include/linux/rbtree.h16
-rw-r--r--include/linux/rculist.h23
-rw-r--r--include/linux/rcupdate.h24
-rw-r--r--include/linux/rcutiny.h17
-rw-r--r--include/linux/rcutree.h2
-rw-r--r--include/linux/regmap.h53
-rw-r--r--include/linux/regulator/consumer.h79
-rw-r--r--include/linux/regulator/driver.h20
-rw-r--r--include/linux/regulator/machine.h7
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/sched.h187
-rw-r--r--include/linux/sched/sysctl.h1
-rw-r--r--include/linux/sched_clock.h4
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/sfi.h3
-rw-r--r--include/linux/skbuff.h322
-rw-r--r--include/linux/smp.h6
-rw-r--r--include/linux/spi/rspi.h2
-rw-r--r--include/linux/spi/spi.h61
-rw-r--r--include/linux/ssb/ssb_driver_gige.h14
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/xprt.h2
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysfs.h88
-rw-r--r--include/linux/sysrq.h3
-rw-r--r--include/linux/tegra-powergate.h9
-rw-r--r--include/linux/thinkpad_acpi.h15
-rw-r--r--include/linux/thread_info.h17
-rw-r--r--include/linux/timex.h15
-rw-r--r--include/linux/topology.h6
-rw-r--r--include/linux/tty.h29
-rw-r--r--include/linux/uaccess.h8
-rw-r--r--include/linux/uprobes.h15
-rw-r--r--include/linux/usb.h10
-rw-r--r--include/linux/usb/cdc_ncm.h33
-rw-r--r--include/linux/usb/hcd.h16
-rw-r--r--include/linux/usb/intel_mid_otg.h180
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/omap_control_usb.h33
-rw-r--r--include/linux/usb/serial.h2
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h5
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/usb/wusb-wa.h51
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/vgaarb.h7
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/wait.h374
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/yam.h2
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/bluetooth/a2mp.h150
-rw-r--r--include/net/bluetooth/amp.h54
-rw-r--r--include/net/bluetooth/bluetooth.h27
-rw-r--r--include/net/bluetooth/hci.h156
-rw-r--r--include/net/bluetooth/hci_core.h193
-rw-r--r--include/net/bluetooth/l2cap.h35
-rw-r--r--include/net/bluetooth/mgmt.h18
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/bluetooth/sco.h5
-rw-r--r--include/net/bluetooth/smp.h146
-rw-r--r--include/net/caif/caif_hsi.h2
-rw-r--r--include/net/cfg80211.h32
-rw-r--r--include/net/checksum.h11
-rw-r--r--include/net/cipso_ipv4.h6
-rw-r--r--include/net/codel.h19
-rw-r--r--include/net/compat.h48
-rw-r--r--include/net/dcbevent.h6
-rw-r--r--include/net/dn.h20
-rw-r--r--include/net/dn_dev.h30
-rw-r--r--include/net/dn_fib.h47
-rw-r--r--include/net/dn_neigh.h12
-rw-r--r--include/net/dn_nsp.h49
-rw-r--r--include/net/dn_route.h13
-rw-r--r--include/net/dst.h37
-rw-r--r--include/net/esp.h12
-rw-r--r--include/net/fib_rules.h17
-rw-r--r--include/net/flow.h11
-rw-r--r--include/net/flow_keys.h3
-rw-r--r--include/net/garp.h27
-rw-r--r--include/net/gen_stats.h51
-rw-r--r--include/net/genetlink.h26
-rw-r--r--include/net/gre.h8
-rw-r--r--include/net/icmp.h10
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet6_connection_sock.h32
-rw-r--r--include/net/inet6_hashtables.h67
-rw-r--r--include/net/inet_common.h48
-rw-r--r--include/net/inet_connection_sock.h79
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/net/inet_hashtables.h99
-rw-r--r--include/net/inet_sock.h49
-rw-r--r--include/net/inet_timewait_sock.h69
-rw-r--r--include/net/inetpeer.h12
-rw-r--r--include/net/ip.h201
-rw-r--r--include/net/ip6_checksum.h4
-rw-r--r--include/net/ip6_fib.h52
-rw-r--r--include/net/ip6_route.h104
-rw-r--r--include/net/ip_fib.h61
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/ip_vs.h292
-rw-r--r--include/net/ipv6.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/mac802154.h2
-rw-r--r--include/net/mrp.h23
-rw-r--r--include/net/ndisc.h61
-rw-r--r--include/net/net_namespace.h33
-rw-r--r--include/net/netevent.h6
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h6
-rw-r--r--include/net/netfilter/ipv4/nf_defrag_ipv4.h2
-rw-r--r--include/net/netfilter/ipv6/nf_defrag_ipv6.h13
-rw-r--r--include/net/netfilter/nf_conntrack.h69
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h22
-rw-r--r--include/net/netfilter/nf_conntrack_core.h69
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h22
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h6
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h40
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h16
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h32
-rw-r--r--include/net/netfilter/nf_conntrack_seqadj.h30
-rw-r--r--include/net/netfilter/nf_conntrack_synproxy.h28
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h4
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h8
-rw-r--r--include/net/netfilter/nf_nat.h13
-rw-r--r--include/net/netfilter/nf_nat_core.h8
-rw-r--r--include/net/netfilter/nf_nat_helper.h29
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h23
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h30
-rw-r--r--include/net/netfilter/nf_queue.h2
-rw-r--r--include/net/netfilter/nf_tables.h519
-rw-r--r--include/net/netfilter/nf_tables_core.h42
-rw-r--r--include/net/netfilter/nf_tables_ipv4.h23
-rw-r--r--include/net/netfilter/nf_tables_ipv6.h30
-rw-r--r--include/net/netfilter/xt_rateest.h4
-rw-r--r--include/net/netlink.h63
-rw-r--r--include/net/netns/ipv4.h7
-rw-r--r--include/net/netns/nftables.h19
-rw-r--r--include/net/netrom.h89
-rw-r--r--include/net/nfc/digital.h227
-rw-r--r--include/net/nfc/hci.h6
-rw-r--r--include/net/nfc/nci.h4
-rw-r--r--include/net/nfc/nci_core.h46
-rw-r--r--include/net/nfc/nfc.h25
-rw-r--r--include/net/p8022.h18
-rw-r--r--include/net/ping.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.h27
-rw-r--r--include/net/sock.h287
-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/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.h2
-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/block.h6
-rw-r--r--include/trace/events/btrfs.h1
-rw-r--r--include/trace/events/f2fs.h51
-rw-r--r--include/trace/events/kmem.h10
-rw-r--r--include/trace/events/rcu.h80
-rw-r--r--include/trace/events/sched.h2
-rw-r--r--include/trace/events/spi.h156
-rw-r--r--include/trace/events/target.h4
-rw-r--r--include/trace/events/writeback.h6
-rw-r--r--include/uapi/asm-generic/errno.h2
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/drm/drm_mode.h2
-rw-r--r--include/uapi/drm/radeon_drm.h2
-rw-r--r--include/uapi/linux/Kbuild2
-rw-r--r--include/uapi/linux/audit.h1
-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/elf-em.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/mic_common.h240
-rw-r--r--include/uapi/linux/mic_ioctl.h76
-rw-r--r--include/uapi/linux/netfilter/Kbuild2
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h16
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h718
-rw-r--r--include/uapi/linux/netfilter/nf_tables_compat.h38
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h10
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_cttimeout.h2
-rw-r--r--include/uapi/linux/nfc.h4
-rw-r--r--include/uapi/linux/nfs_mount.h2
-rw-r--r--include/uapi/linux/nl80211.h27
-rw-r--r--include/uapi/linux/openvswitch.h18
-rw-r--r--include/uapi/linux/perf_event.h54
-rw-r--r--include/uapi/linux/pkt_cls.h14
-rw-r--r--include/uapi/linux/pkt_sched.h4
-rw-r--r--include/uapi/linux/random.h7
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/tc_defact.h (renamed from include/linux/tc_act/tc_defact.h)2
-rw-r--r--include/uapi/rdma/ib_user_verbs.h6
-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/exynos_dp.h131
-rw-r--r--include/video/exynos_mipi_dsim.h5
-rw-r--r--include/xen/interface/io/netif.h18
438 files changed, 10681 insertions, 6187 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 02e113bb8b7d..d9019821aa60 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -311,7 +311,6 @@ struct acpi_device {
311 unsigned int physical_node_count; 311 unsigned int physical_node_count;
312 struct list_head physical_node_list; 312 struct list_head physical_node_list;
313 struct mutex physical_node_lock; 313 struct mutex physical_node_lock;
314 struct list_head power_dependent;
315 void (*remove)(struct acpi_device *); 314 void (*remove)(struct acpi_device *);
316}; 315};
317 316
@@ -456,8 +455,6 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
456acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 455acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
457 acpi_notify_handler handler); 456 acpi_notify_handler handler);
458int acpi_pm_device_sleep_state(struct device *, int *, int); 457int acpi_pm_device_sleep_state(struct device *, int *, int);
459void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
460void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
461#else 458#else
462static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 459static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
463 acpi_notify_handler handler, 460 acpi_notify_handler handler,
@@ -478,10 +475,6 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
478 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? 475 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
479 m : ACPI_STATE_D0; 476 m : ACPI_STATE_D0;
480} 477}
481static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
482 struct device *depdev) {}
483static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
484 struct device *depdev) {}
485#endif 478#endif
486 479
487#ifdef CONFIG_PM_RUNTIME 480#ifdef CONFIG_PM_RUNTIME
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/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/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/hugetlb.h b/include/asm-generic/hugetlb.h
index d06079c774a0..99b490b4d05a 100644
--- a/include/asm-generic/hugetlb.h
+++ b/include/asm-generic/hugetlb.h
@@ -6,12 +6,12 @@ static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
6 return mk_pte(page, pgprot); 6 return mk_pte(page, pgprot);
7} 7}
8 8
9static inline int huge_pte_write(pte_t pte) 9static inline unsigned long huge_pte_write(pte_t pte)
10{ 10{
11 return pte_write(pte); 11 return pte_write(pte);
12} 12}
13 13
14static inline int huge_pte_dirty(pte_t pte) 14static inline unsigned long huge_pte_dirty(pte_t pte)
15{ 15{
16 return pte_dirty(pte); 16 return pte_dirty(pte);
17} 17}
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
new file mode 100644
index 000000000000..ddf2b420ac8f
--- /dev/null
+++ b/include/asm-generic/preempt.h
@@ -0,0 +1,105 @@
1#ifndef __ASM_PREEMPT_H
2#define __ASM_PREEMPT_H
3
4#include <linux/thread_info.h>
5
6/*
7 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
8 * that think a non-zero value indicates we cannot preempt.
9 */
10static __always_inline int preempt_count(void)
11{
12 return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
13}
14
15static __always_inline int *preempt_count_ptr(void)
16{
17 return &current_thread_info()->preempt_count;
18}
19
20/*
21 * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
22 * alternative is loosing a reschedule. Better schedule too often -- also this
23 * should be a very rare operation.
24 */
25static __always_inline void preempt_count_set(int pc)
26{
27 *preempt_count_ptr() = pc;
28}
29
30/*
31 * must be macros to avoid header recursion hell
32 */
33#define task_preempt_count(p) \
34 (task_thread_info(p)->preempt_count & ~PREEMPT_NEED_RESCHED)
35
36#define init_task_preempt_count(p) do { \
37 task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \
38} while (0)
39
40#define init_idle_preempt_count(p, cpu) do { \
41 task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \
42} while (0)
43
44/*
45 * We fold the NEED_RESCHED bit into the preempt count such that
46 * preempt_enable() can decrement and test for needing to reschedule with a
47 * single instruction.
48 *
49 * We invert the actual bit, so that when the decrement hits 0 we know we both
50 * need to resched (the bit is cleared) and can resched (no preempt count).
51 */
52
53static __always_inline void set_preempt_need_resched(void)
54{
55 *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
56}
57
58static __always_inline void clear_preempt_need_resched(void)
59{
60 *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
61}
62
63static __always_inline bool test_preempt_need_resched(void)
64{
65 return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
66}
67
68/*
69 * The various preempt_count add/sub methods
70 */
71
72static __always_inline void __preempt_count_add(int val)
73{
74 *preempt_count_ptr() += val;
75}
76
77static __always_inline void __preempt_count_sub(int val)
78{
79 *preempt_count_ptr() -= val;
80}
81
82static __always_inline bool __preempt_count_dec_and_test(void)
83{
84 return !--*preempt_count_ptr();
85}
86
87/*
88 * Returns true when we need to resched and can (barring IRQ state).
89 */
90static __always_inline bool should_resched(void)
91{
92 return unlikely(!*preempt_count_ptr());
93}
94
95#ifdef CONFIG_PREEMPT
96extern asmlinkage void preempt_schedule(void);
97#define __preempt_schedule() preempt_schedule()
98
99#ifdef CONFIG_CONTEXT_TRACKING
100extern asmlinkage void preempt_schedule_context(void);
101#define __preempt_schedule_context() preempt_schedule_context()
102#endif
103#endif /* CONFIG_PREEMPT */
104
105#endif /* __ASM_PREEMPT_H */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index b685d3bd32e2..3d1a3af5cf59 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -32,6 +32,6 @@ static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
32 32
33#endif 33#endif
34 34
35extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from); 35extern int copy_siginfo_to_user(struct siginfo __user *to, const struct siginfo *from);
36 36
37#endif 37#endif
diff --git a/include/asm-generic/vtime.h b/include/asm-generic/vtime.h
index e69de29bb2d1..b1a49677fe25 100644
--- a/include/asm-generic/vtime.h
+++ b/include/asm-generic/vtime.h
@@ -0,0 +1 @@
/* no content, but patch(1) dislikes empty files */
diff --git a/include/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 290734191f72..b46fb45f2cca 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1322,10 +1322,9 @@ extern int drm_newctx(struct drm_device *dev, void *data,
1322extern int drm_rmctx(struct drm_device *dev, void *data, 1322extern int drm_rmctx(struct drm_device *dev, void *data,
1323 struct drm_file *file_priv); 1323 struct drm_file *file_priv);
1324 1324
1325extern void drm_legacy_ctxbitmap_init(struct drm_device *dev); 1325extern int drm_ctxbitmap_init(struct drm_device *dev);
1326extern void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); 1326extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1327extern void drm_legacy_ctxbitmap_release(struct drm_device *dev, 1327extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1328 struct drm_file *file_priv);
1329 1328
1330extern int drm_setsareactx(struct drm_device *dev, void *data, 1329extern int drm_setsareactx(struct drm_device *dev, void *data,
1331 struct drm_file *file_priv); 1330 struct drm_file *file_priv);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index fd54a14a7c2a..3d79e513c0b3 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -12,11 +12,14 @@
12 {0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 12 {0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
13 {0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 13 {0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
14 {0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 14 {0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
15 {0x1002, 0x1312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
15 {0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 16 {0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
16 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 17 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
17 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 18 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
19 {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
18 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 20 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
19 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 21 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
22 {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
20 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 23 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
21 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 24 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
22 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 25 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
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/dbx500-prcmu.h b/include/dt-bindings/mfd/dbx500-prcmu.h
new file mode 100644
index 000000000000..552a2d174f01
--- /dev/null
+++ b/include/dt-bindings/mfd/dbx500-prcmu.h
@@ -0,0 +1,83 @@
1/*
2 * This header provides constants for the PRCMU bindings.
3 *
4 */
5
6#ifndef _DT_BINDINGS_MFD_PRCMU_H
7#define _DT_BINDINGS_MFD_PRCMU_H
8
9/*
10 * Clock identifiers.
11 */
12#define ARMCLK 0
13#define PRCMU_ACLK 1
14#define PRCMU_SVAMMCSPCLK 2
15#define PRCMU_SDMMCHCLK 2 /* DBx540 only. */
16#define PRCMU_SIACLK 3
17#define PRCMU_SIAMMDSPCLK 3 /* DBx540 only. */
18#define PRCMU_SGACLK 4
19#define PRCMU_UARTCLK 5
20#define PRCMU_MSP02CLK 6
21#define PRCMU_MSP1CLK 7
22#define PRCMU_I2CCLK 8
23#define PRCMU_SDMMCCLK 9
24#define PRCMU_SLIMCLK 10
25#define PRCMU_CAMCLK 10 /* DBx540 only. */
26#define PRCMU_PER1CLK 11
27#define PRCMU_PER2CLK 12
28#define PRCMU_PER3CLK 13
29#define PRCMU_PER5CLK 14
30#define PRCMU_PER6CLK 15
31#define PRCMU_PER7CLK 16
32#define PRCMU_LCDCLK 17
33#define PRCMU_BMLCLK 18
34#define PRCMU_HSITXCLK 19
35#define PRCMU_HSIRXCLK 20
36#define PRCMU_HDMICLK 21
37#define PRCMU_APEATCLK 22
38#define PRCMU_APETRACECLK 23
39#define PRCMU_MCDECLK 24
40#define PRCMU_IPI2CCLK 25
41#define PRCMU_DSIALTCLK 26
42#define PRCMU_DMACLK 27
43#define PRCMU_B2R2CLK 28
44#define PRCMU_TVCLK 29
45#define SPARE_UNIPROCLK 30
46#define PRCMU_SSPCLK 31
47#define PRCMU_RNGCLK 32
48#define PRCMU_UICCCLK 33
49#define PRCMU_G1CLK 34 /* DBx540 only. */
50#define PRCMU_HVACLK 35 /* DBx540 only. */
51#define PRCMU_SPARE1CLK 36
52#define PRCMU_SPARE2CLK 37
53
54#define PRCMU_NUM_REG_CLOCKS 38
55
56#define PRCMU_RTCCLK PRCMU_NUM_REG_CLOCKS
57#define PRCMU_SYSCLK 39
58#define PRCMU_CDCLK 40
59#define PRCMU_TIMCLK 41
60#define PRCMU_PLLSOC0 42
61#define PRCMU_PLLSOC1 43
62#define PRCMU_ARMSS 44
63#define PRCMU_PLLDDR 45
64
65/* DSI Clocks */
66#define PRCMU_PLLDSI 46
67#define PRCMU_DSI0CLK 47
68#define PRCMU_DSI1CLK 48
69#define PRCMU_DSI0ESCCLK 49
70#define PRCMU_DSI1ESCCLK 50
71#define PRCMU_DSI2ESCCLK 51
72
73/* LCD DSI PLL - Ux540 only */
74#define PRCMU_PLLDSI_LCD 52
75#define PRCMU_DSI0CLK_LCD 53
76#define PRCMU_DSI1CLK_LCD 54
77#define PRCMU_DSI0ESCCLK_LCD 55
78#define PRCMU_DSI1ESCCLK_LCD 56
79#define PRCMU_DSI2ESCCLK_LCD 57
80
81#define PRCMU_NUM_CLKS 58
82
83#endif
diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h
new file mode 100644
index 000000000000..eb6c366adfba
--- /dev/null
+++ b/include/dt-bindings/pinctrl/am43xx.h
@@ -0,0 +1,31 @@
1/*
2 * This header provides constants specific to AM43XX pinctrl bindings.
3 */
4
5#ifndef _DT_BINDINGS_PINCTRL_AM43XX_H
6#define _DT_BINDINGS_PINCTRL_AM43XX_H
7
8#define MUX_MODE0 0
9#define MUX_MODE1 1
10#define MUX_MODE2 2
11#define MUX_MODE3 3
12#define MUX_MODE4 4
13#define MUX_MODE5 5
14#define MUX_MODE6 6
15#define MUX_MODE7 7
16
17#define PULL_DISABLE (1 << 16)
18#define PULL_UP (1 << 17)
19#define INPUT_EN (1 << 18)
20#define SLEWCTRL_FAST (1 << 19)
21#define DS0_PULL_UP_DOWN_EN (1 << 27)
22
23#define PIN_OUTPUT (PULL_DISABLE)
24#define PIN_OUTPUT_PULLUP (PULL_UP)
25#define PIN_OUTPUT_PULLDOWN 0
26#define PIN_INPUT (INPUT_EN | PULL_DISABLE)
27#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP)
28#define PIN_INPUT_PULLDOWN (INPUT_EN)
29
30#endif
31
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
index d7988b4d8af9..0fee6ff77ffc 100644
--- a/include/dt-bindings/pinctrl/at91.h
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -16,7 +16,7 @@
16#define AT91_PINCTRL_PULL_DOWN (1 << 3) 16#define AT91_PINCTRL_PULL_DOWN (1 << 3)
17#define AT91_PINCTRL_DIS_SCHMIT (1 << 4) 17#define AT91_PINCTRL_DIS_SCHMIT (1 << 4)
18#define AT91_PINCTRL_DEBOUNCE (1 << 16) 18#define AT91_PINCTRL_DEBOUNCE (1 << 16)
19#define AT91_PINCTRL_DEBOUNCE_VA(x) (x << 17) 19#define AT91_PINCTRL_DEBOUNCE_VAL(x) (x << 17)
20 20
21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH) 21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
22 22
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
new file mode 100644
index 000000000000..002a2855c046
--- /dev/null
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -0,0 +1,50 @@
1/*
2 * This header provides constants for DRA pinctrl bindings.
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Author: Rajendra Nayak <rnayak@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _DT_BINDINGS_PINCTRL_DRA_H
13#define _DT_BINDINGS_PINCTRL_DRA_H
14
15/* DRA7 mux mode options for each pin. See TRM for options */
16#define MUX_MODE0 0x0
17#define MUX_MODE1 0x1
18#define MUX_MODE2 0x2
19#define MUX_MODE3 0x3
20#define MUX_MODE4 0x4
21#define MUX_MODE5 0x5
22#define MUX_MODE6 0x6
23#define MUX_MODE7 0x7
24#define MUX_MODE8 0x8
25#define MUX_MODE9 0x9
26#define MUX_MODE10 0xa
27#define MUX_MODE11 0xb
28#define MUX_MODE12 0xc
29#define MUX_MODE13 0xd
30#define MUX_MODE14 0xe
31#define MUX_MODE15 0xf
32
33#define PULL_ENA (1 << 16)
34#define PULL_UP (1 << 17)
35#define INPUT_EN (1 << 18)
36#define SLEWCONTROL (1 << 19)
37#define WAKEUP_EN (1 << 24)
38#define WAKEUP_EVENT (1 << 25)
39
40/* Active pin states */
41#define PIN_OUTPUT 0
42#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
43#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
44#define PIN_INPUT INPUT_EN
45#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
46#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
47#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
48
49#endif
50
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
index edbd250809cb..bed35e36fd27 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -23,7 +23,7 @@
23#define PULL_UP (1 << 4) 23#define PULL_UP (1 << 4)
24#define ALTELECTRICALSEL (1 << 5) 24#define ALTELECTRICALSEL (1 << 5)
25 25
26/* 34xx specific mux bit defines */ 26/* omap3/4/5 specific mux bit defines */
27#define INPUT_EN (1 << 8) 27#define INPUT_EN (1 << 8)
28#define OFF_EN (1 << 9) 28#define OFF_EN (1 << 9)
29#define OFFOUT_EN (1 << 10) 29#define OFFOUT_EN (1 << 10)
@@ -31,8 +31,6 @@
31#define OFF_PULL_EN (1 << 12) 31#define OFF_PULL_EN (1 << 12)
32#define OFF_PULL_UP (1 << 13) 32#define OFF_PULL_UP (1 << 13)
33#define WAKEUP_EN (1 << 14) 33#define WAKEUP_EN (1 << 14)
34
35/* 44xx specific mux bit defines */
36#define WAKEUP_EVENT (1 << 15) 34#define WAKEUP_EVENT (1 << 15)
37 35
38/* Active pin states */ 36/* Active pin states */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a5db4aeefa36..c30bac8503bc 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -311,6 +311,7 @@ struct acpi_osc_context {
311#define OSC_INVALID_REVISION_ERROR 8 311#define OSC_INVALID_REVISION_ERROR 8
312#define OSC_CAPABILITIES_MASK_ERROR 16 312#define OSC_CAPABILITIES_MASK_ERROR 16
313 313
314acpi_status acpi_str_to_uuid(char *str, u8 *uuid);
314acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); 315acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
315 316
316/* platform-wide _OSC bits */ 317/* platform-wide _OSC bits */
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/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/atmel_serial.h b/include/linux/atmel_serial.h
index be201ca2990c..00beddf6be20 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -125,5 +125,6 @@
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */ 127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128#define ATMEL_US_VERSION 0xfc /* Ip Version */
128 129
129#endif 130#endif
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index f7f1d7169b11..089743ade734 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -159,6 +159,26 @@ static inline bool balloon_page_movable(struct page *page)
159} 159}
160 160
161/* 161/*
162 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */
171static inline bool isolated_balloon_page(struct page *page)
172{
173 /* Already isolated balloon pages, by default, have a raised refcount */
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179}
180
181/*
162 * balloon_page_insert - insert a page into the balloon's page list and make 182 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly. 183 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page' 184 * @page : page to be assigned as a 'balloon page'
@@ -243,6 +263,11 @@ static inline bool balloon_page_movable(struct page *page)
243 return false; 263 return false;
244} 264}
245 265
266static inline bool isolated_balloon_page(struct page *page)
267{
268 return false;
269}
270
246static inline bool balloon_page_isolate(struct page *page) 271static inline bool balloon_page_isolate(struct page *page)
247{ 272{
248 return false; 273 return false;
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index d66033f418c9..0333e605ea0d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -242,6 +242,7 @@ extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
242 struct bcma_device *core, bool enable); 242 struct bcma_device *core, bool enable);
243extern void bcma_core_pci_up(struct bcma_bus *bus); 243extern void bcma_core_pci_up(struct bcma_bus *bus);
244extern void bcma_core_pci_down(struct bcma_bus *bus); 244extern void bcma_core_pci_down(struct bcma_bus *bus);
245extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
245 246
246extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 247extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
247extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 248extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 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/bitops.h b/include/linux/bitops.h
index a3b6b82108b9..bd0c4598d03b 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,14 @@
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13/*
14 * Create a contiguous bitmask starting at bit position @l and ending at
15 * position @h. For example
16 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
17 */
18#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
19#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
20
13extern unsigned int __sw_hweight8(unsigned int w); 21extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w); 22extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w); 23extern unsigned int __sw_hweight32(unsigned int w);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a451b49..0e6f765aa1f5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862 return blk_queue_get_max_sectors(q, rq->cmd_flags); 862 return blk_queue_get_max_sectors(q, rq->cmd_flags);
863} 863}
864 864
865static inline unsigned int blk_rq_count_bios(struct request *rq)
866{
867 unsigned int nr_bios = 0;
868 struct bio *bio;
869
870 __rq_for_each_bio(bio, rq)
871 nr_bios++;
872
873 return nr_bios;
874}
875
865/* 876/*
866 * Request issue related functions. 877 * Request issue related functions.
867 */ 878 */
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index ce6df39f60ff..8f47625a0661 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -335,6 +335,8 @@ extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
335 struct ceph_osd_request *req); 335 struct ceph_osd_request *req);
336extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 336extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
337 337
338extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc);
339
338extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, 340extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
339 struct ceph_vino vino, 341 struct ceph_vino vino,
340 struct ceph_file_layout *layout, 342 struct ceph_file_layout *layout,
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 3561d305b1e0..39c1d9469677 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -612,11 +612,6 @@ struct cgroup_subsys {
612 int subsys_id; 612 int subsys_id;
613 int disabled; 613 int disabled;
614 int early_init; 614 int early_init;
615 /*
616 * True if this subsys uses ID. ID is not available before cgroup_init()
617 * (not available in early_init time.)
618 */
619 bool use_id;
620 615
621 /* 616 /*
622 * If %false, this subsystem is properly hierarchical - 617 * If %false, this subsystem is properly hierarchical -
@@ -642,9 +637,6 @@ struct cgroup_subsys {
642 */ 637 */
643 struct cgroupfs_root *root; 638 struct cgroupfs_root *root;
644 struct list_head sibling; 639 struct list_head sibling;
645 /* used when use_id == true */
646 struct idr idr;
647 spinlock_t id_lock;
648 640
649 /* list of cftype_sets */ 641 /* list of cftype_sets */
650 struct list_head cftsets; 642 struct list_head cftsets;
@@ -875,35 +867,6 @@ int css_scan_tasks(struct cgroup_subsys_state *css,
875int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 867int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
876int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 868int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
877 869
878/*
879 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
880 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
881 * CSS ID is assigned at cgroup allocation (create) automatically
882 * and removed when subsys calls free_css_id() function. This is because
883 * the lifetime of cgroup_subsys_state is subsys's matter.
884 *
885 * Looking up and scanning function should be called under rcu_read_lock().
886 * Taking cgroup_mutex is not necessary for following calls.
887 * But the css returned by this routine can be "not populated yet" or "being
888 * destroyed". The caller should check css and cgroup's status.
889 */
890
891/*
892 * Typically Called at ->destroy(), or somewhere the subsys frees
893 * cgroup_subsys_state.
894 */
895void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
896
897/* Find a cgroup_subsys_state which has given ID */
898
899struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
900
901/* Returns true if root is ancestor of cg */
902bool css_is_ancestor(struct cgroup_subsys_state *cg,
903 const struct cgroup_subsys_state *root);
904
905/* Get id and depth of css */
906unsigned short css_id(struct cgroup_subsys_state *css);
907struct cgroup_subsys_state *css_from_dir(struct dentry *dentry, 870struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
908 struct cgroup_subsys *ss); 871 struct cgroup_subsys *ss);
909 872
diff --git a/include/linux/clk-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/clk/mxs.h b/include/linux/clk/mxs.h
index 90c30dc3efc7..5138a90e018c 100644
--- a/include/linux/clk/mxs.h
+++ b/include/linux/clk/mxs.h
@@ -9,8 +9,6 @@
9#ifndef __LINUX_CLK_MXS_H 9#ifndef __LINUX_CLK_MXS_H
10#define __LINUX_CLK_MXS_H 10#define __LINUX_CLK_MXS_H
11 11
12int mx23_clocks_init(void);
13int mx28_clocks_init(void);
14int mxs_saif_clkmux_select(unsigned int clkmux); 12int mxs_saif_clkmux_select(unsigned int clkmux);
15 13
16#endif 14#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 0857922e8ad0..493aa021c7a9 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -60,6 +60,7 @@ enum clock_event_mode {
60 * Core shall set the interrupt affinity dynamically in broadcast mode 60 * Core shall set the interrupt affinity dynamically in broadcast mode
61 */ 61 */
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040
63 64
64/** 65/**
65 * struct clock_event_device - clock event device descriptor 66 * struct clock_event_device - clock event device descriptor
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index dbbf8aa7731b..67301a405712 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -292,6 +292,8 @@ extern void clocksource_resume(void);
292extern struct clocksource * __init __weak clocksource_default_clock(void); 292extern struct clocksource * __init __weak clocksource_default_clock(void);
293extern void clocksource_mark_unstable(struct clocksource *cs); 293extern void clocksource_mark_unstable(struct clocksource *cs);
294 294
295extern u64
296clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask);
295extern void 297extern void
296clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 298clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
297 299
diff --git a/include/linux/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/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 842de225055f..ded429966c1f 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -65,6 +65,21 @@
65#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
66#endif 66#endif
67 67
68/*
69 * GCC 'asm goto' miscompiles certain code sequences:
70 *
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 *
76 * (asm goto is automatically volatile - the naming reflects this.)
77 */
78#if GCC_VERSION <= 40801
79# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
80#else
81# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
82#endif
68 83
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 84#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if GCC_VERSION >= 40400 85#if GCC_VERSION >= 40400
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 3cd574d5b19e..22c33e35bcb2 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -5,7 +5,7 @@
5 * (C) Copyright 2001 Linus Torvalds 5 * (C) Copyright 2001 Linus Torvalds
6 * 6 *
7 * Atomic wait-for-completion handler data structures. 7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched/core.c for details. 8 * See kernel/sched/completion.c for details.
9 */ 9 */
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
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..fbd25c3c2923 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);
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/debugfs.h b/include/linux/debugfs.h
index 263489d0788d..4d0b4d1aa132 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -206,6 +206,12 @@ static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mod
206 return ERR_PTR(-ENODEV); 206 return ERR_PTR(-ENODEV);
207} 207}
208 208
209static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
210 struct dentry *parent, atomic_t *value)
211{
212 return ERR_PTR(-ENODEV);
213}
214
209static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, 215static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
210 struct dentry *parent, 216 struct dentry *parent,
211 u32 *value) 217 u32 *value)
@@ -227,6 +233,12 @@ static inline struct dentry *debugfs_create_regset32(const char *name,
227 return ERR_PTR(-ENODEV); 233 return ERR_PTR(-ENODEV);
228} 234}
229 235
236static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
237 int nregs, void __iomem *base, char *prefix)
238{
239 return 0;
240}
241
230static inline bool debugfs_initialized(void) 242static inline bool debugfs_initialized(void)
231{ 243{
232 return false; 244 return false;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 653073de09e3..ed419c62dde1 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -406,13 +406,14 @@ int dm_noflush_suspending(struct dm_target *ti);
406union map_info *dm_get_mapinfo(struct bio *bio); 406union map_info *dm_get_mapinfo(struct bio *bio);
407union map_info *dm_get_rq_mapinfo(struct request *rq); 407union map_info *dm_get_rq_mapinfo(struct request *rq);
408 408
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
410
409/* 411/*
410 * Geometry functions. 412 * Geometry functions.
411 */ 413 */
412int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo); 414int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
413int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); 415int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
414 416
415
416/*----------------------------------------------------------------- 417/*-----------------------------------------------------------------
417 * Functions for manipulating device-mapper tables. 418 * Functions for manipulating device-mapper tables.
418 *---------------------------------------------------------------*/ 419 *---------------------------------------------------------------*/
diff --git a/include/linux/device.h b/include/linux/device.h
index 2a9d6ed59579..b025925df7f7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -26,6 +26,7 @@
26#include <linux/atomic.h> 26#include <linux/atomic.h>
27#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
28#include <linux/uidgid.h> 28#include <linux/uidgid.h>
29#include <linux/gfp.h>
29#include <asm/device.h> 30#include <asm/device.h>
30 31
31struct device; 32struct device;
@@ -63,9 +64,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
63 * @name: The name of the bus. 64 * @name: The name of the bus.
64 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 65 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
65 * @dev_root: Default device to use as the parent. 66 * @dev_root: Default device to use as the parent.
66 * @bus_attrs: Default attributes of the bus.
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus. 68 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus. 69 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus. 70 * @drv_groups: Default attributes of the device drivers on the bus.
@@ -106,9 +105,7 @@ struct bus_type {
106 const char *name; 105 const char *name;
107 const char *dev_name; 106 const char *dev_name;
108 struct device *dev_root; 107 struct device *dev_root;
109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
110 struct device_attribute *dev_attrs; /* use dev_groups instead */ 108 struct device_attribute *dev_attrs; /* use dev_groups instead */
111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups; 109 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups; 110 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups; 111 const struct attribute_group **drv_groups;
@@ -329,8 +326,6 @@ int subsys_virtual_register(struct bus_type *subsys,
329 * @owner: The module owner. 326 * @owner: The module owner.
330 * @class_attrs: Default attributes of this class. 327 * @class_attrs: Default attributes of this class.
331 * @dev_groups: Default attributes of the devices that belong to the class. 328 * @dev_groups: Default attributes of the devices that belong to the class.
332 * @dev_attrs: Default attributes of the devices belong to the class.
333 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
334 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 329 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
335 * @dev_uevent: Called when a device is added, removed from this class, or a 330 * @dev_uevent: Called when a device is added, removed from this class, or a
336 * few other things that generate uevents to add the environment 331 * few other things that generate uevents to add the environment
@@ -358,9 +353,7 @@ struct class {
358 struct module *owner; 353 struct module *owner;
359 354
360 struct class_attribute *class_attrs; 355 struct class_attribute *class_attrs;
361 struct device_attribute *dev_attrs; /* use dev_groups instead */
362 const struct attribute_group **dev_groups; 356 const struct attribute_group **dev_groups;
363 struct bin_attribute *dev_bin_attrs;
364 struct kobject *dev_kobj; 357 struct kobject *dev_kobj;
365 358
366 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 359 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -427,8 +420,6 @@ struct class_attribute {
427 char *buf); 420 char *buf);
428 ssize_t (*store)(struct class *class, struct class_attribute *attr, 421 ssize_t (*store)(struct class *class, struct class_attribute *attr,
429 const char *buf, size_t count); 422 const char *buf, size_t count);
430 const void *(*namespace)(struct class *class,
431 const struct class_attribute *attr);
432}; 423};
433 424
434#define CLASS_ATTR(_name, _mode, _show, _store) \ 425#define CLASS_ATTR(_name, _mode, _show, _store) \
@@ -438,10 +429,24 @@ struct class_attribute {
438#define CLASS_ATTR_RO(_name) \ 429#define CLASS_ATTR_RO(_name) \
439 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 430 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
440 431
441extern int __must_check class_create_file(struct class *class, 432extern int __must_check class_create_file_ns(struct class *class,
442 const struct class_attribute *attr); 433 const struct class_attribute *attr,
443extern void class_remove_file(struct class *class, 434 const void *ns);
444 const struct class_attribute *attr); 435extern void class_remove_file_ns(struct class *class,
436 const struct class_attribute *attr,
437 const void *ns);
438
439static inline int __must_check class_create_file(struct class *class,
440 const struct class_attribute *attr)
441{
442 return class_create_file_ns(class, attr, NULL);
443}
444
445static inline void class_remove_file(struct class *class,
446 const struct class_attribute *attr)
447{
448 return class_remove_file_ns(class, attr, NULL);
449}
445 450
446/* Simple class attribute that is just a static string */ 451/* Simple class attribute that is just a static string */
447struct class_attribute_string { 452struct class_attribute_string {
@@ -602,8 +607,24 @@ extern void devres_close_group(struct device *dev, void *id);
602extern void devres_remove_group(struct device *dev, void *id); 607extern void devres_remove_group(struct device *dev, void *id);
603extern int devres_release_group(struct device *dev, void *id); 608extern int devres_release_group(struct device *dev, void *id);
604 609
605/* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */ 610/* managed devm_k.alloc/kfree for device drivers */
606extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 611extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
615}
616static inline void *devm_kmalloc_array(struct device *dev,
617 size_t n, size_t size, gfp_t flags)
618{
619 if (size != 0 && n > SIZE_MAX / size)
620 return NULL;
621 return devm_kmalloc(dev, n * size, flags);
622}
623static inline void *devm_kcalloc(struct device *dev,
624 size_t n, size_t size, gfp_t flags)
625{
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627}
607extern void devm_kfree(struct device *dev, void *p); 628extern void devm_kfree(struct device *dev, void *p);
608 629
609void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
@@ -1149,16 +1170,15 @@ do { \
1149#endif 1170#endif
1150 1171
1151/* 1172/*
1152 * dev_WARN*() acts like dev_printk(), but with the key difference 1173 * dev_WARN*() acts like dev_printk(), but with the key difference of
1153 * of using a WARN/WARN_ON to get the message out, including the 1174 * using WARN/WARN_ONCE to include file/line information and a backtrace.
1154 * file/line information and a backtrace.
1155 */ 1175 */
1156#define dev_WARN(dev, format, arg...) \ 1176#define dev_WARN(dev, format, arg...) \
1157 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); 1177 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
1158 1178
1159#define dev_WARN_ONCE(dev, condition, format, arg...) \ 1179#define dev_WARN_ONCE(dev, condition, format, arg...) \
1160 WARN_ONCE(condition, "Device %s\n" format, \ 1180 WARN_ONCE(condition, "%s %s: " format, \
1161 dev_driver_string(dev), ## arg) 1181 dev_driver_string(dev), dev_name(dev), ## arg)
1162 1182
1163/* Create alias, so I can be autoloaded. */ 1183/* Create alias, so I can be autoloaded. */
1164#define MODULE_ALIAS_CHARDEV(major,minor) \ 1184#define MODULE_ALIAS_CHARDEV(major,minor) \
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/extcon.h b/include/linux/extcon.h
index fcb51c88319f..21c59af1150b 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -51,10 +51,10 @@
51enum extcon_cable_name { 51enum extcon_cable_name {
52 EXTCON_USB = 0, 52 EXTCON_USB = 0,
53 EXTCON_USB_HOST, 53 EXTCON_USB_HOST,
54 EXTCON_TA, /* Travel Adaptor */ 54 EXTCON_TA, /* Travel Adaptor */
55 EXTCON_FAST_CHARGER, 55 EXTCON_FAST_CHARGER,
56 EXTCON_SLOW_CHARGER, 56 EXTCON_SLOW_CHARGER,
57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */ 57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
58 EXTCON_HDMI, 58 EXTCON_HDMI,
59 EXTCON_MHL, 59 EXTCON_MHL,
60 EXTCON_DVI, 60 EXTCON_DVI,
@@ -76,8 +76,8 @@ struct extcon_cable;
76 76
77/** 77/**
78 * struct extcon_dev - An extcon device represents one external connector. 78 * struct extcon_dev - An extcon device represents one external connector.
79 * @name: The name of this extcon device. Parent device name is used 79 * @name: The name of this extcon device. Parent device name is
80 * if NULL. 80 * used if NULL.
81 * @supported_cable: Array of supported cable names ending with NULL. 81 * @supported_cable: Array of supported cable names ending with NULL.
82 * If supported_cable is NULL, cable name related APIs 82 * If supported_cable is NULL, cable name related APIs
83 * are disabled. 83 * are disabled.
@@ -89,21 +89,21 @@ struct extcon_cable;
89 * be attached simulataneously. {0x7, 0} is equivalent to 89 * be attached simulataneously. {0x7, 0} is equivalent to
90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
91 * can be no simultaneous connections. 91 * can be no simultaneous connections.
92 * @print_name: An optional callback to override the method to print the 92 * @print_name: An optional callback to override the method to print the
93 * name of the extcon device. 93 * name of the extcon device.
94 * @print_state: An optional callback to override the method to print the 94 * @print_state: An optional callback to override the method to print the
95 * status of the extcon device. 95 * status of the extcon device.
96 * @dev: Device of this extcon. Do not provide at register-time. 96 * @dev: Device of this extcon.
97 * @state: Attach/detach state of this extcon. Do not provide at 97 * @state: Attach/detach state of this extcon. Do not provide at
98 * register-time 98 * register-time.
99 * @nh: Notifier for the state change events from this extcon 99 * @nh: Notifier for the state change events from this extcon
100 * @entry: To support list of extcon devices so that users can search 100 * @entry: To support list of extcon devices so that users can search
101 * for extcon devices based on the extcon name. 101 * for extcon devices based on the extcon name.
102 * @lock: 102 * @lock:
103 * @max_supported: Internal value to store the number of cables. 103 * @max_supported: Internal value to store the number of cables.
104 * @extcon_dev_type: Device_type struct to provide attribute_groups 104 * @extcon_dev_type: Device_type struct to provide attribute_groups
105 * customized for each extcon device. 105 * customized for each extcon device.
106 * @cables: Sysfs subdirectories. Each represents one cable. 106 * @cables: Sysfs subdirectories. Each represents one cable.
107 * 107 *
108 * In most cases, users only need to provide "User initializing data" of 108 * In most cases, users only need to provide "User initializing data" of
109 * this struct when registering an extcon. In some exceptional cases, 109 * this struct when registering an extcon. In some exceptional cases,
@@ -111,26 +111,27 @@ struct extcon_cable;
111 * are overwritten by register function. 111 * are overwritten by register function.
112 */ 112 */
113struct extcon_dev { 113struct extcon_dev {
114 /* --- Optional user initializing data --- */ 114 /* Optional user initializing data */
115 const char *name; 115 const char *name;
116 const char **supported_cable; 116 const char **supported_cable;
117 const u32 *mutually_exclusive; 117 const u32 *mutually_exclusive;
118 118
119 /* --- Optional callbacks to override class functions --- */ 119 /* Optional callbacks to override class functions */
120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf); 120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf); 121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
122 122
123 /* --- Internal data. Please do not set. --- */ 123 /* Internal data. Please do not set. */
124 struct device *dev; 124 struct device dev;
125 u32 state;
126 struct raw_notifier_head nh; 125 struct raw_notifier_head nh;
127 struct list_head entry; 126 struct list_head entry;
128 spinlock_t lock; /* could be called by irq handler */
129 int max_supported; 127 int max_supported;
128 spinlock_t lock; /* could be called by irq handler */
129 u32 state;
130 130
131 /* /sys/class/extcon/.../cable.n/... */ 131 /* /sys/class/extcon/.../cable.n/... */
132 struct device_type extcon_dev_type; 132 struct device_type extcon_dev_type;
133 struct extcon_cable *cables; 133 struct extcon_cable *cables;
134
134 /* /sys/class/extcon/.../mutually_exclusive/... */ 135 /* /sys/class/extcon/.../mutually_exclusive/... */
135 struct attribute_group attr_g_muex; 136 struct attribute_group attr_g_muex;
136 struct attribute **attrs_muex; 137 struct attribute **attrs_muex;
@@ -138,13 +139,13 @@ struct extcon_dev {
138}; 139};
139 140
140/** 141/**
141 * struct extcon_cable - An internal data for each cable of extcon device. 142 * struct extcon_cable - An internal data for each cable of extcon device.
142 * @edev: The extcon device 143 * @edev: The extcon device
143 * @cable_index: Index of this cable in the edev 144 * @cable_index: Index of this cable in the edev
144 * @attr_g: Attribute group for the cable 145 * @attr_g: Attribute group for the cable
145 * @attr_name: "name" sysfs entry 146 * @attr_name: "name" sysfs entry
146 * @attr_state: "state" sysfs entry 147 * @attr_state: "state" sysfs entry
147 * @attrs: Array pointing to attr_name and attr_state for attr_g 148 * @attrs: Array pointing to attr_name and attr_state for attr_g
148 */ 149 */
149struct extcon_cable { 150struct extcon_cable {
150 struct extcon_dev *edev; 151 struct extcon_dev *edev;
@@ -159,11 +160,13 @@ struct extcon_cable {
159 160
160/** 161/**
161 * struct extcon_specific_cable_nb - An internal data for 162 * struct extcon_specific_cable_nb - An internal data for
162 * extcon_register_interest(). 163 * extcon_register_interest().
163 * @internal_nb: a notifier block bridging extcon notifier and cable notifier. 164 * @internal_nb: A notifier block bridging extcon notifier
164 * @user_nb: user provided notifier block for events from a specific cable. 165 * and cable notifier.
166 * @user_nb: user provided notifier block for events from
167 * a specific cable.
165 * @cable_index: the target cable. 168 * @cable_index: the target cable.
166 * @edev: the target extcon device. 169 * @edev: the target extcon device.
167 * @previous_value: the saved previous event value. 170 * @previous_value: the saved previous event value.
168 */ 171 */
169struct extcon_specific_cable_nb { 172struct extcon_specific_cable_nb {
@@ -180,7 +183,7 @@ struct extcon_specific_cable_nb {
180 * Following APIs are for notifiers or configurations. 183 * Following APIs are for notifiers or configurations.
181 * Notifiers are the external port and connection devices. 184 * Notifiers are the external port and connection devices.
182 */ 185 */
183extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev); 186extern int extcon_dev_register(struct extcon_dev *edev);
184extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
185extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
186 189
@@ -238,8 +241,7 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
238extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
239 struct notifier_block *nb); 242 struct notifier_block *nb);
240#else /* CONFIG_EXTCON */ 243#else /* CONFIG_EXTCON */
241static inline int extcon_dev_register(struct extcon_dev *edev, 244static inline int extcon_dev_register(struct extcon_dev *edev)
242 struct device *dev)
243{ 245{
244 return 0; 246 return 0;
245} 247}
diff --git a/include/linux/extcon/extcon-adc-jack.h b/include/linux/extcon/extcon-adc-jack.h
index 20e9eef25d4c..9ca958c4e94c 100644
--- a/include/linux/extcon/extcon-adc-jack.h
+++ b/include/linux/extcon/extcon-adc-jack.h
@@ -20,10 +20,10 @@
20 20
21/** 21/**
22 * struct adc_jack_cond - condition to use an extcon state 22 * struct adc_jack_cond - condition to use an extcon state
23 * @state - the corresponding extcon state (if 0, this struct denotes 23 * @state: the corresponding extcon state (if 0, this struct
24 * the last adc_jack_cond element among the array) 24 * denotes the last adc_jack_cond element among the array)
25 * @min_adc - min adc value for this condition 25 * @min_adc: min adc value for this condition
26 * @max_adc - max adc value for this condition 26 * @max_adc: max adc value for this condition
27 * 27 *
28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means 28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means
29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and 29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and
@@ -33,34 +33,34 @@
33 * because when no adc_jack_cond is met, state = 0 is automatically chosen. 33 * because when no adc_jack_cond is met, state = 0 is automatically chosen.
34 */ 34 */
35struct adc_jack_cond { 35struct adc_jack_cond {
36 u32 state; /* extcon state value. 0 if invalid */ 36 u32 state; /* extcon state value. 0 if invalid */
37 u32 min_adc; 37 u32 min_adc;
38 u32 max_adc; 38 u32 max_adc;
39}; 39};
40 40
41/** 41/**
42 * struct adc_jack_pdata - platform data for adc jack device. 42 * struct adc_jack_pdata - platform data for adc jack device.
43 * @name - name of the extcon device. If null, "adc-jack" is used. 43 * @name: name of the extcon device. If null, "adc-jack" is used.
44 * @consumer_channel - Unique name to identify the channel on the consumer 44 * @consumer_channel: Unique name to identify the channel on the consumer
45 * side. This typically describes the channels used within 45 * side. This typically describes the channels used within
46 * the consumer. E.g. 'battery_voltage' 46 * the consumer. E.g. 'battery_voltage'
47 * @cable_names - array of cable names ending with null. 47 * @cable_names: array of cable names ending with null.
48 * @adc_contitions - array of struct adc_jack_cond conditions ending 48 * @adc_contitions: array of struct adc_jack_cond conditions ending
49 * with .state = 0 entry. This describes how to decode 49 * with .state = 0 entry. This describes how to decode
50 * adc values into extcon state. 50 * adc values into extcon state.
51 * @irq_flags - irq flags used for the @irq 51 * @irq_flags: irq flags used for the @irq
52 * @handling_delay_ms - in some devices, we need to read ADC value some 52 * @handling_delay_ms: in some devices, we need to read ADC value some
53 * milli-seconds after the interrupt occurs. You may 53 * milli-seconds after the interrupt occurs. You may
54 * describe such delays with @handling_delay_ms, which 54 * describe such delays with @handling_delay_ms, which
55 * is rounded-off by jiffies. 55 * is rounded-off by jiffies.
56 */ 56 */
57struct adc_jack_pdata { 57struct adc_jack_pdata {
58 const char *name; 58 const char *name;
59 const char *consumer_channel; 59 const char *consumer_channel;
60 /* 60
61 * The last entry should be NULL 61 /* The last entry should be NULL */
62 */
63 const char **cable_names; 62 const char **cable_names;
63
64 /* The last entry's state should be 0 */ 64 /* The last entry's state should be 0 */
65 struct adc_jack_cond *adc_conditions; 65 struct adc_jack_cond *adc_conditions;
66 66
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 2d8307f7d67d..4195810f87fe 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -25,14 +25,17 @@
25 25
26/** 26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. 27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device. 28 * @name: The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO. 29 * @gpio: Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms. 30 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). 31 * If true, low state of gpio means active.
32 * @state_on print_state is overriden with state_on if attached. If Null, 32 * If false, high state of gpio means active.
33 * default method of extcon class is used. 33 * @debounce: Debounce time for GPIO IRQ in ms.
34 * @state_off print_state is overriden with state_on if detached. If Null, 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * default method of extcon class is used. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached.
38 * If NUll, default method of extcon class is used.
36 * 39 *
37 * Note that in order for state_on or state_off to be valid, both state_on 40 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL, 41 * and state_off should be not NULL. If at least one of them is NULL,
@@ -41,6 +44,7 @@
41struct gpio_extcon_platform_data { 44struct gpio_extcon_platform_data {
42 const char *name; 45 const char *name;
43 unsigned gpio; 46 unsigned gpio;
47 bool gpio_active_low;
44 unsigned long debounce; 48 unsigned long debounce;
45 unsigned long irq_flags; 49 unsigned long irq_flags;
46 50
diff --git a/include/linux/fcdevice.h b/include/linux/fcdevice.h
index e460ef831984..5009fa16b5d8 100644
--- a/include/linux/fcdevice.h
+++ b/include/linux/fcdevice.h
@@ -27,7 +27,7 @@
27#include <linux/if_fc.h> 27#include <linux/if_fc.h>
28 28
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30extern struct net_device *alloc_fcdev(int sizeof_priv); 30struct net_device *alloc_fcdev(int sizeof_priv);
31#endif 31#endif
32 32
33#endif /* _LINUX_FCDEVICE_H */ 33#endif /* _LINUX_FCDEVICE_H */
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index 155bafd9e886..9a79f0106da1 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -25,10 +25,9 @@
25#include <linux/if_fddi.h> 25#include <linux/if_fddi.h>
26 26
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev);
29 struct net_device *dev); 29int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu); 30struct net_device *alloc_fddidev(int sizeof_priv);
31extern struct net_device *alloc_fddidev(int sizeof_priv);
32#endif 31#endif
33 32
34#endif /* _LINUX_FDDIDEVICE_H */ 33#endif /* _LINUX_FDDIDEVICE_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a6ac84871d6d..ff4e40cd45b1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/workqueue.h>
9#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
10 11
11#ifdef CONFIG_COMPAT 12#ifdef CONFIG_COMPAT
@@ -25,15 +26,19 @@ struct sk_filter
25{ 26{
26 atomic_t refcnt; 27 atomic_t refcnt;
27 unsigned int len; /* Number of filter blocks */ 28 unsigned int len; /* Number of filter blocks */
29 struct rcu_head rcu;
28 unsigned int (*bpf_func)(const struct sk_buff *skb, 30 unsigned int (*bpf_func)(const struct sk_buff *skb,
29 const struct sock_filter *filter); 31 const struct sock_filter *filter);
30 struct rcu_head rcu; 32 union {
31 struct sock_filter insns[0]; 33 struct sock_filter insns[0];
34 struct work_struct work;
35 };
32}; 36};
33 37
34static inline unsigned int sk_filter_len(const struct sk_filter *fp) 38static inline unsigned int sk_filter_size(unsigned int proglen)
35{ 39{
36 return fp->len * sizeof(struct sock_filter) + sizeof(*fp); 40 return max(sizeof(struct sk_filter),
41 offsetof(struct sk_filter, insns[proglen]));
37} 42}
38 43
39extern int sk_filter(struct sock *sk, struct sk_buff *skb); 44extern int sk_filter(struct sock *sk, struct sk_buff *skb);
@@ -67,11 +72,13 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
67} 72}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
69#else 74#else
75#include <linux/slab.h>
70static inline void bpf_jit_compile(struct sk_filter *fp) 76static inline void bpf_jit_compile(struct sk_filter *fp)
71{ 77{
72} 78}
73static inline void bpf_jit_free(struct sk_filter *fp) 79static inline void bpf_jit_free(struct sk_filter *fp)
74{ 80{
81 kfree(fp);
75} 82}
76#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) 83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
77#endif 84#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3f40547ba191..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);
1959 return 0; 1968 return 0;
1960} 1969}
1970
1971static inline int break_deleg(struct inode *inode, unsigned int mode)
1972{
1973 if (inode->i_flock)
1974 return __break_lease(inode, mode, FL_DELEG);
1975 return 0;
1976}
1977
1978static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
1979{
1980 int ret;
1981
1982 ret = break_deleg(inode, O_WRONLY|O_NONBLOCK);
1983 if (ret == -EWOULDBLOCK && delegated_inode) {
1984 *delegated_inode = inode;
1985 ihold(inode);
1986 }
1987 return ret;
1988}
1989
1990static inline int break_deleg_wait(struct inode **delegated_inode)
1991{
1992 int ret;
1993
1994 ret = break_deleg(*delegated_inode, O_WRONLY);
1995 iput(*delegated_inode);
1996 *delegated_inode = NULL;
1997 return ret;
1998}
1999
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
@@ -2292,6 +2347,11 @@ static inline void allow_write_access(struct file *file)
2292 if (file) 2347 if (file)
2293 atomic_inc(&file_inode(file)->i_writecount); 2348 atomic_inc(&file_inode(file)->i_writecount);
2294} 2349}
2350static inline bool inode_is_open_for_write(const struct inode *inode)
2351{
2352 return atomic_read(&inode->i_writecount) > 0;
2353}
2354
2295#ifdef CONFIG_IMA 2355#ifdef CONFIG_IMA
2296static inline void i_readcount_dec(struct inode *inode) 2356static inline void i_readcount_dec(struct inode *inode)
2297{ 2357{
@@ -2332,8 +2392,6 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2332extern int inode_init_always(struct super_block *, struct inode *); 2392extern int inode_init_always(struct super_block *, struct inode *);
2333extern void inode_init_once(struct inode *); 2393extern void inode_init_once(struct inode *);
2334extern void address_space_init_once(struct address_space *mapping); 2394extern void address_space_init_once(struct address_space *mapping);
2335extern void ihold(struct inode * inode);
2336extern void iput(struct inode *);
2337extern struct inode * igrab(struct inode *); 2395extern struct inode * igrab(struct inode *);
2338extern ino_t iunique(struct super_block *, ino_t); 2396extern ino_t iunique(struct super_block *, ino_t);
2339extern int inode_needs_sync(struct inode *inode); 2397extern int inode_needs_sync(struct inode *inode);
@@ -2502,8 +2560,10 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
2502 int nofs); 2560 int nofs);
2503extern int page_symlink(struct inode *inode, const char *symname, int len); 2561extern int page_symlink(struct inode *inode, const char *symname, int len);
2504extern 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 *);
2505extern int generic_readlink(struct dentry *, char __user *, int); 2564extern int generic_readlink(struct dentry *, char __user *, int);
2506extern 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);
2507extern int vfs_getattr(struct path *, struct kstat *); 2567extern int vfs_getattr(struct path *, struct kstat *);
2508void __inode_add_bytes(struct inode *inode, loff_t bytes); 2568void __inode_add_bytes(struct inode *inode, loff_t bytes);
2509void inode_add_bytes(struct inode *inode, loff_t bytes); 2569void inode_add_bytes(struct inode *inode, loff_t bytes);
@@ -2562,6 +2622,7 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
2562extern int simple_write_end(struct file *file, struct address_space *mapping, 2622extern int simple_write_end(struct file *file, struct address_space *mapping,
2563 loff_t pos, unsigned len, unsigned copied, 2623 loff_t pos, unsigned len, unsigned copied,
2564 struct page *page, void *fsdata); 2624 struct page *page, void *fsdata);
2625extern struct inode *alloc_anon_inode(struct super_block *);
2565 2626
2566extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2627extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
2567extern 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/fscache-cache.h b/include/linux/fscache-cache.h
index 7823e9ef995e..771484993ca7 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -308,36 +308,6 @@ struct fscache_cache_ops {
308 void (*dissociate_pages)(struct fscache_cache *cache); 308 void (*dissociate_pages)(struct fscache_cache *cache);
309}; 309};
310 310
311/*
312 * data file or index object cookie
313 * - a file will only appear in one cache
314 * - a request to cache a file may or may not be honoured, subject to
315 * constraints such as disk space
316 * - indices are created on disk just-in-time
317 */
318struct fscache_cookie {
319 atomic_t usage; /* number of users of this cookie */
320 atomic_t n_children; /* number of children of this cookie */
321 atomic_t n_active; /* number of active users of netfs ptrs */
322 spinlock_t lock;
323 spinlock_t stores_lock; /* lock on page store tree */
324 struct hlist_head backing_objects; /* object(s) backing this file/index */
325 const struct fscache_cookie_def *def; /* definition */
326 struct fscache_cookie *parent; /* parent of this entry */
327 void *netfs_data; /* back pointer to netfs */
328 struct radix_tree_root stores; /* pages to be stored on this cookie */
329#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
330#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
331
332 unsigned long flags;
333#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
334#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
335#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
336#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
337#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
338#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
339};
340
341extern struct fscache_cookie fscache_fsdef_index; 311extern struct fscache_cookie fscache_fsdef_index;
342 312
343/* 313/*
@@ -400,6 +370,7 @@ struct fscache_object {
400#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */ 370#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
401#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ 371#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
402#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ 372#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
373#define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */
403 374
404 struct list_head cache_link; /* link in cache->object_list */ 375 struct list_head cache_link; /* link in cache->object_list */
405 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 376 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -511,6 +482,11 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
511 op->end_io_func(page, op->context, error); 482 op->end_io_func(page, op->context, error);
512} 483}
513 484
485static inline void __fscache_use_cookie(struct fscache_cookie *cookie)
486{
487 atomic_inc(&cookie->n_active);
488}
489
514/** 490/**
515 * fscache_use_cookie - Request usage of cookie attached to an object 491 * fscache_use_cookie - Request usage of cookie attached to an object
516 * @object: Object description 492 * @object: Object description
@@ -524,6 +500,16 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
524 return atomic_inc_not_zero(&cookie->n_active) != 0; 500 return atomic_inc_not_zero(&cookie->n_active) != 0;
525} 501}
526 502
503static inline bool __fscache_unuse_cookie(struct fscache_cookie *cookie)
504{
505 return atomic_dec_and_test(&cookie->n_active);
506}
507
508static inline void __fscache_wake_unused_cookie(struct fscache_cookie *cookie)
509{
510 wake_up_atomic_t(&cookie->n_active);
511}
512
527/** 513/**
528 * fscache_unuse_cookie - Cease usage of cookie attached to an object 514 * fscache_unuse_cookie - Cease usage of cookie attached to an object
529 * @object: Object description 515 * @object: Object description
@@ -534,8 +520,8 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
534static inline void fscache_unuse_cookie(struct fscache_object *object) 520static inline void fscache_unuse_cookie(struct fscache_object *object)
535{ 521{
536 struct fscache_cookie *cookie = object->cookie; 522 struct fscache_cookie *cookie = object->cookie;
537 if (atomic_dec_and_test(&cookie->n_active)) 523 if (__fscache_unuse_cookie(cookie))
538 wake_up_atomic_t(&cookie->n_active); 524 __fscache_wake_unused_cookie(cookie);
539} 525}
540 526
541/* 527/*
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 19b46458e4e8..115bb81912cc 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -167,6 +167,42 @@ struct fscache_netfs {
167}; 167};
168 168
169/* 169/*
170 * data file or index object cookie
171 * - a file will only appear in one cache
172 * - a request to cache a file may or may not be honoured, subject to
173 * constraints such as disk space
174 * - indices are created on disk just-in-time
175 */
176struct fscache_cookie {
177 atomic_t usage; /* number of users of this cookie */
178 atomic_t n_children; /* number of children of this cookie */
179 atomic_t n_active; /* number of active users of netfs ptrs */
180 spinlock_t lock;
181 spinlock_t stores_lock; /* lock on page store tree */
182 struct hlist_head backing_objects; /* object(s) backing this file/index */
183 const struct fscache_cookie_def *def; /* definition */
184 struct fscache_cookie *parent; /* parent of this entry */
185 void *netfs_data; /* back pointer to netfs */
186 struct radix_tree_root stores; /* pages to be stored on this cookie */
187#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
188#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
189
190 unsigned long flags;
191#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
192#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
193#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
194#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
195#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
196#define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */
197#define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */
198};
199
200static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie)
201{
202 return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
203}
204
205/*
170 * slow-path functions for when there is actually caching available, and the 206 * slow-path functions for when there is actually caching available, and the
171 * netfs does actually have a valid token 207 * netfs does actually have a valid token
172 * - these are not to be called directly 208 * - these are not to be called directly
@@ -181,8 +217,8 @@ extern void __fscache_release_cache_tag(struct fscache_cache_tag *);
181extern struct fscache_cookie *__fscache_acquire_cookie( 217extern struct fscache_cookie *__fscache_acquire_cookie(
182 struct fscache_cookie *, 218 struct fscache_cookie *,
183 const struct fscache_cookie_def *, 219 const struct fscache_cookie_def *,
184 void *); 220 void *, bool);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 221extern void __fscache_relinquish_cookie(struct fscache_cookie *, bool);
186extern int __fscache_check_consistency(struct fscache_cookie *); 222extern int __fscache_check_consistency(struct fscache_cookie *);
187extern void __fscache_update_cookie(struct fscache_cookie *); 223extern void __fscache_update_cookie(struct fscache_cookie *);
188extern int __fscache_attr_changed(struct fscache_cookie *); 224extern int __fscache_attr_changed(struct fscache_cookie *);
@@ -211,6 +247,9 @@ extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
211 struct inode *); 247 struct inode *);
212extern void __fscache_readpages_cancel(struct fscache_cookie *cookie, 248extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
213 struct list_head *pages); 249 struct list_head *pages);
250extern void __fscache_disable_cookie(struct fscache_cookie *, bool);
251extern void __fscache_enable_cookie(struct fscache_cookie *,
252 bool (*)(void *), void *);
214 253
215/** 254/**
216 * fscache_register_netfs - Register a filesystem as desiring caching services 255 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -289,6 +328,7 @@ void fscache_release_cache_tag(struct fscache_cache_tag *tag)
289 * @def: A description of the cache object, including callback operations 328 * @def: A description of the cache object, including callback operations
290 * @netfs_data: An arbitrary piece of data to be kept in the cookie to 329 * @netfs_data: An arbitrary piece of data to be kept in the cookie to
291 * represent the cache object to the netfs 330 * represent the cache object to the netfs
331 * @enable: Whether or not to enable a data cookie immediately
292 * 332 *
293 * This function is used to inform FS-Cache about part of an index hierarchy 333 * This function is used to inform FS-Cache about part of an index hierarchy
294 * that can be used to locate files. This is done by requesting a cookie for 334 * that can be used to locate files. This is done by requesting a cookie for
@@ -301,10 +341,12 @@ static inline
301struct fscache_cookie *fscache_acquire_cookie( 341struct fscache_cookie *fscache_acquire_cookie(
302 struct fscache_cookie *parent, 342 struct fscache_cookie *parent,
303 const struct fscache_cookie_def *def, 343 const struct fscache_cookie_def *def,
304 void *netfs_data) 344 void *netfs_data,
345 bool enable)
305{ 346{
306 if (fscache_cookie_valid(parent)) 347 if (fscache_cookie_valid(parent) && fscache_cookie_enabled(parent))
307 return __fscache_acquire_cookie(parent, def, netfs_data); 348 return __fscache_acquire_cookie(parent, def, netfs_data,
349 enable);
308 else 350 else
309 return NULL; 351 return NULL;
310} 352}
@@ -322,7 +364,7 @@ struct fscache_cookie *fscache_acquire_cookie(
322 * description. 364 * description.
323 */ 365 */
324static inline 366static inline
325void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) 367void fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
326{ 368{
327 if (fscache_cookie_valid(cookie)) 369 if (fscache_cookie_valid(cookie))
328 __fscache_relinquish_cookie(cookie, retire); 370 __fscache_relinquish_cookie(cookie, retire);
@@ -341,7 +383,7 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
341static inline 383static inline
342int fscache_check_consistency(struct fscache_cookie *cookie) 384int fscache_check_consistency(struct fscache_cookie *cookie)
343{ 385{
344 if (fscache_cookie_valid(cookie)) 386 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
345 return __fscache_check_consistency(cookie); 387 return __fscache_check_consistency(cookie);
346 else 388 else
347 return 0; 389 return 0;
@@ -360,7 +402,7 @@ int fscache_check_consistency(struct fscache_cookie *cookie)
360static inline 402static inline
361void fscache_update_cookie(struct fscache_cookie *cookie) 403void fscache_update_cookie(struct fscache_cookie *cookie)
362{ 404{
363 if (fscache_cookie_valid(cookie)) 405 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
364 __fscache_update_cookie(cookie); 406 __fscache_update_cookie(cookie);
365} 407}
366 408
@@ -407,7 +449,7 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
407static inline 449static inline
408int fscache_attr_changed(struct fscache_cookie *cookie) 450int fscache_attr_changed(struct fscache_cookie *cookie)
409{ 451{
410 if (fscache_cookie_valid(cookie)) 452 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
411 return __fscache_attr_changed(cookie); 453 return __fscache_attr_changed(cookie);
412 else 454 else
413 return -ENOBUFS; 455 return -ENOBUFS;
@@ -429,7 +471,7 @@ int fscache_attr_changed(struct fscache_cookie *cookie)
429static inline 471static inline
430void fscache_invalidate(struct fscache_cookie *cookie) 472void fscache_invalidate(struct fscache_cookie *cookie)
431{ 473{
432 if (fscache_cookie_valid(cookie)) 474 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
433 __fscache_invalidate(cookie); 475 __fscache_invalidate(cookie);
434} 476}
435 477
@@ -503,7 +545,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
503 void *context, 545 void *context,
504 gfp_t gfp) 546 gfp_t gfp)
505{ 547{
506 if (fscache_cookie_valid(cookie)) 548 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
507 return __fscache_read_or_alloc_page(cookie, page, end_io_func, 549 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
508 context, gfp); 550 context, gfp);
509 else 551 else
@@ -554,7 +596,7 @@ int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
554 void *context, 596 void *context,
555 gfp_t gfp) 597 gfp_t gfp)
556{ 598{
557 if (fscache_cookie_valid(cookie)) 599 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
558 return __fscache_read_or_alloc_pages(cookie, mapping, pages, 600 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
559 nr_pages, end_io_func, 601 nr_pages, end_io_func,
560 context, gfp); 602 context, gfp);
@@ -585,7 +627,7 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
585 struct page *page, 627 struct page *page,
586 gfp_t gfp) 628 gfp_t gfp)
587{ 629{
588 if (fscache_cookie_valid(cookie)) 630 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
589 return __fscache_alloc_page(cookie, page, gfp); 631 return __fscache_alloc_page(cookie, page, gfp);
590 else 632 else
591 return -ENOBUFS; 633 return -ENOBUFS;
@@ -634,7 +676,7 @@ int fscache_write_page(struct fscache_cookie *cookie,
634 struct page *page, 676 struct page *page,
635 gfp_t gfp) 677 gfp_t gfp)
636{ 678{
637 if (fscache_cookie_valid(cookie)) 679 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
638 return __fscache_write_page(cookie, page, gfp); 680 return __fscache_write_page(cookie, page, gfp);
639 else 681 else
640 return -ENOBUFS; 682 return -ENOBUFS;
@@ -744,4 +786,47 @@ void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
744 __fscache_uncache_all_inode_pages(cookie, inode); 786 __fscache_uncache_all_inode_pages(cookie, inode);
745} 787}
746 788
789/**
790 * fscache_disable_cookie - Disable a cookie
791 * @cookie: The cookie representing the cache object
792 * @invalidate: Invalidate the backing object
793 *
794 * Disable a cookie from accepting further alloc, read, write, invalidate,
795 * update or acquire operations. Outstanding operations can still be waited
796 * upon and pages can still be uncached and the cookie relinquished.
797 *
798 * This will not return until all outstanding operations have completed.
799 *
800 * If @invalidate is set, then the backing object will be invalidated and
801 * detached, otherwise it will just be detached.
802 */
803static inline
804void fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate)
805{
806 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
807 __fscache_disable_cookie(cookie, invalidate);
808}
809
810/**
811 * fscache_enable_cookie - Reenable a cookie
812 * @cookie: The cookie representing the cache object
813 * @can_enable: A function to permit enablement once lock is held
814 * @data: Data for can_enable()
815 *
816 * Reenable a previously disabled cookie, allowing it to accept further alloc,
817 * read, write, invalidate, update or acquire operations. An attempt will be
818 * made to immediately reattach the cookie to a backing object.
819 *
820 * The can_enable() function is called (if not NULL) once the enablement lock
821 * is held to rule on whether enablement is still permitted to go ahead.
822 */
823static inline
824void fscache_enable_cookie(struct fscache_cookie *cookie,
825 bool (*can_enable)(void *data),
826 void *data)
827{
828 if (fscache_cookie_valid(cookie) && !fscache_cookie_enabled(cookie))
829 __fscache_enable_cookie(cookie, can_enable, data);
830}
831
747#endif /* _LINUX_FSCACHE_H */ 832#endif /* _LINUX_FSCACHE_H */
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/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/hardirq.h b/include/linux/hardirq.h
index 1e041063b226..d9cf963ac832 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -33,7 +33,7 @@ extern void rcu_nmi_exit(void);
33#define __irq_enter() \ 33#define __irq_enter() \
34 do { \ 34 do { \
35 account_irq_enter_time(current); \ 35 account_irq_enter_time(current); \
36 add_preempt_count(HARDIRQ_OFFSET); \ 36 preempt_count_add(HARDIRQ_OFFSET); \
37 trace_hardirq_enter(); \ 37 trace_hardirq_enter(); \
38 } while (0) 38 } while (0)
39 39
@@ -49,7 +49,7 @@ extern void irq_enter(void);
49 do { \ 49 do { \
50 trace_hardirq_exit(); \ 50 trace_hardirq_exit(); \
51 account_irq_exit_time(current); \ 51 account_irq_exit_time(current); \
52 sub_preempt_count(HARDIRQ_OFFSET); \ 52 preempt_count_sub(HARDIRQ_OFFSET); \
53 } while (0) 53 } while (0)
54 54
55/* 55/*
@@ -62,7 +62,7 @@ extern void irq_exit(void);
62 lockdep_off(); \ 62 lockdep_off(); \
63 ftrace_nmi_enter(); \ 63 ftrace_nmi_enter(); \
64 BUG_ON(in_nmi()); \ 64 BUG_ON(in_nmi()); \
65 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 65 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
66 rcu_nmi_enter(); \ 66 rcu_nmi_enter(); \
67 trace_hardirq_enter(); \ 67 trace_hardirq_enter(); \
68 } while (0) 68 } while (0)
@@ -72,7 +72,7 @@ extern void irq_exit(void);
72 trace_hardirq_exit(); \ 72 trace_hardirq_exit(); \
73 rcu_nmi_exit(); \ 73 rcu_nmi_exit(); \
74 BUG_ON(!in_nmi()); \ 74 BUG_ON(!in_nmi()); \
75 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 75 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
76 ftrace_nmi_exit(); \ 76 ftrace_nmi_exit(); \
77 lockdep_on(); \ 77 lockdep_on(); \
78 } while (0) 78 } while (0)
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index a9df51f5d54c..519b6e2d769e 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -174,6 +174,21 @@ static inline void hash_del_rcu(struct hlist_node *node)
174 member) 174 member)
175 175
176/** 176/**
177 * hash_for_each_possible_rcu_notrace - iterate over all possible objects hashing
178 * to the same bucket in an rcu enabled hashtable in a rcu enabled hashtable
179 * @name: hashtable to iterate
180 * @obj: the type * to use as a loop cursor for each entry
181 * @member: the name of the hlist_node within the struct
182 * @key: the key of the objects to iterate over
183 *
184 * This is the same as hash_for_each_possible_rcu() except that it does
185 * not do any RCU debugging or tracing.
186 */
187#define hash_for_each_possible_rcu_notrace(name, obj, member, key) \
188 hlist_for_each_entry_rcu_notrace(obj, \
189 &name[hash_min(key, HASH_BITS(name))], member)
190
191/**
177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 192 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
178 * same bucket safe against removals 193 * same bucket safe against removals
179 * @name: hashtable to iterate 194 * @name: hashtable to iterate
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 32ba45158d39..a265af294ea4 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -47,11 +47,13 @@ struct hid_sensor_hub_attribute_info {
47 * @hdev: Stores the hid instance. 47 * @hdev: Stores the hid instance.
48 * @vendor_id: Vendor id of hub device. 48 * @vendor_id: Vendor id of hub device.
49 * @product_id: Product id of hub device. 49 * @product_id: Product id of hub device.
50 * @ref_cnt: Number of MFD clients have opened this device
50 */ 51 */
51struct hid_sensor_hub_device { 52struct hid_sensor_hub_device {
52 struct hid_device *hdev; 53 struct hid_device *hdev;
53 u32 vendor_id; 54 u32 vendor_id;
54 u32 product_id; 55 u32 product_id;
56 int ref_cnt;
55}; 57};
56 58
57/** 59/**
@@ -74,6 +76,22 @@ struct hid_sensor_hub_callbacks {
74 void *priv); 76 void *priv);
75}; 77};
76 78
79/**
80* sensor_hub_device_open() - Open hub device
81* @hsdev: Hub device instance.
82*
83* Used to open hid device for sensor hub.
84*/
85int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev);
86
87/**
88* sensor_hub_device_clode() - Close hub device
89* @hsdev: Hub device instance.
90*
91* Used to clode hid device for sensor hub.
92*/
93void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev);
94
77/* Registration functions */ 95/* Registration functions */
78 96
79/** 97/**
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ee1ffc5e19c9..31b9d299ef6c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -756,6 +756,10 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
756struct hid_device *hid_allocate_device(void); 756struct hid_device *hid_allocate_device(void);
757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
759struct hid_report *hid_validate_values(struct hid_device *hid,
760 unsigned int type, unsigned int id,
761 unsigned int field_index,
762 unsigned int report_counts);
759int hid_open_report(struct hid_device *device); 763int hid_open_report(struct hid_device *device);
760int hid_check_keys_pressed(struct hid_device *hid); 764int hid_check_keys_pressed(struct hid_device *hid);
761int hid_connect(struct hid_device *hid, unsigned int connect_mask); 765int hid_connect(struct hid_device *hid, unsigned int connect_mask);
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index f148e4908410..8ec23fb0b412 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -31,11 +31,11 @@ struct hippi_cb {
31 __u32 ifield; 31 __u32 ifield;
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35extern int hippi_change_mtu(struct net_device *dev, int new_mtu); 35int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p); 36int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p); 37int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
38extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38struct net_device *alloc_hippi_dev(int sizeof_priv);
39#endif 39#endif
40 40
41#endif /* _LINUX_HIPPIDEVICE_H */ 41#endif /* _LINUX_HIPPIDEVICE_H */
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index f346e4d5381c..da0a680e2f6d 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -38,7 +38,7 @@ static inline int vid_to_reg(int val, u8 vrm)
38 return ((val >= 1100) && (val <= 1850) ? 38 return ((val >= 1100) && (val <= 1850) ?
39 ((18499 - val * 10) / 25 + 5) / 10 : -1); 39 ((18499 - val * 10) / 25 + 5) / 10 : -1);
40 default: 40 default:
41 return -1; 41 return -EINVAL;
42 } 42 }
43} 43}
44 44
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index b2514f70d591..09354f6c1d63 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -15,9 +15,19 @@
15#define _HWMON_H_ 15#define _HWMON_H_
16 16
17struct device; 17struct device;
18struct attribute_group;
18 19
19struct device *hwmon_device_register(struct device *dev); 20struct device *hwmon_device_register(struct device *dev);
21struct device *
22hwmon_device_register_with_groups(struct device *dev, const char *name,
23 void *drvdata,
24 const struct attribute_group **groups);
25struct device *
26devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
27 void *drvdata,
28 const struct attribute_group **groups);
20 29
21void hwmon_device_unregister(struct device *dev); 30void hwmon_device_unregister(struct device *dev);
31void devm_hwmon_device_unregister(struct device *dev);
22 32
23#endif 33#endif
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a3b8b2e2d244..15da677478dd 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -30,10 +30,13 @@
30/* 30/*
31 * Framework version for util services. 31 * Framework version for util services.
32 */ 32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
33 37
34#define UTIL_FW_MAJOR 3 38#define UTIL_FW_MAJOR 3
35#define UTIL_FW_MINOR 0 39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
36#define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
37 40
38 41
39/* 42/*
@@ -429,15 +432,6 @@ struct hv_ring_buffer_info {
429 u32 ring_data_startoffset; 432 u32 ring_data_startoffset;
430}; 433};
431 434
432struct hv_ring_buffer_debug_info {
433 u32 current_interrupt_mask;
434 u32 current_read_index;
435 u32 current_write_index;
436 u32 bytes_avail_toread;
437 u32 bytes_avail_towrite;
438};
439
440
441/* 435/*
442 * 436 *
443 * hv_get_ringbuffer_availbytes() 437 * hv_get_ringbuffer_availbytes()
@@ -899,23 +893,6 @@ enum vmbus_channel_state {
899 CHANNEL_OPENED_STATE, 893 CHANNEL_OPENED_STATE,
900}; 894};
901 895
902struct vmbus_channel_debug_info {
903 u32 relid;
904 enum vmbus_channel_state state;
905 uuid_le interfacetype;
906 uuid_le interface_instance;
907 u32 monitorid;
908 u32 servermonitor_pending;
909 u32 servermonitor_latency;
910 u32 servermonitor_connectionid;
911 u32 clientmonitor_pending;
912 u32 clientmonitor_latency;
913 u32 clientmonitor_connectionid;
914
915 struct hv_ring_buffer_debug_info inbound;
916 struct hv_ring_buffer_debug_info outbound;
917};
918
919/* 896/*
920 * Represents each channel msg on the vmbus connection This is a 897 * Represents each channel msg on the vmbus connection This is a
921 * variable-size data structure depending on the msg type itself 898 * variable-size data structure depending on the msg type itself
@@ -1181,19 +1158,8 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
1181 u64 *requestid); 1158 u64 *requestid);
1182 1159
1183 1160
1184extern void vmbus_get_debug_info(struct vmbus_channel *channel,
1185 struct vmbus_channel_debug_info *debug);
1186
1187extern void vmbus_ontimer(unsigned long data); 1161extern void vmbus_ontimer(unsigned long data);
1188 1162
1189struct hv_dev_port_info {
1190 u32 int_mask;
1191 u32 read_idx;
1192 u32 write_idx;
1193 u32 bytes_avail_toread;
1194 u32 bytes_avail_towrite;
1195};
1196
1197/* Base driver object */ 1163/* Base driver object */
1198struct hv_driver { 1164struct hv_driver {
1199 const char *name; 1165 const char *name;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 81cbbdb96aae..673a3ce67f31 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -26,6 +26,7 @@
26#define __TWL_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/phy/phy.h>
29#include <linux/input/matrix_keypad.h> 30#include <linux/input/matrix_keypad.h>
30 31
31/* 32/*
@@ -615,6 +616,7 @@ enum twl4030_usb_mode {
615struct twl4030_usb_data { 616struct twl4030_usb_data {
616 enum twl4030_usb_mode usb_mode; 617 enum twl4030_usb_mode usb_mode;
617 unsigned long features; 618 unsigned long features;
619 struct phy_init_data *init_data;
618 620
619 int (*phy_init)(struct device *dev); 621 int (*phy_init)(struct device *dev);
620 int (*phy_exit)(struct device *dev); 622 int (*phy_exit)(struct device *dev);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b17974917dbf..46a14229a162 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1514,7 +1514,7 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1514 1514
1515char *ide_media_string(ide_drive_t *); 1515char *ide_media_string(ide_drive_t *);
1516 1516
1517extern struct device_attribute ide_dev_attrs[]; 1517extern const struct attribute_group *ide_dev_groups[];
1518extern struct bus_type ide_bus_type; 1518extern struct bus_type ide_bus_type;
1519extern struct class *ide_port_class; 1519extern struct class *ide_port_class;
1520 1520
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a5b598a79bec..8c3b26a21574 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -697,6 +697,18 @@ struct ieee80211_sec_chan_offs_ie {
697} __packed; 697} __packed;
698 698
699/** 699/**
700 * struct ieee80211_mesh_chansw_params_ie - mesh channel switch parameters IE
701 *
702 * This structure represents the "Mesh Channel Switch Paramters element"
703 */
704struct ieee80211_mesh_chansw_params_ie {
705 u8 mesh_ttl;
706 u8 mesh_flags;
707 __le16 mesh_reason;
708 __le16 mesh_pre_value;
709} __packed;
710
711/**
700 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE 712 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE
701 */ 713 */
702struct ieee80211_wide_bw_chansw_ie { 714struct ieee80211_wide_bw_chansw_ie {
@@ -751,6 +763,14 @@ enum mesh_config_capab_flags {
751}; 763};
752 764
753/** 765/**
766 * mesh channel switch parameters element's flag indicator
767 *
768 */
769#define WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT BIT(0)
770#define WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR BIT(1)
771#define WLAN_EID_CHAN_SWITCH_PARAM_REASON BIT(2)
772
773/**
754 * struct ieee80211_rann_ie 774 * struct ieee80211_rann_ie
755 * 775 *
756 * This structure refers to "Root Announcement information element" 776 * This structure refers to "Root Announcement information element"
@@ -1391,8 +1411,8 @@ struct ieee80211_vht_operation {
1391#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 1411#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
1392#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1412#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1393#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1413#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1394#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1414#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MAX 0x0000e000
1395#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000 1415#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00070000
1396#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1416#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1397#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1417#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1398#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1418#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index ddd33fd5904d..c2702856295e 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);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 715c343f7c00..f252deb99454 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -89,6 +89,101 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
89extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 89extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
90extern u16 vlan_dev_vlan_id(const struct net_device *dev); 90extern u16 vlan_dev_vlan_id(const struct net_device *dev);
91 91
92/**
93 * struct vlan_priority_tci_mapping - vlan egress priority mappings
94 * @priority: skb priority
95 * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
96 * @next: pointer to next struct
97 */
98struct vlan_priority_tci_mapping {
99 u32 priority;
100 u16 vlan_qos;
101 struct vlan_priority_tci_mapping *next;
102};
103
104/**
105 * struct vlan_pcpu_stats - VLAN percpu rx/tx stats
106 * @rx_packets: number of received packets
107 * @rx_bytes: number of received bytes
108 * @rx_multicast: number of received multicast packets
109 * @tx_packets: number of transmitted packets
110 * @tx_bytes: number of transmitted bytes
111 * @syncp: synchronization point for 64bit counters
112 * @rx_errors: number of rx errors
113 * @tx_dropped: number of tx drops
114 */
115struct vlan_pcpu_stats {
116 u64 rx_packets;
117 u64 rx_bytes;
118 u64 rx_multicast;
119 u64 tx_packets;
120 u64 tx_bytes;
121 struct u64_stats_sync syncp;
122 u32 rx_errors;
123 u32 tx_dropped;
124};
125
126struct proc_dir_entry;
127struct netpoll;
128
129/**
130 * struct vlan_dev_priv - VLAN private device data
131 * @nr_ingress_mappings: number of ingress priority mappings
132 * @ingress_priority_map: ingress priority mappings
133 * @nr_egress_mappings: number of egress priority mappings
134 * @egress_priority_map: hash of egress priority mappings
135 * @vlan_proto: VLAN encapsulation protocol
136 * @vlan_id: VLAN identifier
137 * @flags: device flags
138 * @real_dev: underlying netdevice
139 * @real_dev_addr: address of underlying netdevice
140 * @dent: proc dir entry
141 * @vlan_pcpu_stats: ptr to percpu rx stats
142 */
143struct vlan_dev_priv {
144 unsigned int nr_ingress_mappings;
145 u32 ingress_priority_map[8];
146 unsigned int nr_egress_mappings;
147 struct vlan_priority_tci_mapping *egress_priority_map[16];
148
149 __be16 vlan_proto;
150 u16 vlan_id;
151 u16 flags;
152
153 struct net_device *real_dev;
154 unsigned char real_dev_addr[ETH_ALEN];
155
156 struct proc_dir_entry *dent;
157 struct vlan_pcpu_stats __percpu *vlan_pcpu_stats;
158#ifdef CONFIG_NET_POLL_CONTROLLER
159 struct netpoll *netpoll;
160#endif
161};
162
163static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
164{
165 return netdev_priv(dev);
166}
167
168static inline u16
169vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
170{
171 struct vlan_priority_tci_mapping *mp;
172
173 smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */
174
175 mp = vlan_dev_priv(dev)->egress_priority_map[(skprio & 0xF)];
176 while (mp) {
177 if (mp->priority == skprio) {
178 return mp->vlan_qos; /* This should already be shifted
179 * to mask correctly with the
180 * VLAN's TCI */
181 }
182 mp = mp->next;
183 }
184 return 0;
185}
186
92extern bool vlan_do_receive(struct sk_buff **skb); 187extern bool vlan_do_receive(struct sk_buff **skb);
93extern struct sk_buff *vlan_untag(struct sk_buff *skb); 188extern struct sk_buff *vlan_untag(struct sk_buff *skb);
94 189
@@ -121,6 +216,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
121 return 0; 216 return 0;
122} 217}
123 218
219static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
220 u32 skprio)
221{
222 return 0;
223}
224
124static inline bool vlan_do_receive(struct sk_buff **skb) 225static inline bool vlan_do_receive(struct sk_buff **skb)
125{ 226{
126 return false; 227 return false;
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 2bac0eb8948d..15607b45221a 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -11,6 +11,7 @@
11#define _IIO_BUFFER_GENERIC_H_ 11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h> 12#include <linux/sysfs.h>
13#include <linux/iio/iio.h> 13#include <linux/iio/iio.h>
14#include <linux/kref.h>
14 15
15#ifdef CONFIG_IIO_BUFFER 16#ifdef CONFIG_IIO_BUFFER
16 17
@@ -26,6 +27,8 @@ struct iio_buffer;
26 * @set_bytes_per_datum:set number of bytes per datum 27 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer 28 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer 29 * @set_length: set number of datums in buffer
30 * @release: called when the last reference to the buffer is dropped,
31 * should free all resources allocated by the buffer.
29 * 32 *
30 * The purpose of this structure is to make the buffer element 33 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require 34 * modular as event for a given driver, different usecases may require
@@ -36,7 +39,7 @@ struct iio_buffer;
36 * any of them not existing. 39 * any of them not existing.
37 **/ 40 **/
38struct iio_buffer_access_funcs { 41struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data); 42 int (*store_to)(struct iio_buffer *buffer, const void *data);
40 int (*read_first_n)(struct iio_buffer *buffer, 43 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n, 44 size_t n,
42 char __user *buf); 45 char __user *buf);
@@ -47,6 +50,8 @@ struct iio_buffer_access_funcs {
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); 50 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer); 51 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length); 52 int (*set_length)(struct iio_buffer *buffer, int length);
53
54 void (*release)(struct iio_buffer *buffer);
50}; 55};
51 56
52/** 57/**
@@ -67,6 +72,7 @@ struct iio_buffer_access_funcs {
67 * @demux_list: [INTERN] list of operations required to demux the scan. 72 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 73 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 * @buffer_list: [INTERN] entry in the devices list of current buffers. 74 * @buffer_list: [INTERN] entry in the devices list of current buffers.
75 * @ref: [INTERN] reference count of the buffer.
70 */ 76 */
71struct iio_buffer { 77struct iio_buffer {
72 int length; 78 int length;
@@ -81,8 +87,9 @@ struct iio_buffer {
81 bool stufftoread; 87 bool stufftoread;
82 const struct attribute_group *attrs; 88 const struct attribute_group *attrs;
83 struct list_head demux_list; 89 struct list_head demux_list;
84 unsigned char *demux_bounce; 90 void *demux_bounce;
85 struct list_head buffer_list; 91 struct list_head buffer_list;
92 struct kref ref;
86}; 93};
87 94
88/** 95/**
@@ -120,7 +127,32 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
120 * @indio_dev: iio_dev structure for device. 127 * @indio_dev: iio_dev structure for device.
121 * @data: Full scan. 128 * @data: Full scan.
122 */ 129 */
123int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data); 130int iio_push_to_buffers(struct iio_dev *indio_dev, const void *data);
131
132/*
133 * iio_push_to_buffers_with_timestamp() - push data and timestamp to buffers
134 * @indio_dev: iio_dev structure for device.
135 * @data: sample data
136 * @timestamp: timestamp for the sample data
137 *
138 * Pushes data to the IIO device's buffers. If timestamps are enabled for the
139 * device the function will store the supplied timestamp as the last element in
140 * the sample data buffer before pushing it to the device buffers. The sample
141 * data buffer needs to be large enough to hold the additional timestamp
142 * (usually the buffer should be indio->scan_bytes bytes large).
143 *
144 * Returns 0 on success, a negative error code otherwise.
145 */
146static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
147 void *data, int64_t timestamp)
148{
149 if (indio_dev->scan_timestamp) {
150 size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
151 ((int64_t *)data)[ts_offset] = timestamp;
152 }
153
154 return iio_push_to_buffers(indio_dev, data);
155}
124 156
125int iio_update_demux(struct iio_dev *indio_dev); 157int iio_update_demux(struct iio_dev *indio_dev);
126 158
@@ -174,11 +206,27 @@ ssize_t iio_buffer_show_enable(struct device *dev,
174 iio_buffer_show_enable, \ 206 iio_buffer_show_enable, \
175 iio_buffer_store_enable) 207 iio_buffer_store_enable)
176 208
177int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
178
179bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, 209bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
180 const unsigned long *mask); 210 const unsigned long *mask);
181 211
212struct iio_buffer *iio_buffer_get(struct iio_buffer *buffer);
213void iio_buffer_put(struct iio_buffer *buffer);
214
215/**
216 * iio_device_attach_buffer - Attach a buffer to a IIO device
217 * @indio_dev: The device the buffer should be attached to
218 * @buffer: The buffer to attach to the device
219 *
220 * This function attaches a buffer to a IIO device. The buffer stays attached to
221 * the device until the device is freed. The function should only be called at
222 * most once per device.
223 */
224static inline void iio_device_attach_buffer(struct iio_dev *indio_dev,
225 struct iio_buffer *buffer)
226{
227 indio_dev->buffer = iio_buffer_get(buffer);
228}
229
182#else /* CONFIG_IIO_BUFFER */ 230#else /* CONFIG_IIO_BUFFER */
183 231
184static inline int iio_buffer_register(struct iio_dev *indio_dev, 232static inline int iio_buffer_register(struct iio_dev *indio_dev,
@@ -191,6 +239,9 @@ static inline int iio_buffer_register(struct iio_dev *indio_dev,
191static inline void iio_buffer_unregister(struct iio_dev *indio_dev) 239static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
192{} 240{}
193 241
242static inline void iio_buffer_get(struct iio_buffer *buffer) {}
243static inline void iio_buffer_put(struct iio_buffer *buffer) {}
244
194#endif /* CONFIG_IIO_BUFFER */ 245#endif /* CONFIG_IIO_BUFFER */
195 246
196#endif /* _IIO_BUFFER_GENERIC_H_ */ 247#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e51f65480ea5..3c005eb3a0a4 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -16,6 +16,7 @@
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/regulator/consumer.h>
19 20
20#include <linux/platform_data/st_sensors_pdata.h> 21#include <linux/platform_data/st_sensors_pdata.h>
21 22
@@ -184,6 +185,7 @@ struct st_sensors {
184 u8 wai; 185 u8 wai;
185 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; 186 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
186 struct iio_chan_spec *ch; 187 struct iio_chan_spec *ch;
188 int num_ch;
187 struct st_sensor_odr odr; 189 struct st_sensor_odr odr;
188 struct st_sensor_power pw; 190 struct st_sensor_power pw;
189 struct st_sensor_axis enable_axis; 191 struct st_sensor_axis enable_axis;
@@ -200,6 +202,8 @@ struct st_sensors {
200 * @trig: The trigger in use by the core driver. 202 * @trig: The trigger in use by the core driver.
201 * @sensor: Pointer to the current sensor struct in use. 203 * @sensor: Pointer to the current sensor struct in use.
202 * @current_fullscale: Maximum range of measure by the sensor. 204 * @current_fullscale: Maximum range of measure by the sensor.
205 * @vdd: Pointer to sensor's Vdd power supply
206 * @vdd_io: Pointer to sensor's Vdd-IO power supply
203 * @enabled: Status of the sensor (false->off, true->on). 207 * @enabled: Status of the sensor (false->off, true->on).
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 208 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 209 * @buffer_data: Data used by buffer part.
@@ -215,6 +219,8 @@ struct st_sensor_data {
215 struct iio_trigger *trig; 219 struct iio_trigger *trig;
216 struct st_sensors *sensor; 220 struct st_sensors *sensor;
217 struct st_sensor_fullscale_avl *current_fullscale; 221 struct st_sensor_fullscale_avl *current_fullscale;
222 struct regulator *vdd;
223 struct regulator *vdd_io;
218 224
219 bool enabled; 225 bool enabled;
220 bool multiread_bit; 226 bool multiread_bit;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 833926c91aa8..2752b1fd12be 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -77,7 +77,7 @@ struct iio_cb_buffer;
77 * fail. 77 * fail.
78 */ 78 */
79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, 79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
80 int (*cb)(u8 *data, 80 int (*cb)(const void *data,
81 void *private), 81 void *private),
82 void *private); 82 void *private);
83/** 83/**
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 13ce220c7003..5dab2c41031f 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -26,20 +26,6 @@ struct iio_event_data {
26 26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) 27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/** 29/**
44 * IIO_EVENT_CODE() - create event identifier 30 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type. 31 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 2103cc32a5fb..256a90a1bea6 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -36,6 +36,14 @@ enum iio_chan_info_enum {
36 IIO_CHAN_INFO_PHASE, 36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN, 37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS, 38 IIO_CHAN_INFO_HYSTERESIS,
39 IIO_CHAN_INFO_INT_TIME,
40};
41
42enum iio_shared_by {
43 IIO_SEPARATE,
44 IIO_SHARED_BY_TYPE,
45 IIO_SHARED_BY_DIR,
46 IIO_SHARED_BY_ALL
39}; 47};
40 48
41enum iio_endian { 49enum iio_endian {
@@ -57,7 +65,7 @@ struct iio_dev;
57 */ 65 */
58struct iio_chan_spec_ext_info { 66struct iio_chan_spec_ext_info {
59 const char *name; 67 const char *name;
60 bool shared; 68 enum iio_shared_by shared;
61 ssize_t (*read)(struct iio_dev *, uintptr_t private, 69 ssize_t (*read)(struct iio_dev *, uintptr_t private,
62 struct iio_chan_spec const *, char *buf); 70 struct iio_chan_spec const *, char *buf);
63 ssize_t (*write)(struct iio_dev *, uintptr_t private, 71 ssize_t (*write)(struct iio_dev *, uintptr_t private,
@@ -125,12 +133,35 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
125#define IIO_ENUM_AVAILABLE(_name, _e) \ 133#define IIO_ENUM_AVAILABLE(_name, _e) \
126{ \ 134{ \
127 .name = (_name "_available"), \ 135 .name = (_name "_available"), \
128 .shared = true, \ 136 .shared = IIO_SHARED_BY_TYPE, \
129 .read = iio_enum_available_read, \ 137 .read = iio_enum_available_read, \
130 .private = (uintptr_t)(_e), \ 138 .private = (uintptr_t)(_e), \
131} 139}
132 140
133/** 141/**
142 * struct iio_event_spec - specification for a channel event
143 * @type: Type of the event
144 * @dir: Direction of the event
145 * @mask_separate: Bit mask of enum iio_event_info values. Attributes
146 * set in this mask will be registered per channel.
147 * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes
148 * set in this mask will be shared by channel type.
149 * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes
150 * set in this mask will be shared by channel type and
151 * direction.
152 * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes
153 * set in this mask will be shared by all channels.
154 */
155struct iio_event_spec {
156 enum iio_event_type type;
157 enum iio_event_direction dir;
158 unsigned long mask_separate;
159 unsigned long mask_shared_by_type;
160 unsigned long mask_shared_by_dir;
161 unsigned long mask_shared_by_all;
162};
163
164/**
134 * struct iio_chan_spec - specification of a single channel 165 * struct iio_chan_spec - specification of a single channel
135 * @type: What type of measurement is the channel making. 166 * @type: What type of measurement is the channel making.
136 * @channel: What number do we wish to assign the channel. 167 * @channel: What number do we wish to assign the channel.
@@ -146,13 +177,18 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
146 * shift: Shift right by this before masking out 177 * shift: Shift right by this before masking out
147 * realbits. 178 * realbits.
148 * endianness: little or big endian 179 * endianness: little or big endian
149 * @info_mask: What information is to be exported about this channel.
150 * This includes calibbias, scale etc.
151 * @info_mask_separate: What information is to be exported that is specific to 180 * @info_mask_separate: What information is to be exported that is specific to
152 * this channel. 181 * this channel.
153 * @info_mask_shared_by_type: What information is to be exported that is shared 182 * @info_mask_shared_by_type: What information is to be exported that is shared
154* by all channels of the same type. 183 * by all channels of the same type.
184 * @info_mask_shared_by_dir: What information is to be exported that is shared
185 * by all channels of the same direction.
186 * @info_mask_shared_by_all: What information is to be exported that is shared
187 * by all channels.
155 * @event_mask: What events can this channel produce. 188 * @event_mask: What events can this channel produce.
189 * @event_spec: Array of events which should be registered for this
190 * channel.
191 * @num_event_specs: Size of the event_spec array.
156 * @ext_info: Array of extended info attributes for this channel. 192 * @ext_info: Array of extended info attributes for this channel.
157 * The array is NULL terminated, the last element should 193 * The array is NULL terminated, the last element should
158 * have its name field set to NULL. 194 * have its name field set to NULL.
@@ -186,10 +222,13 @@ struct iio_chan_spec {
186 u8 shift; 222 u8 shift;
187 enum iio_endian endianness; 223 enum iio_endian endianness;
188 } scan_type; 224 } scan_type;
189 long info_mask;
190 long info_mask_separate; 225 long info_mask_separate;
191 long info_mask_shared_by_type; 226 long info_mask_shared_by_type;
227 long info_mask_shared_by_dir;
228 long info_mask_shared_by_all;
192 long event_mask; 229 long event_mask;
230 const struct iio_event_spec *event_spec;
231 unsigned int num_event_specs;
193 const struct iio_chan_spec_ext_info *ext_info; 232 const struct iio_chan_spec_ext_info *ext_info;
194 const char *extend_name; 233 const char *extend_name;
195 const char *datasheet_name; 234 const char *datasheet_name;
@@ -212,7 +251,9 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 251 enum iio_chan_info_enum type)
213{ 252{
214 return (chan->info_mask_separate & BIT(type)) | 253 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & BIT(type)); 254 (chan->info_mask_shared_by_type & BIT(type)) |
255 (chan->info_mask_shared_by_dir & BIT(type)) |
256 (chan->info_mask_shared_by_all & BIT(type));
216} 257}
217 258
218#define IIO_ST(si, rb, sb, sh) \ 259#define IIO_ST(si, rb, sb, sh) \
@@ -270,6 +311,12 @@ struct iio_dev;
270 * is event dependant. event_code specifies which event. 311 * is event dependant. event_code specifies which event.
271 * @write_event_value: write the value associated with the event. 312 * @write_event_value: write the value associated with the event.
272 * Meaning is event dependent. 313 * Meaning is event dependent.
314 * @read_event_config_new: find out if the event is enabled. New style interface.
315 * @write_event_config_new: set if the event is enabled. New style interface.
316 * @read_event_value_new: read a configuration value associated with the event.
317 * New style interface.
318 * @write_event_value_new: write a configuration value for the event. New style
319 * interface.
273 * @validate_trigger: function to validate the trigger when the 320 * @validate_trigger: function to validate the trigger when the
274 * current trigger gets changed. 321 * current trigger gets changed.
275 * @update_scan_mode: function to configure device and scan buffer when 322 * @update_scan_mode: function to configure device and scan buffer when
@@ -310,6 +357,30 @@ struct iio_info {
310 int (*write_event_value)(struct iio_dev *indio_dev, 357 int (*write_event_value)(struct iio_dev *indio_dev,
311 u64 event_code, 358 u64 event_code,
312 int val); 359 int val);
360
361 int (*read_event_config_new)(struct iio_dev *indio_dev,
362 const struct iio_chan_spec *chan,
363 enum iio_event_type type,
364 enum iio_event_direction dir);
365
366 int (*write_event_config_new)(struct iio_dev *indio_dev,
367 const struct iio_chan_spec *chan,
368 enum iio_event_type type,
369 enum iio_event_direction dir,
370 int state);
371
372 int (*read_event_value_new)(struct iio_dev *indio_dev,
373 const struct iio_chan_spec *chan,
374 enum iio_event_type type,
375 enum iio_event_direction dir,
376 enum iio_event_info info, int *val, int *val2);
377
378 int (*write_event_value_new)(struct iio_dev *indio_dev,
379 const struct iio_chan_spec *chan,
380 enum iio_event_type type,
381 enum iio_event_direction dir,
382 enum iio_event_info info, int val, int val2);
383
313 int (*validate_trigger)(struct iio_dev *indio_dev, 384 int (*validate_trigger)(struct iio_dev *indio_dev,
314 struct iio_trigger *trig); 385 struct iio_trigger *trig);
315 int (*update_scan_mode)(struct iio_dev *indio_dev, 386 int (*update_scan_mode)(struct iio_dev *indio_dev,
@@ -457,7 +528,7 @@ static inline void iio_device_put(struct iio_dev *indio_dev)
457{ 528{
458 if (indio_dev) 529 if (indio_dev)
459 put_device(&indio_dev->dev); 530 put_device(&indio_dev->dev);
460}; 531}
461 532
462/** 533/**
463 * dev_to_iio_dev() - Get IIO device struct from a device struct 534 * dev_to_iio_dev() - Get IIO device struct from a device struct
@@ -593,7 +664,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
593{ 664{
594 return indio_dev->currentmode 665 return indio_dev->currentmode
595 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); 666 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
596}; 667}
597 668
598/** 669/**
599 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry 670 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
@@ -603,12 +674,12 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
603static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 674static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
604{ 675{
605 return indio_dev->debugfs_dentry; 676 return indio_dev->debugfs_dentry;
606}; 677}
607#else 678#else
608static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 679static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
609{ 680{
610 return NULL; 681 return NULL;
611}; 682}
612#endif 683#endif
613 684
614int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, 685int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index 2958c960003a..8a1d18640ab9 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -100,6 +100,21 @@ struct iio_const_attr {
100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ 100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
101 IIO_CONST_ATTR(sampling_frequency_available, _string) 101 IIO_CONST_ATTR(sampling_frequency_available, _string)
102 102
103/**
104 * IIO_DEV_ATTR_INT_TIME_AVAIL - list available integration times
105 * @_show: output method for the attribute
106 **/
107#define IIO_DEV_ATTR_INT_TIME_AVAIL(_show) \
108 IIO_DEVICE_ATTR(integration_time_available, S_IRUGO, _show, NULL, 0)
109/**
110 * IIO_CONST_ATTR_INT_TIME_AVAIL - list available integration times
111 * @_string: frequency string for the attribute
112 *
113 * Constant version
114 **/
115#define IIO_CONST_ATTR_INT_TIME_AVAIL(_string) \
116 IIO_CONST_ATTR(integration_time_available, _string)
117
103#define IIO_DEV_ATTR_TEMP_RAW(_show) \ 118#define IIO_DEV_ATTR_TEMP_RAW(_show) \
104 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) 119 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
105 120
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 88bf0f0d27b4..4ac928ee31c5 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -54,6 +54,26 @@ enum iio_modifier {
54 IIO_MOD_LIGHT_BLUE, 54 IIO_MOD_LIGHT_BLUE,
55}; 55};
56 56
57enum iio_event_type {
58 IIO_EV_TYPE_THRESH,
59 IIO_EV_TYPE_MAG,
60 IIO_EV_TYPE_ROC,
61 IIO_EV_TYPE_THRESH_ADAPTIVE,
62 IIO_EV_TYPE_MAG_ADAPTIVE,
63};
64
65enum iio_event_info {
66 IIO_EV_INFO_ENABLE,
67 IIO_EV_INFO_VALUE,
68 IIO_EV_INFO_HYSTERESIS,
69};
70
71enum iio_event_direction {
72 IIO_EV_DIR_EITHER,
73 IIO_EV_DIR_RISING,
74 IIO_EV_DIR_FALLING,
75};
76
57#define IIO_VAL_INT 1 77#define IIO_VAL_INT 1
58#define IIO_VAL_INT_PLUS_MICRO 2 78#define IIO_VAL_INT_PLUS_MICRO 2
59#define IIO_VAL_INT_PLUS_NANO 3 79#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 79640e015a86..0d678aefe69d 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -147,25 +147,27 @@ struct in_ifaddr {
147 unsigned long ifa_tstamp; /* updated timestamp */ 147 unsigned long ifa_tstamp; /* updated timestamp */
148}; 148};
149 149
150extern int register_inetaddr_notifier(struct notifier_block *nb); 150int register_inetaddr_notifier(struct notifier_block *nb);
151extern int unregister_inetaddr_notifier(struct notifier_block *nb); 151int unregister_inetaddr_notifier(struct notifier_block *nb);
152 152
153extern void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, 153void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,
154 struct ipv4_devconf *devconf); 154 struct ipv4_devconf *devconf);
155 155
156extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); 156struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
157static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) 157static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
158{ 158{
159 return __ip_dev_find(net, addr, true); 159 return __ip_dev_find(net, addr, true);
160} 160}
161 161
162extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 162int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
163extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); 163int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
164extern void devinet_init(void); 164void devinet_init(void);
165extern struct in_device *inetdev_by_index(struct net *, int); 165struct in_device *inetdev_by_index(struct net *, int);
166extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 166__be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
167extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope); 167__be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local,
168extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); 168 int scope);
169struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
170 __be32 mask);
169 171
170static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) 172static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
171{ 173{
@@ -218,7 +220,7 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
218 return rtnl_dereference(dev->ip_ptr); 220 return rtnl_dereference(dev->ip_ptr);
219} 221}
220 222
221extern void in_dev_finish_destroy(struct in_device *idev); 223void in_dev_finish_destroy(struct in_device *idev);
222 224
223static inline void in_dev_put(struct in_device *idev) 225static inline void in_dev_put(struct in_device *idev)
224{ 226{
diff --git a/include/linux/init.h b/include/linux/init.h
index 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/intel-iommu.h b/include/linux/intel-iommu.h
index 78e2ada50cd5..d380c5e68008 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -55,7 +55,7 @@
55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ 55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */ 56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */
57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ 57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ 58#define DMAR_ICS_REG 0x9c /* Invalidation complete status register */
59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ 59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
60 60
61#define OFFSET_STRIDE (9) 61#define OFFSET_STRIDE (9)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5e865b554940..c9e831dc80bc 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/irq.h>
22 23
23/* 24/*
24 * These correspond to the IORESOURCE_IRQ_* defines in 25 * These correspond to the IORESOURCE_IRQ_* defines in
@@ -374,6 +375,16 @@ struct softirq_action
374 375
375asmlinkage void do_softirq(void); 376asmlinkage void do_softirq(void);
376asmlinkage void __do_softirq(void); 377asmlinkage void __do_softirq(void);
378
379#ifdef __ARCH_HAS_DO_SOFTIRQ
380void do_softirq_own_stack(void);
381#else
382static inline void do_softirq_own_stack(void)
383{
384 __do_softirq();
385}
386#endif
387
377extern void open_softirq(int nr, void (*action)(struct softirq_action *)); 388extern void open_softirq(int nr, void (*action)(struct softirq_action *));
378extern void softirq_init(void); 389extern void softirq_init(void);
379extern void __raise_softirq_irqoff(unsigned int nr); 390extern void __raise_softirq_irqoff(unsigned int nr);
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 19c19a5eee29..f6c82de12541 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -34,9 +34,9 @@ struct ipc_namespace {
34 int sem_ctls[4]; 34 int sem_ctls[4];
35 int used_sems; 35 int used_sems;
36 36
37 int msg_ctlmax; 37 unsigned int msg_ctlmax;
38 int msg_ctlmnb; 38 unsigned int msg_ctlmnb;
39 int msg_ctlmni; 39 unsigned int msg_ctlmni;
40 atomic_t msg_bytes; 40 atomic_t msg_bytes;
41 atomic_t msg_hdrs; 41 atomic_t msg_hdrs;
42 int auto_msgmni; 42 int auto_msgmni;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 28ea38439313..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/irqchip/bcm2835.h b/include/linux/irqchip/bcm2835.h
deleted file mode 100644
index 48a859bc9dca..000000000000
--- a/include/linux/irqchip/bcm2835.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __LINUX_IRQCHIP_BCM2835_H_
20#define __LINUX_IRQCHIP_BCM2835_H_
21
22#include <asm/exception.h>
23
24extern void bcm2835_init_irq(void);
25
26extern asmlinkage void __exception_irq_entry bcm2835_handle_irq(
27 struct pt_regs *regs);
28
29#endif
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a5079072da66..39999775b922 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -48,6 +48,13 @@
48 48
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/compiler.h> 50#include <linux/compiler.h>
51#include <linux/bug.h>
52
53extern bool static_key_initialized;
54
55#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \
56 "%s used before call to jump_label_init", \
57 __func__)
51 58
52#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 59#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
53 60
@@ -128,29 +135,32 @@ struct static_key {
128 135
129static __always_inline void jump_label_init(void) 136static __always_inline void jump_label_init(void)
130{ 137{
138 static_key_initialized = true;
131} 139}
132 140
133static __always_inline bool static_key_false(struct static_key *key) 141static __always_inline bool static_key_false(struct static_key *key)
134{ 142{
135 if (unlikely(atomic_read(&key->enabled)) > 0) 143 if (unlikely(atomic_read(&key->enabled) > 0))
136 return true; 144 return true;
137 return false; 145 return false;
138} 146}
139 147
140static __always_inline bool static_key_true(struct static_key *key) 148static __always_inline bool static_key_true(struct static_key *key)
141{ 149{
142 if (likely(atomic_read(&key->enabled)) > 0) 150 if (likely(atomic_read(&key->enabled) > 0))
143 return true; 151 return true;
144 return false; 152 return false;
145} 153}
146 154
147static inline void static_key_slow_inc(struct static_key *key) 155static inline void static_key_slow_inc(struct static_key *key)
148{ 156{
157 STATIC_KEY_CHECK_USE();
149 atomic_inc(&key->enabled); 158 atomic_inc(&key->enabled);
150} 159}
151 160
152static inline void static_key_slow_dec(struct static_key *key) 161static inline void static_key_slow_dec(struct static_key *key)
153{ 162{
163 STATIC_KEY_CHECK_USE();
154 atomic_dec(&key->enabled); 164 atomic_dec(&key->enabled);
155} 165}
156 166
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h
index 113788389b3d..089f70f83e97 100644
--- a/include/linux/jump_label_ratelimit.h
+++ b/include/linux/jump_label_ratelimit.h
@@ -23,12 +23,14 @@ struct static_key_deferred {
23}; 23};
24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) 24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
25{ 25{
26 STATIC_KEY_CHECK_USE();
26 static_key_slow_dec(&key->key); 27 static_key_slow_dec(&key->key);
27} 28}
28static inline void 29static inline void
29jump_label_rate_limit(struct static_key_deferred *key, 30jump_label_rate_limit(struct static_key_deferred *key,
30 unsigned long rl) 31 unsigned long rl)
31{ 32{
33 STATIC_KEY_CHECK_USE();
32} 34}
33#endif /* HAVE_JUMP_LABEL */ 35#endif /* HAVE_JUMP_LABEL */
34#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ 36#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 7f6fe6e015bc..290db1269c4c 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -109,6 +109,7 @@ typedef enum {
109 KDB_REASON_RECURSE, /* Recursive entry to kdb; 109 KDB_REASON_RECURSE, /* Recursive entry to kdb;
110 * regs probably valid */ 110 * regs probably valid */
111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */ 111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
112 KDB_REASON_SYSTEM_NMI, /* In NMI due to SYSTEM cmd; regs valid */
112} kdb_reason_t; 113} kdb_reason_t;
113 114
114extern int kdb_trap_printk; 115extern int kdb_trap_printk;
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index 546eb6a76934..f65ce09784f1 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -15,5 +15,6 @@
15#define KPF_OWNER_PRIVATE 37 15#define KPF_OWNER_PRIVATE 37
16#define KPF_ARCH 38 16#define KPF_ARCH 38
17#define KPF_UNCACHED 39 17#define KPF_UNCACHED 39
18#define KPF_SOFTDIRTY 40
18 19
19#endif /* LINUX_KERNEL_PAGE_FLAGS_H */ 20#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 482ad2d84a32..672ddc4de4af 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -439,6 +439,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
439 return buf; 439 return buf;
440} 440}
441 441
442extern const char hex_asc_upper[];
443#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
444#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
445
446static inline char *hex_byte_pack_upper(char *buf, u8 byte)
447{
448 *buf++ = hex_asc_upper_hi(byte);
449 *buf++ = hex_asc_upper_lo(byte);
450 return buf;
451}
452
442static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) 453static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
443{ 454{
444 return hex_byte_pack(buf, byte); 455 return hex_byte_pack(buf, byte);
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index c6e091bf39a5..dfb4f2ffdaa2 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -310,6 +310,7 @@ extern int
310kgdb_handle_exception(int ex_vector, int signo, int err_code, 310kgdb_handle_exception(int ex_vector, int signo, int err_code,
311 struct pt_regs *regs); 311 struct pt_regs *regs);
312extern int kgdb_nmicallback(int cpu, void *regs); 312extern int kgdb_nmicallback(int cpu, void *regs);
313extern int kgdb_nmicallin(int cpu, int trapnr, void *regs, atomic_t *snd_rdy);
313extern void gdbstub_exit(int status); 314extern void gdbstub_exit(int status);
314 315
315extern int kgdb_single_step; 316extern int kgdb_single_step;
diff --git a/include/linux/kobj_completion.h b/include/linux/kobj_completion.h
new file mode 100644
index 000000000000..a428f6436063
--- /dev/null
+++ b/include/linux/kobj_completion.h
@@ -0,0 +1,18 @@
1#ifndef _KOBJ_COMPLETION_H_
2#define _KOBJ_COMPLETION_H_
3
4#include <linux/kobject.h>
5#include <linux/completion.h>
6
7struct kobj_completion {
8 struct kobject kc_kobj;
9 struct completion kc_unregister;
10};
11
12#define kobj_to_kobj_completion(kobj) \
13 container_of(kobj, struct kobj_completion, kc_kobj)
14
15void kobj_completion_init(struct kobj_completion *kc, struct kobj_type *ktype);
16void kobj_completion_release(struct kobject *kobj);
17void kobj_completion_del_and_wait(struct kobj_completion *kc);
18#endif /* _KOBJ_COMPLETION_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index de6dcbcc6ef7..e7ba650086ce 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -107,6 +107,7 @@ extern int __must_check kobject_move(struct kobject *, struct kobject *);
107extern struct kobject *kobject_get(struct kobject *kobj); 107extern struct kobject *kobject_get(struct kobject *kobj);
108extern void kobject_put(struct kobject *kobj); 108extern void kobject_put(struct kobject *kobj);
109 109
110extern const void *kobject_namespace(struct kobject *kobj);
110extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 111extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
111 112
112struct kobj_type { 113struct kobj_type {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ca645a01d37a..0fbbc7aa02cb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -533,6 +533,7 @@ int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages,
533 533
534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
536unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
536unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 537unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
537void kvm_release_page_clean(struct page *page); 538void kvm_release_page_clean(struct page *page);
538void kvm_release_page_dirty(struct page *page); 539void kvm_release_page_dirty(struct page *page);
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/lockref.h b/include/linux/lockref.h
index f279ed9a9163..13dfd36a3294 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -36,4 +36,10 @@ extern int lockref_put_or_lock(struct lockref *);
36extern void lockref_mark_dead(struct lockref *); 36extern void lockref_mark_dead(struct lockref *);
37extern int lockref_get_not_dead(struct lockref *); 37extern int lockref_get_not_dead(struct lockref *);
38 38
39/* Must be called under spinlock for reliable results */
40static inline int __lockref_is_dead(const struct lockref *l)
41{
42 return ((int)l->count < 0);
43}
44
39#endif /* __LINUX_LOCKREF_H */ 45#endif /* __LINUX_LOCKREF_H */
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/memcontrol.h b/include/linux/memcontrol.h
index 60e95872da29..b3e7a667e03c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -53,23 +53,6 @@ struct mem_cgroup_reclaim_cookie {
53 unsigned int generation; 53 unsigned int generation;
54}; 54};
55 55
56enum mem_cgroup_filter_t {
57 VISIT, /* visit current node */
58 SKIP, /* skip the current node and continue traversal */
59 SKIP_TREE, /* skip the whole subtree and continue traversal */
60};
61
62/*
63 * mem_cgroup_filter_t predicate might instruct mem_cgroup_iter_cond how to
64 * iterate through the hierarchy tree. Each tree element is checked by the
65 * predicate before it is returned by the iterator. If a filter returns
66 * SKIP or SKIP_TREE then the iterator code continues traversal (with the
67 * next node down the hierarchy or the next node that doesn't belong under the
68 * memcg's subtree).
69 */
70typedef enum mem_cgroup_filter_t
71(*mem_cgroup_iter_filter)(struct mem_cgroup *memcg, struct mem_cgroup *root);
72
73#ifdef CONFIG_MEMCG 56#ifdef CONFIG_MEMCG
74/* 57/*
75 * All "charge" functions with gfp_mask should use GFP_KERNEL or 58 * All "charge" functions with gfp_mask should use GFP_KERNEL or
@@ -137,18 +120,9 @@ mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
137extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, 120extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
138 struct page *oldpage, struct page *newpage, bool migration_ok); 121 struct page *oldpage, struct page *newpage, bool migration_ok);
139 122
140struct mem_cgroup *mem_cgroup_iter_cond(struct mem_cgroup *root, 123struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
141 struct mem_cgroup *prev, 124 struct mem_cgroup *,
142 struct mem_cgroup_reclaim_cookie *reclaim, 125 struct mem_cgroup_reclaim_cookie *);
143 mem_cgroup_iter_filter cond);
144
145static inline struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
146 struct mem_cgroup *prev,
147 struct mem_cgroup_reclaim_cookie *reclaim)
148{
149 return mem_cgroup_iter_cond(root, prev, reclaim, NULL);
150}
151
152void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *); 126void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
153 127
154/* 128/*
@@ -163,47 +137,24 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
163extern void mem_cgroup_replace_page_cache(struct page *oldpage, 137extern void mem_cgroup_replace_page_cache(struct page *oldpage,
164 struct page *newpage); 138 struct page *newpage);
165 139
166/** 140static inline void mem_cgroup_oom_enable(void)
167 * mem_cgroup_toggle_oom - toggle the memcg OOM killer for the current task
168 * @new: true to enable, false to disable
169 *
170 * Toggle whether a failed memcg charge should invoke the OOM killer
171 * or just return -ENOMEM. Returns the previous toggle state.
172 *
173 * NOTE: Any path that enables the OOM killer before charging must
174 * call mem_cgroup_oom_synchronize() afterward to finalize the
175 * OOM handling and clean up.
176 */
177static inline bool mem_cgroup_toggle_oom(bool new)
178{ 141{
179 bool old; 142 WARN_ON(current->memcg_oom.may_oom);
180 143 current->memcg_oom.may_oom = 1;
181 old = current->memcg_oom.may_oom;
182 current->memcg_oom.may_oom = new;
183
184 return old;
185} 144}
186 145
187static inline void mem_cgroup_enable_oom(void) 146static inline void mem_cgroup_oom_disable(void)
188{ 147{
189 bool old = mem_cgroup_toggle_oom(true); 148 WARN_ON(!current->memcg_oom.may_oom);
190 149 current->memcg_oom.may_oom = 0;
191 WARN_ON(old == true);
192}
193
194static inline void mem_cgroup_disable_oom(void)
195{
196 bool old = mem_cgroup_toggle_oom(false);
197
198 WARN_ON(old == false);
199} 150}
200 151
201static inline bool task_in_memcg_oom(struct task_struct *p) 152static inline bool task_in_memcg_oom(struct task_struct *p)
202{ 153{
203 return p->memcg_oom.in_memcg_oom; 154 return p->memcg_oom.memcg;
204} 155}
205 156
206bool mem_cgroup_oom_synchronize(void); 157bool mem_cgroup_oom_synchronize(bool wait);
207 158
208#ifdef CONFIG_MEMCG_SWAP 159#ifdef CONFIG_MEMCG_SWAP
209extern int do_swap_account; 160extern int do_swap_account;
@@ -260,9 +211,9 @@ static inline void mem_cgroup_dec_page_stat(struct page *page,
260 mem_cgroup_update_page_stat(page, idx, -1); 211 mem_cgroup_update_page_stat(page, idx, -1);
261} 212}
262 213
263enum mem_cgroup_filter_t 214unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
264mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg, 215 gfp_t gfp_mask,
265 struct mem_cgroup *root); 216 unsigned long *total_scanned);
266 217
267void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 218void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
268static inline void mem_cgroup_count_vm_event(struct mm_struct *mm, 219static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
@@ -376,15 +327,6 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
376 struct page *oldpage, struct page *newpage, bool migration_ok) 327 struct page *oldpage, struct page *newpage, bool migration_ok)
377{ 328{
378} 329}
379static inline struct mem_cgroup *
380mem_cgroup_iter_cond(struct mem_cgroup *root,
381 struct mem_cgroup *prev,
382 struct mem_cgroup_reclaim_cookie *reclaim,
383 mem_cgroup_iter_filter cond)
384{
385 /* first call must return non-NULL, second return NULL */
386 return (struct mem_cgroup *)(unsigned long)!prev;
387}
388 330
389static inline struct mem_cgroup * 331static inline struct mem_cgroup *
390mem_cgroup_iter(struct mem_cgroup *root, 332mem_cgroup_iter(struct mem_cgroup *root,
@@ -437,16 +379,11 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
437{ 379{
438} 380}
439 381
440static inline bool mem_cgroup_toggle_oom(bool new) 382static inline void mem_cgroup_oom_enable(void)
441{ 383{
442 return false;
443} 384}
444 385
445static inline void mem_cgroup_enable_oom(void) 386static inline void mem_cgroup_oom_disable(void)
446{
447}
448
449static inline void mem_cgroup_disable_oom(void)
450{ 387{
451} 388}
452 389
@@ -455,7 +392,7 @@ static inline bool task_in_memcg_oom(struct task_struct *p)
455 return false; 392 return false;
456} 393}
457 394
458static inline bool mem_cgroup_oom_synchronize(void) 395static inline bool mem_cgroup_oom_synchronize(bool wait)
459{ 396{
460 return false; 397 return false;
461} 398}
@@ -471,11 +408,11 @@ static inline void mem_cgroup_dec_page_stat(struct page *page,
471} 408}
472 409
473static inline 410static inline
474enum mem_cgroup_filter_t 411unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
475mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg, 412 gfp_t gfp_mask,
476 struct mem_cgroup *root) 413 unsigned long *total_scanned)
477{ 414{
478 return VISIT; 415 return 0;
479} 416}
480 417
481static inline void mem_cgroup_split_huge_fixup(struct page *head) 418static inline void mem_cgroup_split_huge_fixup(struct page *head)
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 da6716b9e3fe..9fe426b30a41 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -136,6 +136,7 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_vma_policy(struct task_struct *tsk,
138 struct vm_area_struct *vma, unsigned long addr); 138 struct vm_area_struct *vma, unsigned long addr);
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma);
139 140
140extern void numa_default_policy(void); 141extern void numa_default_policy(void);
141extern void numa_policy_init(void); 142extern void numa_policy_init(void);
@@ -168,7 +169,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
168extern int mpol_parse_str(char *str, struct mempolicy **mpol); 169extern int mpol_parse_str(char *str, struct mempolicy **mpol);
169#endif 170#endif
170 171
171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); 172extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
172 173
173/* Check if a vma is migratable */ 174/* Check if a vma is migratable */
174static inline int vma_migratable(struct vm_area_struct *vma) 175static inline int vma_migratable(struct vm_area_struct *vma)
@@ -306,9 +307,8 @@ static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
306} 307}
307#endif 308#endif
308 309
309static 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)
310{ 311{
311 return 0;
312} 312}
313 313
314static 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/core.h b/include/linux/mfd/core.h
index cebe97ee98b8..7314fc4e6d25 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/*
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index ca0790fba2f5..060e11256fbc 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -12,6 +12,8 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/err.h> 13#include <linux/err.h>
14 14
15#include <dt-bindings/mfd/dbx500-prcmu.h> /* For clock identifiers */
16
15/* Offset for the firmware version within the TCPM */ 17/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4 18#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8 19#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
@@ -94,74 +96,6 @@ enum prcmu_wakeup_index {
94#define PRCMU_CLKSRC_ARMCLKFIX 0x46 96#define PRCMU_CLKSRC_ARMCLKFIX 0x46
95#define PRCMU_CLKSRC_HDMICLK 0x47 97#define PRCMU_CLKSRC_HDMICLK 0x47
96 98
97/*
98 * Clock identifiers.
99 */
100enum prcmu_clock {
101 PRCMU_SGACLK,
102 PRCMU_UARTCLK,
103 PRCMU_MSP02CLK,
104 PRCMU_MSP1CLK,
105 PRCMU_I2CCLK,
106 PRCMU_SDMMCCLK,
107 PRCMU_SPARE1CLK,
108 PRCMU_SLIMCLK,
109 PRCMU_PER1CLK,
110 PRCMU_PER2CLK,
111 PRCMU_PER3CLK,
112 PRCMU_PER5CLK,
113 PRCMU_PER6CLK,
114 PRCMU_PER7CLK,
115 PRCMU_LCDCLK,
116 PRCMU_BMLCLK,
117 PRCMU_HSITXCLK,
118 PRCMU_HSIRXCLK,
119 PRCMU_HDMICLK,
120 PRCMU_APEATCLK,
121 PRCMU_APETRACECLK,
122 PRCMU_MCDECLK,
123 PRCMU_IPI2CCLK,
124 PRCMU_DSIALTCLK,
125 PRCMU_DMACLK,
126 PRCMU_B2R2CLK,
127 PRCMU_TVCLK,
128 PRCMU_SSPCLK,
129 PRCMU_RNGCLK,
130 PRCMU_UICCCLK,
131 PRCMU_PWMCLK,
132 PRCMU_IRDACLK,
133 PRCMU_IRRCCLK,
134 PRCMU_SIACLK,
135 PRCMU_SVACLK,
136 PRCMU_ACLK,
137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
141 PRCMU_BML8580CLK,
142 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
144 PRCMU_CDCLK,
145 PRCMU_TIMCLK,
146 PRCMU_PLLSOC0,
147 PRCMU_PLLSOC1,
148 PRCMU_ARMSS,
149 PRCMU_PLLDDR,
150 PRCMU_PLLDSI,
151 PRCMU_DSI0CLK,
152 PRCMU_DSI1CLK,
153 PRCMU_DSI0ESCCLK,
154 PRCMU_DSI1ESCCLK,
155 PRCMU_DSI2ESCCLK,
156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
163};
164
165/** 99/**
166 * enum prcmu_wdog_id - PRCMU watchdog IDs 100 * enum prcmu_wdog_id - PRCMU watchdog IDs
167 * @PRCMU_WDOG_ALL: use all timers 101 * @PRCMU_WDOG_ALL: use all timers
diff --git a/include/linux/mfd/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/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/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index b6bdcd66c07d..7086b2248c8f 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -363,4 +363,9 @@
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2) 363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1) 364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0) 365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
366
367/* For imx6sl iomux gpr register field define */
368#define IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK (0x3 << 17)
369#define IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK (0x1 << 14)
370
366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 371#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c611ab01..08cce7f96ab9 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -46,16 +46,24 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define ENB(val) (1 << (val))
50#define STPENB_STEPENB STEPENB(0x1FFFF)
51#define STPENB_STEPENB_TC STEPENB(0x1FFF)
49 52
50/* IRQ enable */ 53/* IRQ enable */
51#define IRQENB_HW_PEN BIT(0) 54#define IRQENB_HW_PEN BIT(0)
52#define IRQENB_FIFO0THRES BIT(2) 55#define IRQENB_FIFO0THRES BIT(2)
56#define IRQENB_FIFO0OVRRUN BIT(3)
57#define IRQENB_FIFO0UNDRFLW BIT(4)
53#define IRQENB_FIFO1THRES BIT(5) 58#define IRQENB_FIFO1THRES BIT(5)
59#define IRQENB_FIFO1OVRRUN BIT(6)
60#define IRQENB_FIFO1UNDRFLW BIT(7)
54#define IRQENB_PENUP BIT(9) 61#define IRQENB_PENUP BIT(9)
55 62
56/* Step Configuration */ 63/* Step Configuration */
57#define STEPCONFIG_MODE_MASK (3 << 0) 64#define STEPCONFIG_MODE_MASK (3 << 0)
58#define STEPCONFIG_MODE(val) ((val) << 0) 65#define STEPCONFIG_MODE(val) ((val) << 0)
66#define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1)
59#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2) 67#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
60#define STEPCONFIG_AVG_MASK (7 << 2) 68#define STEPCONFIG_AVG_MASK (7 << 2)
61#define STEPCONFIG_AVG(val) ((val) << 2) 69#define STEPCONFIG_AVG(val) ((val) << 2)
@@ -123,6 +131,7 @@
123#define ADC_CLK 3000000 131#define ADC_CLK 3000000
124#define TOTAL_STEPS 16 132#define TOTAL_STEPS 16
125#define TOTAL_CHANNELS 8 133#define TOTAL_CHANNELS 8
134#define FIFO1_THRESHOLD 19
126 135
127/* 136/*
128* ADC runs at 3MHz, and it takes 137* ADC runs at 3MHz, and it takes
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 8d3c57fdf221..f5096b58b20d 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -90,11 +90,12 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
90#endif /* CONFIG_MIGRATION */ 90#endif /* CONFIG_MIGRATION */
91 91
92#ifdef CONFIG_NUMA_BALANCING 92#ifdef CONFIG_NUMA_BALANCING
93extern int migrate_misplaced_page(struct page *page, int node); 93extern int migrate_misplaced_page(struct page *page,
94extern int migrate_misplaced_page(struct page *page, int node); 94 struct vm_area_struct *vma, int node);
95extern bool migrate_ratelimited(int node); 95extern bool migrate_ratelimited(int node);
96#else 96#else
97static inline int migrate_misplaced_page(struct page *page, int node) 97static inline int migrate_misplaced_page(struct page *page,
98 struct vm_area_struct *vma, int node)
98{ 99{
99 return -EAGAIN; /* can't migrate now */ 100 return -EAGAIN; /* can't migrate now */
100} 101}
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 09c2300ddb37..f7eaf2d60083 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,6 +31,7 @@
31#define I2O_MINOR 166 31#define I2O_MINOR 166
32#define MICROCODE_MINOR 184 32#define MICROCODE_MINOR 184
33#define TUN_MINOR 200 33#define TUN_MINOR 200
34#define CUSE_MINOR 203
34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 35#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
35#define MPT_MINOR 220 36#define MPT_MINOR 220
36#define MPT2SAS_MINOR 221 37#define MPT2SAS_MINOR 221
@@ -45,6 +46,7 @@
45#define MAPPER_CTRL_MINOR 236 46#define MAPPER_CTRL_MINOR 236
46#define LOOP_CTRL_MINOR 237 47#define LOOP_CTRL_MINOR 237
47#define VHOST_NET_MINOR 238 48#define VHOST_NET_MINOR 238
49#define UHID_MINOR 239
48#define MISC_DYNAMIC_MINOR 255 50#define MISC_DYNAMIC_MINOR 255
49 51
50struct device; 52struct device;
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index cd1fdf75103b..8df61bc5da00 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -154,10 +154,6 @@ enum {
154 MLX4_CMD_QUERY_IF_STAT = 0X54, 154 MLX4_CMD_QUERY_IF_STAT = 0X54,
155 MLX4_CMD_SET_IF_STAT = 0X55, 155 MLX4_CMD_SET_IF_STAT = 0X55,
156 156
157 /* set port opcode modifiers */
158 MLX4_SET_PORT_PRIO2TC = 0x8,
159 MLX4_SET_PORT_SCHEDULER = 0x9,
160
161 /* register/delete flow steering network rules */ 157 /* register/delete flow steering network rules */
162 MLX4_QP_FLOW_STEERING_ATTACH = 0x65, 158 MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
163 MLX4_QP_FLOW_STEERING_DETACH = 0x66, 159 MLX4_QP_FLOW_STEERING_DETACH = 0x66,
@@ -182,6 +178,8 @@ enum {
182 MLX4_SET_PORT_VLAN_TABLE = 0x3, 178 MLX4_SET_PORT_VLAN_TABLE = 0x3,
183 MLX4_SET_PORT_PRIO_MAP = 0x4, 179 MLX4_SET_PORT_PRIO_MAP = 0x4,
184 MLX4_SET_PORT_GID_TABLE = 0x5, 180 MLX4_SET_PORT_GID_TABLE = 0x5,
181 MLX4_SET_PORT_PRIO2TC = 0x8,
182 MLX4_SET_PORT_SCHEDULER = 0x9,
185}; 183};
186 184
187enum { 185enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 24ce6bdd540e..7d3a523160ba 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -54,6 +54,7 @@ enum {
54 MLX4_FLAG_MASTER = 1 << 2, 54 MLX4_FLAG_MASTER = 1 << 2,
55 MLX4_FLAG_SLAVE = 1 << 3, 55 MLX4_FLAG_SLAVE = 1 << 3,
56 MLX4_FLAG_SRIOV = 1 << 4, 56 MLX4_FLAG_SRIOV = 1 << 4,
57 MLX4_FLAG_OLD_REG_MAC = 1 << 6,
57}; 58};
58 59
59enum { 60enum {
@@ -155,7 +156,7 @@ enum {
155 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 156 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
156 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 157 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
157 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, 158 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
158 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 159 MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 4,
159 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 160 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
160 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 161 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
161 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, 162 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
@@ -640,16 +641,28 @@ struct mlx4_counter {
640 __be64 tx_bytes; 641 __be64 tx_bytes;
641}; 642};
642 643
644struct mlx4_quotas {
645 int qp;
646 int cq;
647 int srq;
648 int mpt;
649 int mtt;
650 int counter;
651 int xrcd;
652};
653
643struct mlx4_dev { 654struct mlx4_dev {
644 struct pci_dev *pdev; 655 struct pci_dev *pdev;
645 unsigned long flags; 656 unsigned long flags;
646 unsigned long num_slaves; 657 unsigned long num_slaves;
647 struct mlx4_caps caps; 658 struct mlx4_caps caps;
648 struct mlx4_phys_caps phys_caps; 659 struct mlx4_phys_caps phys_caps;
660 struct mlx4_quotas quotas;
649 struct radix_tree_root qp_table_tree; 661 struct radix_tree_root qp_table_tree;
650 u8 rev_id; 662 u8 rev_id;
651 char board_id[MLX4_BOARD_ID_LEN]; 663 char board_id[MLX4_BOARD_ID_LEN];
652 int num_vfs; 664 int num_vfs;
665 int numa_node;
653 int oper_log_mgm_entry_size; 666 int oper_log_mgm_entry_size;
654 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 667 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
655 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 668 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
@@ -771,6 +784,12 @@ static inline int mlx4_is_master(struct mlx4_dev *dev)
771 return dev->flags & MLX4_FLAG_MASTER; 784 return dev->flags & MLX4_FLAG_MASTER;
772} 785}
773 786
787static inline int mlx4_num_reserved_sqps(struct mlx4_dev *dev)
788{
789 return dev->phys_caps.base_sqpn + 8 +
790 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev);
791}
792
774static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 793static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
775{ 794{
776 return (qpn < dev->phys_caps.base_sqpn + 8 + 795 return (qpn < dev->phys_caps.base_sqpn + 8 +
@@ -816,7 +835,7 @@ void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn);
816 835
817int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 836int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar);
818void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 837void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar);
819int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf); 838int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node);
820void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf); 839void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf);
821 840
822int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 841int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
@@ -1078,7 +1097,7 @@ int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
1078 u8 *pg, u16 *ratelimit); 1097 u8 *pg, u16 *ratelimit);
1079int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1098int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1080int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1099int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
1081void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 1100void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan);
1082 1101
1083int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 1102int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
1084 int npages, u64 iova, u32 *lkey, u32 *rkey); 1103 int npages, u64 iova, u32 *lkey, u32 *rkey);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 68029b30c3dc..5eb4e31af22b 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -181,7 +181,7 @@ enum {
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41, 183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46, 184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
185}; 185};
186 186
187enum { 187enum {
@@ -417,7 +417,7 @@ struct mlx5_init_seg {
417 struct health_buffer health; 417 struct health_buffer health;
418 __be32 rsvd2[884]; 418 __be32 rsvd2[884];
419 __be32 health_counter; 419 __be32 health_counter;
420 __be32 rsvd3[1023]; 420 __be32 rsvd3[1019];
421 __be64 ieee1588_clk; 421 __be64 ieee1588_clk;
422 __be32 ieee1588_clk_type; 422 __be32 ieee1588_clk_type;
423 __be32 clr_intx; 423 __be32 clr_intx;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 8888381fc150..6b8c496572c8 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -82,7 +82,7 @@ enum {
82}; 82};
83 83
84enum { 84enum {
85 MLX5_MAX_EQ_NAME = 20 85 MLX5_MAX_EQ_NAME = 32
86}; 86};
87 87
88enum { 88enum {
@@ -747,8 +747,7 @@ static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
747 747
748enum { 748enum {
749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0, 749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
750 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1, 750 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 1,
751 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
752}; 751};
753 752
754enum { 753enum {
@@ -758,7 +757,6 @@ enum {
758struct mlx5_profile { 757struct mlx5_profile {
759 u64 mask; 758 u64 mask;
760 u32 log_max_qp; 759 u32 log_max_qp;
761 int cmdif_csum;
762 struct { 760 struct {
763 int size; 761 int size;
764 int limit; 762 int limit;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8b6e55ee8855..42a35d94b82c 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 */
@@ -581,11 +599,11 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
581 * sets it, so none of the operations on it need to be atomic. 599 * sets it, so none of the operations on it need to be atomic.
582 */ 600 */
583 601
584/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_NID] | ... | FLAGS | */ 602/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_CPUPID] | ... | FLAGS | */
585#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) 603#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
586#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) 604#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
587#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) 605#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
588#define LAST_NID_PGOFF (ZONES_PGOFF - LAST_NID_WIDTH) 606#define LAST_CPUPID_PGOFF (ZONES_PGOFF - LAST_CPUPID_WIDTH)
589 607
590/* 608/*
591 * Define the bit shifts to access each section. For non-existent 609 * Define the bit shifts to access each section. For non-existent
@@ -595,7 +613,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
595#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) 613#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
596#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 614#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
597#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 615#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
598#define LAST_NID_PGSHIFT (LAST_NID_PGOFF * (LAST_NID_WIDTH != 0)) 616#define LAST_CPUPID_PGSHIFT (LAST_CPUPID_PGOFF * (LAST_CPUPID_WIDTH != 0))
599 617
600/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */ 618/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
601#ifdef NODE_NOT_IN_PAGE_FLAGS 619#ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -617,7 +635,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
617#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 635#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
618#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 636#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
619#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 637#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
620#define LAST_NID_MASK ((1UL << LAST_NID_WIDTH) - 1) 638#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_WIDTH) - 1)
621#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 639#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
622 640
623static inline enum zone_type page_zonenum(const struct page *page) 641static inline enum zone_type page_zonenum(const struct page *page)
@@ -661,51 +679,117 @@ static inline int page_to_nid(const struct page *page)
661#endif 679#endif
662 680
663#ifdef CONFIG_NUMA_BALANCING 681#ifdef CONFIG_NUMA_BALANCING
664#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 682static inline int cpu_pid_to_cpupid(int cpu, int pid)
665static inline int page_nid_xchg_last(struct page *page, int nid)
666{ 683{
667 return xchg(&page->_last_nid, nid); 684 return ((cpu & LAST__CPU_MASK) << LAST__PID_SHIFT) | (pid & LAST__PID_MASK);
668} 685}
669 686
670static inline int page_nid_last(struct page *page) 687static inline int cpupid_to_pid(int cpupid)
671{ 688{
672 return page->_last_nid; 689 return cpupid & LAST__PID_MASK;
673} 690}
674static inline void page_nid_reset_last(struct page *page) 691
692static inline int cpupid_to_cpu(int cpupid)
675{ 693{
676 page->_last_nid = -1; 694 return (cpupid >> LAST__PID_SHIFT) & LAST__CPU_MASK;
677} 695}
678#else 696
679static inline int page_nid_last(struct page *page) 697static inline int cpupid_to_nid(int cpupid)
680{ 698{
681 return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK; 699 return cpu_to_node(cpupid_to_cpu(cpupid));
682} 700}
683 701
684extern int page_nid_xchg_last(struct page *page, int nid); 702static inline bool cpupid_pid_unset(int cpupid)
703{
704 return cpupid_to_pid(cpupid) == (-1 & LAST__PID_MASK);
705}
685 706
686static inline void page_nid_reset_last(struct page *page) 707static inline bool cpupid_cpu_unset(int cpupid)
687{ 708{
688 int nid = (1 << LAST_NID_SHIFT) - 1; 709 return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK);
710}
711
712static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid)
713{
714 return (task_pid & LAST__PID_MASK) == cpupid_to_pid(cpupid);
715}
716
717#define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid)
718#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
719static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
720{
721 return xchg(&page->_last_cpupid, cpupid);
722}
689 723
690 page->flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT); 724static inline int page_cpupid_last(struct page *page)
691 page->flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT; 725{
726 return page->_last_cpupid;
727}
728static inline void page_cpupid_reset_last(struct page *page)
729{
730 page->_last_cpupid = -1;
692} 731}
693#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
694#else 732#else
695static inline int page_nid_xchg_last(struct page *page, int nid) 733static inline int page_cpupid_last(struct page *page)
696{ 734{
697 return page_to_nid(page); 735 return (page->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
698} 736}
699 737
700static inline int page_nid_last(struct page *page) 738extern int page_cpupid_xchg_last(struct page *page, int cpupid);
739
740static inline void page_cpupid_reset_last(struct page *page)
701{ 741{
702 return page_to_nid(page); 742 int cpupid = (1 << LAST_CPUPID_SHIFT) - 1;
743
744 page->flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
745 page->flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT;
746}
747#endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */
748#else /* !CONFIG_NUMA_BALANCING */
749static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
750{
751 return page_to_nid(page); /* XXX */
703} 752}
704 753
705static inline void page_nid_reset_last(struct page *page) 754static inline int page_cpupid_last(struct page *page)
706{ 755{
756 return page_to_nid(page); /* XXX */
707} 757}
708#endif 758
759static inline int cpupid_to_nid(int cpupid)
760{
761 return -1;
762}
763
764static inline int cpupid_to_pid(int cpupid)
765{
766 return -1;
767}
768
769static inline int cpupid_to_cpu(int cpupid)
770{
771 return -1;
772}
773
774static inline int cpu_pid_to_cpupid(int nid, int pid)
775{
776 return -1;
777}
778
779static inline bool cpupid_pid_unset(int cpupid)
780{
781 return 1;
782}
783
784static inline void page_cpupid_reset_last(struct page *page)
785{
786}
787
788static inline bool cpupid_match_pid(struct task_struct *task, int cpupid)
789{
790 return false;
791}
792#endif /* CONFIG_NUMA_BALANCING */
709 793
710static inline struct zone *page_zone(const struct page *page) 794static inline struct zone *page_zone(const struct page *page)
711{ 795{
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index d9851eeb6e1d..a3198e5aaf4e 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -174,8 +174,8 @@ struct page {
174 void *shadow; 174 void *shadow;
175#endif 175#endif
176 176
177#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 177#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
178 int _last_nid; 178 int _last_cpupid;
179#endif 179#endif
180} 180}
181/* 181/*
@@ -420,28 +420,15 @@ struct mm_struct {
420 */ 420 */
421 unsigned long numa_next_scan; 421 unsigned long numa_next_scan;
422 422
423 /* numa_next_reset is when the PTE scanner period will be reset */
424 unsigned long numa_next_reset;
425
426 /* Restart point for scanning and setting pte_numa */ 423 /* Restart point for scanning and setting pte_numa */
427 unsigned long numa_scan_offset; 424 unsigned long numa_scan_offset;
428 425
429 /* numa_scan_seq prevents two threads setting pte_numa */ 426 /* numa_scan_seq prevents two threads setting pte_numa */
430 int numa_scan_seq; 427 int numa_scan_seq;
431
432 /*
433 * The first node a task was scheduled on. If a task runs on
434 * a different node than Make PTE Scan Go Now.
435 */
436 int first_nid;
437#endif 428#endif
438 struct uprobes_state uprobes_state; 429 struct uprobes_state uprobes_state;
439}; 430};
440 431
441/* first nid will either be a valid NID or one of these values */
442#define NUMA_PTE_SCAN_INIT -1
443#define NUMA_PTE_SCAN_ACTIVE -2
444
445static inline void mm_init_cpumask(struct mm_struct *mm) 432static inline void mm_init_cpumask(struct mm_struct *mm)
446{ 433{
447#ifdef CONFIG_CPUMASK_OFFSTACK 434#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/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/mutex.h b/include/linux/mutex.h
index ccd4260834c5..bab49da8a0f0 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -15,8 +15,8 @@
15#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/lockdep.h> 17#include <linux/lockdep.h>
18
19#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h>
20 20
21/* 21/*
22 * Simple, straightforward mutexes with strict semantics: 22 * Simple, straightforward mutexes with strict semantics:
@@ -175,8 +175,8 @@ extern void mutex_unlock(struct mutex *lock);
175 175
176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
177 177
178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef arch_mutex_cpu_relax
179#define arch_mutex_cpu_relax() cpu_relax() 179# define arch_mutex_cpu_relax() cpu_relax()
180#endif 180#endif
181 181
182#endif 182#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 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 041b42a305f6..8b3de7cc2ffc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,8 +60,8 @@ struct wireless_dev;
60#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */ 66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
@@ -298,7 +298,7 @@ struct netdev_boot_setup {
298}; 298};
299#define NETDEV_BOOT_SETUP_MAX 8 299#define NETDEV_BOOT_SETUP_MAX 8
300 300
301extern int __init netdev_boot_setup(char *str); 301int __init netdev_boot_setup(char *str);
302 302
303/* 303/*
304 * Structure for NAPI scheduling similar to tasklet but with weighting 304 * Structure for NAPI scheduling similar to tasklet but with weighting
@@ -394,7 +394,7 @@ enum rx_handler_result {
394typedef enum rx_handler_result rx_handler_result_t; 394typedef enum rx_handler_result rx_handler_result_t;
395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
396 396
397extern void __napi_schedule(struct napi_struct *n); 397void __napi_schedule(struct napi_struct *n);
398 398
399static inline bool napi_disable_pending(struct napi_struct *n) 399static inline bool napi_disable_pending(struct napi_struct *n)
400{ 400{
@@ -445,8 +445,8 @@ static inline bool napi_reschedule(struct napi_struct *napi)
445 * 445 *
446 * Mark NAPI processing as complete. 446 * Mark NAPI processing as complete.
447 */ 447 */
448extern void __napi_complete(struct napi_struct *n); 448void __napi_complete(struct napi_struct *n);
449extern void napi_complete(struct napi_struct *n); 449void napi_complete(struct napi_struct *n);
450 450
451/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id 452 * napi_by_id - lookup a NAPI by napi_id
@@ -455,7 +455,7 @@ extern void napi_complete(struct napi_struct *n);
455 * lookup @napi_id in napi_hash table 455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock() 456 * must be called under rcu_read_lock()
457 */ 457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id); 458struct napi_struct *napi_by_id(unsigned int napi_id);
459 459
460/** 460/**
461 * napi_hash_add - add a NAPI to global hashtable 461 * napi_hash_add - add a NAPI to global hashtable
@@ -463,7 +463,7 @@ extern struct napi_struct *napi_by_id(unsigned int napi_id);
463 * 463 *
464 * generate a new napi_id and store a @napi under it in napi_hash 464 * generate a new napi_id and store a @napi under it in napi_hash
465 */ 465 */
466extern void napi_hash_add(struct napi_struct *napi); 466void napi_hash_add(struct napi_struct *napi);
467 467
468/** 468/**
469 * napi_hash_del - remove a NAPI from global table 469 * napi_hash_del - remove a NAPI from global table
@@ -472,7 +472,7 @@ extern void napi_hash_add(struct napi_struct *napi);
472 * Warning: caller must observe rcu grace period 472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi 473 * before freeing memory containing @napi
474 */ 474 */
475extern void napi_hash_del(struct napi_struct *napi); 475void napi_hash_del(struct napi_struct *napi);
476 476
477/** 477/**
478 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
@@ -483,6 +483,7 @@ extern void napi_hash_del(struct napi_struct *napi);
483 */ 483 */
484static inline void napi_disable(struct napi_struct *n) 484static inline void napi_disable(struct napi_struct *n)
485{ 485{
486 might_sleep();
486 set_bit(NAPI_STATE_DISABLE, &n->state); 487 set_bit(NAPI_STATE_DISABLE, &n->state);
487 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 488 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
488 msleep(1); 489 msleep(1);
@@ -664,8 +665,8 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
664extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 665extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
665 666
666#ifdef CONFIG_RFS_ACCEL 667#ifdef CONFIG_RFS_ACCEL
667extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, 668bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
668 u32 flow_id, u16 filter_id); 669 u16 filter_id);
669#endif 670#endif
670 671
671/* This structure contains an instance of an RX queue. */ 672/* This structure contains an instance of an RX queue. */
@@ -950,17 +951,36 @@ struct netdev_phys_port_id {
950 * multiple net devices on single physical port. 951 * multiple net devices on single physical port.
951 * 952 *
952 * void (*ndo_add_vxlan_port)(struct net_device *dev, 953 * void (*ndo_add_vxlan_port)(struct net_device *dev,
953 * sa_family_t sa_family, __u16 port); 954 * sa_family_t sa_family, __be16 port);
954 * Called by vxlan to notiy a driver about the UDP port and socket 955 * Called by vxlan to notiy a driver about the UDP port and socket
955 * address family that vxlan is listnening to. It is called only when 956 * address family that vxlan is listnening to. It is called only when
956 * a new port starts listening. The operation is protected by the 957 * a new port starts listening. The operation is protected by the
957 * vxlan_net->sock_lock. 958 * vxlan_net->sock_lock.
958 * 959 *
959 * void (*ndo_del_vxlan_port)(struct net_device *dev, 960 * void (*ndo_del_vxlan_port)(struct net_device *dev,
960 * sa_family_t sa_family, __u16 port); 961 * sa_family_t sa_family, __be16 port);
961 * Called by vxlan to notify the driver about a UDP port and socket 962 * Called by vxlan to notify the driver about a UDP port and socket
962 * address family that vxlan is not listening to anymore. The operation 963 * address family that vxlan is not listening to anymore. The operation
963 * is protected by the vxlan_net->sock_lock. 964 * is protected by the vxlan_net->sock_lock.
965 *
966 * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
967 * struct net_device *dev)
968 * Called by upper layer devices to accelerate switching or other
969 * station functionality into hardware. 'pdev is the lowerdev
970 * to use for the offload and 'dev' is the net device that will
971 * back the offload. Returns a pointer to the private structure
972 * the upper layer will maintain.
973 * void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv)
974 * Called by upper layer device to delete the station created
975 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
976 * the station and priv is the structure returned by the add
977 * operation.
978 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb,
979 * struct net_device *dev,
980 * void *priv);
981 * Callback to use for xmit over the accelerated station. This
982 * is used in place of ndo_start_xmit on accelerated net
983 * devices.
964 */ 984 */
965struct net_device_ops { 985struct net_device_ops {
966 int (*ndo_init)(struct net_device *dev); 986 int (*ndo_init)(struct net_device *dev);
@@ -1093,10 +1113,19 @@ struct net_device_ops {
1093 struct netdev_phys_port_id *ppid); 1113 struct netdev_phys_port_id *ppid);
1094 void (*ndo_add_vxlan_port)(struct net_device *dev, 1114 void (*ndo_add_vxlan_port)(struct net_device *dev,
1095 sa_family_t sa_family, 1115 sa_family_t sa_family,
1096 __u16 port); 1116 __be16 port);
1097 void (*ndo_del_vxlan_port)(struct net_device *dev, 1117 void (*ndo_del_vxlan_port)(struct net_device *dev,
1098 sa_family_t sa_family, 1118 sa_family_t sa_family,
1099 __u16 port); 1119 __be16 port);
1120
1121 void* (*ndo_dfwd_add_station)(struct net_device *pdev,
1122 struct net_device *dev);
1123 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1124 void *priv);
1125
1126 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1127 struct net_device *dev,
1128 void *priv);
1100}; 1129};
1101 1130
1102/* 1131/*
@@ -1131,7 +1160,7 @@ struct net_device {
1131 unsigned long mem_end; /* shared mem end */ 1160 unsigned long mem_end; /* shared mem end */
1132 unsigned long mem_start; /* shared mem start */ 1161 unsigned long mem_start; /* shared mem start */
1133 unsigned long base_addr; /* device I/O address */ 1162 unsigned long base_addr; /* device I/O address */
1134 unsigned int irq; /* device IRQ number */ 1163 int irq; /* device IRQ number */
1135 1164
1136 /* 1165 /*
1137 * Some hardware also needs these fields, but they are not 1166 * Some hardware also needs these fields, but they are not
@@ -1143,8 +1172,19 @@ struct net_device {
1143 struct list_head dev_list; 1172 struct list_head dev_list;
1144 struct list_head napi_list; 1173 struct list_head napi_list;
1145 struct list_head unreg_list; 1174 struct list_head unreg_list;
1146 struct list_head upper_dev_list; /* List of upper devices */ 1175 struct list_head close_list;
1147 struct list_head lower_dev_list; 1176
1177 /* directly linked devices, like slaves for bonding */
1178 struct {
1179 struct list_head upper;
1180 struct list_head lower;
1181 } adj_list;
1182
1183 /* all linked devices, *including* neighbours */
1184 struct {
1185 struct list_head upper;
1186 struct list_head lower;
1187 } all_adj_list;
1148 1188
1149 1189
1150 /* currently active device features */ 1190 /* currently active device features */
@@ -1183,6 +1223,7 @@ struct net_device {
1183 /* Management operations */ 1223 /* Management operations */
1184 const struct net_device_ops *netdev_ops; 1224 const struct net_device_ops *netdev_ops;
1185 const struct ethtool_ops *ethtool_ops; 1225 const struct ethtool_ops *ethtool_ops;
1226 const struct forwarding_accel_ops *fwd_ops;
1186 1227
1187 /* Hardware header description */ 1228 /* Hardware header description */
1188 const struct header_ops *header_ops; 1229 const struct header_ops *header_ops;
@@ -1487,9 +1528,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1487 f(dev, &dev->_tx[i], arg); 1528 f(dev, &dev->_tx[i], arg);
1488} 1529}
1489 1530
1490extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1531struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1491 struct sk_buff *skb); 1532 struct sk_buff *skb);
1492extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); 1533u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1493 1534
1494/* 1535/*
1495 * Net namespace inlines 1536 * Net namespace inlines
@@ -1673,8 +1714,8 @@ struct packet_offload {
1673#define NETDEV_CHANGEUPPER 0x0015 1714#define NETDEV_CHANGEUPPER 0x0015
1674#define NETDEV_RESEND_IGMP 0x0016 1715#define NETDEV_RESEND_IGMP 0x0016
1675 1716
1676extern int register_netdevice_notifier(struct notifier_block *nb); 1717int register_netdevice_notifier(struct notifier_block *nb);
1677extern int unregister_netdevice_notifier(struct notifier_block *nb); 1718int unregister_netdevice_notifier(struct notifier_block *nb);
1678 1719
1679struct netdev_notifier_info { 1720struct netdev_notifier_info {
1680 struct net_device *dev; 1721 struct net_device *dev;
@@ -1697,9 +1738,9 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1697 return info->dev; 1738 return info->dev;
1698} 1739}
1699 1740
1700extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, 1741int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1701 struct netdev_notifier_info *info); 1742 struct netdev_notifier_info *info);
1702extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1743int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1703 1744
1704 1745
1705extern rwlock_t dev_base_lock; /* Device list lock */ 1746extern rwlock_t dev_base_lock; /* Device list lock */
@@ -1754,54 +1795,53 @@ static inline struct net_device *first_net_device_rcu(struct net *net)
1754 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1795 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1755} 1796}
1756 1797
1757extern int netdev_boot_setup_check(struct net_device *dev); 1798int netdev_boot_setup_check(struct net_device *dev);
1758extern unsigned long netdev_boot_base(const char *prefix, int unit); 1799unsigned long netdev_boot_base(const char *prefix, int unit);
1759extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1800struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
1760 const char *hwaddr); 1801 const char *hwaddr);
1761extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); 1802struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
1762extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); 1803struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
1763extern void dev_add_pack(struct packet_type *pt); 1804void dev_add_pack(struct packet_type *pt);
1764extern void dev_remove_pack(struct packet_type *pt); 1805void dev_remove_pack(struct packet_type *pt);
1765extern void __dev_remove_pack(struct packet_type *pt); 1806void __dev_remove_pack(struct packet_type *pt);
1766extern void dev_add_offload(struct packet_offload *po); 1807void dev_add_offload(struct packet_offload *po);
1767extern void dev_remove_offload(struct packet_offload *po); 1808void dev_remove_offload(struct packet_offload *po);
1768extern void __dev_remove_offload(struct packet_offload *po); 1809void __dev_remove_offload(struct packet_offload *po);
1769 1810
1770extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1811struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1771 unsigned short mask); 1812 unsigned short mask);
1772extern struct net_device *dev_get_by_name(struct net *net, const char *name); 1813struct net_device *dev_get_by_name(struct net *net, const char *name);
1773extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1814struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
1774extern struct net_device *__dev_get_by_name(struct net *net, const char *name); 1815struct net_device *__dev_get_by_name(struct net *net, const char *name);
1775extern int dev_alloc_name(struct net_device *dev, const char *name); 1816int dev_alloc_name(struct net_device *dev, const char *name);
1776extern int dev_open(struct net_device *dev); 1817int dev_open(struct net_device *dev);
1777extern int dev_close(struct net_device *dev); 1818int dev_close(struct net_device *dev);
1778extern void dev_disable_lro(struct net_device *dev); 1819void dev_disable_lro(struct net_device *dev);
1779extern int dev_loopback_xmit(struct sk_buff *newskb); 1820int dev_loopback_xmit(struct sk_buff *newskb);
1780extern int dev_queue_xmit(struct sk_buff *skb); 1821int dev_queue_xmit(struct sk_buff *skb);
1781extern int register_netdevice(struct net_device *dev); 1822int register_netdevice(struct net_device *dev);
1782extern void unregister_netdevice_queue(struct net_device *dev, 1823void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
1783 struct list_head *head); 1824void unregister_netdevice_many(struct list_head *head);
1784extern void unregister_netdevice_many(struct list_head *head);
1785static inline void unregister_netdevice(struct net_device *dev) 1825static inline void unregister_netdevice(struct net_device *dev)
1786{ 1826{
1787 unregister_netdevice_queue(dev, NULL); 1827 unregister_netdevice_queue(dev, NULL);
1788} 1828}
1789 1829
1790extern int netdev_refcnt_read(const struct net_device *dev); 1830int netdev_refcnt_read(const struct net_device *dev);
1791extern void free_netdev(struct net_device *dev); 1831void free_netdev(struct net_device *dev);
1792extern void synchronize_net(void); 1832void netdev_freemem(struct net_device *dev);
1793extern int init_dummy_netdev(struct net_device *dev); 1833void synchronize_net(void);
1834int init_dummy_netdev(struct net_device *dev);
1794 1835
1795extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1836struct net_device *dev_get_by_index(struct net *net, int ifindex);
1796extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1837struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1797extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1838struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1798extern int netdev_get_name(struct net *net, char *name, int ifindex); 1839int netdev_get_name(struct net *net, char *name, int ifindex);
1799extern int dev_restart(struct net_device *dev); 1840int dev_restart(struct net_device *dev);
1800#ifdef CONFIG_NETPOLL_TRAP 1841#ifdef CONFIG_NETPOLL_TRAP
1801extern int netpoll_trap(void); 1842int netpoll_trap(void);
1802#endif 1843#endif
1803extern int skb_gro_receive(struct sk_buff **head, 1844int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1804 struct sk_buff *skb);
1805 1845
1806static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1846static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1807{ 1847{
@@ -1873,7 +1913,7 @@ static inline int dev_parse_header(const struct sk_buff *skb,
1873} 1913}
1874 1914
1875typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 1915typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
1876extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); 1916int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
1877static inline int unregister_gifconf(unsigned int family) 1917static inline int unregister_gifconf(unsigned int family)
1878{ 1918{
1879 return register_gifconf(family, NULL); 1919 return register_gifconf(family, NULL);
@@ -1944,7 +1984,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1944 1984
1945DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 1985DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1946 1986
1947extern void __netif_schedule(struct Qdisc *q); 1987void __netif_schedule(struct Qdisc *q);
1948 1988
1949static inline void netif_schedule_queue(struct netdev_queue *txq) 1989static inline void netif_schedule_queue(struct netdev_queue *txq)
1950{ 1990{
@@ -2264,11 +2304,11 @@ 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, struct cpumask *mask, 2307int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2268 u16 index); 2308 u16 index);
2269#else 2309#else
2270static inline int netif_set_xps_queue(struct net_device *dev, 2310static inline int netif_set_xps_queue(struct net_device *dev,
2271 struct cpumask *mask, 2311 const struct cpumask *mask,
2272 u16 index) 2312 u16 index)
2273{ 2313{
2274 return 0; 2314 return 0;
@@ -2296,12 +2336,10 @@ static inline bool netif_is_multiqueue(const struct net_device *dev)
2296 return dev->num_tx_queues > 1; 2336 return dev->num_tx_queues > 1;
2297} 2337}
2298 2338
2299extern 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);
2300 unsigned int txq);
2301 2340
2302#ifdef CONFIG_RPS 2341#ifdef CONFIG_RPS
2303extern 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);
2304 unsigned int rxq);
2305#else 2343#else
2306static 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,
2307 unsigned int rxq) 2345 unsigned int rxq)
@@ -2328,28 +2366,27 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2328} 2366}
2329 2367
2330#define DEFAULT_MAX_NUM_RSS_QUEUES (8) 2368#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
2331extern int netif_get_num_default_rss_queues(void); 2369int netif_get_num_default_rss_queues(void);
2332 2370
2333/* Use this variant when it is known for sure that it 2371/* Use this variant when it is known for sure that it
2334 * is executing from hardware interrupt context or with hardware interrupts 2372 * is executing from hardware interrupt context or with hardware interrupts
2335 * disabled. 2373 * disabled.
2336 */ 2374 */
2337extern void dev_kfree_skb_irq(struct sk_buff *skb); 2375void dev_kfree_skb_irq(struct sk_buff *skb);
2338 2376
2339/* Use this variant in places where it could be invoked 2377/* Use this variant in places where it could be invoked
2340 * from either hardware interrupt or other context, with hardware interrupts 2378 * from either hardware interrupt or other context, with hardware interrupts
2341 * either disabled or enabled. 2379 * either disabled or enabled.
2342 */ 2380 */
2343extern void dev_kfree_skb_any(struct sk_buff *skb); 2381void dev_kfree_skb_any(struct sk_buff *skb);
2344 2382
2345extern int netif_rx(struct sk_buff *skb); 2383int netif_rx(struct sk_buff *skb);
2346extern int netif_rx_ni(struct sk_buff *skb); 2384int netif_rx_ni(struct sk_buff *skb);
2347extern int netif_receive_skb(struct sk_buff *skb); 2385int netif_receive_skb(struct sk_buff *skb);
2348extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2386gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2349 struct sk_buff *skb); 2387void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2350extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2388struct sk_buff *napi_get_frags(struct napi_struct *napi);
2351extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2389gro_result_t napi_gro_frags(struct napi_struct *napi);
2352extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2353 2390
2354static inline void napi_free_frags(struct napi_struct *napi) 2391static inline void napi_free_frags(struct napi_struct *napi)
2355{ 2392{
@@ -2357,40 +2394,36 @@ static inline void napi_free_frags(struct napi_struct *napi)
2357 napi->skb = NULL; 2394 napi->skb = NULL;
2358} 2395}
2359 2396
2360extern int netdev_rx_handler_register(struct net_device *dev, 2397int netdev_rx_handler_register(struct net_device *dev,
2361 rx_handler_func_t *rx_handler, 2398 rx_handler_func_t *rx_handler,
2362 void *rx_handler_data); 2399 void *rx_handler_data);
2363extern void netdev_rx_handler_unregister(struct net_device *dev); 2400void netdev_rx_handler_unregister(struct net_device *dev);
2364 2401
2365extern bool dev_valid_name(const char *name); 2402bool dev_valid_name(const char *name);
2366extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2403int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2367extern int dev_ethtool(struct net *net, struct ifreq *); 2404int dev_ethtool(struct net *net, struct ifreq *);
2368extern unsigned int dev_get_flags(const struct net_device *); 2405unsigned int dev_get_flags(const struct net_device *);
2369extern int __dev_change_flags(struct net_device *, unsigned int flags); 2406int __dev_change_flags(struct net_device *, unsigned int flags);
2370extern int dev_change_flags(struct net_device *, unsigned int); 2407int dev_change_flags(struct net_device *, unsigned int);
2371extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2408void __dev_notify_flags(struct net_device *, unsigned int old_flags,
2372extern int dev_change_name(struct net_device *, const char *); 2409 unsigned int gchanges);
2373extern int dev_set_alias(struct net_device *, const char *, size_t); 2410int dev_change_name(struct net_device *, const char *);
2374extern int dev_change_net_namespace(struct net_device *, 2411int dev_set_alias(struct net_device *, const char *, size_t);
2375 struct net *, const char *); 2412int dev_change_net_namespace(struct net_device *, struct net *, const char *);
2376extern int dev_set_mtu(struct net_device *, int); 2413int dev_set_mtu(struct net_device *, int);
2377extern void dev_set_group(struct net_device *, int); 2414void dev_set_group(struct net_device *, int);
2378extern int dev_set_mac_address(struct net_device *, 2415int dev_set_mac_address(struct net_device *, struct sockaddr *);
2379 struct sockaddr *); 2416int dev_change_carrier(struct net_device *, bool new_carrier);
2380extern int dev_change_carrier(struct net_device *, 2417int dev_get_phys_port_id(struct net_device *dev,
2381 bool new_carrier); 2418 struct netdev_phys_port_id *ppid);
2382extern int dev_get_phys_port_id(struct net_device *dev, 2419int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2383 struct netdev_phys_port_id *ppid); 2420 struct netdev_queue *txq, void *accel_priv);
2384extern int dev_hard_start_xmit(struct sk_buff *skb, 2421int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2385 struct net_device *dev,
2386 struct netdev_queue *txq);
2387extern int dev_forward_skb(struct net_device *dev,
2388 struct sk_buff *skb);
2389 2422
2390extern int netdev_budget; 2423extern int netdev_budget;
2391 2424
2392/* Called by rtnetlink.c:rtnl_unlock() */ 2425/* Called by rtnetlink.c:rtnl_unlock() */
2393extern void netdev_run_todo(void); 2426void netdev_run_todo(void);
2394 2427
2395/** 2428/**
2396 * dev_put - release reference to device 2429 * dev_put - release reference to device
@@ -2423,9 +2456,9 @@ static inline void dev_hold(struct net_device *dev)
2423 * kind of lower layer not just hardware media. 2456 * kind of lower layer not just hardware media.
2424 */ 2457 */
2425 2458
2426extern void linkwatch_init_dev(struct net_device *dev); 2459void linkwatch_init_dev(struct net_device *dev);
2427extern void linkwatch_fire_event(struct net_device *dev); 2460void linkwatch_fire_event(struct net_device *dev);
2428extern void linkwatch_forget_dev(struct net_device *dev); 2461void linkwatch_forget_dev(struct net_device *dev);
2429 2462
2430/** 2463/**
2431 * netif_carrier_ok - test if carrier present 2464 * netif_carrier_ok - test if carrier present
@@ -2438,13 +2471,13 @@ static inline bool netif_carrier_ok(const struct net_device *dev)
2438 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2471 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2439} 2472}
2440 2473
2441extern unsigned long dev_trans_start(struct net_device *dev); 2474unsigned long dev_trans_start(struct net_device *dev);
2442 2475
2443extern void __netdev_watchdog_up(struct net_device *dev); 2476void __netdev_watchdog_up(struct net_device *dev);
2444 2477
2445extern void netif_carrier_on(struct net_device *dev); 2478void netif_carrier_on(struct net_device *dev);
2446 2479
2447extern void netif_carrier_off(struct net_device *dev); 2480void netif_carrier_off(struct net_device *dev);
2448 2481
2449/** 2482/**
2450 * netif_dormant_on - mark device as dormant. 2483 * netif_dormant_on - mark device as dormant.
@@ -2512,9 +2545,9 @@ static inline bool netif_device_present(struct net_device *dev)
2512 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2545 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2513} 2546}
2514 2547
2515extern void netif_device_detach(struct net_device *dev); 2548void netif_device_detach(struct net_device *dev);
2516 2549
2517extern void netif_device_attach(struct net_device *dev); 2550void netif_device_attach(struct net_device *dev);
2518 2551
2519/* 2552/*
2520 * Network interface message level settings 2553 * Network interface message level settings
@@ -2723,119 +2756,138 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
2723 2756
2724/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 2757/* These functions live elsewhere (drivers/net/net_init.c, but related) */
2725 2758
2726extern void ether_setup(struct net_device *dev); 2759void ether_setup(struct net_device *dev);
2727 2760
2728/* Support for loadable net-drivers */ 2761/* Support for loadable net-drivers */
2729extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 2762struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
2730 void (*setup)(struct net_device *), 2763 void (*setup)(struct net_device *),
2731 unsigned int txqs, unsigned int rxqs); 2764 unsigned int txqs, unsigned int rxqs);
2732#define alloc_netdev(sizeof_priv, name, setup) \ 2765#define alloc_netdev(sizeof_priv, name, setup) \
2733 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 2766 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
2734 2767
2735#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 2768#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
2736 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 2769 alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
2737 2770
2738extern int register_netdev(struct net_device *dev); 2771int register_netdev(struct net_device *dev);
2739extern void unregister_netdev(struct net_device *dev); 2772void unregister_netdev(struct net_device *dev);
2740 2773
2741/* General hardware address lists handling functions */ 2774/* General hardware address lists handling functions */
2742extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, 2775int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2743 struct netdev_hw_addr_list *from_list, 2776 struct netdev_hw_addr_list *from_list,
2744 int addr_len, unsigned char addr_type); 2777 int addr_len, unsigned char addr_type);
2745extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, 2778void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2746 struct netdev_hw_addr_list *from_list, 2779 struct netdev_hw_addr_list *from_list,
2747 int addr_len, unsigned char addr_type); 2780 int addr_len, unsigned char addr_type);
2748extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, 2781int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2749 struct netdev_hw_addr_list *from_list, 2782 struct netdev_hw_addr_list *from_list, int addr_len);
2750 int addr_len); 2783void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2751extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 2784 struct netdev_hw_addr_list *from_list, int addr_len);
2752 struct netdev_hw_addr_list *from_list, 2785void __hw_addr_flush(struct netdev_hw_addr_list *list);
2753 int addr_len); 2786void __hw_addr_init(struct netdev_hw_addr_list *list);
2754extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2755extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2756 2787
2757/* Functions used for device addresses handling */ 2788/* Functions used for device addresses handling */
2758extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, 2789int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2759 unsigned char addr_type); 2790 unsigned char addr_type);
2760extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, 2791int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2761 unsigned char addr_type); 2792 unsigned char addr_type);
2762extern int dev_addr_add_multiple(struct net_device *to_dev, 2793int dev_addr_add_multiple(struct net_device *to_dev,
2763 struct net_device *from_dev, 2794 struct net_device *from_dev, unsigned char addr_type);
2764 unsigned char addr_type); 2795int dev_addr_del_multiple(struct net_device *to_dev,
2765extern int dev_addr_del_multiple(struct net_device *to_dev, 2796 struct net_device *from_dev, unsigned char addr_type);
2766 struct net_device *from_dev, 2797void dev_addr_flush(struct net_device *dev);
2767 unsigned char addr_type); 2798int dev_addr_init(struct net_device *dev);
2768extern void dev_addr_flush(struct net_device *dev);
2769extern int dev_addr_init(struct net_device *dev);
2770 2799
2771/* Functions used for unicast addresses handling */ 2800/* Functions used for unicast addresses handling */
2772extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); 2801int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2773extern 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);
2774extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2803int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2775extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2804int dev_uc_sync(struct net_device *to, struct net_device *from);
2776extern 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);
2777extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2806void dev_uc_unsync(struct net_device *to, struct net_device *from);
2778extern void dev_uc_flush(struct net_device *dev); 2807void dev_uc_flush(struct net_device *dev);
2779extern void dev_uc_init(struct net_device *dev); 2808void dev_uc_init(struct net_device *dev);
2780 2809
2781/* Functions used for multicast addresses handling */ 2810/* Functions used for multicast addresses handling */
2782extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); 2811int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2783extern 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);
2784extern 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);
2785extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2814int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2786extern 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);
2787extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2816int dev_mc_sync(struct net_device *to, struct net_device *from);
2788extern 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);
2789extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2818void dev_mc_unsync(struct net_device *to, struct net_device *from);
2790extern void dev_mc_flush(struct net_device *dev); 2819void dev_mc_flush(struct net_device *dev);
2791extern void dev_mc_init(struct net_device *dev); 2820void dev_mc_init(struct net_device *dev);
2792 2821
2793/* Functions used for secondary unicast and multicast support */ 2822/* Functions used for secondary unicast and multicast support */
2794extern void dev_set_rx_mode(struct net_device *dev); 2823void dev_set_rx_mode(struct net_device *dev);
2795extern void __dev_set_rx_mode(struct net_device *dev); 2824void __dev_set_rx_mode(struct net_device *dev);
2796extern int dev_set_promiscuity(struct net_device *dev, int inc); 2825int dev_set_promiscuity(struct net_device *dev, int inc);
2797extern int dev_set_allmulti(struct net_device *dev, int inc); 2826int dev_set_allmulti(struct net_device *dev, int inc);
2798extern void netdev_state_change(struct net_device *dev); 2827void netdev_state_change(struct net_device *dev);
2799extern void netdev_notify_peers(struct net_device *dev); 2828void netdev_notify_peers(struct net_device *dev);
2800extern void netdev_features_change(struct net_device *dev); 2829void netdev_features_change(struct net_device *dev);
2801/* Load a device via the kmod */ 2830/* Load a device via the kmod */
2802extern void dev_load(struct net *net, const char *name); 2831void dev_load(struct net *net, const char *name);
2803extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2832struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2804 struct rtnl_link_stats64 *storage); 2833 struct rtnl_link_stats64 *storage);
2805extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2834void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2806 const struct net_device_stats *netdev_stats); 2835 const struct net_device_stats *netdev_stats);
2807 2836
2808extern int netdev_max_backlog; 2837extern int netdev_max_backlog;
2809extern int netdev_tstamp_prequeue; 2838extern int netdev_tstamp_prequeue;
2810extern int weight_p; 2839extern int weight_p;
2811extern int bpf_jit_enable; 2840extern int bpf_jit_enable;
2812 2841
2813extern bool netdev_has_upper_dev(struct net_device *dev, 2842bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
2814 struct net_device *upper_dev); 2843bool netdev_has_any_upper_dev(struct net_device *dev);
2815extern bool netdev_has_any_upper_dev(struct net_device *dev); 2844struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
2816extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, 2845 struct list_head **iter);
2817 struct list_head **iter);
2818 2846
2819/* iterate through upper list, must be called under RCU read lock */ 2847/* iterate through upper list, must be called under RCU read lock */
2820#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \ 2848#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
2821 for (iter = &(dev)->upper_dev_list, \ 2849 for (iter = &(dev)->all_adj_list.upper, \
2822 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ 2850 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
2823 upper; \ 2851 updev; \
2824 upper = netdev_upper_get_next_dev_rcu(dev, &(iter))) 2852 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
2825 2853
2826extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2854void *netdev_lower_get_next_private(struct net_device *dev,
2827extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2855 struct list_head **iter);
2828extern 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,
2829 struct net_device *upper_dev); 2876 struct net_device *upper_dev);
2830extern int netdev_master_upper_dev_link(struct net_device *dev, 2877int netdev_master_upper_dev_link_private(struct net_device *dev,
2831 struct net_device *upper_dev); 2878 struct net_device *upper_dev,
2832extern void netdev_upper_dev_unlink(struct net_device *dev, 2879 void *private);
2833 struct net_device *upper_dev); 2880void netdev_upper_dev_unlink(struct net_device *dev,
2834extern int skb_checksum_help(struct sk_buff *skb); 2881 struct net_device *upper_dev);
2835extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 2882void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
2836 netdev_features_t features, bool tx_path); 2883 struct net_device *lower_dev);
2837extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 2884void *netdev_lower_dev_get_private(struct net_device *dev,
2838 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);
2839 2891
2840static inline 2892static inline
2841struct 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)
@@ -2857,30 +2909,42 @@ static inline bool can_checksum_protocol(netdev_features_t features,
2857} 2909}
2858 2910
2859#ifdef CONFIG_BUG 2911#ifdef CONFIG_BUG
2860extern void netdev_rx_csum_fault(struct net_device *dev); 2912void netdev_rx_csum_fault(struct net_device *dev);
2861#else 2913#else
2862static inline void netdev_rx_csum_fault(struct net_device *dev) 2914static inline void netdev_rx_csum_fault(struct net_device *dev)
2863{ 2915{
2864} 2916}
2865#endif 2917#endif
2866/* rx skb timestamps */ 2918/* rx skb timestamps */
2867extern void net_enable_timestamp(void); 2919void net_enable_timestamp(void);
2868extern void net_disable_timestamp(void); 2920void net_disable_timestamp(void);
2869 2921
2870#ifdef CONFIG_PROC_FS 2922#ifdef CONFIG_PROC_FS
2871extern int __init dev_proc_init(void); 2923int __init dev_proc_init(void);
2872#else 2924#else
2873#define dev_proc_init() 0 2925#define dev_proc_init() 0
2874#endif 2926#endif
2875 2927
2876extern int netdev_class_create_file(struct class_attribute *class_attr); 2928int netdev_class_create_file_ns(struct class_attribute *class_attr,
2877extern void netdev_class_remove_file(struct class_attribute *class_attr); 2929 const void *ns);
2930void netdev_class_remove_file_ns(struct class_attribute *class_attr,
2931 const void *ns);
2932
2933static inline int netdev_class_create_file(struct class_attribute *class_attr)
2934{
2935 return netdev_class_create_file_ns(class_attr, NULL);
2936}
2937
2938static inline void netdev_class_remove_file(struct class_attribute *class_attr)
2939{
2940 netdev_class_remove_file_ns(class_attr, NULL);
2941}
2878 2942
2879extern struct kobj_ns_type_operations net_ns_type_operations; 2943extern struct kobj_ns_type_operations net_ns_type_operations;
2880 2944
2881extern const char *netdev_drivername(const struct net_device *dev); 2945const char *netdev_drivername(const struct net_device *dev);
2882 2946
2883extern void linkwatch_run_queue(void); 2947void linkwatch_run_queue(void);
2884 2948
2885static inline netdev_features_t netdev_get_wanted_features( 2949static inline netdev_features_t netdev_get_wanted_features(
2886 struct net_device *dev) 2950 struct net_device *dev)
@@ -2944,6 +3008,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2944 dev->gso_max_size = size; 3008 dev->gso_max_size = size;
2945} 3009}
2946 3010
3011static inline bool netif_is_macvlan(struct net_device *dev)
3012{
3013 return dev->priv_flags & IFF_MACVLAN;
3014}
3015
2947static inline bool netif_is_bond_master(struct net_device *dev) 3016static inline bool netif_is_bond_master(struct net_device *dev)
2948{ 3017{
2949 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3018 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
@@ -2972,22 +3041,22 @@ static inline const char *netdev_name(const struct net_device *dev)
2972 return dev->name; 3041 return dev->name;
2973} 3042}
2974 3043
2975extern __printf(3, 4) 3044__printf(3, 4)
2976int netdev_printk(const char *level, const struct net_device *dev, 3045int netdev_printk(const char *level, const struct net_device *dev,
2977 const char *format, ...); 3046 const char *format, ...);
2978extern __printf(2, 3) 3047__printf(2, 3)
2979int netdev_emerg(const struct net_device *dev, const char *format, ...); 3048int netdev_emerg(const struct net_device *dev, const char *format, ...);
2980extern __printf(2, 3) 3049__printf(2, 3)
2981int netdev_alert(const struct net_device *dev, const char *format, ...); 3050int netdev_alert(const struct net_device *dev, const char *format, ...);
2982extern __printf(2, 3) 3051__printf(2, 3)
2983int netdev_crit(const struct net_device *dev, const char *format, ...); 3052int netdev_crit(const struct net_device *dev, const char *format, ...);
2984extern __printf(2, 3) 3053__printf(2, 3)
2985int netdev_err(const struct net_device *dev, const char *format, ...); 3054int netdev_err(const struct net_device *dev, const char *format, ...);
2986extern __printf(2, 3) 3055__printf(2, 3)
2987int netdev_warn(const struct net_device *dev, const char *format, ...); 3056int netdev_warn(const struct net_device *dev, const char *format, ...);
2988extern __printf(2, 3) 3057__printf(2, 3)
2989int netdev_notice(const struct net_device *dev, const char *format, ...); 3058int netdev_notice(const struct net_device *dev, const char *format, ...);
2990extern __printf(2, 3) 3059__printf(2, 3)
2991int netdev_info(const struct net_device *dev, const char *format, ...); 3060int netdev_info(const struct net_device *dev, const char *format, ...);
2992 3061
2993#define MODULE_ALIAS_NETDEV(device) \ 3062#define MODULE_ALIAS_NETDEV(device) \
@@ -3028,7 +3097,7 @@ do { \
3028 * file/line information and a backtrace. 3097 * file/line information and a backtrace.
3029 */ 3098 */
3030#define netdev_WARN(dev, format, args...) \ 3099#define netdev_WARN(dev, format, args...) \
3031 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); 3100 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
3032 3101
3033/* netif printk helpers, similar to netdev_printk */ 3102/* netif printk helpers, similar to netdev_printk */
3034 3103
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 708fe72ab913..2077489f9887 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,14 +35,15 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern int netfilter_init(void); 38int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
42 42
43struct sk_buff; 43struct sk_buff;
44 44
45typedef unsigned int nf_hookfn(unsigned int hooknum, 45struct nf_hook_ops;
46typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
46 struct sk_buff *skb, 47 struct sk_buff *skb,
47 const struct net_device *in, 48 const struct net_device *in,
48 const struct net_device *out, 49 const struct net_device *out,
@@ -52,12 +53,13 @@ struct nf_hook_ops {
52 struct list_head list; 53 struct list_head list;
53 54
54 /* User fills in from here down. */ 55 /* User fills in from here down. */
55 nf_hookfn *hook; 56 nf_hookfn *hook;
56 struct module *owner; 57 struct module *owner;
57 u_int8_t pf; 58 void *priv;
58 unsigned int hooknum; 59 u_int8_t pf;
60 unsigned int hooknum;
59 /* Hooks are ordered in ascending priority. */ 61 /* Hooks are ordered in ascending priority. */
60 int priority; 62 int priority;
61}; 63};
62 64
63struct nf_sockopt_ops { 65struct nf_sockopt_ops {
@@ -208,7 +210,7 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
208/* Call this before modifying an existing packet: ensures it is 210/* Call this before modifying an existing packet: ensures it is
209 modifiable and linear to the point you care about (writable_len). 211 modifiable and linear to the point you care about (writable_len).
210 Returns true or false. */ 212 Returns true or false. */
211extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); 213int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
212 214
213struct flowi; 215struct flowi;
214struct nf_queue_entry; 216struct nf_queue_entry;
@@ -269,8 +271,8 @@ nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
269 return csum; 271 return csum;
270} 272}
271 273
272extern int nf_register_afinfo(const struct nf_afinfo *afinfo); 274int nf_register_afinfo(const struct nf_afinfo *afinfo);
273extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 275void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
274 276
275#include <net/flow.h> 277#include <net/flow.h>
276extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *); 278extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
@@ -315,7 +317,7 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
315 317
316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 318#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
317extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; 319extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
318extern void nf_ct_attach(struct sk_buff *, const struct sk_buff *); 320void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu; 321extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
320 322
321struct nf_conn; 323struct nf_conn;
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index d80e2753847c..c7174b816674 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -49,31 +49,68 @@ enum ip_set_feature {
49 49
50/* Set extensions */ 50/* Set extensions */
51enum ip_set_extension { 51enum ip_set_extension {
52 IPSET_EXT_NONE = 0, 52 IPSET_EXT_BIT_TIMEOUT = 0,
53 IPSET_EXT_BIT_TIMEOUT = 1,
54 IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT), 53 IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT),
55 IPSET_EXT_BIT_COUNTER = 2, 54 IPSET_EXT_BIT_COUNTER = 1,
56 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), 55 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
57}; 56 IPSET_EXT_BIT_COMMENT = 2,
58 57 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT),
59/* Extension offsets */ 58 /* Mark set with an extension which needs to call destroy */
60enum ip_set_offset { 59 IPSET_EXT_BIT_DESTROY = 7,
61 IPSET_OFFSET_TIMEOUT = 0, 60 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY),
62 IPSET_OFFSET_COUNTER,
63 IPSET_OFFSET_MAX,
64}; 61};
65 62
66#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 63#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
67#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 64#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
65#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
66
67/* Extension id, in size order */
68enum ip_set_ext_id {
69 IPSET_EXT_ID_COUNTER = 0,
70 IPSET_EXT_ID_TIMEOUT,
71 IPSET_EXT_ID_COMMENT,
72 IPSET_EXT_ID_MAX,
73};
74
75/* Extension type */
76struct ip_set_ext_type {
77 /* Destroy extension private data (can be NULL) */
78 void (*destroy)(void *ext);
79 enum ip_set_extension type;
80 enum ipset_cadt_flags flag;
81 /* Size and minimal alignment */
82 u8 len;
83 u8 align;
84};
85
86extern const struct ip_set_ext_type ip_set_extensions[];
68 87
69struct ip_set_ext { 88struct ip_set_ext {
70 unsigned long timeout;
71 u64 packets; 89 u64 packets;
72 u64 bytes; 90 u64 bytes;
91 u32 timeout;
92 char *comment;
93};
94
95struct ip_set_counter {
96 atomic64_t bytes;
97 atomic64_t packets;
98};
99
100struct ip_set_comment {
101 char *str;
73}; 102};
74 103
75struct ip_set; 104struct ip_set;
76 105
106#define ext_timeout(e, s) \
107(unsigned long *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_TIMEOUT])
108#define ext_counter(e, s) \
109(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER])
110#define ext_comment(e, s) \
111(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT])
112
113
77typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 114typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
78 const struct ip_set_ext *ext, 115 const struct ip_set_ext *ext,
79 struct ip_set_ext *mext, u32 cmdflags); 116 struct ip_set_ext *mext, u32 cmdflags);
@@ -147,7 +184,8 @@ struct ip_set_type {
147 u8 revision_min, revision_max; 184 u8 revision_min, revision_max;
148 185
149 /* Create set */ 186 /* Create set */
150 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags); 187 int (*create)(struct net *net, struct ip_set *set,
188 struct nlattr *tb[], u32 flags);
151 189
152 /* Attribute policies */ 190 /* Attribute policies */
153 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1]; 191 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1];
@@ -179,14 +217,45 @@ struct ip_set {
179 u8 revision; 217 u8 revision;
180 /* Extensions */ 218 /* Extensions */
181 u8 extensions; 219 u8 extensions;
220 /* Default timeout value, if enabled */
221 u32 timeout;
222 /* Element data size */
223 size_t dsize;
224 /* Offsets to extensions in elements */
225 size_t offset[IPSET_EXT_ID_MAX];
182 /* The type specific data */ 226 /* The type specific data */
183 void *data; 227 void *data;
184}; 228};
185 229
186struct ip_set_counter { 230static inline void
187 atomic64_t bytes; 231ip_set_ext_destroy(struct ip_set *set, void *data)
188 atomic64_t packets; 232{
189}; 233 /* Check that the extension is enabled for the set and
234 * call it's destroy function for its extension part in data.
235 */
236 if (SET_WITH_COMMENT(set))
237 ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy(
238 ext_comment(data, set));
239}
240
241static inline int
242ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
243{
244 u32 cadt_flags = 0;
245
246 if (SET_WITH_TIMEOUT(set))
247 if (unlikely(nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
248 htonl(set->timeout))))
249 return -EMSGSIZE;
250 if (SET_WITH_COUNTER(set))
251 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
252 if (SET_WITH_COMMENT(set))
253 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
254
255 if (!cadt_flags)
256 return 0;
257 return nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(cadt_flags));
258}
190 259
191static inline void 260static inline void
192ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) 261ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter)
@@ -247,13 +316,24 @@ ip_set_init_counter(struct ip_set_counter *counter,
247 atomic64_set(&(counter)->packets, (long long)(ext->packets)); 316 atomic64_set(&(counter)->packets, (long long)(ext->packets));
248} 317}
249 318
319/* Netlink CB args */
320enum {
321 IPSET_CB_NET = 0,
322 IPSET_CB_DUMP,
323 IPSET_CB_INDEX,
324 IPSET_CB_ARG0,
325 IPSET_CB_ARG1,
326 IPSET_CB_ARG2,
327};
328
250/* register and unregister set references */ 329/* register and unregister set references */
251extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); 330extern ip_set_id_t ip_set_get_byname(struct net *net,
252extern void ip_set_put_byindex(ip_set_id_t index); 331 const char *name, struct ip_set **set);
253extern const char *ip_set_name_byindex(ip_set_id_t index); 332extern void ip_set_put_byindex(struct net *net, ip_set_id_t index);
254extern ip_set_id_t ip_set_nfnl_get(const char *name); 333extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index);
255extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index); 334extern ip_set_id_t ip_set_nfnl_get(struct net *net, const char *name);
256extern void ip_set_nfnl_put(ip_set_id_t index); 335extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index);
336extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index);
257 337
258/* API for iptables set match, and SET target */ 338/* API for iptables set match, and SET target */
259 339
@@ -272,6 +352,8 @@ extern void *ip_set_alloc(size_t size);
272extern void ip_set_free(void *members); 352extern void ip_set_free(void *members);
273extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); 353extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
274extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); 354extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
355extern size_t ip_set_elem_len(struct ip_set *set, struct nlattr *tb[],
356 size_t len);
275extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], 357extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
276 struct ip_set_ext *ext); 358 struct ip_set_ext *ext);
277 359
@@ -296,10 +378,12 @@ ip_set_eexist(int ret, u32 flags)
296 378
297/* Match elements marked with nomatch */ 379/* Match elements marked with nomatch */
298static inline bool 380static inline bool
299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) 381ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt, struct ip_set *set)
300{ 382{
301 return adt == IPSET_TEST && 383 return adt == IPSET_TEST &&
302 ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); 384 (set->type->features & IPSET_TYPE_NOMATCH) &&
385 ((flags >> 16) & IPSET_FLAG_NOMATCH) &&
386 (ret > 0 || ret == -ENOTEMPTY);
303} 387}
304 388
305/* Check the NLA_F_NET_BYTEORDER flag */ 389/* Check the NLA_F_NET_BYTEORDER flag */
@@ -387,13 +471,40 @@ bitmap_bytes(u32 a, u32 b)
387} 471}
388 472
389#include <linux/netfilter/ipset/ip_set_timeout.h> 473#include <linux/netfilter/ipset/ip_set_timeout.h>
474#include <linux/netfilter/ipset/ip_set_comment.h>
475
476static inline int
477ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
478 const void *e, bool active)
479{
480 if (SET_WITH_TIMEOUT(set)) {
481 unsigned long *timeout = ext_timeout(e, set);
482
483 if (nla_put_net32(skb, IPSET_ATTR_TIMEOUT,
484 htonl(active ? ip_set_timeout_get(timeout)
485 : *timeout)))
486 return -EMSGSIZE;
487 }
488 if (SET_WITH_COUNTER(set) &&
489 ip_set_put_counter(skb, ext_counter(e, set)))
490 return -EMSGSIZE;
491 if (SET_WITH_COMMENT(set) &&
492 ip_set_put_comment(skb, ext_comment(e, set)))
493 return -EMSGSIZE;
494 return 0;
495}
390 496
391#define IP_SET_INIT_KEXT(skb, opt, map) \ 497#define IP_SET_INIT_KEXT(skb, opt, set) \
392 { .bytes = (skb)->len, .packets = 1, \ 498 { .bytes = (skb)->len, .packets = 1, \
393 .timeout = ip_set_adt_opt_timeout(opt, map) } 499 .timeout = ip_set_adt_opt_timeout(opt, set) }
394 500
395#define IP_SET_INIT_UEXT(map) \ 501#define IP_SET_INIT_UEXT(set) \
396 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \ 502 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \
397 .timeout = (map)->timeout } 503 .timeout = (set)->timeout }
504
505#define IP_SET_INIT_CIDR(a, b) ((a) ? (a) : (b))
506
507#define IPSET_CONCAT(a, b) a##b
508#define IPSET_TOKEN(a, b) IPSET_CONCAT(a, b)
398 509
399#endif /*_IP_SET_H */ 510#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_comment.h b/include/linux/netfilter/ipset/ip_set_comment.h
new file mode 100644
index 000000000000..21217ea008d7
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_comment.h
@@ -0,0 +1,57 @@
1#ifndef _IP_SET_COMMENT_H
2#define _IP_SET_COMMENT_H
3
4/* Copyright (C) 2013 Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifdef __KERNEL__
12
13static inline char*
14ip_set_comment_uget(struct nlattr *tb)
15{
16 return nla_data(tb);
17}
18
19static inline void
20ip_set_init_comment(struct ip_set_comment *comment,
21 const struct ip_set_ext *ext)
22{
23 size_t len = ext->comment ? strlen(ext->comment) : 0;
24
25 if (unlikely(comment->str)) {
26 kfree(comment->str);
27 comment->str = NULL;
28 }
29 if (!len)
30 return;
31 if (unlikely(len > IPSET_MAX_COMMENT_SIZE))
32 len = IPSET_MAX_COMMENT_SIZE;
33 comment->str = kzalloc(len + 1, GFP_ATOMIC);
34 if (unlikely(!comment->str))
35 return;
36 strlcpy(comment->str, ext->comment, len + 1);
37}
38
39static inline int
40ip_set_put_comment(struct sk_buff *skb, struct ip_set_comment *comment)
41{
42 if (!comment->str)
43 return 0;
44 return nla_put_string(skb, IPSET_ATTR_COMMENT, comment->str);
45}
46
47static inline void
48ip_set_comment_free(struct ip_set_comment *comment)
49{
50 if (unlikely(!comment->str))
51 return;
52 kfree(comment->str);
53 comment->str = NULL;
54}
55
56#endif
57#endif
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 3aac04167ca7..83c2f9e0886c 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -23,8 +23,8 @@
23/* Set is defined with timeout support: timeout value may be 0 */ 23/* Set is defined with timeout support: timeout value may be 0 */
24#define IPSET_NO_TIMEOUT UINT_MAX 24#define IPSET_NO_TIMEOUT UINT_MAX
25 25
26#define ip_set_adt_opt_timeout(opt, map) \ 26#define ip_set_adt_opt_timeout(opt, set) \
27((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout) 27((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout)
28 28
29static inline unsigned int 29static inline unsigned int
30ip_set_timeout_uget(struct nlattr *tb) 30ip_set_timeout_uget(struct nlattr *tb)
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 127d0b90604f..275505792664 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -23,6 +23,6 @@ struct ip_conntrack_stat {
23}; 23};
24 24
25/* call to create an explicit dependency on nf_conntrack. */ 25/* call to create an explicit dependency on nf_conntrack. */
26extern void need_conntrack(void); 26void need_conntrack(void);
27 27
28#endif /* _NF_CONNTRACK_COMMON_H */ 28#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index f381020eee92..858d9b214053 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -29,13 +29,13 @@ struct nf_ct_h323_master {
29 29
30struct nf_conn; 30struct nf_conn;
31 31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, 32int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr, 33 TransportAddress *taddr, union nf_inet_addr *addr,
34 union nf_inet_addr *addr, __be16 *port); 34 __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new, 35void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this); 38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 6a0664c0c451..ec2ffaf418c8 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -87,8 +87,8 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
87/* delete keymap entries */ 87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct); 88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89 89
90extern void nf_ct_gre_keymap_flush(struct net *net); 90void nf_ct_gre_keymap_flush(struct net *net);
91extern void nf_nat_need_gre(void); 91void nf_nat_need_gre(void);
92 92
93#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
94#endif /* _CONNTRACK_PROTO_GRE_H */ 94#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index ba7f571a2b1c..d5af3c27fb7d 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -107,85 +107,93 @@ enum sdp_header_types {
107 SDP_HDR_MEDIA, 107 SDP_HDR_MEDIA,
108}; 108};
109 109
110extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 110struct nf_nat_sip_hooks {
111 unsigned int protoff, 111 unsigned int (*msg)(struct sk_buff *skb,
112 unsigned int dataoff, 112 unsigned int protoff,
113 const char **dptr, 113 unsigned int dataoff,
114 unsigned int *datalen); 114 const char **dptr,
115extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, 115 unsigned int *datalen);
116 unsigned int protoff, s16 off); 116
117extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, 117 void (*seq_adjust)(struct sk_buff *skb,
118 unsigned int protoff, 118 unsigned int protoff, s16 off);
119 unsigned int dataoff, 119
120 const char **dptr, 120 unsigned int (*expect)(struct sk_buff *skb,
121 unsigned int *datalen, 121 unsigned int protoff,
122 struct nf_conntrack_expect *exp, 122 unsigned int dataoff,
123 unsigned int matchoff, 123 const char **dptr,
124 unsigned int matchlen); 124 unsigned int *datalen,
125extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, 125 struct nf_conntrack_expect *exp,
126 unsigned int protoff, 126 unsigned int matchoff,
127 unsigned int dataoff, 127 unsigned int matchlen);
128 const char **dptr, 128
129 unsigned int *datalen, 129 unsigned int (*sdp_addr)(struct sk_buff *skb,
130 unsigned int sdpoff, 130 unsigned int protoff,
131 enum sdp_header_types type, 131 unsigned int dataoff,
132 enum sdp_header_types term, 132 const char **dptr,
133 const union nf_inet_addr *addr); 133 unsigned int *datalen,
134extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, 134 unsigned int sdpoff,
135 unsigned int protoff,
136 unsigned int dataoff,
137 const char **dptr,
138 unsigned int *datalen,
139 unsigned int matchoff,
140 unsigned int matchlen,
141 u_int16_t port);
142extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
143 unsigned int protoff,
144 unsigned int dataoff,
145 const char **dptr,
146 unsigned int *datalen,
147 unsigned int sdpoff,
148 const union nf_inet_addr *addr);
149extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
150 unsigned int protoff,
151 unsigned int dataoff,
152 const char **dptr,
153 unsigned int *datalen,
154 struct nf_conntrack_expect *rtp_exp,
155 struct nf_conntrack_expect *rtcp_exp,
156 unsigned int mediaoff,
157 unsigned int medialen,
158 union nf_inet_addr *rtp_addr);
159
160extern int ct_sip_parse_request(const struct nf_conn *ct,
161 const char *dptr, unsigned int datalen,
162 unsigned int *matchoff, unsigned int *matchlen,
163 union nf_inet_addr *addr, __be16 *port);
164extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
165 unsigned int dataoff, unsigned int datalen,
166 enum sip_header_types type,
167 unsigned int *matchoff, unsigned int *matchlen);
168extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
169 unsigned int *dataoff, unsigned int datalen,
170 enum sip_header_types type, int *in_header,
171 unsigned int *matchoff, unsigned int *matchlen,
172 union nf_inet_addr *addr, __be16 *port);
173extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
174 unsigned int dataoff, unsigned int datalen,
175 const char *name,
176 unsigned int *matchoff, unsigned int *matchlen,
177 union nf_inet_addr *addr, bool delim);
178extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
179 unsigned int off, unsigned int datalen,
180 const char *name,
181 unsigned int *matchoff, unsigned int *matchen,
182 unsigned int *val);
183
184extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
185 unsigned int dataoff, unsigned int datalen,
186 enum sdp_header_types type, 135 enum sdp_header_types type,
187 enum sdp_header_types term, 136 enum sdp_header_types term,
188 unsigned int *matchoff, unsigned int *matchlen); 137 const union nf_inet_addr *addr);
138
139 unsigned int (*sdp_port)(struct sk_buff *skb,
140 unsigned int protoff,
141 unsigned int dataoff,
142 const char **dptr,
143 unsigned int *datalen,
144 unsigned int matchoff,
145 unsigned int matchlen,
146 u_int16_t port);
147
148 unsigned int (*sdp_session)(struct sk_buff *skb,
149 unsigned int protoff,
150 unsigned int dataoff,
151 const char **dptr,
152 unsigned int *datalen,
153 unsigned int sdpoff,
154 const union nf_inet_addr *addr);
155
156 unsigned int (*sdp_media)(struct sk_buff *skb,
157 unsigned int protoff,
158 unsigned int dataoff,
159 const char **dptr,
160 unsigned int *datalen,
161 struct nf_conntrack_expect *rtp_exp,
162 struct nf_conntrack_expect *rtcp_exp,
163 unsigned int mediaoff,
164 unsigned int medialen,
165 union nf_inet_addr *rtp_addr);
166};
167extern const struct nf_nat_sip_hooks *nf_nat_sip_hooks;
168
169int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr,
170 unsigned int datalen, unsigned int *matchoff,
171 unsigned int *matchlen, union nf_inet_addr *addr,
172 __be16 *port);
173int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
174 unsigned int dataoff, unsigned int datalen,
175 enum sip_header_types type, unsigned int *matchoff,
176 unsigned int *matchlen);
177int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
178 unsigned int *dataoff, unsigned int datalen,
179 enum sip_header_types type, int *in_header,
180 unsigned int *matchoff, unsigned int *matchlen,
181 union nf_inet_addr *addr, __be16 *port);
182int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
183 unsigned int dataoff, unsigned int datalen,
184 const char *name, unsigned int *matchoff,
185 unsigned int *matchlen, union nf_inet_addr *addr,
186 bool delim);
187int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
188 unsigned int off, unsigned int datalen,
189 const char *name, unsigned int *matchoff,
190 unsigned int *matchen, unsigned int *val);
191
192int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
193 unsigned int dataoff, unsigned int datalen,
194 enum sdp_header_types type,
195 enum sdp_header_types term,
196 unsigned int *matchoff, unsigned int *matchlen);
189 197
190#endif /* __KERNEL__ */ 198#endif /* __KERNEL__ */
191#endif /* __NF_CONNTRACK_SIP_H__ */ 199#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index cadb7402d7a7..28c74367e900 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -14,6 +14,9 @@ struct nfnl_callback {
14 int (*call_rcu)(struct sock *nl, struct sk_buff *skb, 14 int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
15 const struct nlmsghdr *nlh, 15 const struct nlmsghdr *nlh,
16 const struct nlattr * const cda[]); 16 const struct nlattr * const cda[]);
17 int (*call_batch)(struct sock *nl, struct sk_buff *skb,
18 const struct nlmsghdr *nlh,
19 const struct nlattr * const cda[]);
17 const struct nla_policy *policy; /* netlink attribute policy */ 20 const struct nla_policy *policy; /* netlink attribute policy */
18 const u_int16_t attr_count; /* number of nlattr's */ 21 const u_int16_t attr_count; /* number of nlattr's */
19}; 22};
@@ -23,22 +26,24 @@ struct nfnetlink_subsystem {
23 __u8 subsys_id; /* nfnetlink subsystem ID */ 26 __u8 subsys_id; /* nfnetlink subsystem ID */
24 __u8 cb_count; /* number of callbacks */ 27 __u8 cb_count; /* number of callbacks */
25 const struct nfnl_callback *cb; /* callback for individual types */ 28 const struct nfnl_callback *cb; /* callback for individual types */
29 int (*commit)(struct sk_buff *skb);
30 int (*abort)(struct sk_buff *skb);
26}; 31};
27 32
28extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); 33int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 34int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30 35
31extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 36int nfnetlink_has_listeners(struct net *net, unsigned int group);
32extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, 37struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33 u32 dst_portid, gfp_t gfp_mask); 38 u32 dst_portid, gfp_t gfp_mask);
34extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, 39int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
35 unsigned int group, int echo, gfp_t flags); 40 unsigned int group, int echo, gfp_t flags);
36extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); 41int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
37extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, 42int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
38 u32 portid, int flags); 43 int flags);
39 44
40extern void nfnl_lock(__u8 subsys_id); 45void nfnl_lock(__u8 subsys_id);
41extern void nfnl_unlock(__u8 subsys_id); 46void nfnl_unlock(__u8 subsys_id);
42 47
43#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 48#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
44 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 49 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
index bb4bbc9b7a18..b2e85e59f760 100644
--- a/include/linux/netfilter/nfnetlink_acct.h
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -6,8 +6,8 @@
6 6
7struct nf_acct; 7struct nf_acct;
8 8
9extern struct nf_acct *nfnl_acct_find_get(const char *filter_name); 9struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10extern void nfnl_acct_put(struct nf_acct *acct); 10void nfnl_acct_put(struct nf_acct *acct);
11extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); 11void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
12 12
13#endif /* _NFNL_ACCT_H */ 13#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index dd49566315c6..a3e215bb0241 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -229,50 +229,48 @@ struct xt_table_info {
229 229
230#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \ 230#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
231 + nr_cpu_ids * sizeof(char *)) 231 + nr_cpu_ids * sizeof(char *))
232extern int xt_register_target(struct xt_target *target); 232int xt_register_target(struct xt_target *target);
233extern void xt_unregister_target(struct xt_target *target); 233void xt_unregister_target(struct xt_target *target);
234extern int xt_register_targets(struct xt_target *target, unsigned int n); 234int xt_register_targets(struct xt_target *target, unsigned int n);
235extern void xt_unregister_targets(struct xt_target *target, unsigned int n); 235void xt_unregister_targets(struct xt_target *target, unsigned int n);
236 236
237extern int xt_register_match(struct xt_match *target); 237int xt_register_match(struct xt_match *target);
238extern void xt_unregister_match(struct xt_match *target); 238void xt_unregister_match(struct xt_match *target);
239extern int xt_register_matches(struct xt_match *match, unsigned int n); 239int xt_register_matches(struct xt_match *match, unsigned int n);
240extern void xt_unregister_matches(struct xt_match *match, unsigned int n); 240void xt_unregister_matches(struct xt_match *match, unsigned int n);
241 241
242extern int xt_check_match(struct xt_mtchk_param *, 242int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
243 unsigned int size, u_int8_t proto, bool inv_proto); 243 bool inv_proto);
244extern int xt_check_target(struct xt_tgchk_param *, 244int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
245 unsigned int size, u_int8_t proto, bool inv_proto); 245 bool inv_proto);
246 246
247extern struct xt_table *xt_register_table(struct net *net, 247struct xt_table *xt_register_table(struct net *net,
248 const struct xt_table *table, 248 const struct xt_table *table,
249 struct xt_table_info *bootstrap, 249 struct xt_table_info *bootstrap,
250 struct xt_table_info *newinfo); 250 struct xt_table_info *newinfo);
251extern void *xt_unregister_table(struct xt_table *table); 251void *xt_unregister_table(struct xt_table *table);
252 252
253extern struct xt_table_info *xt_replace_table(struct xt_table *table, 253struct xt_table_info *xt_replace_table(struct xt_table *table,
254 unsigned int num_counters, 254 unsigned int num_counters,
255 struct xt_table_info *newinfo, 255 struct xt_table_info *newinfo,
256 int *error); 256 int *error);
257 257
258extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); 258struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
259extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); 259struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
260extern struct xt_match *xt_request_find_match(u8 af, const char *name, 260struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision);
261 u8 revision); 261struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision);
262extern struct xt_target *xt_request_find_target(u8 af, const char *name, 262int xt_find_revision(u8 af, const char *name, u8 revision, int target,
263 u8 revision); 263 int *err);
264extern int xt_find_revision(u8 af, const char *name, u8 revision, 264
265 int target, int *err); 265struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
266 266 const char *name);
267extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, 267void xt_table_unlock(struct xt_table *t);
268 const char *name); 268
269extern void xt_table_unlock(struct xt_table *t); 269int xt_proto_init(struct net *net, u_int8_t af);
270 270void xt_proto_fini(struct net *net, u_int8_t af);
271extern int xt_proto_init(struct net *net, u_int8_t af); 271
272extern void xt_proto_fini(struct net *net, u_int8_t af); 272struct xt_table_info *xt_alloc_table_info(unsigned int size);
273 273void xt_free_table_info(struct xt_table_info *info);
274extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
275extern void xt_free_table_info(struct xt_table_info *info);
276 274
277/** 275/**
278 * xt_recseq - recursive seqcount for netfilter use 276 * xt_recseq - recursive seqcount for netfilter use
@@ -353,8 +351,8 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
353 return ret; 351 return ret;
354} 352}
355 353
356extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); 354struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
357extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *); 355void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
358 356
359#ifdef CONFIG_COMPAT 357#ifdef CONFIG_COMPAT
360#include <net/compat.h> 358#include <net/compat.h>
@@ -414,25 +412,25 @@ struct _compat_xt_align {
414 412
415#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align)) 413#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
416 414
417extern void xt_compat_lock(u_int8_t af); 415void xt_compat_lock(u_int8_t af);
418extern void xt_compat_unlock(u_int8_t af); 416void xt_compat_unlock(u_int8_t af);
419 417
420extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta); 418int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
421extern void xt_compat_flush_offsets(u_int8_t af); 419void xt_compat_flush_offsets(u_int8_t af);
422extern void xt_compat_init_offsets(u_int8_t af, unsigned int number); 420void xt_compat_init_offsets(u_int8_t af, unsigned int number);
423extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); 421int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
424 422
425extern int xt_compat_match_offset(const struct xt_match *match); 423int xt_compat_match_offset(const struct xt_match *match);
426extern int xt_compat_match_from_user(struct xt_entry_match *m, 424int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
427 void **dstptr, unsigned int *size); 425 unsigned int *size);
428extern int xt_compat_match_to_user(const struct xt_entry_match *m, 426int xt_compat_match_to_user(const struct xt_entry_match *m,
429 void __user **dstptr, unsigned int *size); 427 void __user **dstptr, unsigned int *size);
430 428
431extern int xt_compat_target_offset(const struct xt_target *target); 429int xt_compat_target_offset(const struct xt_target *target);
432extern void xt_compat_target_from_user(struct xt_entry_target *t, 430void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
433 void **dstptr, unsigned int *size); 431 unsigned int *size);
434extern int xt_compat_target_to_user(const struct xt_entry_target *t, 432int xt_compat_target_to_user(const struct xt_entry_target *t,
435 void __user **dstptr, unsigned int *size); 433 void __user **dstptr, unsigned int *size);
436 434
437#endif /* CONFIG_COMPAT */ 435#endif /* CONFIG_COMPAT */
438#endif /* _X_TABLES_H */ 436#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index dfb4d9e52bcb..8ab1c278b66d 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -25,7 +25,7 @@ enum nf_br_hook_priorities {
25#define BRNF_PPPoE 0x20 25#define BRNF_PPPoE 0x20
26 26
27/* Only used in br_forward.c */ 27/* Only used in br_forward.c */
28extern int nf_bridge_copy_header(struct sk_buff *skb); 28int nf_bridge_copy_header(struct sk_buff *skb);
29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
30{ 30{
31 if (skb->nf_bridge && 31 if (skb->nf_bridge &&
@@ -53,7 +53,7 @@ static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
53 return 0; 53 return 0;
54} 54}
55 55
56extern int br_handle_frame_finish(struct sk_buff *skb); 56int br_handle_frame_finish(struct sk_buff *skb);
57/* Only used in br_device.c */ 57/* Only used in br_device.c */
58static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb) 58static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
59{ 59{
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index dfaf116b3e81..6e4591bb54d4 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -6,7 +6,7 @@
6 6
7#include <uapi/linux/netfilter_ipv4.h> 7#include <uapi/linux/netfilter_ipv4.h>
8 8
9extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type); 9int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
10extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 10__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
11 unsigned int dataoff, u_int8_t protocol); 11 unsigned int dataoff, u_int8_t protocol);
12#endif /*__LINUX_IP_NETFILTER_H*/ 12#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 2d4df6ce043e..64dad1cc1a4b 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -11,12 +11,12 @@
11 11
12 12
13#ifdef CONFIG_NETFILTER 13#ifdef CONFIG_NETFILTER
14extern int ip6_route_me_harder(struct sk_buff *skb); 14int ip6_route_me_harder(struct sk_buff *skb);
15extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 15__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
16 unsigned int dataoff, u_int8_t protocol); 16 unsigned int dataoff, u_int8_t protocol);
17 17
18extern int ipv6_netfilter_init(void); 18int ipv6_netfilter_init(void);
19extern void ipv6_netfilter_fini(void); 19void ipv6_netfilter_fini(void);
20 20
21/* 21/*
22 * Hook functions for ipv6 to allow xt_* modules to be built-in even 22 * Hook functions for ipv6 to allow xt_* modules to be built-in even
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index f3c7c24bec1c..fbfdb9d8d3a7 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,7 +24,8 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_hook)(struct netpoll *, int, char *, int); 27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
28 29
29 union inet_addr local_ip, remote_ip; 30 union inet_addr local_ip, remote_ip;
30 bool ipv6; 31 bool ipv6;
@@ -41,7 +42,7 @@ struct netpoll_info {
41 unsigned long rx_flags; 42 unsigned long rx_flags;
42 spinlock_t rx_lock; 43 spinlock_t rx_lock;
43 struct semaphore dev_lock; 44 struct semaphore dev_lock;
44 struct list_head rx_np; /* netpolls that registered an rx_hook */ 45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
45 46
46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ 47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
47 struct sk_buff_head txq; 48 struct sk_buff_head txq;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e36dee52f224..c6f41b616965 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -395,7 +395,9 @@ enum lock_type4 {
395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) 398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
399#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
400 (1UL << 17)
399 401
400/* MDS threshold bitmap bits */ 402/* MDS threshold bitmap bits */
401#define THRESHOLD_RD (1UL << 0) 403#define THRESHOLD_RD (1UL << 0)
@@ -460,6 +462,7 @@ enum {
460 NFSPROC4_CLNT_FS_LOCATIONS, 462 NFSPROC4_CLNT_FS_LOCATIONS,
461 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 463 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
462 NFSPROC4_CLNT_SECINFO, 464 NFSPROC4_CLNT_SECINFO,
465 NFSPROC4_CLNT_FSID_PRESENT,
463 466
464 /* nfs41 */ 467 /* nfs41 */
465 NFSPROC4_CLNT_EXCHANGE_ID, 468 NFSPROC4_CLNT_EXCHANGE_ID,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 3ea4cde8701c..14a48207a304 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -269,9 +269,13 @@ static inline int NFS_STALE(const struct inode *inode)
269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
270} 270}
271 271
272static inline int NFS_FSCACHE(const struct inode *inode) 272static inline struct fscache_cookie *nfs_i_fscache(struct inode *inode)
273{ 273{
274 return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); 274#ifdef CONFIG_NFS_FSCACHE
275 return NFS_I(inode)->fscache;
276#else
277 return NULL;
278#endif
275} 279}
276 280
277static inline __u64 NFS_FILEID(const struct inode *inode) 281static inline __u64 NFS_FILEID(const struct inode *inode)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b8cedced50c9..1150ea41b626 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -41,6 +41,7 @@ struct nfs_client {
41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ 41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */ 42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ 43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
44#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */
44 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
45 size_t cl_addrlen; 46 size_t cl_addrlen;
46 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
@@ -78,6 +79,7 @@ struct nfs_client {
78 char cl_ipaddr[48]; 79 char cl_ipaddr[48];
79 u32 cl_cb_ident; /* v4.0 callback identifier */ 80 u32 cl_cb_ident; /* v4.0 callback identifier */
80 const struct nfs4_minor_version_ops *cl_mvops; 81 const struct nfs4_minor_version_ops *cl_mvops;
82 unsigned long cl_mig_gen;
81 83
82 /* NFSv4.0 transport blocking */ 84 /* NFSv4.0 transport blocking */
83 struct nfs4_slot_table *cl_slot_tbl; 85 struct nfs4_slot_table *cl_slot_tbl;
@@ -147,7 +149,9 @@ struct nfs_server {
147 __u64 maxfilesize; /* maximum file size */ 149 __u64 maxfilesize; /* maximum file size */
148 struct timespec time_delta; /* smallest time granularity */ 150 struct timespec time_delta; /* smallest time granularity */
149 unsigned long mount_time; /* when this fs was mounted */ 151 unsigned long mount_time; /* when this fs was mounted */
152 struct super_block *super; /* VFS super block */
150 dev_t s_dev; /* superblock dev numbers */ 153 dev_t s_dev; /* superblock dev numbers */
154 struct nfs_auth_info auth_info; /* parsed auth flavors */
151 155
152#ifdef CONFIG_NFS_FSCACHE 156#ifdef CONFIG_NFS_FSCACHE
153 struct nfs_fscache_key *fscache_key; /* unique key for superblock */ 157 struct nfs_fscache_key *fscache_key; /* unique key for superblock */
@@ -187,6 +191,12 @@ struct nfs_server {
187 struct list_head state_owners_lru; 191 struct list_head state_owners_lru;
188 struct list_head layouts; 192 struct list_head layouts;
189 struct list_head delegations; 193 struct list_head delegations;
194
195 unsigned long mig_gen;
196 unsigned long mig_status;
197#define NFS_MIG_IN_TRANSITION (1)
198#define NFS_MIG_FAILED (2)
199
190 void (*destroy)(struct nfs_server *); 200 void (*destroy)(struct nfs_server *);
191 201
192 atomic_t active; /* Keep trace of any activity to this server */ 202 atomic_t active; /* Keep trace of any activity to this server */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 01fd84b566f7..3ccfcecf8999 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -591,6 +591,13 @@ struct nfs_renameres {
591 struct nfs_fattr *new_fattr; 591 struct nfs_fattr *new_fattr;
592}; 592};
593 593
594/* parsed sec= options */
595#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
596struct nfs_auth_info {
597 unsigned int flavor_len;
598 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
599};
600
594/* 601/*
595 * Argument struct for decode_entry function 602 * Argument struct for decode_entry function
596 */ 603 */
@@ -1053,14 +1060,18 @@ struct nfs4_fs_locations {
1053struct nfs4_fs_locations_arg { 1060struct nfs4_fs_locations_arg {
1054 struct nfs4_sequence_args seq_args; 1061 struct nfs4_sequence_args seq_args;
1055 const struct nfs_fh *dir_fh; 1062 const struct nfs_fh *dir_fh;
1063 const struct nfs_fh *fh;
1056 const struct qstr *name; 1064 const struct qstr *name;
1057 struct page *page; 1065 struct page *page;
1058 const u32 *bitmask; 1066 const u32 *bitmask;
1067 clientid4 clientid;
1068 unsigned char migration:1, renew:1;
1059}; 1069};
1060 1070
1061struct nfs4_fs_locations_res { 1071struct nfs4_fs_locations_res {
1062 struct nfs4_sequence_res seq_res; 1072 struct nfs4_sequence_res seq_res;
1063 struct nfs4_fs_locations *fs_locations; 1073 struct nfs4_fs_locations *fs_locations;
1074 unsigned char migration:1, renew:1;
1064}; 1075};
1065 1076
1066struct nfs4_secinfo4 { 1077struct nfs4_secinfo4 {
@@ -1084,6 +1095,19 @@ struct nfs4_secinfo_res {
1084 struct nfs4_secinfo_flavors *flavors; 1095 struct nfs4_secinfo_flavors *flavors;
1085}; 1096};
1086 1097
1098struct nfs4_fsid_present_arg {
1099 struct nfs4_sequence_args seq_args;
1100 const struct nfs_fh *fh;
1101 clientid4 clientid;
1102 unsigned char renew:1;
1103};
1104
1105struct nfs4_fsid_present_res {
1106 struct nfs4_sequence_res seq_res;
1107 struct nfs_fh *fh;
1108 unsigned char renew:1;
1109};
1110
1087#endif /* CONFIG_NFS_V4 */ 1111#endif /* CONFIG_NFS_V4 */
1088 1112
1089struct nfstime4 { 1113struct nfstime4 {
@@ -1455,7 +1479,8 @@ struct nfs_rpc_ops {
1455 struct inode * (*open_context) (struct inode *dir, 1479 struct inode * (*open_context) (struct inode *dir,
1456 struct nfs_open_context *ctx, 1480 struct nfs_open_context *ctx,
1457 int open_flags, 1481 int open_flags,
1458 struct iattr *iattr); 1482 struct iattr *iattr,
1483 int *);
1459 int (*have_delegation)(struct inode *, fmode_t); 1484 int (*have_delegation)(struct inode *, fmode_t);
1460 int (*return_delegation)(struct inode *); 1485 int (*return_delegation)(struct inode *);
1461 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); 1486 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
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 535cecf1e02f..3f23b4472c31 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -1,8 +1,6 @@
1#ifndef __OF_IRQ_H 1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H 2#define __OF_IRQ_H
3 3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/errno.h> 5#include <linux/errno.h>
8#include <linux/irq.h> 6#include <linux/irq.h>
@@ -10,30 +8,6 @@ struct of_irq;
10#include <linux/ioport.h> 8#include <linux/ioport.h>
11#include <linux/of.h> 9#include <linux/of.h>
12 10
13/*
14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */
18extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
19
20#if defined(CONFIG_OF_IRQ)
21/**
22 * of_irq - container for device_node/irq_specifier pair for an irq controller
23 * @controller: pointer to interrupt controller device tree node
24 * @size: size of interrupt specifier
25 * @specifier: array of cells @size long specifing the specific interrupt
26 *
27 * This structure is returned when an interrupt is mapped. The controller
28 * field needs to be put() after use
29 */
30#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
31struct of_irq {
32 struct device_node *controller; /* Interrupt controller node */
33 u32 size; /* Specifier size */
34 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
35};
36
37typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); 11typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
38 12
39/* 13/*
@@ -45,37 +19,46 @@ typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
45#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 19#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
46extern unsigned int of_irq_workarounds; 20extern unsigned int of_irq_workarounds;
47extern struct device_node *of_irq_dflt_pic; 21extern struct device_node *of_irq_dflt_pic;
48extern int of_irq_map_oldworld(struct device_node *device, int index, 22extern int of_irq_parse_oldworld(struct device_node *device, int index,
49 struct of_irq *out_irq); 23 struct of_phandle_args *out_irq);
50#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 24#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
51#define of_irq_workarounds (0) 25#define of_irq_workarounds (0)
52#define of_irq_dflt_pic (NULL) 26#define of_irq_dflt_pic (NULL)
53static inline int of_irq_map_oldworld(struct device_node *device, int index, 27static inline int of_irq_parse_oldworld(struct device_node *device, int index,
54 struct of_irq *out_irq) 28 struct of_phandle_args *out_irq)
55{ 29{
56 return -EINVAL; 30 return -EINVAL;
57} 31}
58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 32#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
59 33
60 34extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
61extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 35extern int of_irq_parse_one(struct device_node *device, int index,
62 u32 ointsize, const __be32 *addr, 36 struct of_phandle_args *out_irq);
63 struct of_irq *out_irq); 37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
64extern int of_irq_map_one(struct device_node *device, int index,
65 struct of_irq *out_irq);
66extern unsigned int irq_create_of_mapping(struct device_node *controller,
67 const u32 *intspec,
68 unsigned int intsize);
69extern int of_irq_to_resource(struct device_node *dev, int index, 38extern int of_irq_to_resource(struct device_node *dev, int index,
70 struct resource *r); 39 struct resource *r);
71extern int of_irq_count(struct device_node *dev);
72extern int of_irq_to_resource_table(struct device_node *dev, 40extern int of_irq_to_resource_table(struct device_node *dev,
73 struct resource *res, int nr_irqs); 41 struct resource *res, int nr_irqs);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
75 42
76extern void of_irq_init(const struct of_device_id *matches); 43extern void of_irq_init(const struct of_device_id *matches);
77 44
78#endif /* CONFIG_OF_IRQ */ 45#ifdef CONFIG_OF_IRQ
46extern int of_irq_count(struct device_node *dev);
47#else
48static inline int of_irq_count(struct device_node *dev)
49{
50 return 0;
51}
52#endif
53
54#if defined(CONFIG_OF)
55/*
56 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
57 * implements it differently. However, the prototype is the same for all,
58 * so declare it here regardless of the CONFIG_OF_IRQ setting.
59 */
60extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
61extern struct device_node *of_irq_find_parent(struct device_node *child);
79 62
80#else /* !CONFIG_OF */ 63#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev, 64static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
diff --git a/include/linux/of_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/of_reserved_mem.h b/include/linux/of_reserved_mem.h
deleted file mode 100644
index c84128255814..000000000000
--- a/include/linux/of_reserved_mem.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __OF_RESERVED_MEM_H
2#define __OF_RESERVED_MEM_H
3
4#ifdef CONFIG_OF_RESERVED_MEM
5void of_reserved_mem_device_init(struct device *dev);
6void of_reserved_mem_device_release(struct device *dev);
7void early_init_dt_scan_reserved_mem(void);
8#else
9static inline void of_reserved_mem_device_init(struct device *dev) { }
10static inline void of_reserved_mem_device_release(struct device *dev) { }
11static inline void early_init_dt_scan_reserved_mem(void) { }
12#endif
13
14#endif /* __OF_RESERVED_MEM_H */
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/page-flags-layout.h b/include/linux/page-flags-layout.h
index 93506a114034..da523661500a 100644
--- a/include/linux/page-flags-layout.h
+++ b/include/linux/page-flags-layout.h
@@ -38,10 +38,10 @@
38 * The last is when there is insufficient space in page->flags and a separate 38 * The last is when there is insufficient space in page->flags and a separate
39 * lookup is necessary. 39 * lookup is necessary.
40 * 40 *
41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS | 41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
42 * " plus space for last_nid: | NODE | ZONE | LAST_NID ... | FLAGS | 42 * " plus space for last_cpupid: | NODE | ZONE | LAST_CPUPID ... | FLAGS |
43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS | 43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
44 * " plus space for last_nid: | SECTION | NODE | ZONE | LAST_NID ... | FLAGS | 44 * " plus space for last_cpupid: | SECTION | NODE | ZONE | LAST_CPUPID ... | FLAGS |
45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS | 45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
46 */ 46 */
47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
@@ -62,15 +62,21 @@
62#endif 62#endif
63 63
64#ifdef CONFIG_NUMA_BALANCING 64#ifdef CONFIG_NUMA_BALANCING
65#define LAST_NID_SHIFT NODES_SHIFT 65#define LAST__PID_SHIFT 8
66#define LAST__PID_MASK ((1 << LAST__PID_SHIFT)-1)
67
68#define LAST__CPU_SHIFT NR_CPUS_BITS
69#define LAST__CPU_MASK ((1 << LAST__CPU_SHIFT)-1)
70
71#define LAST_CPUPID_SHIFT (LAST__PID_SHIFT+LAST__CPU_SHIFT)
66#else 72#else
67#define LAST_NID_SHIFT 0 73#define LAST_CPUPID_SHIFT 0
68#endif 74#endif
69 75
70#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_NID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS 76#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
71#define LAST_NID_WIDTH LAST_NID_SHIFT 77#define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT
72#else 78#else
73#define LAST_NID_WIDTH 0 79#define LAST_CPUPID_WIDTH 0
74#endif 80#endif
75 81
76/* 82/*
@@ -81,8 +87,8 @@
81#define NODE_NOT_IN_PAGE_FLAGS 87#define NODE_NOT_IN_PAGE_FLAGS
82#endif 88#endif
83 89
84#if defined(CONFIG_NUMA_BALANCING) && LAST_NID_WIDTH == 0 90#if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0
85#define LAST_NID_NOT_IN_PAGE_FLAGS 91#define LAST_CPUPID_NOT_IN_PAGE_FLAGS
86#endif 92#endif
87 93
88#endif /* _LINUX_PAGE_FLAGS_LAYOUT */ 94#endif /* _LINUX_PAGE_FLAGS_LAYOUT */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6d53675c2b54..98ada58f9942 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -329,7 +329,9 @@ static inline void set_page_writeback(struct page *page)
329 * System with lots of page flags available. This allows separate 329 * System with lots of page flags available. This allows separate
330 * flags for PageHead() and PageTail() checks of compound pages so that bit 330 * flags for PageHead() and PageTail() checks of compound pages so that bit
331 * tests can be used in performance sensitive paths. PageCompound is 331 * tests can be used in performance sensitive paths. PageCompound is
332 * generally not used in hot code paths. 332 * generally not used in hot code paths except arch/powerpc/mm/init_64.c
333 * and arch/powerpc/kvm/book3s_64_vio_hv.c which use it to detect huge pages
334 * and avoid handling those in real mode.
333 */ 335 */
334__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head) 336__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
335__PAGEFLAG(Tail, tail) 337__PAGEFLAG(Tail, tail)
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cc88172c7d9a..9e4761caa80c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -332,7 +332,7 @@ do { \
332#endif 332#endif
333 333
334#ifndef this_cpu_sub 334#ifndef this_cpu_sub
335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) 335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
336#endif 336#endif
337 337
338#ifndef this_cpu_inc 338#ifndef this_cpu_inc
@@ -375,22 +375,6 @@ do { \
375# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) 375# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
376#endif 376#endif
377 377
378#ifndef this_cpu_xor
379# ifndef this_cpu_xor_1
380# define this_cpu_xor_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
381# endif
382# ifndef this_cpu_xor_2
383# define this_cpu_xor_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
384# endif
385# ifndef this_cpu_xor_4
386# define this_cpu_xor_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
387# endif
388# ifndef this_cpu_xor_8
389# define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=)
390# endif
391# define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
392#endif
393
394#define _this_cpu_generic_add_return(pcp, val) \ 378#define _this_cpu_generic_add_return(pcp, val) \
395({ \ 379({ \
396 typeof(pcp) ret__; \ 380 typeof(pcp) ret__; \
@@ -418,7 +402,7 @@ do { \
418# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) 402# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
419#endif 403#endif
420 404
421#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) 405#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
422#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) 406#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
423#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) 407#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
424 408
@@ -586,7 +570,7 @@ do { \
586#endif 570#endif
587 571
588#ifndef __this_cpu_sub 572#ifndef __this_cpu_sub
589# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) 573# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
590#endif 574#endif
591 575
592#ifndef __this_cpu_inc 576#ifndef __this_cpu_inc
@@ -629,22 +613,6 @@ do { \
629# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) 613# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val))
630#endif 614#endif
631 615
632#ifndef __this_cpu_xor
633# ifndef __this_cpu_xor_1
634# define __this_cpu_xor_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
635# endif
636# ifndef __this_cpu_xor_2
637# define __this_cpu_xor_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
638# endif
639# ifndef __this_cpu_xor_4
640# define __this_cpu_xor_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
641# endif
642# ifndef __this_cpu_xor_8
643# define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=)
644# endif
645# define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val))
646#endif
647
648#define __this_cpu_generic_add_return(pcp, val) \ 616#define __this_cpu_generic_add_return(pcp, val) \
649({ \ 617({ \
650 __this_cpu_add(pcp, val); \ 618 __this_cpu_add(pcp, val); \
@@ -668,7 +636,7 @@ do { \
668 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) 636 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
669#endif 637#endif
670 638
671#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) 639#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
672#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) 640#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
673#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) 641#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
674 642
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 866e85c5eb94..2e069d1288df 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -294,9 +294,31 @@ struct ring_buffer;
294 */ 294 */
295struct perf_event { 295struct perf_event {
296#ifdef CONFIG_PERF_EVENTS 296#ifdef CONFIG_PERF_EVENTS
297 struct list_head group_entry; 297 /*
298 * entry onto perf_event_context::event_list;
299 * modifications require ctx->lock
300 * RCU safe iterations.
301 */
298 struct list_head event_entry; 302 struct list_head event_entry;
303
304 /*
305 * XXX: group_entry and sibling_list should be mutually exclusive;
306 * either you're a sibling on a group, or you're the group leader.
307 * Rework the code to always use the same list element.
308 *
309 * Locked for modification by both ctx->mutex and ctx->lock; holding
310 * either sufficies for read.
311 */
312 struct list_head group_entry;
299 struct list_head sibling_list; 313 struct list_head sibling_list;
314
315 /*
316 * We need storage to track the entries in perf_pmu_migrate_context; we
317 * cannot use the event_entry because of RCU and we want to keep the
318 * group in tact which avoids us using the other two entries.
319 */
320 struct list_head migrate_entry;
321
300 struct hlist_node hlist_entry; 322 struct hlist_node hlist_entry;
301 int nr_siblings; 323 int nr_siblings;
302 int group_flags; 324 int group_flags;
@@ -562,6 +584,10 @@ struct perf_sample_data {
562 struct perf_regs_user regs_user; 584 struct perf_regs_user regs_user;
563 u64 stack_user_size; 585 u64 stack_user_size;
564 u64 weight; 586 u64 weight;
587 /*
588 * Transaction flags for abort events:
589 */
590 u64 txn;
565}; 591};
566 592
567static inline void perf_sample_data_init(struct perf_sample_data *data, 593static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -577,6 +603,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
577 data->stack_user_size = 0; 603 data->stack_user_size = 0;
578 data->weight = 0; 604 data->weight = 0;
579 data->data_src.val = 0; 605 data->data_src.val = 0;
606 data->txn = 0;
580} 607}
581 608
582extern void perf_output_sample(struct perf_output_handle *handle, 609extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
new file mode 100644
index 000000000000..6d722695e027
--- /dev/null
+++ b/include/linux/phy/phy.h
@@ -0,0 +1,270 @@
1/*
2 * phy.h -- generic phy header file
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Kishon Vijay Abraham I <kishon@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __DRIVERS_PHY_H
15#define __DRIVERS_PHY_H
16
17#include <linux/err.h>
18#include <linux/of.h>
19#include <linux/device.h>
20#include <linux/pm_runtime.h>
21
22struct phy;
23
24/**
25 * struct phy_ops - set of function pointers for performing phy operations
26 * @init: operation to be performed for initializing phy
27 * @exit: operation to be performed while exiting
28 * @power_on: powering on the phy
29 * @power_off: powering off the phy
30 * @owner: the module owner containing the ops
31 */
32struct phy_ops {
33 int (*init)(struct phy *phy);
34 int (*exit)(struct phy *phy);
35 int (*power_on)(struct phy *phy);
36 int (*power_off)(struct phy *phy);
37 struct module *owner;
38};
39
40/**
41 * struct phy - represents the phy device
42 * @dev: phy device
43 * @id: id of the phy device
44 * @ops: function pointers for performing phy operations
45 * @init_data: list of PHY consumers (non-dt only)
46 * @mutex: mutex to protect phy_ops
47 * @init_count: used to protect when the PHY is used by multiple consumers
48 * @power_count: used to protect when the PHY is used by multiple consumers
49 */
50struct phy {
51 struct device dev;
52 int id;
53 const struct phy_ops *ops;
54 struct phy_init_data *init_data;
55 struct mutex mutex;
56 int init_count;
57 int power_count;
58};
59
60/**
61 * struct phy_provider - represents the phy provider
62 * @dev: phy provider device
63 * @owner: the module owner having of_xlate
64 * @of_xlate: function pointer to obtain phy instance from phy pointer
65 * @list: to maintain a linked list of PHY providers
66 */
67struct phy_provider {
68 struct device *dev;
69 struct module *owner;
70 struct list_head list;
71 struct phy * (*of_xlate)(struct device *dev,
72 struct of_phandle_args *args);
73};
74
75/**
76 * struct phy_consumer - represents the phy consumer
77 * @dev_name: the device name of the controller that will use this PHY device
78 * @port: name given to the consumer port
79 */
80struct phy_consumer {
81 const char *dev_name;
82 const char *port;
83};
84
85/**
86 * struct phy_init_data - contains the list of PHY consumers
87 * @num_consumers: number of consumers for this PHY device
88 * @consumers: list of PHY consumers
89 */
90struct phy_init_data {
91 unsigned int num_consumers;
92 struct phy_consumer *consumers;
93};
94
95#define PHY_CONSUMER(_dev_name, _port) \
96{ \
97 .dev_name = _dev_name, \
98 .port = _port, \
99}
100
101#define to_phy(dev) (container_of((dev), struct phy, dev))
102
103#define of_phy_provider_register(dev, xlate) \
104 __of_phy_provider_register((dev), THIS_MODULE, (xlate))
105
106#define devm_of_phy_provider_register(dev, xlate) \
107 __devm_of_phy_provider_register((dev), THIS_MODULE, (xlate))
108
109static inline void phy_set_drvdata(struct phy *phy, void *data)
110{
111 dev_set_drvdata(&phy->dev, data);
112}
113
114static inline void *phy_get_drvdata(struct phy *phy)
115{
116 return dev_get_drvdata(&phy->dev);
117}
118
119#if IS_ENABLED(CONFIG_GENERIC_PHY)
120int phy_pm_runtime_get(struct phy *phy);
121int phy_pm_runtime_get_sync(struct phy *phy);
122int phy_pm_runtime_put(struct phy *phy);
123int phy_pm_runtime_put_sync(struct phy *phy);
124void phy_pm_runtime_allow(struct phy *phy);
125void phy_pm_runtime_forbid(struct phy *phy);
126int phy_init(struct phy *phy);
127int phy_exit(struct phy *phy);
128int phy_power_on(struct phy *phy);
129int phy_power_off(struct phy *phy);
130struct phy *phy_get(struct device *dev, const char *string);
131struct phy *devm_phy_get(struct device *dev, const char *string);
132void phy_put(struct phy *phy);
133void devm_phy_put(struct device *dev, struct phy *phy);
134struct phy *of_phy_simple_xlate(struct device *dev,
135 struct of_phandle_args *args);
136struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
137 struct phy_init_data *init_data);
138struct phy *devm_phy_create(struct device *dev,
139 const struct phy_ops *ops, struct phy_init_data *init_data);
140void phy_destroy(struct phy *phy);
141void devm_phy_destroy(struct device *dev, struct phy *phy);
142struct phy_provider *__of_phy_provider_register(struct device *dev,
143 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
144 struct of_phandle_args *args));
145struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
146 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
147 struct of_phandle_args *args));
148void of_phy_provider_unregister(struct phy_provider *phy_provider);
149void devm_of_phy_provider_unregister(struct device *dev,
150 struct phy_provider *phy_provider);
151#else
152static inline int phy_pm_runtime_get(struct phy *phy)
153{
154 return -ENOSYS;
155}
156
157static inline int phy_pm_runtime_get_sync(struct phy *phy)
158{
159 return -ENOSYS;
160}
161
162static inline int phy_pm_runtime_put(struct phy *phy)
163{
164 return -ENOSYS;
165}
166
167static inline int phy_pm_runtime_put_sync(struct phy *phy)
168{
169 return -ENOSYS;
170}
171
172static inline void phy_pm_runtime_allow(struct phy *phy)
173{
174 return;
175}
176
177static inline void phy_pm_runtime_forbid(struct phy *phy)
178{
179 return;
180}
181
182static inline int phy_init(struct phy *phy)
183{
184 return -ENOSYS;
185}
186
187static inline int phy_exit(struct phy *phy)
188{
189 return -ENOSYS;
190}
191
192static inline int phy_power_on(struct phy *phy)
193{
194 return -ENOSYS;
195}
196
197static inline int phy_power_off(struct phy *phy)
198{
199 return -ENOSYS;
200}
201
202static inline struct phy *phy_get(struct device *dev, const char *string)
203{
204 return ERR_PTR(-ENOSYS);
205}
206
207static inline struct phy *devm_phy_get(struct device *dev, const char *string)
208{
209 return ERR_PTR(-ENOSYS);
210}
211
212static inline void phy_put(struct phy *phy)
213{
214}
215
216static inline void devm_phy_put(struct device *dev, struct phy *phy)
217{
218}
219
220static inline struct phy *of_phy_simple_xlate(struct device *dev,
221 struct of_phandle_args *args)
222{
223 return ERR_PTR(-ENOSYS);
224}
225
226static inline struct phy *phy_create(struct device *dev,
227 const struct phy_ops *ops, struct phy_init_data *init_data)
228{
229 return ERR_PTR(-ENOSYS);
230}
231
232static inline struct phy *devm_phy_create(struct device *dev,
233 const struct phy_ops *ops, struct phy_init_data *init_data)
234{
235 return ERR_PTR(-ENOSYS);
236}
237
238static inline void phy_destroy(struct phy *phy)
239{
240}
241
242static inline void devm_phy_destroy(struct device *dev, struct phy *phy)
243{
244}
245
246static inline struct phy_provider *__of_phy_provider_register(
247 struct device *dev, struct module *owner, struct phy * (*of_xlate)(
248 struct device *dev, struct of_phandle_args *args))
249{
250 return ERR_PTR(-ENOSYS);
251}
252
253static inline struct phy_provider *__devm_of_phy_provider_register(struct device
254 *dev, struct module *owner, struct phy * (*of_xlate)(struct device *dev,
255 struct of_phandle_args *args))
256{
257 return ERR_PTR(-ENOSYS);
258}
259
260static inline void of_phy_provider_unregister(struct phy_provider *phy_provider)
261{
262}
263
264static inline void devm_of_phy_provider_unregister(struct device *dev,
265 struct phy_provider *phy_provider)
266{
267}
268#endif
269
270#endif /* __DRIVERS_PHY_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e2772666f004..7246ef3d4455 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -23,6 +23,7 @@ struct bsd_acct_struct;
23struct pid_namespace { 23struct pid_namespace {
24 struct kref kref; 24 struct kref kref;
25 struct pidmap pidmap[PIDMAP_ENTRIES]; 25 struct pidmap pidmap[PIDMAP_ENTRIES];
26 struct rcu_head rcu;
26 int last_pid; 27 int last_pid;
27 unsigned int nr_hashed; 28 unsigned int nr_hashed;
28 struct task_struct *child_reaper; 29 struct task_struct *child_reaper;
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 5979147d2bda..fefb88663975 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -144,6 +144,9 @@ extern struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
144extern struct pinctrl_gpio_range * 144extern struct pinctrl_gpio_range *
145pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev, 145pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
146 unsigned int pin); 146 unsigned int pin);
147extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
148 const char *pin_group, const unsigned **pins,
149 unsigned *num_pins);
147 150
148#ifdef CONFIG_OF 151#ifdef CONFIG_OF
149extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np); 152extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87b2477..000000000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Minimal platform data header */
2void nomadik_clk_init(void);
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 9d98f3aaa16c..97baf831e071 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -10,6 +10,9 @@
10#ifndef __CLK_UX500_H 10#ifndef __CLK_UX500_H
11#define __CLK_UX500_H 11#define __CLK_UX500_H
12 12
13void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base);
15
13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 16void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base); 17 u32 clkrst5_base, u32 clkrst6_base);
15void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 18void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 8db5ae03b6e3..689a856b86f9 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -84,6 +84,8 @@ struct snd_platform_data {
84 u8 version; 84 u8 version;
85 u8 txnumevt; 85 u8 txnumevt;
86 u8 rxnumevt; 86 u8 rxnumevt;
87 int tx_dma_channel;
88 int rx_dma_channel;
87}; 89};
88 90
89enum { 91enum {
diff --git a/include/linux/platform_data/dma-s3c24xx.h b/include/linux/platform_data/dma-s3c24xx.h
new file mode 100644
index 000000000000..89ba1b0c90e4
--- /dev/null
+++ b/include/linux/platform_data/dma-s3c24xx.h
@@ -0,0 +1,46 @@
1/*
2 * S3C24XX DMA handling
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 */
11
12/* Helper to encode the source selection constraints for early s3c socs. */
13#define S3C24XX_DMA_CHANREQ(src, chan) ((BIT(3) | src) << chan * 4)
14
15enum s3c24xx_dma_bus {
16 S3C24XX_DMA_APB,
17 S3C24XX_DMA_AHB,
18};
19
20/**
21 * @bus: on which bus does the peripheral reside - AHB or APB.
22 * @handshake: is a handshake with the peripheral necessary
23 * @chansel: channel selection information, depending on variant; reqsel for
24 * s3c2443 and later and channel-selection map for earlier SoCs
25 * see CHANSEL doc in s3c2443-dma.c
26 */
27struct s3c24xx_dma_channel {
28 enum s3c24xx_dma_bus bus;
29 bool handshake;
30 u16 chansel;
31};
32
33/**
34 * struct s3c24xx_dma_platdata - platform specific settings
35 * @num_phy_channels: number of physical channels
36 * @channels: array of virtual channel descriptions
37 * @num_channels: number of virtual channels
38 */
39struct s3c24xx_dma_platdata {
40 int num_phy_channels;
41 struct s3c24xx_dma_channel *channels;
42 int num_channels;
43};
44
45struct dma_chan;
46bool s3c24xx_dma_filter(struct dma_chan *chan, void *param);
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
new file mode 100644
index 000000000000..6efd20264585
--- /dev/null
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -0,0 +1,60 @@
1/*
2 * DaVinci GPIO Platform Related Defines
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DAVINCI_GPIO_PLATFORM_H
17#define __DAVINCI_GPIO_PLATFORM_H
18
19#include <linux/io.h>
20#include <linux/spinlock.h>
21
22#include <asm-generic/gpio.h>
23
24enum davinci_gpio_type {
25 GPIO_TYPE_TNETV107X = 0,
26};
27
28struct davinci_gpio_platform_data {
29 u32 ngpio;
30 u32 gpio_unbanked;
31 u32 intc_irq_num;
32};
33
34
35struct davinci_gpio_controller {
36 struct gpio_chip chip;
37 int irq_base;
38 /* Serialize access to GPIO registers */
39 spinlock_t lock;
40 void __iomem *regs;
41 void __iomem *set_data;
42 void __iomem *clr_data;
43 void __iomem *in_data;
44 int gpio_unbanked;
45 unsigned gpio_irq;
46};
47
48/*
49 * basic gpio routines
50 */
51#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
52
53/* Convert GPIO signal to GPIO pin number */
54#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
55
56static inline u32 __gpio_mask(unsigned gpio)
57{
58 return 1 << (gpio % 32);
59}
60#endif
diff --git a/include/linux/platform_data/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/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
index bf34e17cee7f..c2fd9024717c 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis {
25 u8 hs_settle; 25 u8 hs_settle;
26}; 26};
27 27
28/**
29 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
30 * @id: MIPI-CSIS harware instance index (0...1)
31 * @on: true to enable D-PHY and deassert its reset
32 * false to disable D-PHY
33 * @return: 0 on success, or negative error code on failure
34 */
35int s5p_csis_phy_enable(int id, bool on);
36
37#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ 28#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/pinctrl-adi2.h b/include/linux/platform_data/pinctrl-adi2.h
new file mode 100644
index 000000000000..8f91300617ec
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-adi2.h
@@ -0,0 +1,40 @@
1/*
2 * Pinctrl Driver for ADI GPIO2 controller
3 *
4 * Copyright 2007-2013 Analog Devices Inc.
5 *
6 * Licensed under the GPLv2 or later
7 */
8
9
10#ifndef PINCTRL_ADI2_H
11#define PINCTRL_ADI2_H
12
13#include <linux/io.h>
14#include <linux/platform_device.h>
15
16/**
17 * struct adi_pinctrl_gpio_platform_data - Pinctrl gpio platform data
18 * for ADI GPIO2 device.
19 *
20 * @port_gpio_base: Optional global GPIO index of the GPIO bank.
21 * 0 means driver decides.
22 * @port_pin_base: Pin index of the pin controller device.
23 * @port_width: PIN number of the GPIO bank device
24 * @pint_id: GPIO PINT device id that this GPIO bank should map to.
25 * @pint_assign: The 32-bit GPIO PINT registers can be divided into 2 parts. A
26 * GPIO bank can be mapped into either low 16 bits[0] or high 16
27 * bits[1] of each PINT register.
28 * @pint_map: GIOP bank mapping code in PINT device
29 */
30struct adi_pinctrl_gpio_platform_data {
31 unsigned int port_gpio_base;
32 unsigned int port_pin_base;
33 unsigned int port_width;
34 u8 pinctrl_id;
35 u8 pint_id;
36 bool pint_assign;
37 u8 pint_map;
38};
39
40#endif
diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h
new file mode 100644
index 000000000000..72eacda9b360
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-single.h
@@ -0,0 +1,12 @@
1/**
2 * irq: optional wake-up interrupt
3 * rearm: optional soc specific rearm function
4 *
5 * Note that the irq and rearm setup should come from device
6 * tree except for omap where there are still some dependencies
7 * to the legacy PRM code.
8 */
9struct pcs_pdata {
10 int irq;
11 void (*rearm)(void);
12};
diff --git a/include/linux/platform_data/usb-ehci-s5p.h b/include/linux/platform_data/usb-ehci-s5p.h
deleted file mode 100644
index 5f28cae18582..000000000000
--- a/include/linux/platform_data/usb-ehci-s5p.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __PLAT_SAMSUNG_EHCI_H
12#define __PLAT_SAMSUNG_EHCI_H __FILE__
13
14struct s5p_ehci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
20
21#endif /* __PLAT_SAMSUNG_EHCI_H */
diff --git a/include/linux/platform_data/usb-ohci-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h
deleted file mode 100644
index c256c595be5e..000000000000
--- a/include/linux/platform_data/usb-ohci-exynos.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MACH_EXYNOS_OHCI_H
12#define __MACH_EXYNOS_OHCI_H
13
14struct exynos4_ohci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
20
21#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/include/linux/platform_data/usb-rcar-gen2-phy.h b/include/linux/platform_data/usb-rcar-gen2-phy.h
new file mode 100644
index 000000000000..dd3ba46c0d90
--- /dev/null
+++ b/include/linux/platform_data/usb-rcar-gen2-phy.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __USB_RCAR_GEN2_PHY_H
11#define __USB_RCAR_GEN2_PHY_H
12
13#include <linux/types.h>
14
15struct rcar_gen2_phy_platform_data {
16 /* USB channel 0 configuration */
17 bool chan0_pci:1; /* true: PCI USB host 0, false: USBHS */
18 /* USB channel 2 configuration */
19 bool chan2_pci:1; /* true: PCI USB host 2, false: USBSS */
20};
21
22#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ce8e4ffd78c7..16f6654082dd 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -178,6 +178,7 @@ struct platform_driver {
178 int (*resume)(struct platform_device *); 178 int (*resume)(struct platform_device *);
179 struct device_driver driver; 179 struct device_driver driver;
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181 bool prevent_deferred_probe;
181}; 182};
182 183
183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ 184#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index f5d4723cdb3d..a3d9dc8c2c00 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -6,106 +6,95 @@
6 * preempt_count (used for kernel preemption, interrupt count, etc.) 6 * preempt_count (used for kernel preemption, interrupt count, etc.)
7 */ 7 */
8 8
9#include <linux/thread_info.h>
10#include <linux/linkage.h> 9#include <linux/linkage.h>
11#include <linux/list.h> 10#include <linux/list.h>
12 11
13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 12/*
14 extern void add_preempt_count(int val); 13 * We use the MSB mostly because its available; see <linux/preempt_mask.h> for
15 extern void sub_preempt_count(int val); 14 * the other bits -- can't include that header due to inclusion hell.
16#else 15 */
17# define add_preempt_count(val) do { preempt_count() += (val); } while (0) 16#define PREEMPT_NEED_RESCHED 0x80000000
18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
19#endif
20
21#define inc_preempt_count() add_preempt_count(1)
22#define dec_preempt_count() sub_preempt_count(1)
23
24#define preempt_count() (current_thread_info()->preempt_count)
25
26#ifdef CONFIG_PREEMPT
27
28asmlinkage void preempt_schedule(void);
29
30#define preempt_check_resched() \
31do { \
32 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
33 preempt_schedule(); \
34} while (0)
35
36#ifdef CONFIG_CONTEXT_TRACKING
37 17
38void preempt_schedule_context(void); 18#include <asm/preempt.h>
39 19
40#define preempt_check_resched_context() \ 20#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
41do { \ 21extern void preempt_count_add(int val);
42 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ 22extern void preempt_count_sub(int val);
43 preempt_schedule_context(); \ 23#define preempt_count_dec_and_test() ({ preempt_count_sub(1); should_resched(); })
44} while (0)
45#else 24#else
25#define preempt_count_add(val) __preempt_count_add(val)
26#define preempt_count_sub(val) __preempt_count_sub(val)
27#define preempt_count_dec_and_test() __preempt_count_dec_and_test()
28#endif
46 29
47#define preempt_check_resched_context() preempt_check_resched() 30#define __preempt_count_inc() __preempt_count_add(1)
48 31#define __preempt_count_dec() __preempt_count_sub(1)
49#endif /* CONFIG_CONTEXT_TRACKING */
50
51#else /* !CONFIG_PREEMPT */
52
53#define preempt_check_resched() do { } while (0)
54#define preempt_check_resched_context() do { } while (0)
55
56#endif /* CONFIG_PREEMPT */
57 32
33#define preempt_count_inc() preempt_count_add(1)
34#define preempt_count_dec() preempt_count_sub(1)
58 35
59#ifdef CONFIG_PREEMPT_COUNT 36#ifdef CONFIG_PREEMPT_COUNT
60 37
61#define preempt_disable() \ 38#define preempt_disable() \
62do { \ 39do { \
63 inc_preempt_count(); \ 40 preempt_count_inc(); \
64 barrier(); \ 41 barrier(); \
65} while (0) 42} while (0)
66 43
67#define sched_preempt_enable_no_resched() \ 44#define sched_preempt_enable_no_resched() \
68do { \ 45do { \
69 barrier(); \ 46 barrier(); \
70 dec_preempt_count(); \ 47 preempt_count_dec(); \
71} while (0) 48} while (0)
72 49
73#define preempt_enable_no_resched() sched_preempt_enable_no_resched() 50#define preempt_enable_no_resched() sched_preempt_enable_no_resched()
74 51
52#ifdef CONFIG_PREEMPT
75#define preempt_enable() \ 53#define preempt_enable() \
76do { \ 54do { \
77 preempt_enable_no_resched(); \
78 barrier(); \ 55 barrier(); \
79 preempt_check_resched(); \ 56 if (unlikely(preempt_count_dec_and_test())) \
57 __preempt_schedule(); \
58} while (0)
59
60#define preempt_check_resched() \
61do { \
62 if (should_resched()) \
63 __preempt_schedule(); \
80} while (0) 64} while (0)
81 65
82/* For debugging and tracer internals only! */ 66#else
83#define add_preempt_count_notrace(val) \ 67#define preempt_enable() preempt_enable_no_resched()
84 do { preempt_count() += (val); } while (0) 68#define preempt_check_resched() do { } while (0)
85#define sub_preempt_count_notrace(val) \ 69#endif
86 do { preempt_count() -= (val); } while (0)
87#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
88#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
89 70
90#define preempt_disable_notrace() \ 71#define preempt_disable_notrace() \
91do { \ 72do { \
92 inc_preempt_count_notrace(); \ 73 __preempt_count_inc(); \
93 barrier(); \ 74 barrier(); \
94} while (0) 75} while (0)
95 76
96#define preempt_enable_no_resched_notrace() \ 77#define preempt_enable_no_resched_notrace() \
97do { \ 78do { \
98 barrier(); \ 79 barrier(); \
99 dec_preempt_count_notrace(); \ 80 __preempt_count_dec(); \
100} while (0) 81} while (0)
101 82
102/* preempt_check_resched is OK to trace */ 83#ifdef CONFIG_PREEMPT
84
85#ifndef CONFIG_CONTEXT_TRACKING
86#define __preempt_schedule_context() __preempt_schedule()
87#endif
88
103#define preempt_enable_notrace() \ 89#define preempt_enable_notrace() \
104do { \ 90do { \
105 preempt_enable_no_resched_notrace(); \
106 barrier(); \ 91 barrier(); \
107 preempt_check_resched_context(); \ 92 if (unlikely(__preempt_count_dec_and_test())) \
93 __preempt_schedule_context(); \
108} while (0) 94} while (0)
95#else
96#define preempt_enable_notrace() preempt_enable_no_resched_notrace()
97#endif
109 98
110#else /* !CONFIG_PREEMPT_COUNT */ 99#else /* !CONFIG_PREEMPT_COUNT */
111 100
@@ -115,10 +104,11 @@ do { \
115 * that can cause faults and scheduling migrate into our preempt-protected 104 * that can cause faults and scheduling migrate into our preempt-protected
116 * region. 105 * region.
117 */ 106 */
118#define preempt_disable() barrier() 107#define preempt_disable() barrier()
119#define sched_preempt_enable_no_resched() barrier() 108#define sched_preempt_enable_no_resched() barrier()
120#define preempt_enable_no_resched() barrier() 109#define preempt_enable_no_resched() barrier()
121#define preempt_enable() barrier() 110#define preempt_enable() barrier()
111#define preempt_check_resched() do { } while (0)
122 112
123#define preempt_disable_notrace() barrier() 113#define preempt_disable_notrace() barrier()
124#define preempt_enable_no_resched_notrace() barrier() 114#define preempt_enable_no_resched_notrace() barrier()
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a782481..694925837a16 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -233,6 +233,8 @@ extern asmlinkage void dump_stack(void) __cold;
233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
234#endif 234#endif
235 235
236#include <linux/dynamic_debug.h>
237
236/* If you are writing a driver, please use dev_dbg instead */ 238/* If you are writing a driver, please use dev_dbg instead */
237#if defined(CONFIG_DYNAMIC_DEBUG) 239#if defined(CONFIG_DYNAMIC_DEBUG)
238/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 240/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
@@ -343,7 +345,19 @@ extern asmlinkage void dump_stack(void) __cold;
343#endif 345#endif
344 346
345/* If you are writing a driver, please use dev_dbg instead */ 347/* If you are writing a driver, please use dev_dbg instead */
346#if defined(DEBUG) 348#if defined(CONFIG_DYNAMIC_DEBUG)
349/* descriptor check is first to prevent flooding with "callbacks suppressed" */
350#define pr_debug_ratelimited(fmt, ...) \
351do { \
352 static DEFINE_RATELIMIT_STATE(_rs, \
353 DEFAULT_RATELIMIT_INTERVAL, \
354 DEFAULT_RATELIMIT_BURST); \
355 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
356 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
357 __ratelimit(&_rs)) \
358 __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
359} while (0)
360#elif defined(DEBUG)
347#define pr_debug_ratelimited(fmt, ...) \ 361#define pr_debug_ratelimited(fmt, ...) \
348 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 362 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
349#else 363#else
diff --git a/include/linux/random.h b/include/linux/random.h
index 3b9377d6b7a5..4002b3df4c85 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags);
17extern void get_random_bytes(void *buf, int nbytes); 17extern void get_random_bytes(void *buf, int nbytes);
18extern void get_random_bytes_arch(void *buf, int nbytes); 18extern void get_random_bytes_arch(void *buf, int nbytes);
19void generate_random_uuid(unsigned char uuid_out[16]); 19void generate_random_uuid(unsigned char uuid_out[16]);
20extern int random_int_secret_init(void);
20 21
21#ifndef MODULE 22#ifndef MODULE
22extern const struct file_operations random_fops, urandom_fops; 23extern const struct file_operations random_fops, urandom_fops;
@@ -28,8 +29,13 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
28u32 prandom_u32(void); 29u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 30void prandom_bytes(void *buf, int nbytes);
30void prandom_seed(u32 seed); 31void prandom_seed(u32 seed);
32void prandom_reseed_late(void);
31 33
32u32 prandom_u32_state(struct rnd_state *); 34struct rnd_state {
35 __u32 s1, s2, s3, s4;
36};
37
38u32 prandom_u32_state(struct rnd_state *state);
33void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 39void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
34 40
35/* 41/*
@@ -49,9 +55,10 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
49{ 55{
50 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 56 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
51 57
52 state->s1 = __seed(i, 1); 58 state->s1 = __seed(i, 2U);
53 state->s2 = __seed(i, 7); 59 state->s2 = __seed(i, 8U);
54 state->s3 = __seed(i, 15); 60 state->s3 = __seed(i, 16U);
61 state->s4 = __seed(i, 128U);
55} 62}
56 63
57#ifdef CONFIG_ARCH_RANDOM 64#ifdef CONFIG_ARCH_RANDOM
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 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/rculist.h b/include/linux/rculist.h
index 4106721c4e5e..45a0a9e81478 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -19,6 +19,21 @@
19 */ 19 */
20 20
21/* 21/*
22 * INIT_LIST_HEAD_RCU - Initialize a list_head visible to RCU readers
23 * @list: list to be initialized
24 *
25 * You should instead use INIT_LIST_HEAD() for normal initialization and
26 * cleanup tasks, when readers have no access to the list being initialized.
27 * However, if the list being initialized is visible to readers, you
28 * need to keep the compiler from being too mischievous.
29 */
30static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
31{
32 ACCESS_ONCE(list->next) = list;
33 ACCESS_ONCE(list->prev) = list;
34}
35
36/*
22 * return the ->next pointer of a list_head in an rcu safe 37 * return the ->next pointer of a list_head in an rcu safe
23 * way, we must not access it directly 38 * way, we must not access it directly
24 */ 39 */
@@ -191,9 +206,13 @@ static inline void list_splice_init_rcu(struct list_head *list,
191 if (list_empty(list)) 206 if (list_empty(list))
192 return; 207 return;
193 208
194 /* "first" and "last" tracking list, so initialize it. */ 209 /*
210 * "first" and "last" tracking list, so initialize it. RCU readers
211 * have access to this list, so we must use INIT_LIST_HEAD_RCU()
212 * instead of INIT_LIST_HEAD().
213 */
195 214
196 INIT_LIST_HEAD(list); 215 INIT_LIST_HEAD_RCU(list);
197 216
198 /* 217 /*
199 * At this point, the list body still points to the source list. 218 * At this point, the list body still points to the source list.
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index f1f1bc39346b..39cbb889e20d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -261,6 +261,10 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
261 rcu_irq_exit(); \ 261 rcu_irq_exit(); \
262 } while (0) 262 } while (0)
263 263
264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
265extern bool __rcu_is_watching(void);
266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267
264/* 268/*
265 * Infrastructure to implement the synchronize_() primitives in 269 * Infrastructure to implement the synchronize_() primitives in
266 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 270 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
@@ -297,10 +301,6 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
297} 301}
298#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 302#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
299 303
300#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP)
301extern int rcu_is_cpu_idle(void);
302#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP) */
303
304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) 304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU)
305bool rcu_lockdep_current_cpu_online(void); 305bool rcu_lockdep_current_cpu_online(void);
306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
@@ -351,7 +351,7 @@ static inline int rcu_read_lock_held(void)
351{ 351{
352 if (!debug_lockdep_rcu_enabled()) 352 if (!debug_lockdep_rcu_enabled())
353 return 1; 353 return 1;
354 if (rcu_is_cpu_idle()) 354 if (!rcu_is_watching())
355 return 0; 355 return 0;
356 if (!rcu_lockdep_current_cpu_online()) 356 if (!rcu_lockdep_current_cpu_online())
357 return 0; 357 return 0;
@@ -402,7 +402,7 @@ static inline int rcu_read_lock_sched_held(void)
402 402
403 if (!debug_lockdep_rcu_enabled()) 403 if (!debug_lockdep_rcu_enabled())
404 return 1; 404 return 1;
405 if (rcu_is_cpu_idle()) 405 if (!rcu_is_watching())
406 return 0; 406 return 0;
407 if (!rcu_lockdep_current_cpu_online()) 407 if (!rcu_lockdep_current_cpu_online())
408 return 0; 408 return 0;
@@ -771,7 +771,7 @@ static inline void rcu_read_lock(void)
771 __rcu_read_lock(); 771 __rcu_read_lock();
772 __acquire(RCU); 772 __acquire(RCU);
773 rcu_lock_acquire(&rcu_lock_map); 773 rcu_lock_acquire(&rcu_lock_map);
774 rcu_lockdep_assert(!rcu_is_cpu_idle(), 774 rcu_lockdep_assert(rcu_is_watching(),
775 "rcu_read_lock() used illegally while idle"); 775 "rcu_read_lock() used illegally while idle");
776} 776}
777 777
@@ -792,7 +792,7 @@ static inline void rcu_read_lock(void)
792 */ 792 */
793static inline void rcu_read_unlock(void) 793static inline void rcu_read_unlock(void)
794{ 794{
795 rcu_lockdep_assert(!rcu_is_cpu_idle(), 795 rcu_lockdep_assert(rcu_is_watching(),
796 "rcu_read_unlock() used illegally while idle"); 796 "rcu_read_unlock() used illegally while idle");
797 rcu_lock_release(&rcu_lock_map); 797 rcu_lock_release(&rcu_lock_map);
798 __release(RCU); 798 __release(RCU);
@@ -821,7 +821,7 @@ static inline void rcu_read_lock_bh(void)
821 local_bh_disable(); 821 local_bh_disable();
822 __acquire(RCU_BH); 822 __acquire(RCU_BH);
823 rcu_lock_acquire(&rcu_bh_lock_map); 823 rcu_lock_acquire(&rcu_bh_lock_map);
824 rcu_lockdep_assert(!rcu_is_cpu_idle(), 824 rcu_lockdep_assert(rcu_is_watching(),
825 "rcu_read_lock_bh() used illegally while idle"); 825 "rcu_read_lock_bh() used illegally while idle");
826} 826}
827 827
@@ -832,7 +832,7 @@ static inline void rcu_read_lock_bh(void)
832 */ 832 */
833static inline void rcu_read_unlock_bh(void) 833static inline void rcu_read_unlock_bh(void)
834{ 834{
835 rcu_lockdep_assert(!rcu_is_cpu_idle(), 835 rcu_lockdep_assert(rcu_is_watching(),
836 "rcu_read_unlock_bh() used illegally while idle"); 836 "rcu_read_unlock_bh() used illegally while idle");
837 rcu_lock_release(&rcu_bh_lock_map); 837 rcu_lock_release(&rcu_bh_lock_map);
838 __release(RCU_BH); 838 __release(RCU_BH);
@@ -857,7 +857,7 @@ static inline void rcu_read_lock_sched(void)
857 preempt_disable(); 857 preempt_disable();
858 __acquire(RCU_SCHED); 858 __acquire(RCU_SCHED);
859 rcu_lock_acquire(&rcu_sched_lock_map); 859 rcu_lock_acquire(&rcu_sched_lock_map);
860 rcu_lockdep_assert(!rcu_is_cpu_idle(), 860 rcu_lockdep_assert(rcu_is_watching(),
861 "rcu_read_lock_sched() used illegally while idle"); 861 "rcu_read_lock_sched() used illegally while idle");
862} 862}
863 863
@@ -875,7 +875,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
875 */ 875 */
876static inline void rcu_read_unlock_sched(void) 876static inline void rcu_read_unlock_sched(void)
877{ 877{
878 rcu_lockdep_assert(!rcu_is_cpu_idle(), 878 rcu_lockdep_assert(rcu_is_watching(),
879 "rcu_read_unlock_sched() used illegally while idle"); 879 "rcu_read_unlock_sched() used illegally while idle");
880 rcu_lock_release(&rcu_sched_lock_map); 880 rcu_lock_release(&rcu_sched_lock_map);
881 __release(RCU_SCHED); 881 __release(RCU_SCHED);
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e31005ee339e..09ebcbe9fd78 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -132,4 +132,21 @@ static inline void rcu_scheduler_starting(void)
132} 132}
133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
134 134
135#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
136
137static inline bool rcu_is_watching(void)
138{
139 return __rcu_is_watching();
140}
141
142#else /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
143
144static inline bool rcu_is_watching(void)
145{
146 return true;
147}
148
149
150#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
151
135#endif /* __LINUX_RCUTINY_H */ 152#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 226169d1bd2b..4b9c81548742 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -90,4 +90,6 @@ extern void exit_rcu(void);
90extern void rcu_scheduler_starting(void); 90extern void rcu_scheduler_starting(void);
91extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
92 92
93extern bool rcu_is_watching(void);
94
93#endif /* __LINUX_RCUTREE_H */ 95#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a10380bfbeac..e55907804d39 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,6 +23,7 @@ struct device;
23struct i2c_client; 23struct i2c_client;
24struct irq_domain; 24struct irq_domain;
25struct spi_device; 25struct spi_device;
26struct spmi_device;
26struct regmap; 27struct regmap;
27struct regmap_range_cfg; 28struct regmap_range_cfg;
28struct regmap_field; 29struct regmap_field;
@@ -70,6 +71,8 @@ struct regmap_range {
70 unsigned int range_max; 71 unsigned int range_max;
71}; 72};
72 73
74#define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
75
73/* 76/*
74 * A table of ranges including some yes ranges and some no ranges. 77 * A table of ranges including some yes ranges and some no ranges.
75 * If a register belongs to a no_range, the corresponding check function 78 * If a register belongs to a no_range, the corresponding check function
@@ -318,6 +321,8 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
318 const struct regmap_config *config); 321 const struct regmap_config *config);
319struct regmap *regmap_init_spi(struct spi_device *dev, 322struct regmap *regmap_init_spi(struct spi_device *dev,
320 const struct regmap_config *config); 323 const struct regmap_config *config);
324struct regmap *regmap_init_spmi(struct spmi_device *dev,
325 const struct regmap_config *config);
321struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 326struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
322 void __iomem *regs, 327 void __iomem *regs,
323 const struct regmap_config *config); 328 const struct regmap_config *config);
@@ -330,6 +335,8 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
330 const struct regmap_config *config); 335 const struct regmap_config *config);
331struct regmap *devm_regmap_init_spi(struct spi_device *dev, 336struct regmap *devm_regmap_init_spi(struct spi_device *dev,
332 const struct regmap_config *config); 337 const struct regmap_config *config);
338struct regmap *devm_regmap_init_spmi(struct spmi_device *dev,
339 const struct regmap_config *config);
333struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 340struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
334 void __iomem *regs, 341 void __iomem *regs,
335 const struct regmap_config *config); 342 const struct regmap_config *config);
@@ -374,10 +381,13 @@ int regmap_reinit_cache(struct regmap *map,
374 const struct regmap_config *config); 381 const struct regmap_config *config);
375struct regmap *dev_get_regmap(struct device *dev, const char *name); 382struct regmap *dev_get_regmap(struct device *dev, const char *name);
376int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 383int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
384int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
377int regmap_raw_write(struct regmap *map, unsigned int reg, 385int regmap_raw_write(struct regmap *map, unsigned int reg,
378 const void *val, size_t val_len); 386 const void *val, size_t val_len);
379int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 387int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
380 size_t val_count); 388 size_t val_count);
389int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs,
390 int num_regs);
381int regmap_raw_write_async(struct regmap *map, unsigned int reg, 391int regmap_raw_write_async(struct regmap *map, unsigned int reg,
382 const void *val, size_t val_len); 392 const void *val, size_t val_len);
383int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 393int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
@@ -387,9 +397,14 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
387 size_t val_count); 397 size_t val_count);
388int regmap_update_bits(struct regmap *map, unsigned int reg, 398int regmap_update_bits(struct regmap *map, unsigned int reg,
389 unsigned int mask, unsigned int val); 399 unsigned int mask, unsigned int val);
400int regmap_update_bits_async(struct regmap *map, unsigned int reg,
401 unsigned int mask, unsigned int val);
390int regmap_update_bits_check(struct regmap *map, unsigned int reg, 402int regmap_update_bits_check(struct regmap *map, unsigned int reg,
391 unsigned int mask, unsigned int val, 403 unsigned int mask, unsigned int val,
392 bool *change); 404 bool *change);
405int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
406 unsigned int mask, unsigned int val,
407 bool *change);
393int regmap_get_val_bytes(struct regmap *map); 408int regmap_get_val_bytes(struct regmap *map);
394int regmap_async_complete(struct regmap *map); 409int regmap_async_complete(struct regmap *map);
395bool regmap_can_raw_write(struct regmap *map); 410bool regmap_can_raw_write(struct regmap *map);
@@ -425,11 +440,15 @@ bool regmap_reg_in_ranges(unsigned int reg,
425 * @reg: Offset of the register within the regmap bank 440 * @reg: Offset of the register within the regmap bank
426 * @lsb: lsb of the register field. 441 * @lsb: lsb of the register field.
427 * @reg: msb of the register field. 442 * @reg: msb of the register field.
443 * @id_size: port size if it has some ports
444 * @id_offset: address offset for each ports
428 */ 445 */
429struct reg_field { 446struct reg_field {
430 unsigned int reg; 447 unsigned int reg;
431 unsigned int lsb; 448 unsigned int lsb;
432 unsigned int msb; 449 unsigned int msb;
450 unsigned int id_size;
451 unsigned int id_offset;
433}; 452};
434 453
435#define REG_FIELD(_reg, _lsb, _msb) { \ 454#define REG_FIELD(_reg, _lsb, _msb) { \
@@ -448,6 +467,15 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
448 467
449int regmap_field_read(struct regmap_field *field, unsigned int *val); 468int regmap_field_read(struct regmap_field *field, unsigned int *val);
450int regmap_field_write(struct regmap_field *field, unsigned int val); 469int regmap_field_write(struct regmap_field *field, unsigned int val);
470int regmap_field_update_bits(struct regmap_field *field,
471 unsigned int mask, unsigned int val);
472
473int regmap_fields_write(struct regmap_field *field, unsigned int id,
474 unsigned int val);
475int regmap_fields_read(struct regmap_field *field, unsigned int id,
476 unsigned int *val);
477int regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
478 unsigned int mask, unsigned int val);
451 479
452/** 480/**
453 * Description of an IRQ for the generic regmap irq_chip. 481 * Description of an IRQ for the generic regmap irq_chip.
@@ -527,6 +555,13 @@ static inline int regmap_write(struct regmap *map, unsigned int reg,
527 return -EINVAL; 555 return -EINVAL;
528} 556}
529 557
558static inline int regmap_write_async(struct regmap *map, unsigned int reg,
559 unsigned int val)
560{
561 WARN_ONCE(1, "regmap API is disabled");
562 return -EINVAL;
563}
564
530static inline int regmap_raw_write(struct regmap *map, unsigned int reg, 565static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
531 const void *val, size_t val_len) 566 const void *val, size_t val_len)
532{ 567{
@@ -576,6 +611,14 @@ static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
576 return -EINVAL; 611 return -EINVAL;
577} 612}
578 613
614static inline int regmap_update_bits_async(struct regmap *map,
615 unsigned int reg,
616 unsigned int mask, unsigned int val)
617{
618 WARN_ONCE(1, "regmap API is disabled");
619 return -EINVAL;
620}
621
579static inline int regmap_update_bits_check(struct regmap *map, 622static inline int regmap_update_bits_check(struct regmap *map,
580 unsigned int reg, 623 unsigned int reg,
581 unsigned int mask, unsigned int val, 624 unsigned int mask, unsigned int val,
@@ -585,6 +628,16 @@ static inline int regmap_update_bits_check(struct regmap *map,
585 return -EINVAL; 628 return -EINVAL;
586} 629}
587 630
631static inline int regmap_update_bits_check_async(struct regmap *map,
632 unsigned int reg,
633 unsigned int mask,
634 unsigned int val,
635 bool *change)
636{
637 WARN_ONCE(1, "regmap API is disabled");
638 return -EINVAL;
639}
640
588static inline int regmap_get_val_bytes(struct regmap *map) 641static inline int regmap_get_val_bytes(struct regmap *map)
589{ 642{
590 WARN_ONCE(1, "regmap API is disabled"); 643 WARN_ONCE(1, "regmap API is disabled");
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 27be915caa96..e530681bea70 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -146,6 +146,32 @@ struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
146void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
147void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
148 148
149int regulator_register_supply_alias(struct device *dev, const char *id,
150 struct device *alias_dev,
151 const char *alias_id);
152void regulator_unregister_supply_alias(struct device *dev, const char *id);
153
154int regulator_bulk_register_supply_alias(struct device *dev, const char **id,
155 struct device *alias_dev,
156 const char **alias_id, int num_id);
157void regulator_bulk_unregister_supply_alias(struct device *dev,
158 const char **id, int num_id);
159
160int devm_regulator_register_supply_alias(struct device *dev, const char *id,
161 struct device *alias_dev,
162 const char *alias_id);
163void devm_regulator_unregister_supply_alias(struct device *dev,
164 const char *id);
165
166int devm_regulator_bulk_register_supply_alias(struct device *dev,
167 const char **id,
168 struct device *alias_dev,
169 const char **alias_id,
170 int num_id);
171void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
172 const char **id,
173 int num_id);
174
149/* regulator output control and status */ 175/* regulator output control and status */
150int __must_check regulator_enable(struct regulator *regulator); 176int __must_check regulator_enable(struct regulator *regulator);
151int regulator_disable(struct regulator *regulator); 177int regulator_disable(struct regulator *regulator);
@@ -250,6 +276,59 @@ static inline void devm_regulator_put(struct regulator *regulator)
250{ 276{
251} 277}
252 278
279static inline int regulator_register_supply_alias(struct device *dev,
280 const char *id,
281 struct device *alias_dev,
282 const char *alias_id)
283{
284 return 0;
285}
286
287static inline void regulator_unregister_supply_alias(struct device *dev,
288 const char *id)
289{
290}
291
292static inline int regulator_bulk_register_supply_alias(struct device *dev,
293 const char **id,
294 struct device *alias_dev,
295 const char **alias_id,
296 int num_id)
297{
298 return 0;
299}
300
301static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
302 const char **id,
303 int num_id)
304{
305}
306
307static inline int devm_regulator_register_supply_alias(struct device *dev,
308 const char *id,
309 struct device *alias_dev,
310 const char *alias_id)
311{
312 return 0;
313}
314
315static inline void devm_regulator_unregister_supply_alias(struct device *dev,
316 const char *id)
317{
318}
319
320static inline int devm_regulator_bulk_register_supply_alias(
321 struct device *dev, const char **id, struct device *alias_dev,
322 const char **alias_id, int num_id)
323{
324 return 0;
325}
326
327static inline void devm_regulator_bulk_unregister_supply_alias(
328 struct device *dev, const char **id, int num_id)
329{
330}
331
253static inline int regulator_enable(struct regulator *regulator) 332static inline int regulator_enable(struct regulator *regulator)
254{ 333{
255 return 0; 334 return 0;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 67e13aa5a478..9370e65348a4 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -40,23 +40,32 @@ enum regulator_status {
40}; 40};
41 41
42/** 42/**
43 * struct regulator_linear_range - specify linear voltage ranges
44 *
43 * Specify a range of voltages for regulator_map_linar_range() and 45 * Specify a range of voltages for regulator_map_linar_range() and
44 * regulator_list_linear_range(). 46 * regulator_list_linear_range().
45 * 47 *
46 * @min_uV: Lowest voltage in range 48 * @min_uV: Lowest voltage in range
47 * @max_uV: Highest voltage in range
48 * @min_sel: Lowest selector for range 49 * @min_sel: Lowest selector for range
49 * @max_sel: Highest selector for range 50 * @max_sel: Highest selector for range
50 * @uV_step: Step size 51 * @uV_step: Step size
51 */ 52 */
52struct regulator_linear_range { 53struct regulator_linear_range {
53 unsigned int min_uV; 54 unsigned int min_uV;
54 unsigned int max_uV;
55 unsigned int min_sel; 55 unsigned int min_sel;
56 unsigned int max_sel; 56 unsigned int max_sel;
57 unsigned int uV_step; 57 unsigned int uV_step;
58}; 58};
59 59
60/* Initialize struct regulator_linear_range */
61#define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \
62{ \
63 .min_uV = _min_uV, \
64 .min_sel = _min_sel, \
65 .max_sel = _max_sel, \
66 .uV_step = _step_uV, \
67}
68
60/** 69/**
61 * struct regulator_ops - regulator operations. 70 * struct regulator_ops - regulator operations.
62 * 71 *
@@ -207,6 +216,7 @@ enum regulator_type {
207 * @min_uV: Voltage given by the lowest selector (if linear mapping) 216 * @min_uV: Voltage given by the lowest selector (if linear mapping)
208 * @uV_step: Voltage increase with each selector (if linear mapping) 217 * @uV_step: Voltage increase with each selector (if linear mapping)
209 * @linear_min_sel: Minimal selector for starting linear mapping 218 * @linear_min_sel: Minimal selector for starting linear mapping
219 * @fixed_uV: Fixed voltage of rails.
210 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 220 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
211 * @volt_table: Voltage mapping table (if table based mapping) 221 * @volt_table: Voltage mapping table (if table based mapping)
212 * 222 *
@@ -239,6 +249,7 @@ struct regulator_desc {
239 unsigned int min_uV; 249 unsigned int min_uV;
240 unsigned int uV_step; 250 unsigned int uV_step;
241 unsigned int linear_min_sel; 251 unsigned int linear_min_sel;
252 int fixed_uV;
242 unsigned int ramp_delay; 253 unsigned int ramp_delay;
243 254
244 const struct regulator_linear_range *linear_ranges; 255 const struct regulator_linear_range *linear_ranges;
@@ -334,7 +345,12 @@ struct regulator_dev {
334struct regulator_dev * 345struct regulator_dev *
335regulator_register(const struct regulator_desc *regulator_desc, 346regulator_register(const struct regulator_desc *regulator_desc,
336 const struct regulator_config *config); 347 const struct regulator_config *config);
348struct regulator_dev *
349devm_regulator_register(struct device *dev,
350 const struct regulator_desc *regulator_desc,
351 const struct regulator_config *config);
337void regulator_unregister(struct regulator_dev *rdev); 352void regulator_unregister(struct regulator_dev *rdev);
353void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev);
338 354
339int regulator_notifier_call_chain(struct regulator_dev *rdev, 355int regulator_notifier_call_chain(struct regulator_dev *rdev,
340 unsigned long event, void *data); 356 unsigned long event, void *data);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 999b20ce06cf..730e638c5589 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -95,6 +95,7 @@ struct regulator_state {
95 * @initial_state: Suspend state to set by default. 95 * @initial_state: Suspend state to set by default.
96 * @initial_mode: Mode to set at startup. 96 * @initial_mode: Mode to set at startup.
97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
98 * @enable_time: Turn-on time of the rails (unit: microseconds)
98 */ 99 */
99struct regulation_constraints { 100struct regulation_constraints {
100 101
@@ -129,6 +130,7 @@ struct regulation_constraints {
129 unsigned int initial_mode; 130 unsigned int initial_mode;
130 131
131 unsigned int ramp_delay; 132 unsigned int ramp_delay;
133 unsigned int enable_time;
132 134
133 /* constraint flags */ 135 /* constraint flags */
134 unsigned always_on:1; /* regulator never off when system is on */ 136 unsigned always_on:1; /* regulator never off when system is on */
@@ -193,15 +195,10 @@ int regulator_suspend_finish(void);
193 195
194#ifdef CONFIG_REGULATOR 196#ifdef CONFIG_REGULATOR
195void regulator_has_full_constraints(void); 197void regulator_has_full_constraints(void);
196void regulator_use_dummy_regulator(void);
197#else 198#else
198static inline void regulator_has_full_constraints(void) 199static inline void regulator_has_full_constraints(void)
199{ 200{
200} 201}
201
202static inline void regulator_use_dummy_regulator(void)
203{
204}
205#endif 202#endif
206 203
207#endif 204#endif
diff --git a/include/linux/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 6682da36b293..f7efc8604652 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -22,6 +22,7 @@ struct sched_param {
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/nodemask.h> 23#include <linux/nodemask.h>
24#include <linux/mm_types.h> 24#include <linux/mm_types.h>
25#include <linux/preempt.h>
25 26
26#include <asm/page.h> 27#include <asm/page.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -322,6 +323,10 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
322extern void set_dumpable(struct mm_struct *mm, int value); 323extern void set_dumpable(struct mm_struct *mm, int value);
323extern int get_dumpable(struct mm_struct *mm); 324extern int get_dumpable(struct mm_struct *mm);
324 325
326#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
327#define SUID_DUMP_USER 1 /* Dump as user of process */
328#define SUID_DUMP_ROOT 2 /* Dump as root */
329
325/* mm flags */ 330/* mm flags */
326/* dumpable bits */ 331/* dumpable bits */
327#define MMF_DUMPABLE 0 /* core dump is permitted */ 332#define MMF_DUMPABLE 0 /* core dump is permitted */
@@ -427,6 +432,14 @@ struct task_cputime {
427 .sum_exec_runtime = 0, \ 432 .sum_exec_runtime = 0, \
428 } 433 }
429 434
435#define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)
436
437#ifdef CONFIG_PREEMPT_COUNT
438#define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
439#else
440#define PREEMPT_DISABLED PREEMPT_ENABLED
441#endif
442
430/* 443/*
431 * Disable preemption until the scheduler is running. 444 * Disable preemption until the scheduler is running.
432 * Reset by start_kernel()->sched_init()->init_idle(). 445 * Reset by start_kernel()->sched_init()->init_idle().
@@ -434,7 +447,7 @@ struct task_cputime {
434 * We include PREEMPT_ACTIVE to avoid cond_resched() from working 447 * We include PREEMPT_ACTIVE to avoid cond_resched() from working
435 * before the scheduler is active -- see should_resched(). 448 * before the scheduler is active -- see should_resched().
436 */ 449 */
437#define INIT_PREEMPT_COUNT (1 + PREEMPT_ACTIVE) 450#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
438 451
439/** 452/**
440 * struct thread_group_cputimer - thread group interval timer counts 453 * struct thread_group_cputimer - thread group interval timer counts
@@ -768,6 +781,7 @@ enum cpu_idle_type {
768#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 781#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
769#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 782#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
770#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 783#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
784#define SD_NUMA 0x4000 /* cross-node balancing */
771 785
772extern int __weak arch_sd_sibiling_asym_packing(void); 786extern int __weak arch_sd_sibiling_asym_packing(void);
773 787
@@ -811,6 +825,10 @@ struct sched_domain {
811 825
812 u64 last_update; 826 u64 last_update;
813 827
828 /* idle_balance() stats */
829 u64 max_newidle_lb_cost;
830 unsigned long next_decay_max_lb_cost;
831
814#ifdef CONFIG_SCHEDSTATS 832#ifdef CONFIG_SCHEDSTATS
815 /* load_balance() stats */ 833 /* load_balance() stats */
816 unsigned int lb_count[CPU_MAX_IDLE_TYPES]; 834 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
@@ -1029,6 +1047,8 @@ struct task_struct {
1029 struct task_struct *last_wakee; 1047 struct task_struct *last_wakee;
1030 unsigned long wakee_flips; 1048 unsigned long wakee_flips;
1031 unsigned long wakee_flip_decay_ts; 1049 unsigned long wakee_flip_decay_ts;
1050
1051 int wake_cpu;
1032#endif 1052#endif
1033 int on_rq; 1053 int on_rq;
1034 1054
@@ -1046,15 +1066,6 @@ struct task_struct {
1046 struct hlist_head preempt_notifiers; 1066 struct hlist_head preempt_notifiers;
1047#endif 1067#endif
1048 1068
1049 /*
1050 * fpu_counter contains the number of consecutive context switches
1051 * that the FPU is used. If this is over a threshold, the lazy fpu
1052 * saving becomes unlazy to save the trap. This is an unsigned char
1053 * so that after 256 times the counter wraps and the behavior turns
1054 * lazy again; this to deal with bursty apps that only use FPU for
1055 * a short time
1056 */
1057 unsigned char fpu_counter;
1058#ifdef CONFIG_BLK_DEV_IO_TRACE 1069#ifdef CONFIG_BLK_DEV_IO_TRACE
1059 unsigned int btrace_seq; 1070 unsigned int btrace_seq;
1060#endif 1071#endif
@@ -1324,10 +1335,41 @@ struct task_struct {
1324#endif 1335#endif
1325#ifdef CONFIG_NUMA_BALANCING 1336#ifdef CONFIG_NUMA_BALANCING
1326 int numa_scan_seq; 1337 int numa_scan_seq;
1327 int numa_migrate_seq;
1328 unsigned int numa_scan_period; 1338 unsigned int numa_scan_period;
1339 unsigned int numa_scan_period_max;
1340 int numa_preferred_nid;
1341 int numa_migrate_deferred;
1342 unsigned long numa_migrate_retry;
1329 u64 node_stamp; /* migration stamp */ 1343 u64 node_stamp; /* migration stamp */
1330 struct callback_head numa_work; 1344 struct callback_head numa_work;
1345
1346 struct list_head numa_entry;
1347 struct numa_group *numa_group;
1348
1349 /*
1350 * Exponential decaying average of faults on a per-node basis.
1351 * Scheduling placement decisions are made based on the these counts.
1352 * The values remain static for the duration of a PTE scan
1353 */
1354 unsigned long *numa_faults;
1355 unsigned long total_numa_faults;
1356
1357 /*
1358 * numa_faults_buffer records faults per node during the current
1359 * scan window. When the scan completes, the counts in numa_faults
1360 * decay and these values are copied.
1361 */
1362 unsigned long *numa_faults_buffer;
1363
1364 /*
1365 * numa_faults_locality tracks if faults recorded during the last
1366 * scan window were remote/local. The task scan period is adapted
1367 * based on the locality of the faults with different weights
1368 * depending on whether they were shared or private faults
1369 */
1370 unsigned long numa_faults_locality[2];
1371
1372 unsigned long numa_pages_migrated;
1331#endif /* CONFIG_NUMA_BALANCING */ 1373#endif /* CONFIG_NUMA_BALANCING */
1332 1374
1333 struct rcu_head rcu; 1375 struct rcu_head rcu;
@@ -1394,11 +1436,10 @@ struct task_struct {
1394 } memcg_batch; 1436 } memcg_batch;
1395 unsigned int memcg_kmem_skip_account; 1437 unsigned int memcg_kmem_skip_account;
1396 struct memcg_oom_info { 1438 struct memcg_oom_info {
1439 struct mem_cgroup *memcg;
1440 gfp_t gfp_mask;
1441 int order;
1397 unsigned int may_oom:1; 1442 unsigned int may_oom:1;
1398 unsigned int in_memcg_oom:1;
1399 unsigned int oom_locked:1;
1400 int wakeups;
1401 struct mem_cgroup *wait_on_memcg;
1402 } memcg_oom; 1443 } memcg_oom;
1403#endif 1444#endif
1404#ifdef CONFIG_UPROBES 1445#ifdef CONFIG_UPROBES
@@ -1413,16 +1454,33 @@ struct task_struct {
1413/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1454/* Future-safe accessor for struct task_struct's cpus_allowed. */
1414#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1455#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1415 1456
1457#define TNF_MIGRATED 0x01
1458#define TNF_NO_GROUP 0x02
1459#define TNF_SHARED 0x04
1460#define TNF_FAULT_LOCAL 0x08
1461
1416#ifdef CONFIG_NUMA_BALANCING 1462#ifdef CONFIG_NUMA_BALANCING
1417extern void task_numa_fault(int node, int pages, bool migrated); 1463extern void task_numa_fault(int last_node, int node, int pages, int flags);
1464extern pid_t task_numa_group_id(struct task_struct *p);
1418extern void set_numabalancing_state(bool enabled); 1465extern void set_numabalancing_state(bool enabled);
1466extern void task_numa_free(struct task_struct *p);
1467
1468extern unsigned int sysctl_numa_balancing_migrate_deferred;
1419#else 1469#else
1420static inline void task_numa_fault(int node, int pages, bool migrated) 1470static inline void task_numa_fault(int last_node, int node, int pages,
1471 int flags)
1472{
1473}
1474static inline pid_t task_numa_group_id(struct task_struct *p)
1421{ 1475{
1476 return 0;
1422} 1477}
1423static inline void set_numabalancing_state(bool enabled) 1478static inline void set_numabalancing_state(bool enabled)
1424{ 1479{
1425} 1480}
1481static inline void task_numa_free(struct task_struct *p)
1482{
1483}
1426#endif 1484#endif
1427 1485
1428static inline struct pid *task_pid(struct task_struct *task) 1486static inline struct pid *task_pid(struct task_struct *task)
@@ -1975,7 +2033,7 @@ extern void wake_up_new_task(struct task_struct *tsk);
1975#else 2033#else
1976 static inline void kick_process(struct task_struct *tsk) { } 2034 static inline void kick_process(struct task_struct *tsk) { }
1977#endif 2035#endif
1978extern void sched_fork(struct task_struct *p); 2036extern void sched_fork(unsigned long clone_flags, struct task_struct *p);
1979extern void sched_dead(struct task_struct *p); 2037extern void sched_dead(struct task_struct *p);
1980 2038
1981extern void proc_caches_init(void); 2039extern void proc_caches_init(void);
@@ -2402,11 +2460,6 @@ static inline int signal_pending_state(long state, struct task_struct *p)
2402 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); 2460 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
2403} 2461}
2404 2462
2405static inline int need_resched(void)
2406{
2407 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
2408}
2409
2410/* 2463/*
2411 * cond_resched() and cond_resched_lock(): latency reduction via 2464 * cond_resched() and cond_resched_lock(): latency reduction via
2412 * explicit rescheduling in places that are safe. The return 2465 * explicit rescheduling in places that are safe. The return
@@ -2475,36 +2528,105 @@ static inline int tsk_is_polling(struct task_struct *p)
2475{ 2528{
2476 return task_thread_info(p)->status & TS_POLLING; 2529 return task_thread_info(p)->status & TS_POLLING;
2477} 2530}
2478static inline void current_set_polling(void) 2531static inline void __current_set_polling(void)
2479{ 2532{
2480 current_thread_info()->status |= TS_POLLING; 2533 current_thread_info()->status |= TS_POLLING;
2481} 2534}
2482 2535
2483static inline void current_clr_polling(void) 2536static inline bool __must_check current_set_polling_and_test(void)
2537{
2538 __current_set_polling();
2539
2540 /*
2541 * Polling state must be visible before we test NEED_RESCHED,
2542 * paired by resched_task()
2543 */
2544 smp_mb();
2545
2546 return unlikely(tif_need_resched());
2547}
2548
2549static inline void __current_clr_polling(void)
2484{ 2550{
2485 current_thread_info()->status &= ~TS_POLLING; 2551 current_thread_info()->status &= ~TS_POLLING;
2486 smp_mb__after_clear_bit(); 2552}
2553
2554static inline bool __must_check current_clr_polling_and_test(void)
2555{
2556 __current_clr_polling();
2557
2558 /*
2559 * Polling state must be visible before we test NEED_RESCHED,
2560 * paired by resched_task()
2561 */
2562 smp_mb();
2563
2564 return unlikely(tif_need_resched());
2487} 2565}
2488#elif defined(TIF_POLLING_NRFLAG) 2566#elif defined(TIF_POLLING_NRFLAG)
2489static inline int tsk_is_polling(struct task_struct *p) 2567static inline int tsk_is_polling(struct task_struct *p)
2490{ 2568{
2491 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); 2569 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
2492} 2570}
2493static inline void current_set_polling(void) 2571
2572static inline void __current_set_polling(void)
2494{ 2573{
2495 set_thread_flag(TIF_POLLING_NRFLAG); 2574 set_thread_flag(TIF_POLLING_NRFLAG);
2496} 2575}
2497 2576
2498static inline void current_clr_polling(void) 2577static inline bool __must_check current_set_polling_and_test(void)
2578{
2579 __current_set_polling();
2580
2581 /*
2582 * Polling state must be visible before we test NEED_RESCHED,
2583 * paired by resched_task()
2584 *
2585 * XXX: assumes set/clear bit are identical barrier wise.
2586 */
2587 smp_mb__after_clear_bit();
2588
2589 return unlikely(tif_need_resched());
2590}
2591
2592static inline void __current_clr_polling(void)
2499{ 2593{
2500 clear_thread_flag(TIF_POLLING_NRFLAG); 2594 clear_thread_flag(TIF_POLLING_NRFLAG);
2501} 2595}
2596
2597static inline bool __must_check current_clr_polling_and_test(void)
2598{
2599 __current_clr_polling();
2600
2601 /*
2602 * Polling state must be visible before we test NEED_RESCHED,
2603 * paired by resched_task()
2604 */
2605 smp_mb__after_clear_bit();
2606
2607 return unlikely(tif_need_resched());
2608}
2609
2502#else 2610#else
2503static inline int tsk_is_polling(struct task_struct *p) { return 0; } 2611static inline int tsk_is_polling(struct task_struct *p) { return 0; }
2504static inline void current_set_polling(void) { } 2612static inline void __current_set_polling(void) { }
2505static inline void current_clr_polling(void) { } 2613static inline void __current_clr_polling(void) { }
2614
2615static inline bool __must_check current_set_polling_and_test(void)
2616{
2617 return unlikely(tif_need_resched());
2618}
2619static inline bool __must_check current_clr_polling_and_test(void)
2620{
2621 return unlikely(tif_need_resched());
2622}
2506#endif 2623#endif
2507 2624
2625static __always_inline bool need_resched(void)
2626{
2627 return unlikely(tif_need_resched());
2628}
2629
2508/* 2630/*
2509 * Thread group CPU time accounting. 2631 * Thread group CPU time accounting.
2510 */ 2632 */
@@ -2546,6 +2668,11 @@ static inline unsigned int task_cpu(const struct task_struct *p)
2546 return task_thread_info(p)->cpu; 2668 return task_thread_info(p)->cpu;
2547} 2669}
2548 2670
2671static inline int task_node(const struct task_struct *p)
2672{
2673 return cpu_to_node(task_cpu(p));
2674}
2675
2549extern void set_task_cpu(struct task_struct *p, unsigned int cpu); 2676extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
2550 2677
2551#else 2678#else
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index bf8086b2506e..10d16c4fbe89 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -47,7 +47,6 @@ extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
47extern unsigned int sysctl_numa_balancing_scan_delay; 47extern unsigned int sysctl_numa_balancing_scan_delay;
48extern unsigned int sysctl_numa_balancing_scan_period_min; 48extern unsigned int sysctl_numa_balancing_scan_period_min;
49extern unsigned int sysctl_numa_balancing_scan_period_max; 49extern unsigned int sysctl_numa_balancing_scan_period_max;
50extern unsigned int sysctl_numa_balancing_scan_period_reset;
51extern unsigned int sysctl_numa_balancing_scan_size; 50extern unsigned int sysctl_numa_balancing_scan_size;
52extern unsigned int sysctl_numa_balancing_settle_count; 51extern unsigned int sysctl_numa_balancing_settle_count;
53 52
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
index fa7922c80a41..cddf0c2940b6 100644
--- a/include/linux/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -15,7 +15,7 @@ static inline void sched_clock_postinit(void) { }
15#endif 15#endif
16 16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); 17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18 18extern void sched_clock_register(u64 (*read)(void), int bits,
19extern unsigned long long (*sched_clock_func)(void); 19 unsigned long rate);
20 20
21#endif 21#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b98291ac7f14..f729be981da0 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -66,7 +66,6 @@ struct uart_ops {
66 void (*set_ldisc)(struct uart_port *, int new); 66 void (*set_ldisc)(struct uart_port *, int new);
67 void (*pm)(struct uart_port *, unsigned int state, 67 void (*pm)(struct uart_port *, unsigned int state,
68 unsigned int oldstate); 68 unsigned int oldstate);
69 int (*set_wake)(struct uart_port *, unsigned int state);
70 69
71 /* 70 /*
72 * Return a string describing the type of the port 71 * Return a string describing the type of the port
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index d34049712a4d..50fe651da965 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -5,7 +5,7 @@
5#include <linux/sh_dma.h> 5#include <linux/sh_dma.h>
6 6
7/* 7/*
8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index fe817918b30e..d9b436f09925 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -59,6 +59,9 @@
59#ifndef _LINUX_SFI_H 59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H 60#define _LINUX_SFI_H
61 61
62#include <linux/init.h>
63#include <linux/types.h>
64
62/* Table signatures reserved by the SFI specification */ 65/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST" 66#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ" 67#define SFI_SIG_FREQ "FREQ"
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2ddb48d9312c..215b5ea1cb30 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -318,9 +318,13 @@ enum {
318 318
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_IPIP = 1 << 7,
322 322
323 SKB_GSO_MPLS = 1 << 8, 323 SKB_GSO_SIT = 1 << 8,
324
325 SKB_GSO_UDP_TUNNEL = 1 << 9,
326
327 SKB_GSO_MPLS = 1 << 10,
324}; 328};
325 329
326#if BITS_PER_LONG > 32 330#if BITS_PER_LONG > 32
@@ -333,11 +337,6 @@ typedef unsigned int sk_buff_data_t;
333typedef unsigned char *sk_buff_data_t; 337typedef unsigned char *sk_buff_data_t;
334#endif 338#endif
335 339
336#if defined(CONFIG_NF_DEFRAG_IPV4) || defined(CONFIG_NF_DEFRAG_IPV4_MODULE) || \
337 defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
338#define NET_SKBUFF_NF_DEFRAG_NEEDED 1
339#endif
340
341/** 340/**
342 * struct sk_buff - socket buffer 341 * struct sk_buff - socket buffer
343 * @next: Next buffer in list 342 * @next: Next buffer in list
@@ -370,7 +369,6 @@ typedef unsigned char *sk_buff_data_t;
370 * @protocol: Packet protocol from driver 369 * @protocol: Packet protocol from driver
371 * @destructor: Destruct function 370 * @destructor: Destruct function
372 * @nfct: Associated connection, if any 371 * @nfct: Associated connection, if any
373 * @nfct_reasm: netfilter conntrack re-assembly pointer
374 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 372 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
375 * @skb_iif: ifindex of device we arrived on 373 * @skb_iif: ifindex of device we arrived on
376 * @tc_index: Traffic control index 374 * @tc_index: Traffic control index
@@ -459,9 +457,6 @@ struct sk_buff {
459#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 457#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
460 struct nf_conntrack *nfct; 458 struct nf_conntrack *nfct;
461#endif 459#endif
462#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
463 struct sk_buff *nfct_reasm;
464#endif
465#ifdef CONFIG_BRIDGE_NETFILTER 460#ifdef CONFIG_BRIDGE_NETFILTER
466 struct nf_bridge_info *nf_bridge; 461 struct nf_bridge_info *nf_bridge;
467#endif 462#endif
@@ -498,7 +493,7 @@ struct sk_buff {
498 * headers if needed 493 * headers if needed
499 */ 494 */
500 __u8 encapsulation:1; 495 __u8 encapsulation:1;
501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 496 /* 6/8 bit hole (depending on ndisc_nodetype presence) */
502 kmemcheck_bitfield_end(flags2); 497 kmemcheck_bitfield_end(flags2);
503 498
504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 499#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -585,8 +580,8 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
585 skb->_skb_refdst = (unsigned long)dst; 580 skb->_skb_refdst = (unsigned long)dst;
586} 581}
587 582
588extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, 583void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
589 bool force); 584 bool force);
590 585
591/** 586/**
592 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference 587 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference
@@ -634,20 +629,20 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
634 return (struct rtable *)skb_dst(skb); 629 return (struct rtable *)skb_dst(skb);
635} 630}
636 631
637extern void kfree_skb(struct sk_buff *skb); 632void kfree_skb(struct sk_buff *skb);
638extern void kfree_skb_list(struct sk_buff *segs); 633void kfree_skb_list(struct sk_buff *segs);
639extern void skb_tx_error(struct sk_buff *skb); 634void skb_tx_error(struct sk_buff *skb);
640extern void consume_skb(struct sk_buff *skb); 635void consume_skb(struct sk_buff *skb);
641extern void __kfree_skb(struct sk_buff *skb); 636void __kfree_skb(struct sk_buff *skb);
642extern struct kmem_cache *skbuff_head_cache; 637extern struct kmem_cache *skbuff_head_cache;
643 638
644extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); 639void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
645extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, 640bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
646 bool *fragstolen, int *delta_truesize); 641 bool *fragstolen, int *delta_truesize);
647 642
648extern struct sk_buff *__alloc_skb(unsigned int size, 643struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
649 gfp_t priority, int flags, int node); 644 int node);
650extern struct sk_buff *build_skb(void *data, unsigned int frag_size); 645struct sk_buff *build_skb(void *data, unsigned int frag_size);
651static inline struct sk_buff *alloc_skb(unsigned int size, 646static inline struct sk_buff *alloc_skb(unsigned int size,
652 gfp_t priority) 647 gfp_t priority)
653{ 648{
@@ -660,41 +655,33 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
660 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); 655 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
661} 656}
662 657
663extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node); 658struct sk_buff *__alloc_skb_head(gfp_t priority, int node);
664static inline struct sk_buff *alloc_skb_head(gfp_t priority) 659static inline struct sk_buff *alloc_skb_head(gfp_t priority)
665{ 660{
666 return __alloc_skb_head(priority, -1); 661 return __alloc_skb_head(priority, -1);
667} 662}
668 663
669extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 664struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
670extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 665int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
671extern struct sk_buff *skb_clone(struct sk_buff *skb, 666struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
672 gfp_t priority); 667struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
673extern struct sk_buff *skb_copy(const struct sk_buff *skb, 668struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask);
674 gfp_t priority); 669
675extern struct sk_buff *__pskb_copy(struct sk_buff *skb, 670int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
676 int headroom, gfp_t gfp_mask); 671struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
677 672 unsigned int headroom);
678extern int pskb_expand_head(struct sk_buff *skb, 673struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
679 int nhead, int ntail, 674 int newtailroom, gfp_t priority);
680 gfp_t gfp_mask); 675int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
681extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 676 int len);
682 unsigned int headroom); 677int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
683extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 678int skb_pad(struct sk_buff *skb, int pad);
684 int newheadroom, int newtailroom,
685 gfp_t priority);
686extern int skb_to_sgvec(struct sk_buff *skb,
687 struct scatterlist *sg, int offset,
688 int len);
689extern int skb_cow_data(struct sk_buff *skb, int tailbits,
690 struct sk_buff **trailer);
691extern int skb_pad(struct sk_buff *skb, int pad);
692#define dev_kfree_skb(a) consume_skb(a) 679#define dev_kfree_skb(a) consume_skb(a)
693 680
694extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 681int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
695 int getfrag(void *from, char *to, int offset, 682 int getfrag(void *from, char *to, int offset,
696 int len,int odd, struct sk_buff *skb), 683 int len, int odd, struct sk_buff *skb),
697 void *from, int length); 684 void *from, int length);
698 685
699struct skb_seq_state { 686struct skb_seq_state {
700 __u32 lower_offset; 687 __u32 lower_offset;
@@ -706,18 +693,17 @@ struct skb_seq_state {
706 __u8 *frag_data; 693 __u8 *frag_data;
707}; 694};
708 695
709extern void skb_prepare_seq_read(struct sk_buff *skb, 696void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
710 unsigned int from, unsigned int to, 697 unsigned int to, struct skb_seq_state *st);
711 struct skb_seq_state *st); 698unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
712extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data, 699 struct skb_seq_state *st);
713 struct skb_seq_state *st); 700void skb_abort_seq_read(struct skb_seq_state *st);
714extern void skb_abort_seq_read(struct skb_seq_state *st);
715 701
716extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, 702unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
717 unsigned int to, struct ts_config *config, 703 unsigned int to, struct ts_config *config,
718 struct ts_state *state); 704 struct ts_state *state);
719 705
720extern void __skb_get_rxhash(struct sk_buff *skb); 706void __skb_get_rxhash(struct sk_buff *skb);
721static inline __u32 skb_get_rxhash(struct sk_buff *skb) 707static inline __u32 skb_get_rxhash(struct sk_buff *skb)
722{ 708{
723 if (!skb->l4_rxhash) 709 if (!skb->l4_rxhash)
@@ -1095,7 +1081,8 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
1095 * The "__skb_xxxx()" functions are the non-atomic ones that 1081 * The "__skb_xxxx()" functions are the non-atomic ones that
1096 * can only be called with interrupts disabled. 1082 * can only be called with interrupts disabled.
1097 */ 1083 */
1098extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); 1084void skb_insert(struct sk_buff *old, struct sk_buff *newsk,
1085 struct sk_buff_head *list);
1099static inline void __skb_insert(struct sk_buff *newsk, 1086static inline void __skb_insert(struct sk_buff *newsk,
1100 struct sk_buff *prev, struct sk_buff *next, 1087 struct sk_buff *prev, struct sk_buff *next,
1101 struct sk_buff_head *list) 1088 struct sk_buff_head *list)
@@ -1201,8 +1188,8 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
1201 __skb_insert(newsk, prev, prev->next, list); 1188 __skb_insert(newsk, prev, prev->next, list);
1202} 1189}
1203 1190
1204extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, 1191void skb_append(struct sk_buff *old, struct sk_buff *newsk,
1205 struct sk_buff_head *list); 1192 struct sk_buff_head *list);
1206 1193
1207static inline void __skb_queue_before(struct sk_buff_head *list, 1194static inline void __skb_queue_before(struct sk_buff_head *list,
1208 struct sk_buff *next, 1195 struct sk_buff *next,
@@ -1221,7 +1208,7 @@ static inline void __skb_queue_before(struct sk_buff_head *list,
1221 * 1208 *
1222 * A buffer cannot be placed on two lists at the same time. 1209 * A buffer cannot be placed on two lists at the same time.
1223 */ 1210 */
1224extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); 1211void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
1225static inline void __skb_queue_head(struct sk_buff_head *list, 1212static inline void __skb_queue_head(struct sk_buff_head *list,
1226 struct sk_buff *newsk) 1213 struct sk_buff *newsk)
1227{ 1214{
@@ -1238,7 +1225,7 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
1238 * 1225 *
1239 * A buffer cannot be placed on two lists at the same time. 1226 * A buffer cannot be placed on two lists at the same time.
1240 */ 1227 */
1241extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk); 1228void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
1242static inline void __skb_queue_tail(struct sk_buff_head *list, 1229static inline void __skb_queue_tail(struct sk_buff_head *list,
1243 struct sk_buff *newsk) 1230 struct sk_buff *newsk)
1244{ 1231{
@@ -1249,7 +1236,7 @@ static inline void __skb_queue_tail(struct sk_buff_head *list,
1249 * remove sk_buff from list. _Must_ be called atomically, and with 1236 * remove sk_buff from list. _Must_ be called atomically, and with
1250 * the list known.. 1237 * the list known..
1251 */ 1238 */
1252extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list); 1239void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
1253static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) 1240static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
1254{ 1241{
1255 struct sk_buff *next, *prev; 1242 struct sk_buff *next, *prev;
@@ -1270,7 +1257,7 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
1270 * so must be used with appropriate locks held only. The head item is 1257 * so must be used with appropriate locks held only. The head item is
1271 * returned or %NULL if the list is empty. 1258 * returned or %NULL if the list is empty.
1272 */ 1259 */
1273extern struct sk_buff *skb_dequeue(struct sk_buff_head *list); 1260struct sk_buff *skb_dequeue(struct sk_buff_head *list);
1274static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) 1261static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
1275{ 1262{
1276 struct sk_buff *skb = skb_peek(list); 1263 struct sk_buff *skb = skb_peek(list);
@@ -1287,7 +1274,7 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
1287 * so must be used with appropriate locks held only. The tail item is 1274 * so must be used with appropriate locks held only. The tail item is
1288 * returned or %NULL if the list is empty. 1275 * returned or %NULL if the list is empty.
1289 */ 1276 */
1290extern struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list); 1277struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
1291static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) 1278static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
1292{ 1279{
1293 struct sk_buff *skb = skb_peek_tail(list); 1280 struct sk_buff *skb = skb_peek_tail(list);
@@ -1361,7 +1348,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
1361 * @size: the length of the data 1348 * @size: the length of the data
1362 * 1349 *
1363 * As per __skb_fill_page_desc() -- initialises the @i'th fragment of 1350 * As per __skb_fill_page_desc() -- initialises the @i'th fragment of
1364 * @skb to point to &size bytes at offset @off within @page. In 1351 * @skb to point to @size bytes at offset @off within @page. In
1365 * addition updates @skb such that @i is the last fragment. 1352 * addition updates @skb such that @i is the last fragment.
1366 * 1353 *
1367 * Does not take any additional reference on the fragment. 1354 * Does not take any additional reference on the fragment.
@@ -1373,8 +1360,11 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
1373 skb_shinfo(skb)->nr_frags = i + 1; 1360 skb_shinfo(skb)->nr_frags = i + 1;
1374} 1361}
1375 1362
1376extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, 1363void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
1377 int off, int size, unsigned int truesize); 1364 int size, unsigned int truesize);
1365
1366void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
1367 unsigned int truesize);
1378 1368
1379#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1369#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1380#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) 1370#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb))
@@ -1418,7 +1408,8 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1418/* 1408/*
1419 * Add data to an sk_buff 1409 * Add data to an sk_buff
1420 */ 1410 */
1421extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len); 1411unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
1412unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
1422static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 1413static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
1423{ 1414{
1424 unsigned char *tmp = skb_tail_pointer(skb); 1415 unsigned char *tmp = skb_tail_pointer(skb);
@@ -1428,7 +1419,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
1428 return tmp; 1419 return tmp;
1429} 1420}
1430 1421
1431extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len); 1422unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
1432static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 1423static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
1433{ 1424{
1434 skb->data -= len; 1425 skb->data -= len;
@@ -1436,7 +1427,7 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
1436 return skb->data; 1427 return skb->data;
1437} 1428}
1438 1429
1439extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); 1430unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
1440static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 1431static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
1441{ 1432{
1442 skb->len -= len; 1433 skb->len -= len;
@@ -1449,7 +1440,7 @@ static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int l
1449 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); 1440 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1450} 1441}
1451 1442
1452extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1443unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1453 1444
1454static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1445static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
1455{ 1446{
@@ -1753,7 +1744,7 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1753#define NET_SKB_PAD max(32, L1_CACHE_BYTES) 1744#define NET_SKB_PAD max(32, L1_CACHE_BYTES)
1754#endif 1745#endif
1755 1746
1756extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1747int ___pskb_trim(struct sk_buff *skb, unsigned int len);
1757 1748
1758static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 1749static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1759{ 1750{
@@ -1765,7 +1756,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1765 skb_set_tail_pointer(skb, len); 1756 skb_set_tail_pointer(skb, len);
1766} 1757}
1767 1758
1768extern void skb_trim(struct sk_buff *skb, unsigned int len); 1759void skb_trim(struct sk_buff *skb, unsigned int len);
1769 1760
1770static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1761static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
1771{ 1762{
@@ -1838,7 +1829,7 @@ static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
1838 * the list and one reference dropped. This function does not take the 1829 * the list and one reference dropped. This function does not take the
1839 * list lock and the caller must hold the relevant locks to use it. 1830 * list lock and the caller must hold the relevant locks to use it.
1840 */ 1831 */
1841extern void skb_queue_purge(struct sk_buff_head *list); 1832void skb_queue_purge(struct sk_buff_head *list);
1842static inline void __skb_queue_purge(struct sk_buff_head *list) 1833static inline void __skb_queue_purge(struct sk_buff_head *list)
1843{ 1834{
1844 struct sk_buff *skb; 1835 struct sk_buff *skb;
@@ -1850,11 +1841,10 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1850#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER) 1841#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
1851#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE 1842#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE
1852 1843
1853extern void *netdev_alloc_frag(unsigned int fragsz); 1844void *netdev_alloc_frag(unsigned int fragsz);
1854 1845
1855extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1846struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length,
1856 unsigned int length, 1847 gfp_t gfp_mask);
1857 gfp_t gfp_mask);
1858 1848
1859/** 1849/**
1860 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1850 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -2071,6 +2061,8 @@ static inline void skb_frag_set_page(struct sk_buff *skb, int f,
2071 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); 2061 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page);
2072} 2062}
2073 2063
2064bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio);
2065
2074/** 2066/**
2075 * skb_frag_dma_map - maps a paged fragment via the DMA API 2067 * skb_frag_dma_map - maps a paged fragment via the DMA API
2076 * @dev: the device to map the fragment to 2068 * @dev: the device to map the fragment to
@@ -2342,60 +2334,49 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
2342#define skb_walk_frags(skb, iter) \ 2334#define skb_walk_frags(skb, iter) \
2343 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2335 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2344 2336
2345extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2337struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2346 int *peeked, int *off, int *err); 2338 int *peeked, int *off, int *err);
2347extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 2339struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
2348 int noblock, int *err); 2340 int *err);
2349extern unsigned int datagram_poll(struct file *file, struct socket *sock, 2341unsigned int datagram_poll(struct file *file, struct socket *sock,
2350 struct poll_table_struct *wait); 2342 struct poll_table_struct *wait);
2351extern int skb_copy_datagram_iovec(const struct sk_buff *from, 2343int skb_copy_datagram_iovec(const struct sk_buff *from, int offset,
2352 int offset, struct iovec *to, 2344 struct iovec *to, int size);
2353 int size); 2345int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen,
2354extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, 2346 struct iovec *iov);
2355 int hlen, 2347int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset,
2356 struct iovec *iov); 2348 const struct iovec *from, int from_offset,
2357extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 2349 int len);
2358 int offset, 2350int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *frm,
2359 const struct iovec *from, 2351 int offset, size_t count);
2360 int from_offset, 2352int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset,
2361 int len); 2353 const struct iovec *to, int to_offset,
2362extern int zerocopy_sg_from_iovec(struct sk_buff *skb, 2354 int size);
2363 const struct iovec *frm, 2355void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2364 int offset, 2356void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2365 size_t count); 2357int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
2366extern int skb_copy_datagram_const_iovec(const struct sk_buff *from, 2358int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
2367 int offset, 2359int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
2368 const struct iovec *to, 2360__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
2369 int to_offset, 2361 int len, __wsum csum);
2370 int size); 2362int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
2371extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 2363 struct pipe_inode_info *pipe, unsigned int len,
2372extern void skb_free_datagram_locked(struct sock *sk, 2364 unsigned int flags);
2373 struct sk_buff *skb); 2365void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2374extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 2366void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2375 unsigned int flags); 2367int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2376extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 2368void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2377 int len, __wsum csum); 2369struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2378extern int skb_copy_bits(const struct sk_buff *skb, int offset, 2370
2379 void *to, int len); 2371struct skb_checksum_ops {
2380extern int skb_store_bits(struct sk_buff *skb, int offset, 2372 __wsum (*update)(const void *mem, int len, __wsum wsum);
2381 const void *from, int len); 2373 __wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
2382extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 2374};
2383 int offset, u8 *to, int len, 2375
2384 __wsum csum); 2376__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2385extern int skb_splice_bits(struct sk_buff *skb, 2377 __wsum csum, const struct skb_checksum_ops *ops);
2386 unsigned int offset, 2378__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2387 struct pipe_inode_info *pipe, 2379 __wsum csum);
2388 unsigned int len,
2389 unsigned int flags);
2390extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2391extern void skb_split(struct sk_buff *skb,
2392 struct sk_buff *skb1, const u32 len);
2393extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2394 int shiftlen);
2395extern void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2396
2397extern struct sk_buff *skb_segment(struct sk_buff *skb,
2398 netdev_features_t features);
2399 2380
2400static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2381static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2401 int len, void *buffer) 2382 int len, void *buffer)
@@ -2440,7 +2421,7 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
2440 memcpy(skb->data + offset, from, len); 2421 memcpy(skb->data + offset, from, len);
2441} 2422}
2442 2423
2443extern void skb_init(void); 2424void skb_init(void);
2444 2425
2445static inline ktime_t skb_get_ktime(const struct sk_buff *skb) 2426static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
2446{ 2427{
@@ -2483,12 +2464,12 @@ static inline ktime_t net_invalid_timestamp(void)
2483 return ktime_set(0, 0); 2464 return ktime_set(0, 0);
2484} 2465}
2485 2466
2486extern void skb_timestamping_init(void); 2467void skb_timestamping_init(void);
2487 2468
2488#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2469#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2489 2470
2490extern void skb_clone_tx_timestamp(struct sk_buff *skb); 2471void skb_clone_tx_timestamp(struct sk_buff *skb);
2491extern bool skb_defer_rx_timestamp(struct sk_buff *skb); 2472bool skb_defer_rx_timestamp(struct sk_buff *skb);
2492 2473
2493#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ 2474#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
2494 2475
@@ -2529,8 +2510,8 @@ void skb_complete_tx_timestamp(struct sk_buff *skb,
2529 * generates a software time stamp (otherwise), then queues the clone 2510 * generates a software time stamp (otherwise), then queues the clone
2530 * to the error queue of the socket. Errors are silently ignored. 2511 * to the error queue of the socket. Errors are silently ignored.
2531 */ 2512 */
2532extern void skb_tstamp_tx(struct sk_buff *orig_skb, 2513void skb_tstamp_tx(struct sk_buff *orig_skb,
2533 struct skb_shared_hwtstamps *hwtstamps); 2514 struct skb_shared_hwtstamps *hwtstamps);
2534 2515
2535static inline void sw_tx_timestamp(struct sk_buff *skb) 2516static inline void sw_tx_timestamp(struct sk_buff *skb)
2536{ 2517{
@@ -2562,8 +2543,8 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2562 */ 2543 */
2563void skb_complete_wifi_ack(struct sk_buff *skb, bool acked); 2544void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2564 2545
2565extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2546__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2566extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2547__sum16 __skb_checksum_complete(struct sk_buff *skb);
2567 2548
2568static inline int skb_csum_unnecessary(const struct sk_buff *skb) 2549static inline int skb_csum_unnecessary(const struct sk_buff *skb)
2569{ 2550{
@@ -2593,7 +2574,7 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2593} 2574}
2594 2575
2595#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2576#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2596extern void nf_conntrack_destroy(struct nf_conntrack *nfct); 2577void nf_conntrack_destroy(struct nf_conntrack *nfct);
2597static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2578static inline void nf_conntrack_put(struct nf_conntrack *nfct)
2598{ 2579{
2599 if (nfct && atomic_dec_and_test(&nfct->use)) 2580 if (nfct && atomic_dec_and_test(&nfct->use))
@@ -2605,18 +2586,6 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2605 atomic_inc(&nfct->use); 2586 atomic_inc(&nfct->use);
2606} 2587}
2607#endif 2588#endif
2608#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2609static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
2610{
2611 if (skb)
2612 atomic_inc(&skb->users);
2613}
2614static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
2615{
2616 if (skb)
2617 kfree_skb(skb);
2618}
2619#endif
2620#ifdef CONFIG_BRIDGE_NETFILTER 2589#ifdef CONFIG_BRIDGE_NETFILTER
2621static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 2590static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2622{ 2591{
@@ -2635,10 +2604,6 @@ static inline void nf_reset(struct sk_buff *skb)
2635 nf_conntrack_put(skb->nfct); 2604 nf_conntrack_put(skb->nfct);
2636 skb->nfct = NULL; 2605 skb->nfct = NULL;
2637#endif 2606#endif
2638#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2639 nf_conntrack_put_reasm(skb->nfct_reasm);
2640 skb->nfct_reasm = NULL;
2641#endif
2642#ifdef CONFIG_BRIDGE_NETFILTER 2607#ifdef CONFIG_BRIDGE_NETFILTER
2643 nf_bridge_put(skb->nf_bridge); 2608 nf_bridge_put(skb->nf_bridge);
2644 skb->nf_bridge = NULL; 2609 skb->nf_bridge = NULL;
@@ -2660,10 +2625,6 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2660 nf_conntrack_get(src->nfct); 2625 nf_conntrack_get(src->nfct);
2661 dst->nfctinfo = src->nfctinfo; 2626 dst->nfctinfo = src->nfctinfo;
2662#endif 2627#endif
2663#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2664 dst->nfct_reasm = src->nfct_reasm;
2665 nf_conntrack_get_reasm(src->nfct_reasm);
2666#endif
2667#ifdef CONFIG_BRIDGE_NETFILTER 2628#ifdef CONFIG_BRIDGE_NETFILTER
2668 dst->nf_bridge = src->nf_bridge; 2629 dst->nf_bridge = src->nf_bridge;
2669 nf_bridge_get(src->nf_bridge); 2630 nf_bridge_get(src->nf_bridge);
@@ -2675,9 +2636,6 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2675#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2636#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2676 nf_conntrack_put(dst->nfct); 2637 nf_conntrack_put(dst->nfct);
2677#endif 2638#endif
2678#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2679 nf_conntrack_put_reasm(dst->nfct_reasm);
2680#endif
2681#ifdef CONFIG_BRIDGE_NETFILTER 2639#ifdef CONFIG_BRIDGE_NETFILTER
2682 nf_bridge_put(dst->nf_bridge); 2640 nf_bridge_put(dst->nf_bridge);
2683#endif 2641#endif
@@ -2732,28 +2690,27 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
2732 return skb->queue_mapping != 0; 2690 return skb->queue_mapping != 0;
2733} 2691}
2734 2692
2735extern u16 __skb_tx_hash(const struct net_device *dev, 2693u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb,
2736 const struct sk_buff *skb, 2694 unsigned int num_tx_queues);
2737 unsigned int num_tx_queues);
2738 2695
2739#ifdef CONFIG_XFRM
2740static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2696static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2741{ 2697{
2698#ifdef CONFIG_XFRM
2742 return skb->sp; 2699 return skb->sp;
2743}
2744#else 2700#else
2745static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2746{
2747 return NULL; 2701 return NULL;
2748}
2749#endif 2702#endif
2703}
2750 2704
2751/* Keeps track of mac header offset relative to skb->head. 2705/* Keeps track of mac header offset relative to skb->head.
2752 * It is useful for TSO of Tunneling protocol. e.g. GRE. 2706 * It is useful for TSO of Tunneling protocol. e.g. GRE.
2753 * For non-tunnel skb it points to skb_mac_header() and for 2707 * For non-tunnel skb it points to skb_mac_header() and for
2754 * tunnel skb it points to outer mac header. */ 2708 * tunnel skb it points to outer mac header.
2709 * Keeps track of level of encapsulation of network headers.
2710 */
2755struct skb_gso_cb { 2711struct skb_gso_cb {
2756 int mac_offset; 2712 int mac_offset;
2713 int encap_level;
2757}; 2714};
2758#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) 2715#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2759 2716
@@ -2783,12 +2740,13 @@ static inline bool skb_is_gso(const struct sk_buff *skb)
2783 return skb_shinfo(skb)->gso_size; 2740 return skb_shinfo(skb)->gso_size;
2784} 2741}
2785 2742
2743/* Note: Should be called only if skb_is_gso(skb) is true */
2786static inline bool skb_is_gso_v6(const struct sk_buff *skb) 2744static inline bool skb_is_gso_v6(const struct sk_buff *skb)
2787{ 2745{
2788 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 2746 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
2789} 2747}
2790 2748
2791extern void __skb_warn_lro_forwarding(const struct sk_buff *skb); 2749void __skb_warn_lro_forwarding(const struct sk_buff *skb);
2792 2750
2793static inline bool skb_warn_if_lro(const struct sk_buff *skb) 2751static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2794{ 2752{
diff --git a/include/linux/smp.h b/include/linux/smp.h
index cfb7ca094b38..731f5237d5f4 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -155,6 +155,12 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
155 155
156static inline void kick_all_cpus_sync(void) { } 156static inline void kick_all_cpus_sync(void) { }
157 157
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
158#endif /* !SMP */ 164#endif /* !SMP */
159 165
160/* 166/*
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/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 86a12b0cb239..0688472500bb 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -108,6 +108,16 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
108 return 0; 108 return 0;
109} 109}
110 110
111/* Get the device phy address */
112static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
113{
114 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
115 if (!dev)
116 return -ENODEV;
117
118 return dev->dev->bus->sprom.et0phyaddr;
119}
120
111extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 121extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
112 struct pci_dev *pdev); 122 struct pci_dev *pdev);
113extern int ssb_gige_map_irq(struct ssb_device *sdev, 123extern int ssb_gige_map_irq(struct ssb_device *sdev,
@@ -174,6 +184,10 @@ static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
174{ 184{
175 return -ENODEV; 185 return -ENODEV;
176} 186}
187static inline int ssb_gige_get_phyaddr(struct pci_dev *pdev)
188{
189 return -ENODEV;
190}
177 191
178#endif /* CONFIG_SSB_DRIVER_GIGE */ 192#endif /* CONFIG_SSB_DRIVER_GIGE */
179#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ 193#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 3b5e910d14ca..d2abbdb8c6aa 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -28,6 +28,7 @@ struct cpu_stop_work {
28}; 28};
29 29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); 30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, 32void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf); 33 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); 34int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6740801aa71a..8af2804bab16 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -49,6 +49,7 @@ struct rpc_clnt {
49 49
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_discrtry : 1,/* disconnect before retry */ 51 cl_discrtry : 1,/* disconnect before retry */
52 cl_noretranstimeo: 1,/* No retransmit timeouts */
52 cl_autobind : 1,/* use getport() */ 53 cl_autobind : 1,/* use getport() */
53 cl_chatty : 1;/* be verbose */ 54 cl_chatty : 1;/* be verbose */
54 55
@@ -126,6 +127,7 @@ struct rpc_create_args {
126#define RPC_CLNT_CREATE_QUIET (1UL << 6) 127#define RPC_CLNT_CREATE_QUIET (1UL << 6)
127#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) 128#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7)
128#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) 129#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)
130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
129 131
130struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132struct rpc_clnt *rpc_create(struct rpc_create_args *args);
131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 133struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
@@ -134,6 +136,10 @@ void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
134struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 136struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
135struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, 137struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *,
136 rpc_authflavor_t); 138 rpc_authflavor_t);
139int rpc_switch_client_transport(struct rpc_clnt *,
140 struct xprt_create *,
141 const struct rpc_timeout *);
142
137void rpc_shutdown_client(struct rpc_clnt *); 143void rpc_shutdown_client(struct rpc_clnt *);
138void rpc_release_client(struct rpc_clnt *); 144void rpc_release_client(struct rpc_clnt *);
139void rpc_task_release_client(struct rpc_task *); 145void rpc_task_release_client(struct rpc_task *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 096ee58be11a..3a847de83fab 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -122,6 +122,7 @@ struct rpc_task_setup {
122#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ 124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
125#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
125 126
126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 127#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 128#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cec7b9b5e1bf..8097b9df6773 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -288,7 +288,7 @@ int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
291int xprt_prepare_transmit(struct rpc_task *task); 291bool xprt_prepare_transmit(struct rpc_task *task);
292void xprt_transmit(struct rpc_task *task); 292void xprt_transmit(struct rpc_task *task);
293void xprt_end_transmit(struct rpc_task *task); 293void xprt_end_transmit(struct rpc_task *task);
294int xprt_adjust_timeout(struct rpc_rqst *req); 294int xprt_adjust_timeout(struct rpc_rqst *req);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7fac04e7ff6e..c27f846f6b71 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -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/sysfs.h b/include/linux/sysfs.h
index 11baec7c9b26..6695040a0317 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -173,7 +173,6 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
173struct sysfs_ops { 173struct sysfs_ops {
174 ssize_t (*show)(struct kobject *, struct attribute *, char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
176 const void *(*namespace)(struct kobject *, const struct attribute *);
177}; 176};
178 177
179struct sysfs_dirent; 178struct sysfs_dirent;
@@ -183,19 +182,23 @@ struct sysfs_dirent;
183int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 182int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
184 void *data, struct module *owner); 183 void *data, struct module *owner);
185 184
186int __must_check sysfs_create_dir(struct kobject *kobj); 185int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
187void sysfs_remove_dir(struct kobject *kobj); 186void sysfs_remove_dir(struct kobject *kobj);
188int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); 187int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
189int __must_check sysfs_move_dir(struct kobject *kobj, 188 const void *new_ns);
190 struct kobject *new_parent_kobj); 189int __must_check sysfs_move_dir_ns(struct kobject *kobj,
191 190 struct kobject *new_parent_kobj,
192int __must_check sysfs_create_file(struct kobject *kobj, 191 const void *new_ns);
193 const struct attribute *attr); 192
193int __must_check sysfs_create_file_ns(struct kobject *kobj,
194 const struct attribute *attr,
195 const void *ns);
194int __must_check sysfs_create_files(struct kobject *kobj, 196int __must_check sysfs_create_files(struct kobject *kobj,
195 const struct attribute **attr); 197 const struct attribute **attr);
196int __must_check sysfs_chmod_file(struct kobject *kobj, 198int __must_check sysfs_chmod_file(struct kobject *kobj,
197 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
198void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
201 const void *ns);
199void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 202void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
200 203
201int __must_check sysfs_create_bin_file(struct kobject *kobj, 204int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -210,8 +213,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
210 const char *name); 213 const char *name);
211void sysfs_remove_link(struct kobject *kobj, const char *name); 214void sysfs_remove_link(struct kobject *kobj, const char *name);
212 215
213int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 216int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
214 const char *old_name, const char *new_name); 217 const char *old_name, const char *new_name,
218 const void *new_ns);
215 219
216void sysfs_delete_link(struct kobject *dir, struct kobject *targ, 220void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
217 const char *name); 221 const char *name);
@@ -241,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
241 245
242void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
243void sysfs_notify_dirent(struct sysfs_dirent *sd); 247void sysfs_notify_dirent(struct sysfs_dirent *sd);
244struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 248struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
245 const void *ns, 249 const unsigned char *name,
246 const unsigned char *name); 250 const void *ns);
247struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
248void sysfs_put(struct sysfs_dirent *sd); 252void sysfs_put(struct sysfs_dirent *sd);
249 253
@@ -257,7 +261,7 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
257 return -ENOSYS; 261 return -ENOSYS;
258} 262}
259 263
260static inline int sysfs_create_dir(struct kobject *kobj) 264static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
261{ 265{
262 return 0; 266 return 0;
263} 267}
@@ -266,19 +270,22 @@ static inline void sysfs_remove_dir(struct kobject *kobj)
266{ 270{
267} 271}
268 272
269static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 273static inline int sysfs_rename_dir_ns(struct kobject *kobj,
274 const char *new_name, const void *new_ns)
270{ 275{
271 return 0; 276 return 0;
272} 277}
273 278
274static inline int sysfs_move_dir(struct kobject *kobj, 279static inline int sysfs_move_dir_ns(struct kobject *kobj,
275 struct kobject *new_parent_kobj) 280 struct kobject *new_parent_kobj,
281 const void *new_ns)
276{ 282{
277 return 0; 283 return 0;
278} 284}
279 285
280static inline int sysfs_create_file(struct kobject *kobj, 286static inline int sysfs_create_file_ns(struct kobject *kobj,
281 const struct attribute *attr) 287 const struct attribute *attr,
288 const void *ns)
282{ 289{
283 return 0; 290 return 0;
284} 291}
@@ -295,8 +302,9 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
295 return 0; 302 return 0;
296} 303}
297 304
298static inline void sysfs_remove_file(struct kobject *kobj, 305static inline void sysfs_remove_file_ns(struct kobject *kobj,
299 const struct attribute *attr) 306 const struct attribute *attr,
307 const void *ns)
300{ 308{
301} 309}
302 310
@@ -333,8 +341,9 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
333{ 341{
334} 342}
335 343
336static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, 344static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t,
337 const char *old_name, const char *new_name) 345 const char *old_name,
346 const char *new_name, const void *ns)
338{ 347{
339 return 0; 348 return 0;
340} 349}
@@ -413,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
413static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) 422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
414{ 423{
415} 424}
416static inline 425static inline struct sysfs_dirent *
417struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 426sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
418 const void *ns, 427 const void *ns)
419 const unsigned char *name)
420{ 428{
421 return NULL; 429 return NULL;
422} 430}
@@ -435,4 +443,28 @@ static inline int __must_check sysfs_init(void)
435 443
436#endif /* CONFIG_SYSFS */ 444#endif /* CONFIG_SYSFS */
437 445
446static inline int __must_check sysfs_create_file(struct kobject *kobj,
447 const struct attribute *attr)
448{
449 return sysfs_create_file_ns(kobj, attr, NULL);
450}
451
452static inline void sysfs_remove_file(struct kobject *kobj,
453 const struct attribute *attr)
454{
455 return sysfs_remove_file_ns(kobj, attr, NULL);
456}
457
458static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
459 const char *old_name, const char *new_name)
460{
461 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
462}
463
464static inline struct sysfs_dirent *
465sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
466{
467 return sysfs_get_dirent_ns(parent_sd, name, NULL);
468}
469
438#endif /* _SYSFS_H_ */ 470#endif /* _SYSFS_H_ */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 7faf933cced7..387fa7d05c98 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -17,9 +17,6 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
21#define SYSRQ_DEFAULT_ENABLE 1
22
23/* Possible values of bitmask for enabling sysrq functions */ 20/* Possible values of bitmask for enabling sysrq functions */
24/* 0x0001 is reserved for enable everything */ 21/* 0x0001 is reserved for enable everything */
25#define SYSRQ_ENABLE_LOG 0x0002 22#define SYSRQ_ENABLE_LOG 0x0002
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
index 55c29a8d5015..c98cfa406952 100644
--- a/include/linux/tegra-powergate.h
+++ b/include/linux/tegra-powergate.h
@@ -34,8 +34,15 @@ struct clk;
34#define TEGRA_POWERGATE_CPU3 11 34#define TEGRA_POWERGATE_CPU3 11
35#define TEGRA_POWERGATE_CELP 12 35#define TEGRA_POWERGATE_CELP 12
36#define TEGRA_POWERGATE_3D1 13 36#define TEGRA_POWERGATE_3D1 13
37#define TEGRA_POWERGATE_CPU0 14
38#define TEGRA_POWERGATE_C0NC 15
39#define TEGRA_POWERGATE_C1NC 16
40#define TEGRA_POWERGATE_DIS 18
41#define TEGRA_POWERGATE_DISB 19
42#define TEGRA_POWERGATE_XUSBA 20
43#define TEGRA_POWERGATE_XUSBB 21
44#define TEGRA_POWERGATE_XUSBC 22
37 45
38#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
39#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 46#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
40 47
41int tegra_powergate_is_powered(int id); 48int tegra_powergate_is_powered(int id);
diff --git a/include/linux/thinkpad_acpi.h b/include/linux/thinkpad_acpi.h
new file mode 100644
index 000000000000..361de59a2285
--- /dev/null
+++ b/include/linux/thinkpad_acpi.h
@@ -0,0 +1,15 @@
1#ifndef __THINKPAD_ACPI_H__
2#define __THINKPAD_ACPI_H__
3
4/* These two functions return 0 if success, or negative error code
5 (e g -ENODEV if no led present) */
6
7enum {
8 TPACPI_LED_MUTE,
9 TPACPI_LED_MICMUTE,
10 TPACPI_LED_MAX,
11};
12
13int tpacpi_led_set(int whichled, bool on);
14
15#endif
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index e7e04736802f..fddbe2023a5d 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -104,8 +104,21 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
104#define test_thread_flag(flag) \ 104#define test_thread_flag(flag) \
105 test_ti_thread_flag(current_thread_info(), flag) 105 test_ti_thread_flag(current_thread_info(), flag)
106 106
107#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 107static inline __deprecated void set_need_resched(void)
108#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 108{
109 /*
110 * Use of this function in deprecated.
111 *
112 * As of this writing there are only a few users in the DRM tree left
113 * all of which are wrong and can be removed without causing too much
114 * grief.
115 *
116 * The DRM people are aware and are working on removing the last few
117 * instances.
118 */
119}
120
121#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
109 122
110#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK 123#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
111/* 124/*
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b3726e61368e..9d3f1a5b6178 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -64,6 +64,20 @@
64 64
65#include <asm/timex.h> 65#include <asm/timex.h>
66 66
67#ifndef random_get_entropy
68/*
69 * The random_get_entropy() function is used by the /dev/random driver
70 * in order to extract entropy via the relative unpredictability of
71 * when an interrupt takes places versus a high speed, fine-grained
72 * timing source or cycle counter. Since it will be occurred on every
73 * single interrupt, it must have a very low cost/overhead.
74 *
75 * By default we use get_cycles() for this purpose, but individual
76 * architectures may override this in their asm/timex.h header file.
77 */
78#define random_get_entropy() get_cycles()
79#endif
80
67/* 81/*
68 * SHIFT_PLL is used as a dampening factor to define how much we 82 * SHIFT_PLL is used as a dampening factor to define how much we
69 * adjust the frequency correction for a given offset in PLL mode. 83 * adjust the frequency correction for a given offset in PLL mode.
@@ -141,6 +155,7 @@ extern int do_adjtimex(struct timex *);
141extern void hardpps(const struct timespec *, const struct timespec *); 155extern void hardpps(const struct timespec *, const struct timespec *);
142 156
143int read_current_timer(unsigned long *timer_val); 157int read_current_timer(unsigned long *timer_val);
158void ntp_notify_cmos_timer(void);
144 159
145/* The clock frequency of the i8253/i8254 PIT */ 160/* The clock frequency of the i8253/i8254 PIT */
146#define PIT_TICK_RATE 1193182ul 161#define PIT_TICK_RATE 1193182ul
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d3cf0d6e7712..12ae6ce997d6 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -106,6 +106,8 @@ int arch_update_cpu_topology(void);
106 .last_balance = jiffies, \ 106 .last_balance = jiffies, \
107 .balance_interval = 1, \ 107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \ 108 .smt_gain = 1178, /* 15% */ \
109 .max_newidle_lb_cost = 0, \
110 .next_decay_max_lb_cost = jiffies, \
109} 111}
110#endif 112#endif
111#endif /* CONFIG_SCHED_SMT */ 113#endif /* CONFIG_SCHED_SMT */
@@ -135,6 +137,8 @@ int arch_update_cpu_topology(void);
135 , \ 137 , \
136 .last_balance = jiffies, \ 138 .last_balance = jiffies, \
137 .balance_interval = 1, \ 139 .balance_interval = 1, \
140 .max_newidle_lb_cost = 0, \
141 .next_decay_max_lb_cost = jiffies, \
138} 142}
139#endif 143#endif
140#endif /* CONFIG_SCHED_MC */ 144#endif /* CONFIG_SCHED_MC */
@@ -166,6 +170,8 @@ int arch_update_cpu_topology(void);
166 , \ 170 , \
167 .last_balance = jiffies, \ 171 .last_balance = jiffies, \
168 .balance_interval = 1, \ 172 .balance_interval = 1, \
173 .max_newidle_lb_cost = 0, \
174 .next_decay_max_lb_cost = jiffies, \
169} 175}
170#endif 176#endif
171 177
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 64f864651d86..97d660ed70c1 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -180,7 +180,6 @@ struct tty_port_operations {
180 IFF the port was initialized. Do not use to free resources. Called 180 IFF the port was initialized. Do not use to free resources. Called
181 under the port mutex to serialize against activate/shutdowns */ 181 under the port mutex to serialize against activate/shutdowns */
182 void (*shutdown)(struct tty_port *port); 182 void (*shutdown)(struct tty_port *port);
183 void (*drop)(struct tty_port *port);
184 /* Called under the port mutex from tty_port_open, serialized using 183 /* Called under the port mutex from tty_port_open, serialized using
185 the port mutex */ 184 the port mutex */
186 /* FIXME: long term getting the tty argument *out* of this would be 185 /* FIXME: long term getting the tty argument *out* of this would be
@@ -672,31 +671,17 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
672#define wait_event_interruptible_tty(tty, wq, condition) \ 671#define wait_event_interruptible_tty(tty, wq, condition) \
673({ \ 672({ \
674 int __ret = 0; \ 673 int __ret = 0; \
675 if (!(condition)) { \ 674 if (!(condition)) \
676 __wait_event_interruptible_tty(tty, wq, condition, __ret); \ 675 __ret = __wait_event_interruptible_tty(tty, wq, \
677 } \ 676 condition); \
678 __ret; \ 677 __ret; \
679}) 678})
680 679
681#define __wait_event_interruptible_tty(tty, wq, condition, ret) \ 680#define __wait_event_interruptible_tty(tty, wq, condition) \
682do { \ 681 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
683 DEFINE_WAIT(__wait); \ 682 tty_unlock(tty); \
684 \
685 for (;;) { \
686 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
687 if (condition) \
688 break; \
689 if (!signal_pending(current)) { \
690 tty_unlock(tty); \
691 schedule(); \ 683 schedule(); \
692 tty_lock(tty); \ 684 tty_lock(tty))
693 continue; \
694 } \
695 ret = -ERESTARTSYS; \
696 break; \
697 } \
698 finish_wait(&wq, &__wait); \
699} while (0)
700 685
701#ifdef CONFIG_PROC_FS 686#ifdef CONFIG_PROC_FS
702extern void proc_tty_register_driver(struct tty_driver *); 687extern void proc_tty_register_driver(struct tty_driver *);
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 5ca0951e1855..9d8cf056e661 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -15,7 +15,7 @@
15 */ 15 */
16static inline void pagefault_disable(void) 16static inline void pagefault_disable(void)
17{ 17{
18 inc_preempt_count(); 18 preempt_count_inc();
19 /* 19 /*
20 * make sure to have issued the store before a pagefault 20 * make sure to have issued the store before a pagefault
21 * can hit. 21 * can hit.
@@ -30,11 +30,7 @@ static inline void pagefault_enable(void)
30 * the pagefault handler again. 30 * the pagefault handler again.
31 */ 31 */
32 barrier(); 32 barrier();
33 dec_preempt_count(); 33 preempt_count_dec();
34 /*
35 * make sure we do..
36 */
37 barrier();
38 preempt_check_resched(); 34 preempt_check_resched();
39} 35}
40 36
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 06f28beed7c2..319eae70fe84 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -30,6 +30,7 @@
30struct vm_area_struct; 30struct vm_area_struct;
31struct mm_struct; 31struct mm_struct;
32struct inode; 32struct inode;
33struct notifier_block;
33 34
34#ifdef CONFIG_ARCH_SUPPORTS_UPROBES 35#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
35# include <asm/uprobes.h> 36# include <asm/uprobes.h>
@@ -108,6 +109,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
108extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 109extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
109extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 110extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
110extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 111extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
112extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
111extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 113extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
112extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 114extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
113extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 115extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -117,14 +119,21 @@ extern void uprobe_start_dup_mmap(void);
117extern void uprobe_end_dup_mmap(void); 119extern void uprobe_end_dup_mmap(void);
118extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 120extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
119extern void uprobe_free_utask(struct task_struct *t); 121extern void uprobe_free_utask(struct task_struct *t);
120extern void uprobe_copy_process(struct task_struct *t); 122extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
121extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 123extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
122extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 124extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
123extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 125extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
124extern void uprobe_notify_resume(struct pt_regs *regs); 126extern void uprobe_notify_resume(struct pt_regs *regs);
125extern bool uprobe_deny_signal(void); 127extern bool uprobe_deny_signal(void);
126extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs); 128extern bool arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
127extern void uprobe_clear_state(struct mm_struct *mm); 129extern void uprobe_clear_state(struct mm_struct *mm);
130extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
131extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
132extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
133extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
134extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
135extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
136extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
128#else /* !CONFIG_UPROBES */ 137#else /* !CONFIG_UPROBES */
129struct uprobes_state { 138struct uprobes_state {
130}; 139};
@@ -174,7 +183,7 @@ static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
174static inline void uprobe_free_utask(struct task_struct *t) 183static inline void uprobe_free_utask(struct task_struct *t)
175{ 184{
176} 185}
177static inline void uprobe_copy_process(struct task_struct *t) 186static inline void uprobe_copy_process(struct task_struct *t, unsigned long flags)
178{ 187{
179} 188}
180static inline void uprobe_clear_state(struct mm_struct *mm) 189static inline void uprobe_clear_state(struct mm_struct *mm)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 001629cd1a97..7454865ad148 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -475,7 +475,8 @@ struct usb3_lpm_parameters {
475 * @lpm_capable: device supports LPM 475 * @lpm_capable: device supports LPM
476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM 477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
478 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 478 * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled
479 * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled
479 * @usb3_lpm_enabled: USB3 hardware LPM enabled 480 * @usb3_lpm_enabled: USB3 hardware LPM enabled
480 * @string_langid: language ID for strings 481 * @string_langid: language ID for strings
481 * @product: iProduct string, if present (static) 482 * @product: iProduct string, if present (static)
@@ -548,6 +549,7 @@ struct usb_device {
548 unsigned usb2_hw_lpm_capable:1; 549 unsigned usb2_hw_lpm_capable:1;
549 unsigned usb2_hw_lpm_besl_capable:1; 550 unsigned usb2_hw_lpm_besl_capable:1;
550 unsigned usb2_hw_lpm_enabled:1; 551 unsigned usb2_hw_lpm_enabled:1;
552 unsigned usb2_hw_lpm_allowed:1;
551 unsigned usb3_lpm_enabled:1; 553 unsigned usb3_lpm_enabled:1;
552 int string_langid; 554 int string_langid;
553 555
@@ -702,7 +704,7 @@ extern int usb_alloc_streams(struct usb_interface *interface,
702 unsigned int num_streams, gfp_t mem_flags); 704 unsigned int num_streams, gfp_t mem_flags);
703 705
704/* Reverts a group of bulk endpoints back to not using stream IDs. */ 706/* Reverts a group of bulk endpoints back to not using stream IDs. */
705extern void usb_free_streams(struct usb_interface *interface, 707extern int usb_free_streams(struct usb_interface *interface,
706 struct usb_host_endpoint **eps, unsigned int num_eps, 708 struct usb_host_endpoint **eps, unsigned int num_eps,
707 gfp_t mem_flags); 709 gfp_t mem_flags);
708 710
@@ -1209,11 +1211,13 @@ struct usb_anchor {
1209 struct list_head urb_list; 1211 struct list_head urb_list;
1210 wait_queue_head_t wait; 1212 wait_queue_head_t wait;
1211 spinlock_t lock; 1213 spinlock_t lock;
1214 atomic_t suspend_wakeups;
1212 unsigned int poisoned:1; 1215 unsigned int poisoned:1;
1213}; 1216};
1214 1217
1215static inline void init_usb_anchor(struct usb_anchor *anchor) 1218static inline void init_usb_anchor(struct usb_anchor *anchor)
1216{ 1219{
1220 memset(anchor, 0, sizeof(*anchor));
1217 INIT_LIST_HEAD(&anchor->urb_list); 1221 INIT_LIST_HEAD(&anchor->urb_list);
1218 init_waitqueue_head(&anchor->wait); 1222 init_waitqueue_head(&anchor->wait);
1219 spin_lock_init(&anchor->lock); 1223 spin_lock_init(&anchor->lock);
@@ -1574,6 +1578,8 @@ extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1574extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1578extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1575extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1579extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1576extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1580extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1581extern void usb_anchor_suspend_wakeups(struct usb_anchor *anchor);
1582extern void usb_anchor_resume_wakeups(struct usb_anchor *anchor);
1577extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1583extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1578extern void usb_unanchor_urb(struct urb *urb); 1584extern void usb_unanchor_urb(struct urb *urb);
1579extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1585extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index cc25b70af33c..c3fa80745996 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -36,6 +36,9 @@
36 * SUCH DAMAGE. 36 * SUCH DAMAGE.
37 */ 37 */
38 38
39#ifndef __LINUX_USB_CDC_NCM_H
40#define __LINUX_USB_CDC_NCM_H
41
39#define CDC_NCM_COMM_ALTSETTING_NCM 0 42#define CDC_NCM_COMM_ALTSETTING_NCM 0
40#define CDC_NCM_COMM_ALTSETTING_MBIM 1 43#define CDC_NCM_COMM_ALTSETTING_MBIM 1
41 44
@@ -85,22 +88,13 @@
85#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) 88#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB)
86 89
87struct cdc_ncm_ctx { 90struct cdc_ncm_ctx {
88 struct usb_cdc_ncm_ntb_parameters ncm_parm;
89 struct hrtimer tx_timer; 91 struct hrtimer tx_timer;
90 struct tasklet_struct bh; 92 struct tasklet_struct bh;
91 93
92 const struct usb_cdc_ncm_desc *func_desc; 94 const struct usb_cdc_ncm_desc *func_desc;
93 const struct usb_cdc_mbim_desc *mbim_desc; 95 const struct usb_cdc_mbim_desc *mbim_desc;
94 const struct usb_cdc_header_desc *header_desc;
95 const struct usb_cdc_union_desc *union_desc;
96 const struct usb_cdc_ether_desc *ether_desc; 96 const struct usb_cdc_ether_desc *ether_desc;
97 97
98 struct net_device *netdev;
99 struct usb_device *udev;
100 struct usb_host_endpoint *in_ep;
101 struct usb_host_endpoint *out_ep;
102 struct usb_host_endpoint *status_ep;
103 struct usb_interface *intf;
104 struct usb_interface *control; 98 struct usb_interface *control;
105 struct usb_interface *data; 99 struct usb_interface *data;
106 100
@@ -113,8 +107,6 @@ struct cdc_ncm_ctx {
113 107
114 u32 tx_timer_pending; 108 u32 tx_timer_pending;
115 u32 tx_curr_frame_num; 109 u32 tx_curr_frame_num;
116 u32 rx_speed;
117 u32 tx_speed;
118 u32 rx_max; 110 u32 rx_max;
119 u32 tx_max; 111 u32 tx_max;
120 u32 max_datagram_size; 112 u32 max_datagram_size;
@@ -127,9 +119,14 @@ struct cdc_ncm_ctx {
127 u16 connected; 119 u16 connected;
128}; 120};
129 121
130extern u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); 122u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf);
131extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 123int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
132extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 124void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
133extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); 125struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
134extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); 126int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
135extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset); 127int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
128struct sk_buff *
129cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
130int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);
131
132#endif /* __LINUX_USB_CDC_NCM_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 75efc45eaa2f..b8aba196f7f1 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -73,6 +73,7 @@ struct giveback_urb_bh {
73 spinlock_t lock; 73 spinlock_t lock;
74 struct list_head head; 74 struct list_head head;
75 struct tasklet_struct bh; 75 struct tasklet_struct bh;
76 struct usb_host_endpoint *completing_ep;
76}; 77};
77 78
78struct usb_hcd { 79struct usb_hcd {
@@ -140,6 +141,7 @@ struct usb_hcd {
140 unsigned wireless:1; /* Wireless USB HCD */ 141 unsigned wireless:1; /* Wireless USB HCD */
141 unsigned authorized_default:1; 142 unsigned authorized_default:1;
142 unsigned has_tt:1; /* Integrated TT in root hub */ 143 unsigned has_tt:1; /* Integrated TT in root hub */
144 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
143 145
144 unsigned int irq; /* irq allocated */ 146 unsigned int irq; /* irq allocated */
145 void __iomem *regs; /* device memory/io */ 147 void __iomem *regs; /* device memory/io */
@@ -378,6 +380,12 @@ static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
378 return hcd->driver->flags & HCD_BH; 380 return hcd->driver->flags & HCD_BH;
379} 381}
380 382
383static inline bool hcd_periodic_completion_in_progress(struct usb_hcd *hcd,
384 struct usb_host_endpoint *ep)
385{
386 return hcd->high_prio_bh.completing_ep == ep;
387}
388
381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 389extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 390extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
383 int status); 391 int status);
@@ -428,6 +436,8 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
428extern void usb_hcd_pci_remove(struct pci_dev *dev); 436extern void usb_hcd_pci_remove(struct pci_dev *dev);
429extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 437extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
430 438
439extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
440
431#ifdef CONFIG_PM 441#ifdef CONFIG_PM
432extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 442extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
433#endif 443#endif
@@ -496,6 +506,7 @@ struct usb_tt {
496 struct usb_device *hub; /* upstream highspeed hub */ 506 struct usb_device *hub; /* upstream highspeed hub */
497 int multi; /* true means one TT per port */ 507 int multi; /* true means one TT per port */
498 unsigned think_time; /* think time in ns */ 508 unsigned think_time; /* think time in ns */
509 void *hcpriv; /* HCD private data */
499 510
500 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ 511 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
501 spinlock_t lock; 512 spinlock_t lock;
@@ -554,9 +565,8 @@ extern void usb_ep0_reinit(struct usb_device *);
554 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ 565 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
555 /* bytecount = data payload byte count */ 566 /* bytecount = data payload byte count */
556 567
557#define NS_TO_US(ns) ((ns + 500L) / 1000L) 568#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L)
558 /* convert & round nanoseconds to microseconds */ 569 /* convert nanoseconds to microseconds, rounding up */
559
560 570
561/* 571/*
562 * Full/low speed bandwidth allocation constants/support. 572 * Full/low speed bandwidth allocation constants/support.
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
deleted file mode 100644
index 756cf5543ffd..000000000000
--- a/include/linux/usb/intel_mid_otg.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * Intel MID (Langwell/Penwell) USB OTG Transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __INTEL_MID_OTG_H
21#define __INTEL_MID_OTG_H
22
23#include <linux/pm.h>
24#include <linux/usb/otg.h>
25#include <linux/notifier.h>
26
27struct intel_mid_otg_xceiv;
28
29/* This is a common data structure for Intel MID platform to
30 * save values of the OTG state machine */
31struct otg_hsm {
32 /* Input */
33 int a_bus_resume;
34 int a_bus_suspend;
35 int a_conn;
36 int a_sess_vld;
37 int a_srp_det;
38 int a_vbus_vld;
39 int b_bus_resume;
40 int b_bus_suspend;
41 int b_conn;
42 int b_se0_srp;
43 int b_ssend_srp;
44 int b_sess_end;
45 int b_sess_vld;
46 int id;
47/* id values */
48#define ID_B 0x05
49#define ID_A 0x04
50#define ID_ACA_C 0x03
51#define ID_ACA_B 0x02
52#define ID_ACA_A 0x01
53 int power_up;
54 int adp_change;
55 int test_device;
56
57 /* Internal variables */
58 int a_set_b_hnp_en;
59 int b_srp_done;
60 int b_hnp_enable;
61 int hnp_poll_enable;
62
63 /* Timeout indicator for timers */
64 int a_wait_vrise_tmout;
65 int a_wait_bcon_tmout;
66 int a_aidl_bdis_tmout;
67 int a_bidl_adis_tmout;
68 int a_bidl_adis_tmr;
69 int a_wait_vfall_tmout;
70 int b_ase0_brst_tmout;
71 int b_bus_suspend_tmout;
72 int b_srp_init_tmout;
73 int b_srp_fail_tmout;
74 int b_srp_fail_tmr;
75 int b_adp_sense_tmout;
76
77 /* Informative variables */
78 int a_bus_drop;
79 int a_bus_req;
80 int a_clr_err;
81 int b_bus_req;
82 int a_suspend_req;
83 int b_bus_suspend_vld;
84
85 /* Output */
86 int drv_vbus;
87 int loc_conn;
88 int loc_sof;
89
90 /* Others */
91 int vbus_srp_up;
92};
93
94/* must provide ULPI access function to read/write registers implemented in
95 * ULPI address space */
96struct iotg_ulpi_access_ops {
97 int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val);
98 int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val);
99};
100
101#define OTG_A_DEVICE 0x0
102#define OTG_B_DEVICE 0x1
103
104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on usb_phy data structure for this
108 * purpose.
109 */
110struct intel_mid_otg_xceiv {
111 struct usb_phy otg;
112 struct otg_hsm hsm;
113
114 /* base address */
115 void __iomem *base;
116
117 /* ops to access ulpi */
118 struct iotg_ulpi_access_ops ulpi_ops;
119
120 /* atomic notifier for interrupt context */
121 struct atomic_notifier_head iotg_notifier;
122
123 /* start/stop USB Host function */
124 int (*start_host)(struct intel_mid_otg_xceiv *iotg);
125 int (*stop_host)(struct intel_mid_otg_xceiv *iotg);
126
127 /* start/stop USB Peripheral function */
128 int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg);
129 int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg);
130
131 /* start/stop ADP sense/probe function */
132 int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg,
133 bool enabled, int dev);
134 int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg,
135 bool enabled);
136
137#ifdef CONFIG_PM
138 /* suspend/resume USB host function */
139 int (*suspend_host)(struct intel_mid_otg_xceiv *iotg,
140 pm_message_t message);
141 int (*resume_host)(struct intel_mid_otg_xceiv *iotg);
142
143 int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg,
144 pm_message_t message);
145 int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg);
146#endif
147
148};
149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153}
154
155#define MID_OTG_NOTIFY_CONNECT 0x0001
156#define MID_OTG_NOTIFY_DISCONN 0x0002
157#define MID_OTG_NOTIFY_HSUSPEND 0x0003
158#define MID_OTG_NOTIFY_HRESUME 0x0004
159#define MID_OTG_NOTIFY_CSUSPEND 0x0005
160#define MID_OTG_NOTIFY_CRESUME 0x0006
161#define MID_OTG_NOTIFY_HOSTADD 0x0007
162#define MID_OTG_NOTIFY_HOSTREMOVE 0x0008
163#define MID_OTG_NOTIFY_CLIENTADD 0x0009
164#define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a
165
166static inline int
167intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg,
168 struct notifier_block *nb)
169{
170 return atomic_notifier_chain_register(&iotg->iotg_notifier, nb);
171}
172
173static inline void
174intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg,
175 struct notifier_block *nb)
176{
177 atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb);
178}
179
180#endif /* __INTEL_MID_OTG_H */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 053c26841cc3..eb505250940a 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,8 +99,6 @@ struct musb_hdrc_platform_data {
99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ 99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
100 u8 mode; 100 u8 mode;
101 101
102 u8 has_mailbox:1;
103
104 /* for clk_get() */ 102 /* for clk_get() */
105 const char *clock; 103 const char *clock;
106 104
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c931b0..596b01918813 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -19,20 +19,23 @@
19#ifndef __OMAP_CONTROL_USB_H__ 19#ifndef __OMAP_CONTROL_USB_H__
20#define __OMAP_CONTROL_USB_H__ 20#define __OMAP_CONTROL_USB_H__
21 21
22enum omap_control_usb_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27};
28
22struct omap_control_usb { 29struct omap_control_usb {
23 struct device *dev; 30 struct device *dev;
24 31
25 u32 __iomem *dev_conf;
26 u32 __iomem *otghs_control; 32 u32 __iomem *otghs_control;
27 u32 __iomem *phy_power; 33 u32 __iomem *power;
34 u32 __iomem *power_aux;
28 35
29 struct clk *sys_clk; 36 struct clk *sys_clk;
30 37
31 u32 type; 38 enum omap_control_usb_type type;
32};
33
34struct omap_control_usb_platform_data {
35 u8 type;
36}; 39};
37 40
38enum omap_control_usb_mode { 41enum omap_control_usb_mode {
@@ -42,10 +45,6 @@ enum omap_control_usb_mode {
42 USB_MODE_DISCONNECT, 45 USB_MODE_DISCONNECT,
43}; 46};
44 47
45/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
46#define OMAP_CTRL_DEV_TYPE1 0x1
47#define OMAP_CTRL_DEV_TYPE2 0x2
48
49#define OMAP_CTRL_DEV_PHY_PD BIT(0) 48#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50 49
51#define OMAP_CTRL_DEV_AVALID BIT(0) 50#define OMAP_CTRL_DEV_AVALID BIT(0)
@@ -63,26 +62,18 @@ enum omap_control_usb_mode {
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 62#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 63#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
65 64
65#define OMAP_CTRL_USB2_PHY_PD BIT(28)
66
66#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 67#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
67extern struct device *omap_get_control_dev(void);
68extern void omap_control_usb_phy_power(struct device *dev, int on); 68extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb3_phy_power(struct device *dev, bool on);
70extern void omap_control_usb_set_mode(struct device *dev, 69extern void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode); 70 enum omap_control_usb_mode mode);
72#else 71#else
73static inline struct device *omap_get_control_dev(void)
74{
75 return ERR_PTR(-ENODEV);
76}
77 72
78static inline void omap_control_usb_phy_power(struct device *dev, int on) 73static inline void omap_control_usb_phy_power(struct device *dev, int on)
79{ 74{
80} 75}
81 76
82static inline void omap_control_usb3_phy_power(struct device *dev, int on)
83{
84}
85
86static inline void omap_control_usb_set_mode(struct device *dev, 77static inline void omap_control_usb_set_mode(struct device *dev,
87 enum omap_control_usb_mode mode) 78 enum omap_control_usb_mode mode)
88{ 79{
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index d528b8045150..704a1ab8240c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -320,6 +320,8 @@ extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
320extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
321extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
322 struct usb_serial_port *port); 322 struct usb_serial_port *port);
323extern int usb_serial_generic_write_start(struct usb_serial_port *port,
324 gfp_t mem_flags);
323extern int usb_serial_generic_write(struct tty_struct *tty, 325extern int usb_serial_generic_write(struct tty_struct *tty,
324 struct usb_serial_port *port, const unsigned char *buf, int count); 326 struct usb_serial_port *port, const unsigned char *buf, int count);
325extern void usb_serial_generic_close(struct usb_serial_port *port); 327extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index f9a7e7bc925b..cc8d818a83be 100644
--- a/include/linux/usb/usb_phy_gen_xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -9,10 +9,11 @@ struct usb_phy_gen_xceiv_platform_data {
9 9
10 /* if set fails with -EPROBE_DEFER if can't get regulator */ 10 /* if set fails with -EPROBE_DEFER if can't get regulator */
11 unsigned int needs_vcc:1; 11 unsigned int needs_vcc:1;
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1; /* deprecated */
13 int gpio_reset;
13}; 14};
14 15
15#if IS_ENABLED(CONFIG_NOP_USB_XCEIV) 16#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
16/* sometimes transceivers are accessed only through e.g. ULPI */ 17/* sometimes transceivers are accessed only through e.g. ULPI */
17extern void usb_nop_xceiv_register(void); 18extern void usb_nop_xceiv_register(void);
18extern void usb_nop_xceiv_unregister(void); 19extern void usb_nop_xceiv_unregister(void);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 9cb2fe8ca944..e303eef94dd5 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -42,6 +42,7 @@ struct usbnet {
42 struct usb_host_endpoint *status; 42 struct usb_host_endpoint *status;
43 unsigned maxpacket; 43 unsigned maxpacket;
44 struct timer_list delay; 44 struct timer_list delay;
45 const char *padding_pkt;
45 46
46 /* protocol/interface state */ 47 /* protocol/interface state */
47 struct net_device *net; 48 struct net_device *net;
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index 4ff744e2b678..c1257130769b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -142,7 +142,7 @@ enum wa_notif_type {
142struct wa_notif_hdr { 142struct wa_notif_hdr {
143 u8 bLength; 143 u8 bLength;
144 u8 bNotifyType; /* enum wa_notif_type */ 144 u8 bNotifyType; /* enum wa_notif_type */
145} __attribute__((packed)); 145} __packed;
146 146
147/** 147/**
148 * HWA DN Received notification [(WUSB] section 8.5.4.2) 148 * HWA DN Received notification [(WUSB] section 8.5.4.2)
@@ -158,7 +158,7 @@ struct hwa_notif_dn {
158 u8 bSourceDeviceAddr; /* from errata 2005/07 */ 158 u8 bSourceDeviceAddr; /* from errata 2005/07 */
159 u8 bmAttributes; 159 u8 bmAttributes;
160 struct wusb_dn_hdr dndata[]; 160 struct wusb_dn_hdr dndata[];
161} __attribute__((packed)); 161} __packed;
162 162
163/* [WUSB] section 8.3.3 */ 163/* [WUSB] section 8.3.3 */
164enum wa_xfer_type { 164enum wa_xfer_type {
@@ -167,6 +167,8 @@ enum wa_xfer_type {
167 WA_XFER_TYPE_ISO = 0x82, 167 WA_XFER_TYPE_ISO = 0x82,
168 WA_XFER_RESULT = 0x83, 168 WA_XFER_RESULT = 0x83,
169 WA_XFER_ABORT = 0x84, 169 WA_XFER_ABORT = 0x84,
170 WA_XFER_ISO_PACKET_INFO = 0xA0,
171 WA_XFER_ISO_PACKET_STATUS = 0xA1,
170}; 172};
171 173
172/* [WUSB] section 8.3.3 */ 174/* [WUSB] section 8.3.3 */
@@ -177,28 +179,47 @@ struct wa_xfer_hdr {
177 __le32 dwTransferID; /* Host-assigned ID */ 179 __le32 dwTransferID; /* Host-assigned ID */
178 __le32 dwTransferLength; /* Length of data to xfer */ 180 __le32 dwTransferLength; /* Length of data to xfer */
179 u8 bTransferSegment; 181 u8 bTransferSegment;
180} __attribute__((packed)); 182} __packed;
181 183
182struct wa_xfer_ctl { 184struct wa_xfer_ctl {
183 struct wa_xfer_hdr hdr; 185 struct wa_xfer_hdr hdr;
184 u8 bmAttribute; 186 u8 bmAttribute;
185 __le16 wReserved; 187 __le16 wReserved;
186 struct usb_ctrlrequest baSetupData; 188 struct usb_ctrlrequest baSetupData;
187} __attribute__((packed)); 189} __packed;
188 190
189struct wa_xfer_bi { 191struct wa_xfer_bi {
190 struct wa_xfer_hdr hdr; 192 struct wa_xfer_hdr hdr;
191 u8 bReserved; 193 u8 bReserved;
192 __le16 wReserved; 194 __le16 wReserved;
193} __attribute__((packed)); 195} __packed;
194 196
197/* [WUSB] section 8.5.5 */
195struct wa_xfer_hwaiso { 198struct wa_xfer_hwaiso {
196 struct wa_xfer_hdr hdr; 199 struct wa_xfer_hdr hdr;
197 u8 bReserved; 200 u8 bReserved;
198 __le16 wPresentationTime; 201 __le16 wPresentationTime;
199 __le32 dwNumOfPackets; 202 __le32 dwNumOfPackets;
200 /* FIXME: u8 pktdata[]? */ 203} __packed;
201} __attribute__((packed)); 204
205struct wa_xfer_packet_info_hwaiso {
206 __le16 wLength;
207 u8 bPacketType;
208 u8 bReserved;
209 __le16 PacketLength[0];
210} __packed;
211
212struct wa_xfer_packet_status_len_hwaiso {
213 __le16 PacketLength;
214 __le16 PacketStatus;
215} __packed;
216
217struct wa_xfer_packet_status_hwaiso {
218 __le16 wLength;
219 u8 bPacketType;
220 u8 bReserved;
221 struct wa_xfer_packet_status_len_hwaiso PacketStatus[0];
222} __packed;
202 223
203/* [WUSB] section 8.3.3.5 */ 224/* [WUSB] section 8.3.3.5 */
204struct wa_xfer_abort { 225struct wa_xfer_abort {
@@ -206,7 +227,7 @@ struct wa_xfer_abort {
206 u8 bRequestType; 227 u8 bRequestType;
207 __le16 wRPipe; /* RPipe index */ 228 __le16 wRPipe; /* RPipe index */
208 __le32 dwTransferID; /* Host-assigned ID */ 229 __le32 dwTransferID; /* Host-assigned ID */
209} __attribute__((packed)); 230} __packed;
210 231
211/** 232/**
212 * WA Transfer Complete notification ([WUSB] section 8.3.3.3) 233 * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
@@ -216,7 +237,7 @@ struct wa_notif_xfer {
216 struct wa_notif_hdr hdr; 237 struct wa_notif_hdr hdr;
217 u8 bEndpoint; 238 u8 bEndpoint;
218 u8 Reserved; 239 u8 Reserved;
219} __attribute__((packed)); 240} __packed;
220 241
221/** Transfer result basic codes [WUSB] table 8-15 */ 242/** Transfer result basic codes [WUSB] table 8-15 */
222enum { 243enum {
@@ -243,7 +264,7 @@ struct wa_xfer_result {
243 u8 bTransferSegment; 264 u8 bTransferSegment;
244 u8 bTransferStatus; 265 u8 bTransferStatus;
245 __le32 dwNumOfPackets; 266 __le32 dwNumOfPackets;
246} __attribute__((packed)); 267} __packed;
247 268
248/** 269/**
249 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). 270 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
@@ -258,16 +279,16 @@ struct wa_xfer_result {
258struct usb_wa_descriptor { 279struct usb_wa_descriptor {
259 u8 bLength; 280 u8 bLength;
260 u8 bDescriptorType; 281 u8 bDescriptorType;
261 u16 bcdWAVersion; 282 __le16 bcdWAVersion;
262 u8 bNumPorts; /* don't use!! */ 283 u8 bNumPorts; /* don't use!! */
263 u8 bmAttributes; /* Reserved == 0 */ 284 u8 bmAttributes; /* Reserved == 0 */
264 u16 wNumRPipes; 285 __le16 wNumRPipes;
265 u16 wRPipeMaxBlock; 286 __le16 wRPipeMaxBlock;
266 u8 bRPipeBlockSize; 287 u8 bRPipeBlockSize;
267 u8 bPwrOn2PwrGood; 288 u8 bPwrOn2PwrGood;
268 u8 bNumMMCIEs; 289 u8 bNumMMCIEs;
269 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ 290 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
270} __attribute__((packed)); 291} __packed;
271 292
272/** 293/**
273 * HWA Device Information Buffer (WUSB1.0[T8.54]) 294 * HWA Device Information Buffer (WUSB1.0[T8.54])
@@ -277,6 +298,6 @@ struct hwa_dev_info {
277 u8 bDeviceAddress; 298 u8 bDeviceAddress;
278 __le16 wPHYRates; 299 __le16 wPHYRates;
279 u8 bmDeviceAttribute; 300 u8 bmDeviceAttribute;
280} __attribute__((packed)); 301} __packed;
281 302
282#endif /* #ifndef __LINUX_USB_WUSB_WA_H */ 303#endif /* #ifndef __LINUX_USB_WUSB_WA_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index bf99cd01be20..630356866030 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -66,7 +66,9 @@
66 US_FLAG(INITIAL_READ10, 0x00100000) \ 66 US_FLAG(INITIAL_READ10, 0x00100000) \
67 /* Initial READ(10) (and others) must be retried */ \ 67 /* Initial READ(10) (and others) must be retried */ \
68 US_FLAG(WRITE_CACHE, 0x00200000) \ 68 US_FLAG(WRITE_CACHE, 0x00200000) \
69 /* Write Cache status is not available */ 69 /* Write Cache status is not available */ \
70 US_FLAG(NEEDS_CAP16, 0x00400000)
71 /* cannot handle READ_CAPACITY_10 */
70 72
71#define US_FLAG(name, value) US_FL_##name = value , 73#define US_FLAG(name, value) US_FL_##name = value ,
72enum { US_DO_ALL_FLAGS }; 74enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 80cf8173a65b..2c02f3a8d2ba 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,15 +65,8 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
69extern void vga_set_legacy_decoding(struct pci_dev *pdev, 68extern void vga_set_legacy_decoding(struct pci_dev *pdev,
70 unsigned int decodes); 69 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes)
74{
75}
76#endif
77 70
78/** 71/**
79 * vga_get - acquire & locks VGA resources 72 * vga_get - acquire & locks VGA resources
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/wait.h b/include/linux/wait.h
index a67fc1635592..61939ba30aa0 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_WAIT_H 1#ifndef _LINUX_WAIT_H
2#define _LINUX_WAIT_H 2#define _LINUX_WAIT_H
3 3/*
4 4 * Linux wait queue related types and methods
5 */
5#include <linux/list.h> 6#include <linux/list.h>
6#include <linux/stddef.h> 7#include <linux/stddef.h>
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
@@ -13,27 +14,27 @@ typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, v
13int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); 14int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
14 15
15struct __wait_queue { 16struct __wait_queue {
16 unsigned int flags; 17 unsigned int flags;
17#define WQ_FLAG_EXCLUSIVE 0x01 18#define WQ_FLAG_EXCLUSIVE 0x01
18 void *private; 19 void *private;
19 wait_queue_func_t func; 20 wait_queue_func_t func;
20 struct list_head task_list; 21 struct list_head task_list;
21}; 22};
22 23
23struct wait_bit_key { 24struct wait_bit_key {
24 void *flags; 25 void *flags;
25 int bit_nr; 26 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
27}; 28};
28 29
29struct wait_bit_queue { 30struct wait_bit_queue {
30 struct wait_bit_key key; 31 struct wait_bit_key key;
31 wait_queue_t wait; 32 wait_queue_t wait;
32}; 33};
33 34
34struct __wait_queue_head { 35struct __wait_queue_head {
35 spinlock_t lock; 36 spinlock_t lock;
36 struct list_head task_list; 37 struct list_head task_list;
37}; 38};
38typedef struct __wait_queue_head wait_queue_head_t; 39typedef struct __wait_queue_head wait_queue_head_t;
39 40
@@ -84,17 +85,17 @@ extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct
84 85
85static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
86{ 87{
87 q->flags = 0; 88 q->flags = 0;
88 q->private = p; 89 q->private = p;
89 q->func = default_wake_function; 90 q->func = default_wake_function;
90} 91}
91 92
92static inline void init_waitqueue_func_entry(wait_queue_t *q, 93static inline void
93 wait_queue_func_t func) 94init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func)
94{ 95{
95 q->flags = 0; 96 q->flags = 0;
96 q->private = NULL; 97 q->private = NULL;
97 q->func = func; 98 q->func = func;
98} 99}
99 100
100static inline int waitqueue_active(wait_queue_head_t *q) 101static inline int waitqueue_active(wait_queue_head_t *q)
@@ -114,8 +115,8 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
114/* 115/*
115 * Used for wake-one threads: 116 * Used for wake-one threads:
116 */ 117 */
117static inline void __add_wait_queue_exclusive(wait_queue_head_t *q, 118static inline void
118 wait_queue_t *wait) 119__add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
119{ 120{
120 wait->flags |= WQ_FLAG_EXCLUSIVE; 121 wait->flags |= WQ_FLAG_EXCLUSIVE;
121 __add_wait_queue(q, wait); 122 __add_wait_queue(q, wait);
@@ -127,23 +128,22 @@ static inline void __add_wait_queue_tail(wait_queue_head_t *head,
127 list_add_tail(&new->task_list, &head->task_list); 128 list_add_tail(&new->task_list, &head->task_list);
128} 129}
129 130
130static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q, 131static inline void
131 wait_queue_t *wait) 132__add_wait_queue_tail_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
132{ 133{
133 wait->flags |= WQ_FLAG_EXCLUSIVE; 134 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue_tail(q, wait); 135 __add_wait_queue_tail(q, wait);
135} 136}
136 137
137static inline void __remove_wait_queue(wait_queue_head_t *head, 138static inline void
138 wait_queue_t *old) 139__remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
139{ 140{
140 list_del(&old->task_list); 141 list_del(&old->task_list);
141} 142}
142 143
143void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
144void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
145void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
146 void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 149void __wake_up_bit(wait_queue_head_t *, void *, int);
@@ -170,27 +170,64 @@ wait_queue_head_t *bit_waitqueue(void *, int);
170/* 170/*
171 * Wakeup macros to be used to report events to the targets. 171 * Wakeup macros to be used to report events to the targets.
172 */ 172 */
173#define wake_up_poll(x, m) \ 173#define wake_up_poll(x, m) \
174 __wake_up(x, TASK_NORMAL, 1, (void *) (m)) 174 __wake_up(x, TASK_NORMAL, 1, (void *) (m))
175#define wake_up_locked_poll(x, m) \ 175#define wake_up_locked_poll(x, m) \
176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) 176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
177#define wake_up_interruptible_poll(x, m) \ 177#define wake_up_interruptible_poll(x, m) \
178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) 178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
179#define wake_up_interruptible_sync_poll(x, m) \ 179#define wake_up_interruptible_sync_poll(x, m) \
180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) 180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
181 181
182#define __wait_event(wq, condition) \ 182#define ___wait_cond_timeout(condition) \
183do { \ 183({ \
184 DEFINE_WAIT(__wait); \ 184 bool __cond = (condition); \
185 if (__cond && !__ret) \
186 __ret = 1; \
187 __cond || !__ret; \
188})
189
190#define ___wait_is_interruptible(state) \
191 (!__builtin_constant_p(state) || \
192 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
193
194#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
195({ \
196 __label__ __out; \
197 wait_queue_t __wait; \
198 long __ret = ret; \
199 \
200 INIT_LIST_HEAD(&__wait.task_list); \
201 if (exclusive) \
202 __wait.flags = WQ_FLAG_EXCLUSIVE; \
203 else \
204 __wait.flags = 0; \
185 \ 205 \
186 for (;;) { \ 206 for (;;) { \
187 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 207 long __int = prepare_to_wait_event(&wq, &__wait, state);\
208 \
188 if (condition) \ 209 if (condition) \
189 break; \ 210 break; \
190 schedule(); \ 211 \
212 if (___wait_is_interruptible(state) && __int) { \
213 __ret = __int; \
214 if (exclusive) { \
215 abort_exclusive_wait(&wq, &__wait, \
216 state, NULL); \
217 goto __out; \
218 } \
219 break; \
220 } \
221 \
222 cmd; \
191 } \ 223 } \
192 finish_wait(&wq, &__wait); \ 224 finish_wait(&wq, &__wait); \
193} while (0) 225__out: __ret; \
226})
227
228#define __wait_event(wq, condition) \
229 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
230 schedule())
194 231
195/** 232/**
196 * wait_event - sleep until a condition gets true 233 * wait_event - sleep until a condition gets true
@@ -204,29 +241,17 @@ do { \
204 * wake_up() has to be called after changing any variable that could 241 * wake_up() has to be called after changing any variable that could
205 * change the result of the wait condition. 242 * change the result of the wait condition.
206 */ 243 */
207#define wait_event(wq, condition) \ 244#define wait_event(wq, condition) \
208do { \ 245do { \
209 if (condition) \ 246 if (condition) \
210 break; \ 247 break; \
211 __wait_event(wq, condition); \ 248 __wait_event(wq, condition); \
212} while (0) 249} while (0)
213 250
214#define __wait_event_timeout(wq, condition, ret) \ 251#define __wait_event_timeout(wq, condition, timeout) \
215do { \ 252 ___wait_event(wq, ___wait_cond_timeout(condition), \
216 DEFINE_WAIT(__wait); \ 253 TASK_UNINTERRUPTIBLE, 0, timeout, \
217 \ 254 __ret = schedule_timeout(__ret))
218 for (;;) { \
219 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
220 if (condition) \
221 break; \
222 ret = schedule_timeout(ret); \
223 if (!ret) \
224 break; \
225 } \
226 if (!ret && (condition)) \
227 ret = 1; \
228 finish_wait(&wq, &__wait); \
229} while (0)
230 255
231/** 256/**
232 * wait_event_timeout - sleep until a condition gets true or a timeout elapses 257 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
@@ -248,28 +273,14 @@ do { \
248#define wait_event_timeout(wq, condition, timeout) \ 273#define wait_event_timeout(wq, condition, timeout) \
249({ \ 274({ \
250 long __ret = timeout; \ 275 long __ret = timeout; \
251 if (!(condition)) \ 276 if (!___wait_cond_timeout(condition)) \
252 __wait_event_timeout(wq, condition, __ret); \ 277 __ret = __wait_event_timeout(wq, condition, timeout); \
253 __ret; \ 278 __ret; \
254}) 279})
255 280
256#define __wait_event_interruptible(wq, condition, ret) \ 281#define __wait_event_interruptible(wq, condition) \
257do { \ 282 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
258 DEFINE_WAIT(__wait); \ 283 schedule())
259 \
260 for (;;) { \
261 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
262 if (condition) \
263 break; \
264 if (!signal_pending(current)) { \
265 schedule(); \
266 continue; \
267 } \
268 ret = -ERESTARTSYS; \
269 break; \
270 } \
271 finish_wait(&wq, &__wait); \
272} while (0)
273 284
274/** 285/**
275 * wait_event_interruptible - sleep until a condition gets true 286 * wait_event_interruptible - sleep until a condition gets true
@@ -290,31 +301,14 @@ do { \
290({ \ 301({ \
291 int __ret = 0; \ 302 int __ret = 0; \
292 if (!(condition)) \ 303 if (!(condition)) \
293 __wait_event_interruptible(wq, condition, __ret); \ 304 __ret = __wait_event_interruptible(wq, condition); \
294 __ret; \ 305 __ret; \
295}) 306})
296 307
297#define __wait_event_interruptible_timeout(wq, condition, ret) \ 308#define __wait_event_interruptible_timeout(wq, condition, timeout) \
298do { \ 309 ___wait_event(wq, ___wait_cond_timeout(condition), \
299 DEFINE_WAIT(__wait); \ 310 TASK_INTERRUPTIBLE, 0, timeout, \
300 \ 311 __ret = schedule_timeout(__ret))
301 for (;;) { \
302 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
303 if (condition) \
304 break; \
305 if (!signal_pending(current)) { \
306 ret = schedule_timeout(ret); \
307 if (!ret) \
308 break; \
309 continue; \
310 } \
311 ret = -ERESTARTSYS; \
312 break; \
313 } \
314 if (!ret && (condition)) \
315 ret = 1; \
316 finish_wait(&wq, &__wait); \
317} while (0)
318 312
319/** 313/**
320 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses 314 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
@@ -337,15 +331,15 @@ do { \
337#define wait_event_interruptible_timeout(wq, condition, timeout) \ 331#define wait_event_interruptible_timeout(wq, condition, timeout) \
338({ \ 332({ \
339 long __ret = timeout; \ 333 long __ret = timeout; \
340 if (!(condition)) \ 334 if (!___wait_cond_timeout(condition)) \
341 __wait_event_interruptible_timeout(wq, condition, __ret); \ 335 __ret = __wait_event_interruptible_timeout(wq, \
336 condition, timeout); \
342 __ret; \ 337 __ret; \
343}) 338})
344 339
345#define __wait_event_hrtimeout(wq, condition, timeout, state) \ 340#define __wait_event_hrtimeout(wq, condition, timeout, state) \
346({ \ 341({ \
347 int __ret = 0; \ 342 int __ret = 0; \
348 DEFINE_WAIT(__wait); \
349 struct hrtimer_sleeper __t; \ 343 struct hrtimer_sleeper __t; \
350 \ 344 \
351 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \ 345 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \
@@ -356,25 +350,15 @@ do { \
356 current->timer_slack_ns, \ 350 current->timer_slack_ns, \
357 HRTIMER_MODE_REL); \ 351 HRTIMER_MODE_REL); \
358 \ 352 \
359 for (;;) { \ 353 __ret = ___wait_event(wq, condition, state, 0, 0, \
360 prepare_to_wait(&wq, &__wait, state); \
361 if (condition) \
362 break; \
363 if (state == TASK_INTERRUPTIBLE && \
364 signal_pending(current)) { \
365 __ret = -ERESTARTSYS; \
366 break; \
367 } \
368 if (!__t.task) { \ 354 if (!__t.task) { \
369 __ret = -ETIME; \ 355 __ret = -ETIME; \
370 break; \ 356 break; \
371 } \ 357 } \
372 schedule(); \ 358 schedule()); \
373 } \
374 \ 359 \
375 hrtimer_cancel(&__t.timer); \ 360 hrtimer_cancel(&__t.timer); \
376 destroy_hrtimer_on_stack(&__t.timer); \ 361 destroy_hrtimer_on_stack(&__t.timer); \
377 finish_wait(&wq, &__wait); \
378 __ret; \ 362 __ret; \
379}) 363})
380 364
@@ -428,33 +412,15 @@ do { \
428 __ret; \ 412 __ret; \
429}) 413})
430 414
431#define __wait_event_interruptible_exclusive(wq, condition, ret) \ 415#define __wait_event_interruptible_exclusive(wq, condition) \
432do { \ 416 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
433 DEFINE_WAIT(__wait); \ 417 schedule())
434 \
435 for (;;) { \
436 prepare_to_wait_exclusive(&wq, &__wait, \
437 TASK_INTERRUPTIBLE); \
438 if (condition) { \
439 finish_wait(&wq, &__wait); \
440 break; \
441 } \
442 if (!signal_pending(current)) { \
443 schedule(); \
444 continue; \
445 } \
446 ret = -ERESTARTSYS; \
447 abort_exclusive_wait(&wq, &__wait, \
448 TASK_INTERRUPTIBLE, NULL); \
449 break; \
450 } \
451} while (0)
452 418
453#define wait_event_interruptible_exclusive(wq, condition) \ 419#define wait_event_interruptible_exclusive(wq, condition) \
454({ \ 420({ \
455 int __ret = 0; \ 421 int __ret = 0; \
456 if (!(condition)) \ 422 if (!(condition)) \
457 __wait_event_interruptible_exclusive(wq, condition, __ret);\ 423 __ret = __wait_event_interruptible_exclusive(wq, condition);\
458 __ret; \ 424 __ret; \
459}) 425})
460 426
@@ -606,24 +572,8 @@ do { \
606 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) 572 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
607 573
608 574
609 575#define __wait_event_killable(wq, condition) \
610#define __wait_event_killable(wq, condition, ret) \ 576 ___wait_event(wq, condition, TASK_KILLABLE, 0, 0, schedule())
611do { \
612 DEFINE_WAIT(__wait); \
613 \
614 for (;;) { \
615 prepare_to_wait(&wq, &__wait, TASK_KILLABLE); \
616 if (condition) \
617 break; \
618 if (!fatal_signal_pending(current)) { \
619 schedule(); \
620 continue; \
621 } \
622 ret = -ERESTARTSYS; \
623 break; \
624 } \
625 finish_wait(&wq, &__wait); \
626} while (0)
627 577
628/** 578/**
629 * wait_event_killable - sleep until a condition gets true 579 * wait_event_killable - sleep until a condition gets true
@@ -644,26 +594,17 @@ do { \
644({ \ 594({ \
645 int __ret = 0; \ 595 int __ret = 0; \
646 if (!(condition)) \ 596 if (!(condition)) \
647 __wait_event_killable(wq, condition, __ret); \ 597 __ret = __wait_event_killable(wq, condition); \
648 __ret; \ 598 __ret; \
649}) 599})
650 600
651 601
652#define __wait_event_lock_irq(wq, condition, lock, cmd) \ 602#define __wait_event_lock_irq(wq, condition, lock, cmd) \
653do { \ 603 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
654 DEFINE_WAIT(__wait); \ 604 spin_unlock_irq(&lock); \
655 \ 605 cmd; \
656 for (;;) { \ 606 schedule(); \
657 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 607 spin_lock_irq(&lock))
658 if (condition) \
659 break; \
660 spin_unlock_irq(&lock); \
661 cmd; \
662 schedule(); \
663 spin_lock_irq(&lock); \
664 } \
665 finish_wait(&wq, &__wait); \
666} while (0)
667 608
668/** 609/**
669 * wait_event_lock_irq_cmd - sleep until a condition gets true. The 610 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
@@ -723,26 +664,12 @@ do { \
723} while (0) 664} while (0)
724 665
725 666
726#define __wait_event_interruptible_lock_irq(wq, condition, \ 667#define __wait_event_interruptible_lock_irq(wq, condition, lock, cmd) \
727 lock, ret, cmd) \ 668 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
728do { \ 669 spin_unlock_irq(&lock); \
729 DEFINE_WAIT(__wait); \ 670 cmd; \
730 \ 671 schedule(); \
731 for (;;) { \ 672 spin_lock_irq(&lock))
732 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
733 if (condition) \
734 break; \
735 if (signal_pending(current)) { \
736 ret = -ERESTARTSYS; \
737 break; \
738 } \
739 spin_unlock_irq(&lock); \
740 cmd; \
741 schedule(); \
742 spin_lock_irq(&lock); \
743 } \
744 finish_wait(&wq, &__wait); \
745} while (0)
746 673
747/** 674/**
748 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true. 675 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
@@ -772,10 +699,9 @@ do { \
772#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \ 699#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
773({ \ 700({ \
774 int __ret = 0; \ 701 int __ret = 0; \
775 \
776 if (!(condition)) \ 702 if (!(condition)) \
777 __wait_event_interruptible_lock_irq(wq, condition, \ 703 __ret = __wait_event_interruptible_lock_irq(wq, \
778 lock, __ret, cmd); \ 704 condition, lock, cmd); \
779 __ret; \ 705 __ret; \
780}) 706})
781 707
@@ -804,39 +730,24 @@ do { \
804#define wait_event_interruptible_lock_irq(wq, condition, lock) \ 730#define wait_event_interruptible_lock_irq(wq, condition, lock) \
805({ \ 731({ \
806 int __ret = 0; \ 732 int __ret = 0; \
807 \
808 if (!(condition)) \ 733 if (!(condition)) \
809 __wait_event_interruptible_lock_irq(wq, condition, \ 734 __ret = __wait_event_interruptible_lock_irq(wq, \
810 lock, __ret, ); \ 735 condition, lock,); \
811 __ret; \ 736 __ret; \
812}) 737})
813 738
814#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \ 739#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815 lock, ret) \ 740 lock, timeout) \
816do { \ 741 ___wait_event(wq, ___wait_cond_timeout(condition), \
817 DEFINE_WAIT(__wait); \ 742 TASK_INTERRUPTIBLE, 0, timeout, \
818 \ 743 spin_unlock_irq(&lock); \
819 for (;;) { \ 744 __ret = schedule_timeout(__ret); \
820 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ 745 spin_lock_irq(&lock));
821 if (condition) \
822 break; \
823 if (signal_pending(current)) { \
824 ret = -ERESTARTSYS; \
825 break; \
826 } \
827 spin_unlock_irq(&lock); \
828 ret = schedule_timeout(ret); \
829 spin_lock_irq(&lock); \
830 if (!ret) \
831 break; \
832 } \
833 finish_wait(&wq, &__wait); \
834} while (0)
835 746
836/** 747/**
837 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses. 748 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
838 * The condition is checked under the lock. This is expected 749 * true or a timeout elapses. The condition is checked under
839 * to be called with the lock taken. 750 * the lock. This is expected to be called with the lock taken.
840 * @wq: the waitqueue to wait on 751 * @wq: the waitqueue to wait on
841 * @condition: a C expression for the event to wait for 752 * @condition: a C expression for the event to wait for
842 * @lock: a locked spinlock_t, which will be released before schedule() 753 * @lock: a locked spinlock_t, which will be released before schedule()
@@ -860,11 +771,10 @@ do { \
860#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \ 771#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861 timeout) \ 772 timeout) \
862({ \ 773({ \
863 int __ret = timeout; \ 774 long __ret = timeout; \
864 \ 775 if (!___wait_cond_timeout(condition)) \
865 if (!(condition)) \ 776 __ret = __wait_event_interruptible_lock_irq_timeout( \
866 __wait_event_interruptible_lock_irq_timeout( \ 777 wq, condition, lock, timeout); \
867 wq, condition, lock, __ret); \
868 __ret; \ 778 __ret; \
869}) 779})
870 780
@@ -875,20 +785,18 @@ do { \
875 * We plan to remove these interfaces. 785 * We plan to remove these interfaces.
876 */ 786 */
877extern void sleep_on(wait_queue_head_t *q); 787extern void sleep_on(wait_queue_head_t *q);
878extern long sleep_on_timeout(wait_queue_head_t *q, 788extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
879 signed long timeout);
880extern void interruptible_sleep_on(wait_queue_head_t *q); 789extern void interruptible_sleep_on(wait_queue_head_t *q);
881extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, 790extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
882 signed long timeout);
883 791
884/* 792/*
885 * Waitqueues which are removed from the waitqueue_head at wakeup time 793 * Waitqueues which are removed from the waitqueue_head at wakeup time
886 */ 794 */
887void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); 795void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
888void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); 796void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
797long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state);
889void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); 798void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
890void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, 799void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key);
891 unsigned int mode, void *key);
892int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 800int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
893int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 801int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
894 802
@@ -934,8 +842,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
934 * One uses wait_on_bit() where one is waiting for the bit to clear, 842 * One uses wait_on_bit() where one is waiting for the bit to clear,
935 * but has no intention of setting it. 843 * but has no intention of setting it.
936 */ 844 */
937static inline int wait_on_bit(void *word, int bit, 845static inline int
938 int (*action)(void *), unsigned mode) 846wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
939{ 847{
940 if (!test_bit(bit, word)) 848 if (!test_bit(bit, word))
941 return 0; 849 return 0;
@@ -958,8 +866,8 @@ static inline int wait_on_bit(void *word, int bit,
958 * One uses wait_on_bit_lock() where one is waiting for the bit to 866 * One uses wait_on_bit_lock() where one is waiting for the bit to
959 * clear with the intention of setting it, and when done, clearing it. 867 * clear with the intention of setting it, and when done, clearing it.
960 */ 868 */
961static inline int wait_on_bit_lock(void *word, int bit, 869static inline int
962 int (*action)(void *), unsigned mode) 870wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode)
963{ 871{
964 if (!test_and_set_bit(bit, word)) 872 if (!test_and_set_bit(bit, word))
965 return 0; 873 return 0;
@@ -983,5 +891,5 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
983 return 0; 891 return 0;
984 return out_of_line_wait_on_atomic_t(val, action, mode); 892 return out_of_line_wait_on_atomic_t(val, action, mode);
985} 893}
986 894
987#endif 895#endif /* _LINUX_WAIT_H */
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/linux/yam.h b/include/linux/yam.h
index 7fe28228b274..512cdc2fb80f 100644
--- a/include/linux/yam.h
+++ b/include/linux/yam.h
@@ -77,6 +77,6 @@ struct yamdrv_ioctl_cfg {
77 77
78struct yamdrv_ioctl_mcs { 78struct yamdrv_ioctl_mcs {
79 int cmd; 79 int cmd;
80 int bitrate; 80 unsigned int bitrate;
81 unsigned char bits[YAM_FPGA_SIZE]; 81 unsigned char bits[YAM_FPGA_SIZE];
82}; 82};
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index fb314de2b61b..86505bfa5d2c 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -67,6 +67,10 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
67int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr); 67int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr);
68#endif 68#endif
69 69
70bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
71 const unsigned int prefix_len,
72 struct net_device *dev);
73
70int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev); 74int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev);
71 75
72struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 76struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
deleted file mode 100644
index 487b54c1308f..000000000000
--- a/include/net/bluetooth/a2mp.h
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
18#include <net/bluetooth/l2cap.h>
19
20#define A2MP_FEAT_EXT 0x8000
21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26 WRITE_REMOTE_AMP_ASSOC,
27};
28
29struct amp_mgr {
30 struct list_head list;
31 struct l2cap_conn *l2cap_conn;
32 struct l2cap_chan *a2mp_chan;
33 struct l2cap_chan *bredr_chan;
34 struct kref kref;
35 __u8 ident;
36 __u8 handle;
37 unsigned long state;
38 unsigned long flags;
39
40 struct list_head amp_ctrls;
41 struct mutex amp_ctrls_lock;
42};
43
44struct a2mp_cmd {
45 __u8 code;
46 __u8 ident;
47 __le16 len;
48 __u8 data[0];
49} __packed;
50
51/* A2MP command codes */
52#define A2MP_COMMAND_REJ 0x01
53struct a2mp_cmd_rej {
54 __le16 reason;
55 __u8 data[0];
56} __packed;
57
58#define A2MP_DISCOVER_REQ 0x02
59struct a2mp_discov_req {
60 __le16 mtu;
61 __le16 ext_feat;
62} __packed;
63
64struct a2mp_cl {
65 __u8 id;
66 __u8 type;
67 __u8 status;
68} __packed;
69
70#define A2MP_DISCOVER_RSP 0x03
71struct a2mp_discov_rsp {
72 __le16 mtu;
73 __le16 ext_feat;
74 struct a2mp_cl cl[0];
75} __packed;
76
77#define A2MP_CHANGE_NOTIFY 0x04
78#define A2MP_CHANGE_RSP 0x05
79
80#define A2MP_GETINFO_REQ 0x06
81struct a2mp_info_req {
82 __u8 id;
83} __packed;
84
85#define A2MP_GETINFO_RSP 0x07
86struct a2mp_info_rsp {
87 __u8 id;
88 __u8 status;
89 __le32 total_bw;
90 __le32 max_bw;
91 __le32 min_latency;
92 __le16 pal_cap;
93 __le16 assoc_size;
94} __packed;
95
96#define A2MP_GETAMPASSOC_REQ 0x08
97struct a2mp_amp_assoc_req {
98 __u8 id;
99} __packed;
100
101#define A2MP_GETAMPASSOC_RSP 0x09
102struct a2mp_amp_assoc_rsp {
103 __u8 id;
104 __u8 status;
105 __u8 amp_assoc[0];
106} __packed;
107
108#define A2MP_CREATEPHYSLINK_REQ 0x0A
109#define A2MP_DISCONNPHYSLINK_REQ 0x0C
110struct a2mp_physlink_req {
111 __u8 local_id;
112 __u8 remote_id;
113 __u8 amp_assoc[0];
114} __packed;
115
116#define A2MP_CREATEPHYSLINK_RSP 0x0B
117#define A2MP_DISCONNPHYSLINK_RSP 0x0D
118struct a2mp_physlink_rsp {
119 __u8 local_id;
120 __u8 remote_id;
121 __u8 status;
122} __packed;
123
124/* A2MP response status */
125#define A2MP_STATUS_SUCCESS 0x00
126#define A2MP_STATUS_INVALID_CTRL_ID 0x01
127#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
128#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
129#define A2MP_STATUS_COLLISION_OCCURED 0x03
130#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
131#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
132#define A2MP_STATUS_SECURITY_VIOLATION 0x06
133
134extern struct list_head amp_mgr_list;
135extern struct mutex amp_mgr_list_lock;
136
137struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
138int amp_mgr_put(struct amp_mgr *mgr);
139u8 __next_ident(struct amp_mgr *mgr);
140struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
141 struct sk_buff *skb);
142struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
143void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
144void a2mp_discover_amp(struct l2cap_chan *chan);
145void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
146void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
147void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
148void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
149
150#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
deleted file mode 100644
index 7ea3db77ba89..000000000000
--- a/include/net/bluetooth/amp.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
50void amp_create_logical_link(struct l2cap_chan *chan);
51void amp_disconnect_logical_link(struct hci_chan *hchan);
52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
53
54#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 10d43d8c7037..2a628b28249f 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -197,8 +197,8 @@ static inline bool bdaddr_type_is_le(__u8 type)
197 return false; 197 return false;
198} 198}
199 199
200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} }) 200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
201#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 201#define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
202 202
203/* Copy, swap, convert BD Address */ 203/* Copy, swap, convert BD Address */
204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) 204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
@@ -218,11 +218,10 @@ void baswap(bdaddr_t *dst, bdaddr_t *src);
218 218
219struct bt_sock { 219struct bt_sock {
220 struct sock sk; 220 struct sock sk;
221 bdaddr_t src;
222 bdaddr_t dst;
223 struct list_head accept_q; 221 struct list_head accept_q;
224 struct sock *parent; 222 struct sock *parent;
225 unsigned long flags; 223 unsigned long flags;
224 void (*skb_msg_name)(struct sk_buff *, void *, int *);
226}; 225};
227 226
228enum { 227enum {
@@ -249,6 +248,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
249uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); 248uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
250int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 249int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
251int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 250int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
251int bt_sock_wait_ready(struct sock *sk, unsigned long flags);
252 252
253void bt_accept_enqueue(struct sock *parent, struct sock *sk); 253void bt_accept_enqueue(struct sock *parent, struct sock *sk);
254void bt_accept_unlink(struct sock *sk); 254void bt_accept_unlink(struct sock *sk);
@@ -282,8 +282,11 @@ struct bt_skb_cb {
282 __u8 incoming; 282 __u8 incoming;
283 __u16 expect; 283 __u16 expect;
284 __u8 force_active; 284 __u8 force_active;
285 struct l2cap_chan *chan;
285 struct l2cap_ctrl control; 286 struct l2cap_ctrl control;
286 struct hci_req_ctrl req; 287 struct hci_req_ctrl req;
288 bdaddr_t bdaddr;
289 __le16 psm;
287}; 290};
288#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 291#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
289 292
@@ -331,16 +334,16 @@ out:
331 334
332int bt_to_errno(__u16 code); 335int bt_to_errno(__u16 code);
333 336
334extern int hci_sock_init(void); 337int hci_sock_init(void);
335extern void hci_sock_cleanup(void); 338void hci_sock_cleanup(void);
336 339
337extern int bt_sysfs_init(void); 340int bt_sysfs_init(void);
338extern void bt_sysfs_cleanup(void); 341void bt_sysfs_cleanup(void);
339 342
340extern int bt_procfs_init(struct net *net, const char *name, 343int bt_procfs_init(struct net *net, const char *name,
341 struct bt_sock_list* sk_list, 344 struct bt_sock_list *sk_list,
342 int (* seq_show)(struct seq_file *, void *)); 345 int (*seq_show)(struct seq_file *, void *));
343extern void bt_procfs_cleanup(struct net *net, const char *name); 346void bt_procfs_cleanup(struct net *net, const char *name);
344 347
345extern struct dentry *bt_debugfs; 348extern struct dentry *bt_debugfs;
346 349
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaeaf0938ec0..1784c48699f0 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -35,6 +35,8 @@
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672 36#define HCI_MAX_AMP_ASSOC_SIZE 672
37 37
38#define HCI_MAX_CSB_DATA_SIZE 252
39
38/* HCI dev events */ 40/* HCI dev events */
39#define HCI_DEV_REG 1 41#define HCI_DEV_REG 1
40#define HCI_DEV_UNREG 2 42#define HCI_DEV_UNREG 2
@@ -62,16 +64,20 @@
62#define HCI_AMP 0x01 64#define HCI_AMP 0x01
63 65
64/* First BR/EDR Controller shall have ID = 0 */ 66/* First BR/EDR Controller shall have ID = 0 */
65#define HCI_BREDR_ID 0 67#define AMP_ID_BREDR 0x00
68
69/* AMP controller types */
70#define AMP_TYPE_BREDR 0x00
71#define AMP_TYPE_80211 0x01
66 72
67/* AMP controller status */ 73/* AMP controller status */
68#define AMP_CTRL_POWERED_DOWN 0x00 74#define AMP_STATUS_POWERED_DOWN 0x00
69#define AMP_CTRL_BLUETOOTH_ONLY 0x01 75#define AMP_STATUS_BLUETOOTH_ONLY 0x01
70#define AMP_CTRL_NO_CAPACITY 0x02 76#define AMP_STATUS_NO_CAPACITY 0x02
71#define AMP_CTRL_LOW_CAPACITY 0x03 77#define AMP_STATUS_LOW_CAPACITY 0x03
72#define AMP_CTRL_MEDIUM_CAPACITY 0x04 78#define AMP_STATUS_MEDIUM_CAPACITY 0x04
73#define AMP_CTRL_HIGH_CAPACITY 0x05 79#define AMP_STATUS_HIGH_CAPACITY 0x05
74#define AMP_CTRL_FULL_CAPACITY 0x06 80#define AMP_STATUS_FULL_CAPACITY 0x06
75 81
76/* HCI device quirks */ 82/* HCI device quirks */
77enum { 83enum {
@@ -104,22 +110,27 @@ enum {
104enum { 110enum {
105 HCI_SETUP, 111 HCI_SETUP,
106 HCI_AUTO_OFF, 112 HCI_AUTO_OFF,
113 HCI_RFKILLED,
107 HCI_MGMT, 114 HCI_MGMT,
108 HCI_PAIRABLE, 115 HCI_PAIRABLE,
109 HCI_SERVICE_CACHE, 116 HCI_SERVICE_CACHE,
110 HCI_DEBUG_KEYS, 117 HCI_DEBUG_KEYS,
118 HCI_DUT_MODE,
111 HCI_UNREGISTER, 119 HCI_UNREGISTER,
120 HCI_USER_CHANNEL,
112 121
113 HCI_LE_SCAN, 122 HCI_LE_SCAN,
114 HCI_SSP_ENABLED, 123 HCI_SSP_ENABLED,
115 HCI_HS_ENABLED, 124 HCI_HS_ENABLED,
116 HCI_LE_ENABLED, 125 HCI_LE_ENABLED,
117 HCI_LE_PERIPHERAL, 126 HCI_ADVERTISING,
118 HCI_CONNECTABLE, 127 HCI_CONNECTABLE,
119 HCI_DISCOVERABLE, 128 HCI_DISCOVERABLE,
129 HCI_LIMITED_DISCOVERABLE,
120 HCI_LINK_SECURITY, 130 HCI_LINK_SECURITY,
121 HCI_PERIODIC_INQ, 131 HCI_PERIODIC_INQ,
122 HCI_FAST_CONNECTABLE, 132 HCI_FAST_CONNECTABLE,
133 HCI_BREDR_ENABLED,
123}; 134};
124 135
125/* A mask for the flags that are supposed to remain when a reset happens 136/* A mask for the flags that are supposed to remain when a reset happens
@@ -623,6 +634,24 @@ struct hci_rp_logical_link_cancel {
623 __u8 flow_spec_id; 634 __u8 flow_spec_id;
624} __packed; 635} __packed;
625 636
637#define HCI_OP_SET_CSB 0x0441
638struct hci_cp_set_csb {
639 __u8 enable;
640 __u8 lt_addr;
641 __u8 lpo_allowed;
642 __le16 packet_type;
643 __le16 interval_min;
644 __le16 interval_max;
645 __le16 csb_sv_tout;
646} __packed;
647struct hci_rp_set_csb {
648 __u8 status;
649 __u8 lt_addr;
650 __le16 interval;
651} __packed;
652
653#define HCI_OP_START_SYNC_TRAIN 0x0443
654
626#define HCI_OP_SNIFF_MODE 0x0803 655#define HCI_OP_SNIFF_MODE 0x0803
627struct hci_cp_sniff_mode { 656struct hci_cp_sniff_mode {
628 __le16 handle; 657 __le16 handle;
@@ -693,9 +722,6 @@ struct hci_cp_sniff_subrate {
693} __packed; 722} __packed;
694 723
695#define HCI_OP_SET_EVENT_MASK 0x0c01 724#define HCI_OP_SET_EVENT_MASK 0x0c01
696struct hci_cp_set_event_mask {
697 __u8 mask[8];
698} __packed;
699 725
700#define HCI_OP_RESET 0x0c03 726#define HCI_OP_RESET 0x0c03
701 727
@@ -791,6 +817,20 @@ struct hci_cp_host_buffer_size {
791 __le16 sco_max_pkt; 817 __le16 sco_max_pkt;
792} __packed; 818} __packed;
793 819
820#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
821struct hci_rp_read_num_supported_iac {
822 __u8 status;
823 __u8 num_iac;
824} __packed;
825
826#define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39
827
828#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
829struct hci_cp_write_current_iac_lap {
830 __u8 num_iac;
831 __u8 iac_lap[6];
832} __packed;
833
794#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 834#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
795 835
796#define HCI_MAX_EIR_LENGTH 240 836#define HCI_MAX_EIR_LENGTH 240
@@ -825,6 +865,10 @@ struct hci_rp_read_inq_rsp_tx_power {
825 __s8 tx_power; 865 __s8 tx_power;
826} __packed; 866} __packed;
827 867
868#define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63
869
870#define HCI_OP_READ_LOCATION_DATA 0x0c64
871
828#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 872#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
829struct hci_rp_read_flow_control_mode { 873struct hci_rp_read_flow_control_mode {
830 __u8 status; 874 __u8 status;
@@ -837,6 +881,50 @@ struct hci_cp_write_le_host_supported {
837 __u8 simul; 881 __u8 simul;
838} __packed; 882} __packed;
839 883
884#define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74
885struct hci_cp_set_reserved_lt_addr {
886 __u8 lt_addr;
887} __packed;
888struct hci_rp_set_reserved_lt_addr {
889 __u8 status;
890 __u8 lt_addr;
891} __packed;
892
893#define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75
894struct hci_cp_delete_reserved_lt_addr {
895 __u8 lt_addr;
896} __packed;
897struct hci_rp_delete_reserved_lt_addr {
898 __u8 status;
899 __u8 lt_addr;
900} __packed;
901
902#define HCI_OP_SET_CSB_DATA 0x0c76
903struct hci_cp_set_csb_data {
904 __u8 lt_addr;
905 __u8 fragment;
906 __u8 data_length;
907 __u8 data[HCI_MAX_CSB_DATA_SIZE];
908} __packed;
909struct hci_rp_set_csb_data {
910 __u8 status;
911 __u8 lt_addr;
912} __packed;
913
914#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
915
916#define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78
917struct hci_cp_write_sync_train_params {
918 __le16 interval_min;
919 __le16 interval_max;
920 __le32 sync_train_tout;
921 __u8 service_data;
922} __packed;
923struct hci_rp_write_sync_train_params {
924 __u8 status;
925 __le16 sync_train_int;
926} __packed;
927
840#define HCI_OP_READ_LOCAL_VERSION 0x1001 928#define HCI_OP_READ_LOCAL_VERSION 0x1001
841struct hci_rp_read_local_version { 929struct hci_rp_read_local_version {
842 __u8 status; 930 __u8 status;
@@ -956,6 +1044,10 @@ struct hci_rp_write_remote_amp_assoc {
956 __u8 phy_handle; 1044 __u8 phy_handle;
957} __packed; 1045} __packed;
958 1046
1047#define HCI_OP_ENABLE_DUT_MODE 0x1803
1048
1049#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
1050
959#define HCI_OP_LE_SET_EVENT_MASK 0x2001 1051#define HCI_OP_LE_SET_EVENT_MASK 0x2001
960struct hci_cp_le_set_event_mask { 1052struct hci_cp_le_set_event_mask {
961 __u8 mask[8]; 1053 __u8 mask[8];
@@ -974,6 +1066,20 @@ struct hci_rp_le_read_local_features {
974 __u8 features[8]; 1066 __u8 features[8];
975} __packed; 1067} __packed;
976 1068
1069#define HCI_OP_LE_SET_RANDOM_ADDR 0x2005
1070
1071#define HCI_OP_LE_SET_ADV_PARAM 0x2006
1072struct hci_cp_le_set_adv_param {
1073 __le16 min_interval;
1074 __le16 max_interval;
1075 __u8 type;
1076 __u8 own_address_type;
1077 __u8 direct_addr_type;
1078 bdaddr_t direct_addr;
1079 __u8 channel_map;
1080 __u8 filter_policy;
1081} __packed;
1082
977#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1083#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
978struct hci_rp_le_read_adv_tx_power { 1084struct hci_rp_le_read_adv_tx_power {
979 __u8 status; 1085 __u8 status;
@@ -988,6 +1094,12 @@ struct hci_cp_le_set_adv_data {
988 __u8 data[HCI_MAX_AD_LENGTH]; 1094 __u8 data[HCI_MAX_AD_LENGTH];
989} __packed; 1095} __packed;
990 1096
1097#define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009
1098struct hci_cp_le_set_scan_rsp_data {
1099 __u8 length;
1100 __u8 data[HCI_MAX_AD_LENGTH];
1101} __packed;
1102
991#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1103#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
992 1104
993#define LE_SCAN_PASSIVE 0x00 1105#define LE_SCAN_PASSIVE 0x00
@@ -1437,6 +1549,13 @@ struct hci_ev_num_comp_blocks {
1437 struct hci_comp_blocks_info handles[0]; 1549 struct hci_comp_blocks_info handles[0];
1438} __packed; 1550} __packed;
1439 1551
1552#define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F
1553struct hci_ev_sync_train_complete {
1554 __u8 status;
1555} __packed;
1556
1557#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
1558
1440/* Low energy meta events */ 1559/* Low energy meta events */
1441#define LE_CONN_ROLE_MASTER 0x00 1560#define LE_CONN_ROLE_MASTER 0x00
1442 1561
@@ -1461,11 +1580,11 @@ struct hci_ev_le_ltk_req {
1461} __packed; 1580} __packed;
1462 1581
1463/* Advertising report event types */ 1582/* Advertising report event types */
1464#define ADV_IND 0x00 1583#define LE_ADV_IND 0x00
1465#define ADV_DIRECT_IND 0x01 1584#define LE_ADV_DIRECT_IND 0x01
1466#define ADV_SCAN_IND 0x02 1585#define LE_ADV_SCAN_IND 0x02
1467#define ADV_NONCONN_IND 0x03 1586#define LE_ADV_NONCONN_IND 0x03
1468#define ADV_SCAN_RSP 0x04 1587#define LE_ADV_SCAN_RSP 0x04
1469 1588
1470#define ADDR_LE_DEV_PUBLIC 0x00 1589#define ADDR_LE_DEV_PUBLIC 0x00
1471#define ADDR_LE_DEV_RANDOM 0x01 1590#define ADDR_LE_DEV_RANDOM 0x01
@@ -1570,6 +1689,7 @@ struct sockaddr_hci {
1570#define HCI_DEV_NONE 0xffff 1689#define HCI_DEV_NONE 0xffff
1571 1690
1572#define HCI_CHANNEL_RAW 0 1691#define HCI_CHANNEL_RAW 0
1692#define HCI_CHANNEL_USER 1
1573#define HCI_CHANNEL_MONITOR 2 1693#define HCI_CHANNEL_MONITOR 2
1574#define HCI_CHANNEL_CONTROL 3 1694#define HCI_CHANNEL_CONTROL 3
1575 1695
@@ -1672,6 +1792,4 @@ struct hci_inquiry_req {
1672}; 1792};
1673#define IREQ_CACHE_FLUSH 0x0001 1793#define IREQ_CACHE_FLUSH 0x0001
1674 1794
1675extern bool enable_hs;
1676
1677#endif /* __HCI_H */ 1795#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3ede820d328f..f8555ad7b104 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -81,6 +81,7 @@ struct hci_conn_hash {
81struct bdaddr_list { 81struct bdaddr_list {
82 struct list_head list; 82 struct list_head list;
83 bdaddr_t bdaddr; 83 bdaddr_t bdaddr;
84 u8 bdaddr_type;
84}; 85};
85 86
86struct bt_uuid { 87struct bt_uuid {
@@ -140,6 +141,8 @@ struct hci_dev {
140 __u8 bus; 141 __u8 bus;
141 __u8 dev_type; 142 __u8 dev_type;
142 bdaddr_t bdaddr; 143 bdaddr_t bdaddr;
144 bdaddr_t static_addr;
145 __u8 own_addr_type;
143 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 146 __u8 dev_name[HCI_MAX_NAME_LENGTH];
144 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
145 __u8 eir[HCI_MAX_EIR_LENGTH]; 148 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -158,11 +161,17 @@ struct hci_dev {
158 __u16 manufacturer; 161 __u16 manufacturer;
159 __u16 lmp_subver; 162 __u16 lmp_subver;
160 __u16 voice_setting; 163 __u16 voice_setting;
164 __u8 num_iac;
161 __u8 io_capability; 165 __u8 io_capability;
162 __s8 inq_tx_power; 166 __s8 inq_tx_power;
163 __u16 page_scan_interval; 167 __u16 page_scan_interval;
164 __u16 page_scan_window; 168 __u16 page_scan_window;
165 __u8 page_scan_type; 169 __u8 page_scan_type;
170 __u16 le_scan_interval;
171 __u16 le_scan_window;
172 __u16 le_conn_min_interval;
173 __u16 le_conn_max_interval;
174 __u8 ssp_debug_mode;
166 175
167 __u16 devid_source; 176 __u16 devid_source;
168 __u16 devid_vendor; 177 __u16 devid_vendor;
@@ -279,14 +288,15 @@ struct hci_dev {
279 __s8 adv_tx_power; 288 __s8 adv_tx_power;
280 __u8 adv_data[HCI_MAX_AD_LENGTH]; 289 __u8 adv_data[HCI_MAX_AD_LENGTH];
281 __u8 adv_data_len; 290 __u8 adv_data_len;
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len;
282 293
283 int (*open)(struct hci_dev *hdev); 294 int (*open)(struct hci_dev *hdev);
284 int (*close)(struct hci_dev *hdev); 295 int (*close)(struct hci_dev *hdev);
285 int (*flush)(struct hci_dev *hdev); 296 int (*flush)(struct hci_dev *hdev);
286 int (*setup)(struct hci_dev *hdev); 297 int (*setup)(struct hci_dev *hdev);
287 int (*send)(struct sk_buff *skb); 298 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
288 void (*notify)(struct hci_dev *hdev, unsigned int evt); 299 void (*notify)(struct hci_dev *hdev, unsigned int evt);
289 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
290}; 300};
291 301
292#define HCI_PHY_HANDLE(handle) (handle & 0xff) 302#define HCI_PHY_HANDLE(handle) (handle & 0xff)
@@ -298,6 +308,8 @@ struct hci_conn {
298 308
299 bdaddr_t dst; 309 bdaddr_t dst;
300 __u8 dst_type; 310 __u8 dst_type;
311 bdaddr_t src;
312 __u8 src_type;
301 __u16 handle; 313 __u16 handle;
302 __u16 state; 314 __u16 state;
303 __u8 mode; 315 __u8 mode;
@@ -306,7 +318,6 @@ struct hci_conn {
306 __u8 attempt; 318 __u8 attempt;
307 __u8 dev_class[3]; 319 __u8 dev_class[3];
308 __u8 features[HCI_MAX_PAGES][8]; 320 __u8 features[HCI_MAX_PAGES][8];
309 __u16 interval;
310 __u16 pkt_type; 321 __u16 pkt_type;
311 __u16 link_policy; 322 __u16 link_policy;
312 __u32 link_mode; 323 __u32 link_mode;
@@ -334,8 +345,8 @@ struct hci_conn {
334 struct list_head chan_list; 345 struct list_head chan_list;
335 346
336 struct delayed_work disc_work; 347 struct delayed_work disc_work;
337 struct timer_list idle_timer; 348 struct delayed_work auto_accept_work;
338 struct timer_list auto_accept_timer; 349 struct delayed_work idle_work;
339 350
340 struct device dev; 351 struct device dev;
341 352
@@ -367,18 +378,17 @@ extern rwlock_t hci_dev_list_lock;
367extern rwlock_t hci_cb_list_lock; 378extern rwlock_t hci_cb_list_lock;
368 379
369/* ----- HCI interface to upper protocols ----- */ 380/* ----- HCI interface to upper protocols ----- */
370extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 381int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
371extern void l2cap_connect_cfm(struct hci_conn *hcon, u8 status); 382void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
372extern int l2cap_disconn_ind(struct hci_conn *hcon); 383int l2cap_disconn_ind(struct hci_conn *hcon);
373extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 384void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
374extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 385int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
375extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 386int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
376 u16 flags); 387
377 388int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
378extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 389void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
379extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 390void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
380extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 391int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
381extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
382 392
383/* ----- Inquiry cache ----- */ 393/* ----- Inquiry cache ----- */
384#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 394#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
@@ -644,7 +654,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)
644 switch (conn->type) { 654 switch (conn->type) {
645 case ACL_LINK: 655 case ACL_LINK:
646 case LE_LINK: 656 case LE_LINK:
647 del_timer(&conn->idle_timer); 657 cancel_delayed_work(&conn->idle_work);
648 if (conn->state == BT_CONNECTED) { 658 if (conn->state == BT_CONNECTED) {
649 timeo = conn->disc_timeout; 659 timeo = conn->disc_timeout;
650 if (!conn->out) 660 if (!conn->out)
@@ -703,19 +713,6 @@ static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
703 dev_set_drvdata(&hdev->dev, data); 713 dev_set_drvdata(&hdev->dev, data);
704} 714}
705 715
706/* hci_dev_list shall be locked */
707static inline uint8_t __hci_num_ctrl(void)
708{
709 uint8_t count = 0;
710 struct list_head *p;
711
712 list_for_each(p, &hci_dev_list) {
713 count++;
714 }
715
716 return count;
717}
718
719struct hci_dev *hci_dev_get(int index); 716struct hci_dev *hci_dev_get(int index);
720struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src); 717struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src);
721 718
@@ -738,7 +735,7 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
738int hci_inquiry(void __user *arg); 735int hci_inquiry(void __user *arg);
739 736
740struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 737struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
741 bdaddr_t *bdaddr); 738 bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_clear(struct hci_dev *hdev); 739int hci_blacklist_clear(struct hci_dev *hdev);
743int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 740int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
744int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 741int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
@@ -768,13 +765,11 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
768 765
769void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 766void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
770 767
771int hci_recv_frame(struct sk_buff *skb); 768int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
772int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 769int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
773int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 770int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
774 771
775void hci_init_sysfs(struct hci_dev *hdev); 772void hci_init_sysfs(struct hci_dev *hdev);
776int hci_add_sysfs(struct hci_dev *hdev);
777void hci_del_sysfs(struct hci_dev *hdev);
778void hci_conn_init_sysfs(struct hci_conn *conn); 773void hci_conn_init_sysfs(struct hci_conn *conn);
779void hci_conn_add_sysfs(struct hci_conn *conn); 774void hci_conn_add_sysfs(struct hci_conn *conn);
780void hci_conn_del_sysfs(struct hci_conn *conn); 775void hci_conn_del_sysfs(struct hci_conn *conn);
@@ -807,22 +802,6 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
807#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 802#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
808#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 803#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
809 804
810/* returns true if at least one AMP active */
811static inline bool hci_amp_capable(void)
812{
813 struct hci_dev *hdev;
814 bool ret = false;
815
816 read_lock(&hci_dev_list_lock);
817 list_for_each_entry(hdev, &hci_dev_list, list)
818 if (hdev->amp_type == HCI_AMP &&
819 test_bit(HCI_UP, &hdev->flags))
820 ret = true;
821 read_unlock(&hci_dev_list_lock);
822
823 return ret;
824}
825
826/* ----- HCI protocols ----- */ 805/* ----- HCI protocols ----- */
827#define HCI_PROTO_DEFER 0x01 806#define HCI_PROTO_DEFER 0x01
828 807
@@ -1033,34 +1012,6 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1033 return false; 1012 return false;
1034} 1013}
1035 1014
1036static inline size_t eir_get_length(u8 *eir, size_t eir_len)
1037{
1038 size_t parsed = 0;
1039
1040 while (parsed < eir_len) {
1041 u8 field_len = eir[0];
1042
1043 if (field_len == 0)
1044 return parsed;
1045
1046 parsed += field_len + 1;
1047 eir += field_len + 1;
1048 }
1049
1050 return eir_len;
1051}
1052
1053static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
1054 u8 data_len)
1055{
1056 eir[eir_len++] = sizeof(type) + data_len;
1057 eir[eir_len++] = type;
1058 memcpy(&eir[eir_len], data, data_len);
1059 eir_len += data_len;
1060
1061 return eir_len;
1062}
1063
1064int hci_register_cb(struct hci_cb *hcb); 1015int hci_register_cb(struct hci_cb *hcb);
1065int hci_unregister_cb(struct hci_cb *hcb); 1016int hci_unregister_cb(struct hci_cb *hcb);
1066 1017
@@ -1120,29 +1071,30 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1120#define DISCOV_BREDR_INQUIRY_LEN 0x08 1071#define DISCOV_BREDR_INQUIRY_LEN 0x08
1121 1072
1122int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1073int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1123int mgmt_index_added(struct hci_dev *hdev); 1074void mgmt_index_added(struct hci_dev *hdev);
1124int mgmt_index_removed(struct hci_dev *hdev); 1075void mgmt_index_removed(struct hci_dev *hdev);
1125int mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1076void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1126int mgmt_powered(struct hci_dev *hdev, u8 powered); 1077int mgmt_powered(struct hci_dev *hdev, u8 powered);
1127int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1078void mgmt_discoverable_timeout(struct hci_dev *hdev);
1128int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1079void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1129int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1080void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1130int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1081void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1131 bool persistent); 1082void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1132int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1083 bool persistent);
1133 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1084void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1134 u8 *dev_class); 1085 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1135int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1086 u8 *dev_class);
1136 u8 link_type, u8 addr_type, u8 reason); 1087void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1137int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1088 u8 link_type, u8 addr_type, u8 reason);
1138 u8 link_type, u8 addr_type, u8 status); 1089void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1139int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1090 u8 link_type, u8 addr_type, u8 status);
1140 u8 addr_type, u8 status); 1091void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1141int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 1092 u8 addr_type, u8 status);
1142int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1093void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
1143 u8 status); 1094void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1144int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1095 u8 status);
1145 u8 status); 1096void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 status);
1146int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1098int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1147 u8 link_type, u8 addr_type, __le32 value, 1099 u8 link_type, u8 addr_type, __le32 value,
1148 u8 confirm_hint); 1100 u8 confirm_hint);
@@ -1159,26 +1111,25 @@ int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1159int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, 1111int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1160 u8 link_type, u8 addr_type, u32 passkey, 1112 u8 link_type, u8 addr_type, u32 passkey,
1161 u8 entered); 1113 u8 entered);
1162int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1114void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1163 u8 addr_type, u8 status); 1115 u8 addr_type, u8 status);
1164int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1116void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1165int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1117void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1166int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1118void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1167 u8 status); 1119 u8 status);
1168int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1120void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1169int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1121void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
1170 u8 *randomizer, u8 status); 1122 u8 *randomizer, u8 status);
1171int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1123void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1172int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1124 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1173 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1125 u8 ssp, u8 *eir, u16 eir_len);
1174 u8 ssp, u8 *eir, u16 eir_len); 1126void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1175int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1127 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1176 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1128void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1177int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1178int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1129int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1179int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1130int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1180bool mgmt_valid_hdev(struct hci_dev *hdev); 1131void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
1181int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1132void mgmt_reenable_advertising(struct hci_dev *hdev);
1182 1133
1183/* HCI info for socket */ 1134/* HCI info for socket */
1184#define hci_pi(sk) ((struct hci_pinfo *) sk) 1135#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1208,15 +1159,11 @@ struct hci_sec_filter {
1208#define hci_req_lock(d) mutex_lock(&d->req_lock) 1159#define hci_req_lock(d) mutex_lock(&d->req_lock)
1209#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1160#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1210 1161
1211void hci_update_ad(struct hci_request *req);
1212
1213void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1162void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1214 u16 latency, u16 to_multiplier); 1163 u16 latency, u16 to_multiplier);
1215void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1164void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1216 __u8 ltk[16]); 1165 __u8 ltk[16]);
1217 1166
1218u8 bdaddr_to_le(u8 bdaddr_type);
1219
1220#define SCO_AIRMODE_MASK 0x0003 1167#define SCO_AIRMODE_MASK 0x0003
1221#define SCO_AIRMODE_CVSD 0x0000 1168#define SCO_AIRMODE_CVSD 0x0000
1222#define SCO_AIRMODE_TRANSP 0x0003 1169#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 1a966afbbfa8..51329905bfaa 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -131,6 +131,7 @@ struct l2cap_conninfo {
131 131
132/* L2CAP fixed channels */ 132/* L2CAP fixed channels */
133#define L2CAP_FC_L2CAP 0x02 133#define L2CAP_FC_L2CAP 0x02
134#define L2CAP_FC_CONNLESS 0x04
134#define L2CAP_FC_A2MP 0x08 135#define L2CAP_FC_A2MP 0x08
135 136
136/* L2CAP Control Field bit masks */ 137/* L2CAP Control Field bit masks */
@@ -237,6 +238,7 @@ struct l2cap_conn_rsp {
237/* protocol/service multiplexer (PSM) */ 238/* protocol/service multiplexer (PSM) */
238#define L2CAP_PSM_SDP 0x0001 239#define L2CAP_PSM_SDP 0x0001
239#define L2CAP_PSM_RFCOMM 0x0003 240#define L2CAP_PSM_RFCOMM 0x0003
241#define L2CAP_PSM_3DSP 0x0021
240 242
241/* channel indentifier */ 243/* channel indentifier */
242#define L2CAP_CID_SIGNALING 0x0001 244#define L2CAP_CID_SIGNALING 0x0001
@@ -433,8 +435,6 @@ struct l2cap_seq_list {
433#define L2CAP_SEQ_LIST_TAIL 0x8000 435#define L2CAP_SEQ_LIST_TAIL 0x8000
434 436
435struct l2cap_chan { 437struct l2cap_chan {
436 struct sock *sk;
437
438 struct l2cap_conn *conn; 438 struct l2cap_conn *conn;
439 struct hci_conn *hs_hcon; 439 struct hci_conn *hs_hcon;
440 struct hci_chan *hs_hchan; 440 struct hci_chan *hs_hchan;
@@ -442,7 +442,12 @@ struct l2cap_chan {
442 442
443 __u8 state; 443 __u8 state;
444 444
445 bdaddr_t dst;
446 __u8 dst_type;
447 bdaddr_t src;
448 __u8 src_type;
445 __le16 psm; 449 __le16 psm;
450 __le16 sport;
446 __u16 dcid; 451 __u16 dcid;
447 __u16 scid; 452 __u16 scid;
448 453
@@ -453,8 +458,6 @@ struct l2cap_chan {
453 __u8 chan_type; 458 __u8 chan_type;
454 __u8 chan_policy; 459 __u8 chan_policy;
455 460
456 __le16 sport;
457
458 __u8 sec_level; 461 __u8 sec_level;
459 462
460 __u8 ident; 463 __u8 ident;
@@ -546,9 +549,12 @@ struct l2cap_ops {
546 void (*teardown) (struct l2cap_chan *chan, int err); 549 void (*teardown) (struct l2cap_chan *chan, int err);
547 void (*close) (struct l2cap_chan *chan); 550 void (*close) (struct l2cap_chan *chan);
548 void (*state_change) (struct l2cap_chan *chan, 551 void (*state_change) (struct l2cap_chan *chan,
549 int state); 552 int state, int err);
550 void (*ready) (struct l2cap_chan *chan); 553 void (*ready) (struct l2cap_chan *chan);
551 void (*defer) (struct l2cap_chan *chan); 554 void (*defer) (struct l2cap_chan *chan);
555 void (*resume) (struct l2cap_chan *chan);
556 void (*set_shutdown) (struct l2cap_chan *chan);
557 long (*get_sndtimeo) (struct l2cap_chan *chan);
552 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 558 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
553 unsigned long len, int nb); 559 unsigned long len, int nb);
554}; 560};
@@ -557,13 +563,11 @@ struct l2cap_conn {
557 struct hci_conn *hcon; 563 struct hci_conn *hcon;
558 struct hci_chan *hchan; 564 struct hci_chan *hchan;
559 565
560 bdaddr_t *dst;
561 bdaddr_t *src;
562
563 unsigned int mtu; 566 unsigned int mtu;
564 567
565 __u32 feat_mask; 568 __u32 feat_mask;
566 __u8 fixed_chan_mask; 569 __u8 fixed_chan_mask;
570 bool hs_enabled;
567 571
568 __u8 info_state; 572 __u8 info_state;
569 __u8 info_ident; 573 __u8 info_ident;
@@ -649,6 +653,7 @@ enum {
649 FLAG_FLUSHABLE, 653 FLAG_FLUSHABLE,
650 FLAG_EXT_CTRL, 654 FLAG_EXT_CTRL,
651 FLAG_EFS_ENABLE, 655 FLAG_EFS_ENABLE,
656 FLAG_DEFER_SETUP,
652}; 657};
653 658
654enum { 659enum {
@@ -790,6 +795,19 @@ static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
790{ 795{
791} 796}
792 797
798static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
799{
800}
801
802static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
803{
804}
805
806static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
807{
808 return 0;
809}
810
793extern bool disable_ertm; 811extern bool disable_ertm;
794 812
795int l2cap_init_sockets(void); 813int l2cap_init_sockets(void);
@@ -797,7 +815,6 @@ void l2cap_cleanup_sockets(void);
797bool l2cap_is_socket(struct socket *sock); 815bool l2cap_is_socket(struct socket *sock);
798 816
799void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 817void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
800int __l2cap_wait_ack(struct sock *sk);
801 818
802int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 819int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
803int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 820int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 9944c3e68c5d..518c5c84e39a 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -93,6 +93,7 @@ struct mgmt_rp_read_index_list {
93#define MGMT_SETTING_BREDR 0x00000080 93#define MGMT_SETTING_BREDR 0x00000080
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400
96 97
97#define MGMT_OP_READ_INFO 0x0004 98#define MGMT_OP_READ_INFO 0x0004
98#define MGMT_READ_INFO_SIZE 0 99#define MGMT_READ_INFO_SIZE 0
@@ -351,6 +352,23 @@ struct mgmt_cp_set_device_id {
351} __packed; 352} __packed;
352#define MGMT_SET_DEVICE_ID_SIZE 8 353#define MGMT_SET_DEVICE_ID_SIZE 8
353 354
355#define MGMT_OP_SET_ADVERTISING 0x0029
356
357#define MGMT_OP_SET_BREDR 0x002A
358
359#define MGMT_OP_SET_STATIC_ADDRESS 0x002B
360struct mgmt_cp_set_static_address {
361 bdaddr_t bdaddr;
362} __packed;
363#define MGMT_SET_STATIC_ADDRESS_SIZE 6
364
365#define MGMT_OP_SET_SCAN_PARAMS 0x002C
366struct mgmt_cp_set_scan_params {
367 __le16 interval;
368 __le16 window;
369} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4
371
354#define MGMT_EV_CMD_COMPLETE 0x0001 372#define MGMT_EV_CMD_COMPLETE 0x0001
355struct mgmt_ev_cmd_complete { 373struct mgmt_ev_cmd_complete {
356 __le16 opcode; 374 __le16 opcode;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 7afd4199d6b6..486213a1aed8 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -256,8 +256,8 @@ static inline void rfcomm_dlc_put(struct rfcomm_dlc *d)
256 rfcomm_dlc_free(d); 256 rfcomm_dlc_free(d);
257} 257}
258 258
259extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); 259void __rfcomm_dlc_throttle(struct rfcomm_dlc *d);
260extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); 260void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d);
261 261
262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) 262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d)
263{ 263{
@@ -300,6 +300,8 @@ struct rfcomm_conninfo {
300 300
301struct rfcomm_pinfo { 301struct rfcomm_pinfo {
302 struct bt_sock bt; 302 struct bt_sock bt;
303 bdaddr_t src;
304 bdaddr_t dst;
303 struct rfcomm_dlc *dlc; 305 struct rfcomm_dlc *dlc;
304 u8 channel; 306 u8 channel;
305 u8 sec_level; 307 u8 sec_level;
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index e252a31ee6b6..2019d1a0996a 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -55,9 +55,6 @@ struct sco_conninfo {
55struct sco_conn { 55struct sco_conn {
56 struct hci_conn *hcon; 56 struct hci_conn *hcon;
57 57
58 bdaddr_t *dst;
59 bdaddr_t *src;
60
61 spinlock_t lock; 58 spinlock_t lock;
62 struct sock *sk; 59 struct sock *sk;
63 60
@@ -72,6 +69,8 @@ struct sco_conn {
72 69
73struct sco_pinfo { 70struct sco_pinfo {
74 struct bt_sock bt; 71 struct bt_sock bt;
72 bdaddr_t src;
73 bdaddr_t dst;
75 __u32 flags; 74 __u32 flags;
76 __u16 setting; 75 __u16 setting;
77 struct sco_conn *conn; 76 struct sco_conn *conn;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
deleted file mode 100644
index f8ba07f3e5fa..000000000000
--- a/include/net/bluetooth/smp.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation;
8
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
23#ifndef __SMP_H
24#define __SMP_H
25
26struct smp_command_hdr {
27 __u8 code;
28} __packed;
29
30#define SMP_CMD_PAIRING_REQ 0x01
31#define SMP_CMD_PAIRING_RSP 0x02
32struct smp_cmd_pairing {
33 __u8 io_capability;
34 __u8 oob_flag;
35 __u8 auth_req;
36 __u8 max_key_size;
37 __u8 init_key_dist;
38 __u8 resp_key_dist;
39} __packed;
40
41#define SMP_IO_DISPLAY_ONLY 0x00
42#define SMP_IO_DISPLAY_YESNO 0x01
43#define SMP_IO_KEYBOARD_ONLY 0x02
44#define SMP_IO_NO_INPUT_OUTPUT 0x03
45#define SMP_IO_KEYBOARD_DISPLAY 0x04
46
47#define SMP_OOB_NOT_PRESENT 0x00
48#define SMP_OOB_PRESENT 0x01
49
50#define SMP_DIST_ENC_KEY 0x01
51#define SMP_DIST_ID_KEY 0x02
52#define SMP_DIST_SIGN 0x04
53
54#define SMP_AUTH_NONE 0x00
55#define SMP_AUTH_BONDING 0x01
56#define SMP_AUTH_MITM 0x04
57
58#define SMP_CMD_PAIRING_CONFIRM 0x03
59struct smp_cmd_pairing_confirm {
60 __u8 confirm_val[16];
61} __packed;
62
63#define SMP_CMD_PAIRING_RANDOM 0x04
64struct smp_cmd_pairing_random {
65 __u8 rand_val[16];
66} __packed;
67
68#define SMP_CMD_PAIRING_FAIL 0x05
69struct smp_cmd_pairing_fail {
70 __u8 reason;
71} __packed;
72
73#define SMP_CMD_ENCRYPT_INFO 0x06
74struct smp_cmd_encrypt_info {
75 __u8 ltk[16];
76} __packed;
77
78#define SMP_CMD_MASTER_IDENT 0x07
79struct smp_cmd_master_ident {
80 __le16 ediv;
81 __u8 rand[8];
82} __packed;
83
84#define SMP_CMD_IDENT_INFO 0x08
85struct smp_cmd_ident_info {
86 __u8 irk[16];
87} __packed;
88
89#define SMP_CMD_IDENT_ADDR_INFO 0x09
90struct smp_cmd_ident_addr_info {
91 __u8 addr_type;
92 bdaddr_t bdaddr;
93} __packed;
94
95#define SMP_CMD_SIGN_INFO 0x0a
96struct smp_cmd_sign_info {
97 __u8 csrk[16];
98} __packed;
99
100#define SMP_CMD_SECURITY_REQ 0x0b
101struct smp_cmd_security_req {
102 __u8 auth_req;
103} __packed;
104
105#define SMP_PASSKEY_ENTRY_FAILED 0x01
106#define SMP_OOB_NOT_AVAIL 0x02
107#define SMP_AUTH_REQUIREMENTS 0x03
108#define SMP_CONFIRM_FAILED 0x04
109#define SMP_PAIRING_NOTSUPP 0x05
110#define SMP_ENC_KEY_SIZE 0x06
111#define SMP_CMD_NOTSUPP 0x07
112#define SMP_UNSPECIFIED 0x08
113#define SMP_REPEATED_ATTEMPTS 0x09
114
115#define SMP_MIN_ENC_KEY_SIZE 7
116#define SMP_MAX_ENC_KEY_SIZE 16
117
118#define SMP_FLAG_TK_VALID 1
119#define SMP_FLAG_CFM_PENDING 2
120#define SMP_FLAG_MITM_AUTH 3
121
122struct smp_chan {
123 struct l2cap_conn *conn;
124 u8 preq[7]; /* SMP Pairing Request */
125 u8 prsp[7]; /* SMP Pairing Response */
126 u8 prnd[16]; /* SMP Pairing Random (local) */
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */
130 u8 enc_key_size;
131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm;
134 struct work_struct random;
135
136};
137
138/* SMP Commands */
139int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
143
144void smp_chan_destroy(struct l2cap_conn *conn);
145
146#endif /* __SMP_H */
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 4795e817afe5..097f69cfaa75 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -195,6 +195,6 @@ enum ifla_caif_hsi {
195 __IFLA_CAIF_HSI_MAX 195 __IFLA_CAIF_HSI_MAX
196}; 196};
197 197
198extern struct cfhsi_ops *cfhsi_get_ops(void); 198struct cfhsi_ops *cfhsi_get_ops(void);
199 199
200#endif /* CAIF_HSI_H_ */ 200#endif /* CAIF_HSI_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cb710913d5c8..3eae46cb1acf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -437,6 +437,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
437 u32 prohibited_flags); 437 u32 prohibited_flags);
438 438
439/** 439/**
440 * cfg80211_chandef_dfs_required - checks if radar detection is required
441 * @wiphy: the wiphy to validate against
442 * @chandef: the channel definition to check
443 * Return: 1 if radar detection is required, 0 if it is not, < 0 on error
444 */
445int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
446 const struct cfg80211_chan_def *chandef);
447
448/**
440 * ieee80211_chandef_rate_flags - returns rate flags for a channel 449 * ieee80211_chandef_rate_flags - returns rate flags for a channel
441 * 450 *
442 * In some channel types, not all rates may be used - for example CCK 451 * In some channel types, not all rates may be used - for example CCK
@@ -735,6 +744,10 @@ enum station_parameters_apply_mask {
735 * @capability: station capability 744 * @capability: station capability
736 * @ext_capab: extended capabilities of the station 745 * @ext_capab: extended capabilities of the station
737 * @ext_capab_len: number of extended capabilities 746 * @ext_capab_len: number of extended capabilities
747 * @supported_channels: supported channels in IEEE 802.11 format
748 * @supported_channels_len: number of supported channels
749 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
750 * @supported_oper_classes_len: number of supported operating classes
738 */ 751 */
739struct station_parameters { 752struct station_parameters {
740 const u8 *supported_rates; 753 const u8 *supported_rates;
@@ -754,6 +767,10 @@ struct station_parameters {
754 u16 capability; 767 u16 capability;
755 const u8 *ext_capab; 768 const u8 *ext_capab;
756 u8 ext_capab_len; 769 u8 ext_capab_len;
770 const u8 *supported_channels;
771 u8 supported_channels_len;
772 const u8 *supported_oper_classes;
773 u8 supported_oper_classes_len;
757}; 774};
758 775
759/** 776/**
@@ -1647,6 +1664,9 @@ struct cfg80211_disassoc_request {
1647 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1664 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1648 * required to assume that the port is unauthorized until authorized by 1665 * required to assume that the port is unauthorized until authorized by
1649 * user space. Otherwise, port is marked authorized by default. 1666 * user space. Otherwise, port is marked authorized by default.
1667 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1668 * changes the channel when a radar is detected. This is required
1669 * to operate on DFS channels.
1650 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1670 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1651 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1671 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1652 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1672 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
@@ -1664,6 +1684,7 @@ struct cfg80211_ibss_params {
1664 bool channel_fixed; 1684 bool channel_fixed;
1665 bool privacy; 1685 bool privacy;
1666 bool control_port; 1686 bool control_port;
1687 bool userspace_handles_dfs;
1667 int mcast_rate[IEEE80211_NUM_BANDS]; 1688 int mcast_rate[IEEE80211_NUM_BANDS];
1668 struct ieee80211_ht_cap ht_capa; 1689 struct ieee80211_ht_cap ht_capa;
1669 struct ieee80211_ht_cap ht_capa_mask; 1690 struct ieee80211_ht_cap ht_capa_mask;
@@ -3044,6 +3065,7 @@ struct cfg80211_cached_keys;
3044 * @conn: (private) cfg80211 software SME connection state machine data 3065 * @conn: (private) cfg80211 software SME connection state machine data
3045 * @connect_keys: (private) keys to set after connection is established 3066 * @connect_keys: (private) keys to set after connection is established
3046 * @ibss_fixed: (private) IBSS is using fixed BSSID 3067 * @ibss_fixed: (private) IBSS is using fixed BSSID
3068 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3047 * @event_list: (private) list for internal event processing 3069 * @event_list: (private) list for internal event processing
3048 * @event_lock: (private) lock for event list 3070 * @event_lock: (private) lock for event list
3049 */ 3071 */
@@ -3082,6 +3104,7 @@ struct wireless_dev {
3082 struct ieee80211_channel *channel; 3104 struct ieee80211_channel *channel;
3083 3105
3084 bool ibss_fixed; 3106 bool ibss_fixed;
3107 bool ibss_dfs_possible;
3085 3108
3086 bool ps; 3109 bool ps;
3087 int ps_timeout; 3110 int ps_timeout;
@@ -3474,6 +3497,15 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3474const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3497const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3475 u32 center_freq); 3498 u32 center_freq);
3476 3499
3500/**
3501 * reg_initiator_name - map regulatory request initiator enum to name
3502 * @initiator: the regulatory request initiator
3503 *
3504 * You can use this to map the regulatory request initiator enum to a
3505 * proper string representation.
3506 */
3507const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3508
3477/* 3509/*
3478 * callbacks for asynchronous cfg80211 methods, notification 3510 * callbacks for asynchronous cfg80211 methods, notification
3479 * functions and BSS handling helpers 3511 * functions and BSS handling helpers
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 8f59ca50477c..37a0e24adbe7 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -79,6 +79,12 @@ csum_block_add(__wsum csum, __wsum csum2, int offset)
79} 79}
80 80
81static inline __wsum 81static inline __wsum
82csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
83{
84 return csum_block_add(csum, csum2, offset);
85}
86
87static inline __wsum
82csum_block_sub(__wsum csum, __wsum csum2, int offset) 88csum_block_sub(__wsum csum, __wsum csum2, int offset)
83{ 89{
84 u32 sum = (__force u32)csum2; 90 u32 sum = (__force u32)csum2;
@@ -92,6 +98,11 @@ static inline __wsum csum_unfold(__sum16 n)
92 return (__force __wsum)n; 98 return (__force __wsum)n;
93} 99}
94 100
101static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
102{
103 return csum_partial(buff, len, sum);
104}
105
95#define CSUM_MANGLED_0 ((__force __sum16)0xffff) 106#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
96 107
97static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 108static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a7a683e30b64..a8c2ef6d3b93 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -290,6 +290,7 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
290 unsigned char err_offset = 0; 290 unsigned char err_offset = 0;
291 u8 opt_len = opt[1]; 291 u8 opt_len = opt[1];
292 u8 opt_iter; 292 u8 opt_iter;
293 u8 tag_len;
293 294
294 if (opt_len < 8) { 295 if (opt_len < 8) {
295 err_offset = 1; 296 err_offset = 1;
@@ -302,11 +303,12 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
302 } 303 }
303 304
304 for (opt_iter = 6; opt_iter < opt_len;) { 305 for (opt_iter = 6; opt_iter < opt_len;) {
305 if (opt[opt_iter + 1] > (opt_len - opt_iter)) { 306 tag_len = opt[opt_iter + 1];
307 if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) {
306 err_offset = opt_iter + 1; 308 err_offset = opt_iter + 1;
307 goto out; 309 goto out;
308 } 310 }
309 opt_iter += opt[opt_iter + 1]; 311 opt_iter += tag_len;
310 } 312 }
311 313
312out: 314out:
diff --git a/include/net/codel.h b/include/net/codel.h
index 389cf621161d..3b04ff5f6f8d 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -72,10 +72,21 @@ static inline codel_time_t codel_get_time(void)
72 return ns >> CODEL_SHIFT; 72 return ns >> CODEL_SHIFT;
73} 73}
74 74
75#define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0) 75/* Dealing with timer wrapping, according to RFC 1982, as desc in wikipedia:
76#define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0) 76 * https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
77#define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0) 77 * codel_time_after(a,b) returns true if the time a is after time b.
78#define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0) 78 */
79#define codel_time_after(a, b) \
80 (typecheck(codel_time_t, a) && \
81 typecheck(codel_time_t, b) && \
82 ((s32)((a) - (b)) > 0))
83#define codel_time_before(a, b) codel_time_after(b, a)
84
85#define codel_time_after_eq(a, b) \
86 (typecheck(codel_time_t, a) && \
87 typecheck(codel_time_t, b) && \
88 ((s32)((a) - (b)) >= 0))
89#define codel_time_before_eq(a, b) codel_time_after_eq(b, a)
79 90
80/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */ 91/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */
81struct codel_skb_cb { 92struct codel_skb_cb {
diff --git a/include/net/compat.h b/include/net/compat.h
index 6e9565324989..3b603b199c01 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -29,8 +29,8 @@ struct compat_cmsghdr {
29 compat_int_t cmsg_type; 29 compat_int_t cmsg_type;
30}; 30};
31 31
32extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 32int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
33extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); 33int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
34 34
35#else /* defined(CONFIG_COMPAT) */ 35#else /* defined(CONFIG_COMPAT) */
36/* 36/*
@@ -40,24 +40,30 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
40#define compat_mmsghdr mmsghdr 40#define compat_mmsghdr mmsghdr
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); 44int verify_compat_iovec(struct msghdr *, struct iovec *,
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned int); 45 struct sockaddr_storage *, int);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
47 unsigned int, unsigned int); 47 unsigned int);
48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned int); 48asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 49 unsigned int, unsigned int);
50 unsigned int, unsigned int, 50asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
51 struct compat_timespec __user *); 51 unsigned int);
52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 52asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 53 unsigned int, unsigned int,
54 54 struct compat_timespec __user *);
55extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 55asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
56 56 int __user *);
57extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int, 57int put_cmsg_compat(struct msghdr*, int, int, int, void *);
58 int (*)(struct sock *, int, int, char __user *, unsigned int)); 58
59extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 59int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
60 int __user *, int (*)(struct sock *, int, int, char __user *, 60 unsigned char *, int);
61 int __user *)); 61
62int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
63 int (*)(struct sock *, int, int, char __user *,
64 unsigned int));
65int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
66 int (*)(struct sock *, int, int, char __user *,
67 int __user *));
62 68
63#endif /* NET_COMPAT_H */ 69#endif /* NET_COMPAT_H */
diff --git a/include/net/dcbevent.h b/include/net/dcbevent.h
index 443626ed4cbc..d2f3041c0dfa 100644
--- a/include/net/dcbevent.h
+++ b/include/net/dcbevent.h
@@ -25,9 +25,9 @@ enum dcbevent_notif_type {
25}; 25};
26 26
27#ifdef CONFIG_DCB 27#ifdef CONFIG_DCB
28extern int register_dcbevent_notifier(struct notifier_block *nb); 28int register_dcbevent_notifier(struct notifier_block *nb);
29extern int unregister_dcbevent_notifier(struct notifier_block *nb); 29int unregister_dcbevent_notifier(struct notifier_block *nb);
30extern int call_dcbevent_notifiers(unsigned long val, void *v); 30int call_dcbevent_notifiers(unsigned long val, void *v);
31#else 31#else
32static inline int 32static inline int
33register_dcbevent_notifier(struct notifier_block *nb) 33register_dcbevent_notifier(struct notifier_block *nb)
diff --git a/include/net/dn.h b/include/net/dn.h
index c88bf4ebd330..ccc15588d108 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,24 +199,26 @@ static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
199 fld->fld_dport = scp->addrrem; 199 fld->fld_dport = scp->addrrem;
200} 200}
201 201
202extern unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu); 202unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu);
203 203
204#define DN_MENUVER_ACC 0x01 204#define DN_MENUVER_ACC 0x01
205#define DN_MENUVER_USR 0x02 205#define DN_MENUVER_USR 0x02
206#define DN_MENUVER_PRX 0x04 206#define DN_MENUVER_PRX 0x04
207#define DN_MENUVER_UIC 0x08 207#define DN_MENUVER_UIC 0x08
208 208
209extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); 209struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
210extern struct sock *dn_find_by_skb(struct sk_buff *skb); 210struct sock *dn_find_by_skb(struct sk_buff *skb);
211#define DN_ASCBUF_LEN 9 211#define DN_ASCBUF_LEN 9
212extern char *dn_addr2asc(__u16, char *); 212char *dn_addr2asc(__u16, char *);
213extern int dn_destroy_timer(struct sock *sk); 213int dn_destroy_timer(struct sock *sk);
214 214
215extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); 215int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf,
216extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr, unsigned char *type); 216 unsigned char type);
217int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr,
218 unsigned char *type);
217 219
218extern void dn_start_slow_timer(struct sock *sk); 220void dn_start_slow_timer(struct sock *sk);
219extern void dn_stop_slow_timer(struct sock *sk); 221void dn_stop_slow_timer(struct sock *sk);
220 222
221extern __le16 decnet_address; 223extern __le16 decnet_address;
222extern int decnet_debug_level; 224extern int decnet_debug_level;
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index b9e32db03f20..20b5ab06032d 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -148,27 +148,27 @@ struct rtnode_hello_message {
148} __packed; 148} __packed;
149 149
150 150
151extern void dn_dev_init(void); 151void dn_dev_init(void);
152extern void dn_dev_cleanup(void); 152void dn_dev_cleanup(void);
153 153
154extern int dn_dev_ioctl(unsigned int cmd, void __user *arg); 154int dn_dev_ioctl(unsigned int cmd, void __user *arg);
155 155
156extern void dn_dev_devices_off(void); 156void dn_dev_devices_off(void);
157extern void dn_dev_devices_on(void); 157void dn_dev_devices_on(void);
158 158
159extern void dn_dev_init_pkt(struct sk_buff *skb); 159void dn_dev_init_pkt(struct sk_buff *skb);
160extern void dn_dev_veri_pkt(struct sk_buff *skb); 160void dn_dev_veri_pkt(struct sk_buff *skb);
161extern void dn_dev_hello(struct sk_buff *skb); 161void dn_dev_hello(struct sk_buff *skb);
162 162
163extern void dn_dev_up(struct net_device *); 163void dn_dev_up(struct net_device *);
164extern void dn_dev_down(struct net_device *); 164void dn_dev_down(struct net_device *);
165 165
166extern int dn_dev_set_default(struct net_device *dev, int force); 166int dn_dev_set_default(struct net_device *dev, int force);
167extern struct net_device *dn_dev_get_default(void); 167struct net_device *dn_dev_get_default(void);
168extern int dn_dev_bind_default(__le16 *addr); 168int dn_dev_bind_default(__le16 *addr);
169 169
170extern int register_dnaddr_notifier(struct notifier_block *nb); 170int register_dnaddr_notifier(struct notifier_block *nb);
171extern int unregister_dnaddr_notifier(struct notifier_block *nb); 171int unregister_dnaddr_notifier(struct notifier_block *nb);
172 172
173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr) 173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
174{ 174{
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 74004af31c48..f2ca135ddcc9 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -95,41 +95,38 @@ struct dn_fib_table {
95/* 95/*
96 * dn_fib.c 96 * dn_fib.c
97 */ 97 */
98extern void dn_fib_init(void); 98void dn_fib_init(void);
99extern void dn_fib_cleanup(void); 99void dn_fib_cleanup(void);
100 100
101extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, 101int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
102 unsigned long arg); 102struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
103extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, 103 struct nlattr *attrs[],
104 struct nlattr *attrs[], 104 const struct nlmsghdr *nlh, int *errp);
105 const struct nlmsghdr *nlh, int *errp); 105int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
106extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 106 const struct flowidn *fld, struct dn_fib_res *res);
107 const struct flowidn *fld, 107void dn_fib_release_info(struct dn_fib_info *fi);
108 struct dn_fib_res *res); 108void dn_fib_flush(void);
109extern void dn_fib_release_info(struct dn_fib_info *fi); 109void dn_fib_select_multipath(const struct flowidn *fld, struct dn_fib_res *res);
110extern void dn_fib_flush(void);
111extern void dn_fib_select_multipath(const struct flowidn *fld,
112 struct dn_fib_res *res);
113 110
114/* 111/*
115 * dn_tables.c 112 * dn_tables.c
116 */ 113 */
117extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); 114struct dn_fib_table *dn_fib_get_table(u32 n, int creat);
118extern struct dn_fib_table *dn_fib_empty_table(void); 115struct dn_fib_table *dn_fib_empty_table(void);
119extern void dn_fib_table_init(void); 116void dn_fib_table_init(void);
120extern void dn_fib_table_cleanup(void); 117void dn_fib_table_cleanup(void);
121 118
122/* 119/*
123 * dn_rules.c 120 * dn_rules.c
124 */ 121 */
125extern void dn_fib_rules_init(void); 122void dn_fib_rules_init(void);
126extern void dn_fib_rules_cleanup(void); 123void dn_fib_rules_cleanup(void);
127extern unsigned int dnet_addr_type(__le16 addr); 124unsigned int dnet_addr_type(__le16 addr);
128extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); 125int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
129 126
130extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 127int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
131 128
132extern void dn_fib_free_info(struct dn_fib_info *fi); 129void dn_fib_free_info(struct dn_fib_info *fi);
133 130
134static inline void dn_fib_info_put(struct dn_fib_info *fi) 131static inline void dn_fib_info_put(struct dn_fib_info *fi)
135{ 132{
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index 4cb4ae7fb81f..fac4e3f4a6d3 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -16,12 +16,12 @@ struct dn_neigh {
16 __u8 priority; 16 __u8 priority;
17}; 17};
18 18
19extern void dn_neigh_init(void); 19void dn_neigh_init(void);
20extern void dn_neigh_cleanup(void); 20void dn_neigh_cleanup(void);
21extern int dn_neigh_router_hello(struct sk_buff *skb); 21int dn_neigh_router_hello(struct sk_buff *skb);
22extern int dn_neigh_endnode_hello(struct sk_buff *skb); 22int dn_neigh_endnode_hello(struct sk_buff *skb);
23extern void dn_neigh_pointopoint_hello(struct sk_buff *skb); 23void dn_neigh_pointopoint_hello(struct sk_buff *skb);
24extern int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); 24int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
25 25
26extern struct neigh_table dn_neigh_table; 26extern struct neigh_table dn_neigh_table;
27 27
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index e43a2893f132..3a3e33d18456 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -15,29 +15,32 @@
15*******************************************************************************/ 15*******************************************************************************/
16/* dn_nsp.c functions prototyping */ 16/* dn_nsp.c functions prototyping */
17 17
18extern void dn_nsp_send_data_ack(struct sock *sk); 18void dn_nsp_send_data_ack(struct sock *sk);
19extern void dn_nsp_send_oth_ack(struct sock *sk); 19void dn_nsp_send_oth_ack(struct sock *sk);
20extern void dn_nsp_delayed_ack(struct sock *sk); 20void dn_nsp_delayed_ack(struct sock *sk);
21extern void dn_send_conn_ack(struct sock *sk); 21void dn_send_conn_ack(struct sock *sk);
22extern void dn_send_conn_conf(struct sock *sk, gfp_t gfp); 22void dn_send_conn_conf(struct sock *sk, gfp_t gfp);
23extern void dn_nsp_send_disc(struct sock *sk, unsigned char type, 23void dn_nsp_send_disc(struct sock *sk, unsigned char type,
24 unsigned short reason, gfp_t gfp); 24 unsigned short reason, gfp_t gfp);
25extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type, 25void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type,
26 unsigned short reason); 26 unsigned short reason);
27extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval); 27void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval);
28extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags); 28void dn_nsp_send_conninit(struct sock *sk, unsigned char flags);
29 29
30extern void dn_nsp_output(struct sock *sk); 30void dn_nsp_output(struct sock *sk);
31extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); 31int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb,
32extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oob); 32 struct sk_buff_head *q, unsigned short acknum);
33extern unsigned long dn_nsp_persist(struct sock *sk); 33void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp,
34extern int dn_nsp_xmit_timeout(struct sock *sk); 34 int oob);
35 35unsigned long dn_nsp_persist(struct sock *sk);
36extern int dn_nsp_rx(struct sk_buff *); 36int dn_nsp_xmit_timeout(struct sock *sk);
37extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 37
38 38int dn_nsp_rx(struct sk_buff *);
39extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 39int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
40extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err); 40
41struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
42struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock,
43 long timeo, int *err);
41 44
42#define NSP_REASON_OK 0 /* No error */ 45#define NSP_REASON_OK 0 /* No error */
43#define NSP_REASON_NR 1 /* No resources */ 46#define NSP_REASON_NR 1 /* No resources */
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 2e9d317c82dc..b409ad6b8d7a 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -15,10 +15,11 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *, struct sock *sk, int flags); 19int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *,
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20 struct sock *sk, int flags);
21extern void dn_rt_cache_flush(int delay); 21int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
22void dn_rt_cache_flush(int delay);
22 23
23/* Masks for flags field */ 24/* Masks for flags field */
24#define DN_RT_F_PID 0x07 /* Mask for packet type */ 25#define DN_RT_F_PID 0x07 /* Mask for packet type */
@@ -92,8 +93,8 @@ static inline bool dn_is_output_route(struct dn_route *rt)
92 return rt->fld.flowidn_iif == 0; 93 return rt->fld.flowidn_iif == 0;
93} 94}
94 95
95extern void dn_route_init(void); 96void dn_route_init(void);
96extern void dn_route_cleanup(void); 97void dn_route_cleanup(void);
97 98
98#include <net/sock.h> 99#include <net/sock.h>
99#include <linux/if_arp.h> 100#include <linux/if_arp.h>
diff --git a/include/net/dst.h b/include/net/dst.h
index 3bc4865f8267..44995c13e941 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -106,7 +106,7 @@ struct dst_entry {
106 }; 106 };
107}; 107};
108 108
109extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 110extern const u32 dst_default_metrics[];
111 111
112#define DST_METRICS_READ_ONLY 0x1UL 112#define DST_METRICS_READ_ONLY 0x1UL
@@ -119,7 +119,7 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 119 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 120}
121 121
122extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 123
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 124static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
125{ 125{
@@ -262,7 +262,7 @@ static inline struct dst_entry *dst_clone(struct dst_entry *dst)
262 return dst; 262 return dst;
263} 263}
264 264
265extern void dst_release(struct dst_entry *dst); 265void dst_release(struct dst_entry *dst);
266 266
267static inline void refdst_drop(unsigned long refdst) 267static inline void refdst_drop(unsigned long refdst)
268{ 268{
@@ -362,12 +362,11 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
362 return child; 362 return child;
363} 363}
364 364
365extern int dst_discard(struct sk_buff *skb); 365int dst_discard(struct sk_buff *skb);
366extern void *dst_alloc(struct dst_ops *ops, struct net_device *dev, 366void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
367 int initial_ref, int initial_obsolete, 367 int initial_obsolete, unsigned short flags);
368 unsigned short flags); 368void __dst_free(struct dst_entry *dst);
369extern void __dst_free(struct dst_entry *dst); 369struct dst_entry *dst_destroy(struct dst_entry *dst);
370extern struct dst_entry *dst_destroy(struct dst_entry *dst);
371 370
372static inline void dst_free(struct dst_entry *dst) 371static inline void dst_free(struct dst_entry *dst)
373{ 372{
@@ -463,7 +462,7 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
463 return dst; 462 return dst;
464} 463}
465 464
466extern void dst_init(void); 465void dst_init(void);
467 466
468/* Flags for xfrm_lookup flags argument. */ 467/* Flags for xfrm_lookup flags argument. */
469enum { 468enum {
@@ -479,10 +478,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net,
479{ 478{
480 return dst_orig; 479 return dst_orig;
481} 480}
481
482static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
483{
484 return NULL;
485}
486
482#else 487#else
483extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, 488struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
484 const struct flowi *fl, struct sock *sk, 489 const struct flowi *fl, struct sock *sk,
485 int flags); 490 int flags);
491
492/* skb attached with this dst needs transformation if dst->xfrm is valid */
493static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
494{
495 return dst->xfrm;
496}
486#endif 497#endif
487 498
488#endif /* _NET_DST_H */ 499#endif /* _NET_DST_H */
diff --git a/include/net/esp.h b/include/net/esp.h
index d58451331dbd..a43be85aedc4 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -3,18 +3,6 @@
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5 5
6struct crypto_aead;
7
8struct esp_data {
9 /* 0..255 */
10 int padlen;
11
12 /* Confidentiality & Integrity */
13 struct crypto_aead *aead;
14};
15
16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
17
18struct ip_esp_hdr; 6struct ip_esp_hdr;
19 7
20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) 8static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 4b2b557fb0e8..e584de16e4c3 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -115,14 +115,13 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
115 return frh->table; 115 return frh->table;
116} 116}
117 117
118extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); 118struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *,
119extern void fib_rules_unregister(struct fib_rules_ops *); 119 struct net *);
120void fib_rules_unregister(struct fib_rules_ops *);
120 121
121extern int fib_rules_lookup(struct fib_rules_ops *, 122int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags,
122 struct flowi *, int flags, 123 struct fib_lookup_arg *);
123 struct fib_lookup_arg *); 124int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table,
124extern int fib_default_rule_add(struct fib_rules_ops *, 125 u32 flags);
125 u32 pref, u32 table, 126u32 fib_default_rule_pref(struct fib_rules_ops *ops);
126 u32 flags);
127extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
128#endif 127#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 628e11b98c58..65ce471d2ab5 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -215,12 +215,13 @@ typedef struct flow_cache_object *(*flow_resolve_t)(
215 struct net *net, const struct flowi *key, u16 family, 215 struct net *net, const struct flowi *key, u16 family,
216 u8 dir, struct flow_cache_object *oldobj, void *ctx); 216 u8 dir, struct flow_cache_object *oldobj, void *ctx);
217 217
218extern struct flow_cache_object *flow_cache_lookup( 218struct flow_cache_object *flow_cache_lookup(struct net *net,
219 struct net *net, const struct flowi *key, u16 family, 219 const struct flowi *key, u16 family,
220 u8 dir, flow_resolve_t resolver, void *ctx); 220 u8 dir, flow_resolve_t resolver,
221 void *ctx);
221 222
222extern void flow_cache_flush(void); 223void flow_cache_flush(void);
223extern void flow_cache_flush_deferred(void); 224void flow_cache_flush_deferred(void);
224extern atomic_t flow_cache_genid; 225extern atomic_t flow_cache_genid;
225 226
226#endif 227#endif
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index bb8271d487b7..7e64bd8bbda9 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -13,5 +13,6 @@ struct flow_keys {
13 u8 ip_proto; 13 u8 ip_proto;
14}; 14};
15 15
16extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 16bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
17__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
17#endif 18#endif
diff --git a/include/net/garp.h b/include/net/garp.h
index 834d8add9e5f..abf33bbd2e6a 100644
--- a/include/net/garp.h
+++ b/include/net/garp.h
@@ -112,19 +112,18 @@ struct garp_port {
112 struct rcu_head rcu; 112 struct rcu_head rcu;
113}; 113};
114 114
115extern int garp_register_application(struct garp_application *app); 115int garp_register_application(struct garp_application *app);
116extern void garp_unregister_application(struct garp_application *app); 116void garp_unregister_application(struct garp_application *app);
117 117
118extern int garp_init_applicant(struct net_device *dev, 118int garp_init_applicant(struct net_device *dev, struct garp_application *app);
119 struct garp_application *app); 119void garp_uninit_applicant(struct net_device *dev,
120extern void garp_uninit_applicant(struct net_device *dev, 120 struct garp_application *app);
121 struct garp_application *app); 121
122 122int garp_request_join(const struct net_device *dev,
123extern int garp_request_join(const struct net_device *dev, 123 const struct garp_application *app, const void *data,
124 const struct garp_application *app, 124 u8 len, u8 type);
125 const void *data, u8 len, u8 type); 125void garp_request_leave(const struct net_device *dev,
126extern void garp_request_leave(const struct net_device *dev, 126 const struct garp_application *app,
127 const struct garp_application *app, 127 const void *data, u8 len, u8 type);
128 const void *data, u8 len, u8 type);
129 128
130#endif /* _NET_GARP_H */ 129#endif /* _NET_GARP_H */
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index cf8439ba4d11..ea4271dceff0 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -19,32 +19,31 @@ struct gnet_dump {
19 struct tc_stats tc_stats; 19 struct tc_stats tc_stats;
20}; 20};
21 21
22extern int gnet_stats_start_copy(struct sk_buff *skb, int type, 22int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
23 struct gnet_dump *d);
24
25int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
26 int tc_stats_type, int xstats_type,
23 spinlock_t *lock, struct gnet_dump *d); 27 spinlock_t *lock, struct gnet_dump *d);
24 28
25extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, 29int gnet_stats_copy_basic(struct gnet_dump *d,
26 int tc_stats_type,int xstats_type, 30 struct gnet_stats_basic_packed *b);
27 spinlock_t *lock, struct gnet_dump *d); 31int gnet_stats_copy_rate_est(struct gnet_dump *d,
28 32 const struct gnet_stats_basic_packed *b,
29extern int gnet_stats_copy_basic(struct gnet_dump *d, 33 struct gnet_stats_rate_est64 *r);
30 struct gnet_stats_basic_packed *b); 34int gnet_stats_copy_queue(struct gnet_dump *d, struct gnet_stats_queue *q);
31extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 35int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
32 const struct gnet_stats_basic_packed *b, 36
33 struct gnet_stats_rate_est64 *r); 37int gnet_stats_finish_copy(struct gnet_dump *d);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 38
35 struct gnet_stats_queue *q); 39int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 40 struct gnet_stats_rate_est64 *rate_est,
37 41 spinlock_t *stats_lock, struct nlattr *opt);
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 42void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
39 43 struct gnet_stats_rate_est64 *rate_est);
40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 44int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est64 *rate_est, 45 struct gnet_stats_rate_est64 *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 46 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 47bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est64 *rate_est); 48 const struct gnet_stats_rate_est64 *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est64 *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est64 *rate_est);
50#endif 49#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8e0b6c856a13..9b787b62cf16 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -122,7 +122,7 @@ struct genl_ops {
122 struct list_head ops_list; 122 struct list_head ops_list;
123}; 123};
124 124
125extern int __genl_register_family(struct genl_family *family); 125int __genl_register_family(struct genl_family *family);
126 126
127static inline int genl_register_family(struct genl_family *family) 127static inline int genl_register_family(struct genl_family *family)
128{ 128{
@@ -130,8 +130,8 @@ static inline int genl_register_family(struct genl_family *family)
130 return __genl_register_family(family); 130 return __genl_register_family(family);
131} 131}
132 132
133extern int __genl_register_family_with_ops(struct genl_family *family, 133int __genl_register_family_with_ops(struct genl_family *family,
134 struct genl_ops *ops, size_t n_ops); 134 struct genl_ops *ops, size_t n_ops);
135 135
136static inline int genl_register_family_with_ops(struct genl_family *family, 136static inline int genl_register_family_with_ops(struct genl_family *family,
137 struct genl_ops *ops, size_t n_ops) 137 struct genl_ops *ops, size_t n_ops)
@@ -140,18 +140,18 @@ static inline int genl_register_family_with_ops(struct genl_family *family,
140 return __genl_register_family_with_ops(family, ops, n_ops); 140 return __genl_register_family_with_ops(family, ops, n_ops);
141} 141}
142 142
143extern int genl_unregister_family(struct genl_family *family); 143int genl_unregister_family(struct genl_family *family);
144extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 144int genl_register_ops(struct genl_family *, struct genl_ops *ops);
145extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 145int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
146extern int genl_register_mc_group(struct genl_family *family, 146int genl_register_mc_group(struct genl_family *family,
147 struct genl_multicast_group *grp); 147 struct genl_multicast_group *grp);
148extern void genl_unregister_mc_group(struct genl_family *family, 148void genl_unregister_mc_group(struct genl_family *family,
149 struct genl_multicast_group *grp); 149 struct genl_multicast_group *grp);
150extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, 150void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
151 u32 group, struct nlmsghdr *nlh, gfp_t flags); 151 u32 group, struct nlmsghdr *nlh, gfp_t flags);
152 152
153void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 153void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
154 struct genl_family *family, int flags, u8 cmd); 154 struct genl_family *family, int flags, u8 cmd);
155 155
156/** 156/**
157 * genlmsg_nlhdr - Obtain netlink header from user specified header 157 * genlmsg_nlhdr - Obtain netlink header from user specified header
diff --git a/include/net/gre.h b/include/net/gre.h
index 57e4afdf7879..dcd9ae3270d3 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -38,7 +38,13 @@ void gre_offload_exit(void);
38 38
39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, 39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
40 int hdr_len); 40 int hdr_len);
41struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum); 41
42static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
43 bool gre_csum)
44{
45 return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE);
46}
47
42 48
43static inline int ip_gre_calc_hlen(__be16 o_flags) 49static inline int ip_gre_calc_hlen(__be16 o_flags)
44{ 50{
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 081439fd070e..970028e13382 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -39,10 +39,10 @@ struct net_proto_family;
39struct sk_buff; 39struct sk_buff;
40struct net; 40struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43int icmp_rcv(struct sk_buff *skb);
44extern void icmp_err(struct sk_buff *, u32 info); 44void icmp_err(struct sk_buff *skb, u32 info);
45extern int icmp_init(void); 45int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 46void icmp_out_count(struct net *net, unsigned char type);
47 47
48#endif /* _ICMP_H */ 48#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 02ef7727bb55..76d54270f2e2 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -66,11 +66,10 @@ struct inet6_ifaddr {
66 struct hlist_node addr_lst; 66 struct hlist_node addr_lst;
67 struct list_head if_list; 67 struct list_head if_list;
68 68
69#ifdef CONFIG_IPV6_PRIVACY
70 struct list_head tmp_list; 69 struct list_head tmp_list;
71 struct inet6_ifaddr *ifpub; 70 struct inet6_ifaddr *ifpub;
72 int regen_count; 71 int regen_count;
73#endif 72
74 bool tokenized; 73 bool tokenized;
75 74
76 struct rcu_head rcu; 75 struct rcu_head rcu;
@@ -192,11 +191,9 @@ struct inet6_dev {
192 __u32 if_flags; 191 __u32 if_flags;
193 int dead; 192 int dead;
194 193
195#ifdef CONFIG_IPV6_PRIVACY
196 u8 rndid[8]; 194 u8 rndid[8];
197 struct timer_list regen_timer; 195 struct timer_list regen_timer;
198 struct list_head tempaddr_list; 196 struct list_head tempaddr_list;
199#endif
200 197
201 struct in6_addr token; 198 struct in6_addr token;
202 199
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 04642c920431..f981ba7adeed 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -22,27 +22,25 @@ struct sk_buff;
22struct sock; 22struct sock;
23struct sockaddr; 23struct sockaddr;
24 24
25extern int inet6_csk_bind_conflict(const struct sock *sk, 25int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb, bool relax); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28struct dst_entry *inet6_csk_route_req(struct sock *sk, struct flowi6 *fl6,
29 struct flowi6 *fl6, 29 const struct request_sock *req);
30 const struct request_sock *req);
31 30
32extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 31struct request_sock *inet6_csk_search_req(const struct sock *sk,
33 struct request_sock ***prevp, 32 struct request_sock ***prevp,
34 const __be16 rport, 33 const __be16 rport,
35 const struct in6_addr *raddr, 34 const struct in6_addr *raddr,
36 const struct in6_addr *laddr, 35 const struct in6_addr *laddr,
37 const int iif); 36 const int iif);
38 37
39extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, 38void inet6_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
40 struct request_sock *req, 39 const unsigned long timeout);
41 const unsigned long timeout);
42 40
43extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 41void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
44 42
45extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 43int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl);
46 44
47extern struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); 45struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu);
48#endif /* _INET6_CONNECTION_SOCK_H */ 46#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index fd4ee016ba5c..ae0613544308 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -28,32 +28,17 @@
28 28
29struct inet_hashinfo; 29struct inet_hashinfo;
30 30
31static inline unsigned int inet6_ehashfn(struct net *net, 31static inline unsigned int __inet6_ehashfn(const u32 lhash,
32 const struct in6_addr *laddr, const u16 lport, 32 const u16 lport,
33 const struct in6_addr *faddr, const __be16 fport) 33 const u32 fhash,
34 const __be16 fport,
35 const u32 initval)
34{ 36{
35 u32 ports = (((u32)lport) << 16) | (__force u32)fport; 37 const u32 ports = (((u32)lport) << 16) | (__force u32)fport;
36 38 return jhash_3words(lhash, fhash, ports, initval);
37 return jhash_3words((__force u32)laddr->s6_addr32[3],
38 ipv6_addr_jhash(faddr),
39 ports,
40 inet_ehash_secret + net_hash_mix(net));
41}
42
43static inline int inet6_sk_ehashfn(const struct sock *sk)
44{
45 const struct inet_sock *inet = inet_sk(sk);
46 const struct ipv6_pinfo *np = inet6_sk(sk);
47 const struct in6_addr *laddr = &np->rcv_saddr;
48 const struct in6_addr *faddr = &np->daddr;
49 const __u16 lport = inet->inet_num;
50 const __be16 fport = inet->inet_dport;
51 struct net *net = sock_net(sk);
52
53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
54} 39}
55 40
56extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp); 41int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
57 42
58/* 43/*
59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 44 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -61,21 +46,19 @@ extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
61 * 46 *
62 * The sockhash lock must be held as a reader here. 47 * The sockhash lock must be held as a reader here.
63 */ 48 */
64extern struct sock *__inet6_lookup_established(struct net *net, 49struct sock *__inet6_lookup_established(struct net *net,
65 struct inet_hashinfo *hashinfo, 50 struct inet_hashinfo *hashinfo,
66 const struct in6_addr *saddr, 51 const struct in6_addr *saddr,
67 const __be16 sport, 52 const __be16 sport,
68 const struct in6_addr *daddr, 53 const struct in6_addr *daddr,
69 const u16 hnum, 54 const u16 hnum, const int dif);
70 const int dif); 55
71 56struct sock *inet6_lookup_listener(struct net *net,
72extern struct sock *inet6_lookup_listener(struct net *net, 57 struct inet_hashinfo *hashinfo,
73 struct inet_hashinfo *hashinfo, 58 const struct in6_addr *saddr,
74 const struct in6_addr *saddr, 59 const __be16 sport,
75 const __be16 sport, 60 const struct in6_addr *daddr,
76 const struct in6_addr *daddr, 61 const unsigned short hnum, const int dif);
77 const unsigned short hnum,
78 const int dif);
79 62
80static inline struct sock *__inet6_lookup(struct net *net, 63static inline struct sock *__inet6_lookup(struct net *net,
81 struct inet_hashinfo *hashinfo, 64 struct inet_hashinfo *hashinfo,
@@ -110,9 +93,9 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
110 inet6_iif(skb)); 93 inet6_iif(skb));
111} 94}
112 95
113extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 96struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
114 const struct in6_addr *saddr, const __be16 sport, 97 const struct in6_addr *saddr, const __be16 sport,
115 const struct in6_addr *daddr, const __be16 dport, 98 const struct in6_addr *daddr, const __be16 dport,
116 const int dif); 99 const int dif);
117#endif /* IS_ENABLED(CONFIG_IPV6) */ 100#endif /* IS_ENABLED(CONFIG_IPV6) */
118#endif /* _INET6_HASHTABLES_H */ 101#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 234008782c8c..fe7994c48b75 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -13,30 +13,30 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 17int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
18 int addr_len, int flags); 18 int addr_len, int flags);
19extern int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 19int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
20 int addr_len, int flags); 20 int addr_len, int flags);
21extern int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, 21int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
22 int addr_len, int flags); 22 int addr_len, int flags);
23extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); 23int inet_accept(struct socket *sock, struct socket *newsock, int flags);
24extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock, 24int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
25 struct msghdr *msg, size_t size); 25 size_t size);
26extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, 26ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
27 size_t size, int flags); 27 size_t size, int flags);
28extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock, 28int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
29 struct msghdr *msg, size_t size, int flags); 29 size_t size, int flags);
30extern int inet_shutdown(struct socket *sock, int how); 30int inet_shutdown(struct socket *sock, int how);
31extern int inet_listen(struct socket *sock, int backlog); 31int inet_listen(struct socket *sock, int backlog);
32extern void inet_sock_destruct(struct sock *sk); 32void inet_sock_destruct(struct sock *sk);
33extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); 33int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
34extern int inet_getname(struct socket *sock, struct sockaddr *uaddr, 34int inet_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
35 int *uaddr_len, int peer); 35 int peer);
36extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 36int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
37extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, 37int inet_ctl_sock_create(struct sock **sk, unsigned short family,
38 unsigned short type, unsigned char protocol, 38 unsigned short type, unsigned char protocol,
39 struct net *net); 39 struct net *net);
40 40
41static inline void inet_ctl_sock_destroy(struct sock *sk) 41static inline void inet_ctl_sock_destroy(struct sock *sk)
42{ 42{
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index de2c78529afa..c55aeed41ace 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -146,9 +146,9 @@ static inline void *inet_csk_ca(const struct sock *sk)
146 return (void *)inet_csk(sk)->icsk_ca_priv; 146 return (void *)inet_csk(sk)->icsk_ca_priv;
147} 147}
148 148
149extern struct sock *inet_csk_clone_lock(const struct sock *sk, 149struct sock *inet_csk_clone_lock(const struct sock *sk,
150 const struct request_sock *req, 150 const struct request_sock *req,
151 const gfp_t priority); 151 const gfp_t priority);
152 152
153enum inet_csk_ack_state_t { 153enum inet_csk_ack_state_t {
154 ICSK_ACK_SCHED = 1, 154 ICSK_ACK_SCHED = 1,
@@ -157,11 +157,11 @@ enum inet_csk_ack_state_t {
157 ICSK_ACK_PUSHED2 = 8 157 ICSK_ACK_PUSHED2 = 8
158}; 158};
159 159
160extern void inet_csk_init_xmit_timers(struct sock *sk, 160void inet_csk_init_xmit_timers(struct sock *sk,
161 void (*retransmit_handler)(unsigned long), 161 void (*retransmit_handler)(unsigned long),
162 void (*delack_handler)(unsigned long), 162 void (*delack_handler)(unsigned long),
163 void (*keepalive_handler)(unsigned long)); 163 void (*keepalive_handler)(unsigned long));
164extern void inet_csk_clear_xmit_timers(struct sock *sk); 164void inet_csk_clear_xmit_timers(struct sock *sk);
165 165
166static inline void inet_csk_schedule_ack(struct sock *sk) 166static inline void inet_csk_schedule_ack(struct sock *sk)
167{ 167{
@@ -178,8 +178,8 @@ static inline void inet_csk_delack_init(struct sock *sk)
178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack)); 178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
179} 179}
180 180
181extern void inet_csk_delete_keepalive_timer(struct sock *sk); 181void inet_csk_delete_keepalive_timer(struct sock *sk);
182extern void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 182void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
183 183
184#ifdef INET_CSK_DEBUG 184#ifdef INET_CSK_DEBUG
185extern const char inet_csk_timer_bug_msg[]; 185extern const char inet_csk_timer_bug_msg[];
@@ -241,23 +241,21 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
241#endif 241#endif
242} 242}
243 243
244extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); 244struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
245 245
246extern struct request_sock *inet_csk_search_req(const struct sock *sk, 246struct request_sock *inet_csk_search_req(const struct sock *sk,
247 struct request_sock ***prevp, 247 struct request_sock ***prevp,
248 const __be16 rport, 248 const __be16 rport,
249 const __be32 raddr, 249 const __be32 raddr,
250 const __be32 laddr); 250 const __be32 laddr);
251extern int inet_csk_bind_conflict(const struct sock *sk, 251int inet_csk_bind_conflict(const struct sock *sk,
252 const struct inet_bind_bucket *tb, bool relax); 252 const struct inet_bind_bucket *tb, bool relax);
253extern int inet_csk_get_port(struct sock *sk, unsigned short snum); 253int inet_csk_get_port(struct sock *sk, unsigned short snum);
254 254
255extern struct dst_entry* inet_csk_route_req(struct sock *sk, 255struct dst_entry *inet_csk_route_req(struct sock *sk, struct flowi4 *fl4,
256 struct flowi4 *fl4, 256 const struct request_sock *req);
257struct dst_entry *inet_csk_route_child_sock(struct sock *sk, struct sock *newsk,
257 const struct request_sock *req); 258 const struct request_sock *req);
258extern struct dst_entry* inet_csk_route_child_sock(struct sock *sk,
259 struct sock *newsk,
260 const struct request_sock *req);
261 259
262static inline void inet_csk_reqsk_queue_add(struct sock *sk, 260static inline void inet_csk_reqsk_queue_add(struct sock *sk,
263 struct request_sock *req, 261 struct request_sock *req,
@@ -266,9 +264,8 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
266 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child); 264 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child);
267} 265}
268 266
269extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 267void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
270 struct request_sock *req, 268 unsigned long timeout);
271 unsigned long timeout);
272 269
273static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 270static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
274 struct request_sock *req) 271 struct request_sock *req)
@@ -315,13 +312,13 @@ static inline void inet_csk_reqsk_queue_drop(struct sock *sk,
315 reqsk_free(req); 312 reqsk_free(req);
316} 313}
317 314
318extern void inet_csk_reqsk_queue_prune(struct sock *parent, 315void inet_csk_reqsk_queue_prune(struct sock *parent,
319 const unsigned long interval, 316 const unsigned long interval,
320 const unsigned long timeout, 317 const unsigned long timeout,
321 const unsigned long max_rto); 318 const unsigned long max_rto);
322 319
323extern void inet_csk_destroy_sock(struct sock *sk); 320void inet_csk_destroy_sock(struct sock *sk);
324extern void inet_csk_prepare_forced_close(struct sock *sk); 321void inet_csk_prepare_forced_close(struct sock *sk);
325 322
326/* 323/*
327 * LISTEN is a special case for poll.. 324 * LISTEN is a special case for poll..
@@ -332,15 +329,15 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
332 (POLLIN | POLLRDNORM) : 0; 329 (POLLIN | POLLRDNORM) : 0;
333} 330}
334 331
335extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 332int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
336extern void inet_csk_listen_stop(struct sock *sk); 333void inet_csk_listen_stop(struct sock *sk);
337 334
338extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 335void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
339 336
340extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 337int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
341 char __user *optval, int __user *optlen); 338 char __user *optval, int __user *optlen);
342extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 339int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
343 char __user *optval, unsigned int optlen); 340 char __user *optval, unsigned int optlen);
344 341
345extern struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); 342struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
346#endif /* _INET_CONNECTION_SOCK_H */ 343#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index bfcbc0017950..6f59de98dabd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -64,6 +64,10 @@ struct inet_frags {
64 rwlock_t lock ____cacheline_aligned_in_smp; 64 rwlock_t lock ____cacheline_aligned_in_smp;
65 int secret_interval; 65 int secret_interval;
66 struct timer_list secret_timer; 66 struct timer_list secret_timer;
67
68 /* The first call to hashfn is responsible to initialize
69 * rnd. This is best done with net_get_random_once.
70 */
67 u32 rnd; 71 u32 rnd;
68 int qsize; 72 int qsize;
69 73
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index ef83d9e844b5..1bdb47715def 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -37,12 +37,11 @@
37#include <asm/byteorder.h> 37#include <asm/byteorder.h>
38 38
39/* This is for all connections with a full identity, no wildcards. 39/* This is for all connections with a full identity, no wildcards.
40 * One chain is dedicated to TIME_WAIT sockets. 40 * The 'e' prefix stands for Establish, but we really put all sockets
41 * I'll experiment with dynamic table growth later. 41 * but LISTEN ones.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_nulls_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_nulls_head twchain;
46}; 45};
47 46
48/* There are a few simple rules, which allow for local port reuse by 47/* There are a few simple rules, which allow for local port reuse by
@@ -123,7 +122,6 @@ struct inet_hashinfo {
123 * 122 *
124 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE 123 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
125 * 124 *
126 * TIME_WAIT sockets use a separate chain (twchain).
127 */ 125 */
128 struct inet_ehash_bucket *ehash; 126 struct inet_ehash_bucket *ehash;
129 spinlock_t *ehash_locks; 127 spinlock_t *ehash_locks;
@@ -218,22 +216,21 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
218 } 216 }
219} 217}
220 218
221extern struct inet_bind_bucket * 219struct inet_bind_bucket *
222 inet_bind_bucket_create(struct kmem_cache *cachep, 220inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net,
223 struct net *net, 221 struct inet_bind_hashbucket *head,
224 struct inet_bind_hashbucket *head, 222 const unsigned short snum);
225 const unsigned short snum); 223void inet_bind_bucket_destroy(struct kmem_cache *cachep,
226extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 224 struct inet_bind_bucket *tb);
227 struct inet_bind_bucket *tb);
228 225
229static inline int inet_bhashfn(struct net *net, 226static inline int inet_bhashfn(struct net *net, const __u16 lport,
230 const __u16 lport, const int bhash_size) 227 const int bhash_size)
231{ 228{
232 return (lport + net_hash_mix(net)) & (bhash_size - 1); 229 return (lport + net_hash_mix(net)) & (bhash_size - 1);
233} 230}
234 231
235extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 232void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
236 const unsigned short snum); 233 const unsigned short snum);
237 234
238/* These can have wildcards, don't try too hard. */ 235/* These can have wildcards, don't try too hard. */
239static inline int inet_lhashfn(struct net *net, const unsigned short num) 236static inline int inet_lhashfn(struct net *net, const unsigned short num)
@@ -247,23 +244,22 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
247} 244}
248 245
249/* Caller must disable local BH processing. */ 246/* Caller must disable local BH processing. */
250extern int __inet_inherit_port(struct sock *sk, struct sock *child); 247int __inet_inherit_port(struct sock *sk, struct sock *child);
251 248
252extern void inet_put_port(struct sock *sk); 249void inet_put_port(struct sock *sk);
253 250
254void inet_hashinfo_init(struct inet_hashinfo *h); 251void inet_hashinfo_init(struct inet_hashinfo *h);
255 252
256extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); 253int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
257extern void inet_hash(struct sock *sk); 254void inet_hash(struct sock *sk);
258extern void inet_unhash(struct sock *sk); 255void inet_unhash(struct sock *sk);
259 256
260extern struct sock *__inet_lookup_listener(struct net *net, 257struct sock *__inet_lookup_listener(struct net *net,
261 struct inet_hashinfo *hashinfo, 258 struct inet_hashinfo *hashinfo,
262 const __be32 saddr, 259 const __be32 saddr, const __be16 sport,
263 const __be16 sport, 260 const __be32 daddr,
264 const __be32 daddr, 261 const unsigned short hnum,
265 const unsigned short hnum, 262 const int dif);
266 const int dif);
267 263
268static inline struct sock *inet_lookup_listener(struct net *net, 264static inline struct sock *inet_lookup_listener(struct net *net,
269 struct inet_hashinfo *hashinfo, 265 struct inet_hashinfo *hashinfo,
@@ -304,30 +300,17 @@ static inline struct sock *inet_lookup_listener(struct net *net,
304 ((__force __u64)(__be32)(__saddr))); 300 ((__force __u64)(__be32)(__saddr)));
305#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
306#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
307 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 303 (((__sk)->sk_portpair == (__ports)) && \
308 (inet_sk(__sk)->inet_addrpair == (__cookie)) && \ 304 ((__sk)->sk_addrpair == (__cookie)) && \
309 (!(__sk)->sk_bound_dev_if || \ 305 (!(__sk)->sk_bound_dev_if || \
310 ((__sk)->sk_bound_dev_if == (__dif))) && \ 306 ((__sk)->sk_bound_dev_if == (__dif))) && \
311 net_eq(sock_net(__sk), (__net))) 307 net_eq(sock_net(__sk), (__net)))
312#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif)\
313 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
314 (inet_twsk(__sk)->tw_addrpair == (__cookie)) && \
315 (!(__sk)->sk_bound_dev_if || \
316 ((__sk)->sk_bound_dev_if == (__dif))) && \
317 net_eq(sock_net(__sk), (__net)))
318#else /* 32-bit arch */ 308#else /* 32-bit arch */
319#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 309#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
320#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 310#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
321 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 311 (((__sk)->sk_portpair == (__ports)) && \
322 (inet_sk(__sk)->inet_daddr == (__saddr)) && \ 312 ((__sk)->sk_daddr == (__saddr)) && \
323 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ 313 ((__sk)->sk_rcv_saddr == (__daddr)) && \
324 (!(__sk)->sk_bound_dev_if || \
325 ((__sk)->sk_bound_dev_if == (__dif))) && \
326 net_eq(sock_net(__sk), (__net)))
327#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
328 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
329 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
330 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
331 (!(__sk)->sk_bound_dev_if || \ 314 (!(__sk)->sk_bound_dev_if || \
332 ((__sk)->sk_bound_dev_if == (__dif))) && \ 315 ((__sk)->sk_bound_dev_if == (__dif))) && \
333 net_eq(sock_net(__sk), (__net))) 316 net_eq(sock_net(__sk), (__net)))
@@ -339,10 +322,11 @@ static inline struct sock *inet_lookup_listener(struct net *net,
339 * 322 *
340 * Local BH must be disabled here. 323 * Local BH must be disabled here.
341 */ 324 */
342extern struct sock * __inet_lookup_established(struct net *net, 325struct sock *__inet_lookup_established(struct net *net,
343 struct inet_hashinfo *hashinfo, 326 struct inet_hashinfo *hashinfo,
344 const __be32 saddr, const __be16 sport, 327 const __be32 saddr, const __be16 sport,
345 const __be32 daddr, const u16 hnum, const int dif); 328 const __be32 daddr, const u16 hnum,
329 const int dif);
346 330
347static inline struct sock * 331static inline struct sock *
348 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo, 332 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
@@ -399,13 +383,14 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
399 iph->daddr, dport, inet_iif(skb)); 383 iph->daddr, dport, inet_iif(skb));
400} 384}
401 385
402extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 386int __inet_hash_connect(struct inet_timewait_death_row *death_row,
403 struct sock *sk, 387 struct sock *sk, u32 port_offset,
404 u32 port_offset, 388 int (*check_established)(struct inet_timewait_death_row *,
405 int (*check_established)(struct inet_timewait_death_row *, 389 struct sock *, __u16,
406 struct sock *, __u16, struct inet_timewait_sock **), 390 struct inet_timewait_sock **),
407 int (*hash)(struct sock *sk, struct inet_timewait_sock *twp)); 391 int (*hash)(struct sock *sk,
392 struct inet_timewait_sock *twp));
408 393
409extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 394int inet_hash_connect(struct inet_timewait_death_row *death_row,
410 struct sock *sk); 395 struct sock *sk);
411#endif /* _INET_HASHTABLES_H */ 396#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index b21a7f06d6a4..1833c3f389ee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -70,13 +70,14 @@ struct ip_options_data {
70 70
71struct inet_request_sock { 71struct inet_request_sock {
72 struct request_sock req; 72 struct request_sock req;
73#if IS_ENABLED(CONFIG_IPV6) 73#define ir_loc_addr req.__req_common.skc_rcv_saddr
74 u16 inet6_rsk_offset; 74#define ir_rmt_addr req.__req_common.skc_daddr
75#endif 75#define ir_num req.__req_common.skc_num
76 __be16 loc_port; 76#define ir_rmt_port req.__req_common.skc_dport
77 __be32 loc_addr; 77#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
78 __be32 rmt_addr; 78#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
79 __be16 rmt_port; 79#define ir_iif req.__req_common.skc_bound_dev_if
80
80 kmemcheck_bitfield_begin(flags); 81 kmemcheck_bitfield_begin(flags);
81 u16 snd_wscale : 4, 82 u16 snd_wscale : 4,
82 rcv_wscale : 4, 83 rcv_wscale : 4,
@@ -88,6 +89,7 @@ struct inet_request_sock {
88 no_srccheck: 1; 89 no_srccheck: 1;
89 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
90 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts;
91}; 93};
92 94
93static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -103,6 +105,9 @@ struct inet_cork {
103 int length; /* Total length of all frames */ 105 int length; /* Total length of all frames */
104 struct dst_entry *dst; 106 struct dst_entry *dst;
105 u8 tx_flags; 107 u8 tx_flags;
108 __u8 ttl;
109 __s16 tos;
110 char priority;
106}; 111};
107 112
108struct inet_cork_full { 113struct inet_cork_full {
@@ -143,10 +148,8 @@ struct inet_sock {
143 /* Socket demultiplex comparisons on incoming packets. */ 148 /* Socket demultiplex comparisons on incoming packets. */
144#define inet_daddr sk.__sk_common.skc_daddr 149#define inet_daddr sk.__sk_common.skc_daddr
145#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 150#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
146#define inet_addrpair sk.__sk_common.skc_addrpair
147#define inet_dport sk.__sk_common.skc_dport 151#define inet_dport sk.__sk_common.skc_dport
148#define inet_num sk.__sk_common.skc_num 152#define inet_num sk.__sk_common.skc_num
149#define inet_portpair sk.__sk_common.skc_portpair
150 153
151 __be32 inet_saddr; 154 __be32 inet_saddr;
152 __s16 uc_ttl; 155 __s16 uc_ttl;
@@ -199,32 +202,18 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
199} 202}
200#endif 203#endif
201 204
202extern int inet_sk_rebuild_header(struct sock *sk); 205int inet_sk_rebuild_header(struct sock *sk);
203
204extern u32 inet_ehash_secret;
205extern u32 ipv6_hash_secret;
206extern void build_ehash_secret(void);
207 206
208static inline unsigned int inet_ehashfn(struct net *net, 207static inline unsigned int __inet_ehashfn(const __be32 laddr,
209 const __be32 laddr, const __u16 lport, 208 const __u16 lport,
210 const __be32 faddr, const __be16 fport) 209 const __be32 faddr,
210 const __be16 fport,
211 u32 initval)
211{ 212{
212 return jhash_3words((__force __u32) laddr, 213 return jhash_3words((__force __u32) laddr,
213 (__force __u32) faddr, 214 (__force __u32) faddr,
214 ((__u32) lport) << 16 | (__force __u32)fport, 215 ((__u32) lport) << 16 | (__force __u32)fport,
215 inet_ehash_secret + net_hash_mix(net)); 216 initval);
216}
217
218static inline int inet_sk_ehashfn(const struct sock *sk)
219{
220 const struct inet_sock *inet = inet_sk(sk);
221 const __be32 laddr = inet->inet_rcv_saddr;
222 const __u16 lport = inet->inet_num;
223 const __be32 faddr = inet->inet_daddr;
224 const __be16 fport = inet->inet_dport;
225 struct net *net = sock_net(sk);
226
227 return inet_ehashfn(net, laddr, lport, faddr, fport);
228} 217}
229 218
230static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 219static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f908dfc06505..71c6e264e5b5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -58,6 +58,11 @@ struct inet_hashinfo;
58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) 58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
59#endif 59#endif
60 60
61static inline u32 inet_tw_time_stamp(void)
62{
63 return jiffies;
64}
65
61/* TIME_WAIT reaping mechanism. */ 66/* TIME_WAIT reaping mechanism. */
62#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */ 67#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
63 68
@@ -83,9 +88,9 @@ struct inet_timewait_death_row {
83 int sysctl_max_tw_buckets; 88 int sysctl_max_tw_buckets;
84}; 89};
85 90
86extern void inet_twdr_hangman(unsigned long data); 91void inet_twdr_hangman(unsigned long data);
87extern void inet_twdr_twkill_work(struct work_struct *work); 92void inet_twdr_twkill_work(struct work_struct *work);
88extern void inet_twdr_twcal_tick(unsigned long data); 93void inet_twdr_twcal_tick(unsigned long data);
89 94
90struct inet_bind_bucket; 95struct inet_bind_bucket;
91 96
@@ -111,11 +116,11 @@ struct inet_timewait_sock {
111#define tw_prot __tw_common.skc_prot 116#define tw_prot __tw_common.skc_prot
112#define tw_net __tw_common.skc_net 117#define tw_net __tw_common.skc_net
113#define tw_daddr __tw_common.skc_daddr 118#define tw_daddr __tw_common.skc_daddr
119#define tw_v6_daddr __tw_common.skc_v6_daddr
114#define tw_rcv_saddr __tw_common.skc_rcv_saddr 120#define tw_rcv_saddr __tw_common.skc_rcv_saddr
115#define tw_addrpair __tw_common.skc_addrpair 121#define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr
116#define tw_dport __tw_common.skc_dport 122#define tw_dport __tw_common.skc_dport
117#define tw_num __tw_common.skc_num 123#define tw_num __tw_common.skc_num
118#define tw_portpair __tw_common.skc_portpair
119 124
120 int tw_timeout; 125 int tw_timeout;
121 volatile unsigned char tw_substate; 126 volatile unsigned char tw_substate;
@@ -130,26 +135,14 @@ struct inet_timewait_sock {
130 tw_transparent : 1, 135 tw_transparent : 1,
131 tw_pad : 6, /* 6 bits hole */ 136 tw_pad : 6, /* 6 bits hole */
132 tw_tos : 8, 137 tw_tos : 8,
133 tw_ipv6_offset : 16; 138 tw_pad2 : 16; /* 16 bits hole */
134 kmemcheck_bitfield_end(flags); 139 kmemcheck_bitfield_end(flags);
135 unsigned long tw_ttd; 140 u32 tw_ttd;
136 struct inet_bind_bucket *tw_tb; 141 struct inet_bind_bucket *tw_tb;
137 struct hlist_node tw_death_node; 142 struct hlist_node tw_death_node;
138}; 143};
139#define tw_tclass tw_tos 144#define tw_tclass tw_tos
140 145
141static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
142 struct hlist_nulls_head *list)
143{
144 hlist_nulls_add_head_rcu(&tw->tw_node, list);
145}
146
147static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
148 struct hlist_head *list)
149{
150 hlist_add_head(&tw->tw_bind_node, list);
151}
152
153static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) 146static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
154{ 147{
155 return !hlist_unhashed(&tw->tw_death_node); 148 return !hlist_unhashed(&tw->tw_death_node);
@@ -189,34 +182,28 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
189 return (struct inet_timewait_sock *)sk; 182 return (struct inet_timewait_sock *)sk;
190} 183}
191 184
192static inline __be32 sk_rcv_saddr(const struct sock *sk) 185void inet_twsk_free(struct inet_timewait_sock *tw);
193{ 186void inet_twsk_put(struct inet_timewait_sock *tw);
194/* both inet_sk() and inet_twsk() store rcv_saddr in skc_rcv_saddr */
195 return sk->__sk_common.skc_rcv_saddr;
196}
197
198extern void inet_twsk_put(struct inet_timewait_sock *tw);
199 187
200extern int inet_twsk_unhash(struct inet_timewait_sock *tw); 188int inet_twsk_unhash(struct inet_timewait_sock *tw);
201 189
202extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, 190int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
203 struct inet_hashinfo *hashinfo); 191 struct inet_hashinfo *hashinfo);
204 192
205extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 193struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
206 const int state); 194 const int state);
207 195
208extern void __inet_twsk_hashdance(struct inet_timewait_sock *tw, 196void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
209 struct sock *sk, 197 struct inet_hashinfo *hashinfo);
210 struct inet_hashinfo *hashinfo);
211 198
212extern void inet_twsk_schedule(struct inet_timewait_sock *tw, 199void inet_twsk_schedule(struct inet_timewait_sock *tw,
213 struct inet_timewait_death_row *twdr, 200 struct inet_timewait_death_row *twdr,
214 const int timeo, const int timewait_len); 201 const int timeo, const int timewait_len);
215extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 202void inet_twsk_deschedule(struct inet_timewait_sock *tw,
216 struct inet_timewait_death_row *twdr); 203 struct inet_timewait_death_row *twdr);
217 204
218extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, 205void inet_twsk_purge(struct inet_hashinfo *hashinfo,
219 struct inet_timewait_death_row *twdr, int family); 206 struct inet_timewait_death_row *twdr, int family);
220 207
221static inline 208static inline
222struct net *twsk_net(const struct inet_timewait_sock *twsk) 209struct net *twsk_net(const struct inet_timewait_sock *twsk)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 53f464d7cddc..f4e127af4e17 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -120,9 +120,9 @@ static inline void inetpeer_transfer_peer(unsigned long *to, unsigned long *from
120 } 120 }
121} 121}
122 122
123extern void inet_peer_base_init(struct inet_peer_base *); 123void inet_peer_base_init(struct inet_peer_base *);
124 124
125void inet_initpeers(void) __init; 125void inet_initpeers(void) __init;
126 126
127#define INETPEER_METRICS_NEW (~(u32) 0) 127#define INETPEER_METRICS_NEW (~(u32) 0)
128 128
@@ -159,11 +159,11 @@ static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
159} 159}
160 160
161/* can be called from BH context or outside */ 161/* can be called from BH context or outside */
162extern void inet_putpeer(struct inet_peer *p); 162void inet_putpeer(struct inet_peer *p);
163extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 163bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
164 164
165extern void inetpeer_invalidate_tree(struct inet_peer_base *); 165void inetpeer_invalidate_tree(struct inet_peer_base *);
166extern void inetpeer_invalidate_family(int family); 166void inetpeer_invalidate_family(int family);
167 167
168/* 168/*
169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 48f55979d842..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,11 +269,13 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
262 !(dst_metric_locked(dst, RTAX_MTU))); 269 !(dst_metric_locked(dst, RTAX_MTU)));
263} 270}
264 271
265extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); 272void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
266 273
267static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, struct sock *sk) 274static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
268{ 275{
269 if (iph->frag_off & htons(IP_DF)) { 276 struct iphdr *iph = ip_hdr(skb);
277
278 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) {
270 /* This is only to work around buggy Windows95/2000 279 /* This is only to work around buggy Windows95/2000
271 * VJ compression implementations. If the ID field 280 * VJ compression implementations. If the ID field
272 * does not change, they drop every other packet in 281 * does not change, they drop every other packet in
@@ -278,9 +287,11 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
278 __ip_select_ident(iph, dst, 0); 287 __ip_select_ident(iph, dst, 0);
279} 288}
280 289
281static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) 290static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more)
282{ 291{
283 if (iph->frag_off & htons(IP_DF)) { 292 struct iphdr *iph = ip_hdr(skb);
293
294 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) {
284 if (sk && inet_sk(sk)->inet_daddr) { 295 if (sk && inet_sk(sk)->inet_daddr) {
285 iph->id = htons(inet_sk(sk)->inet_id); 296 iph->id = htons(inet_sk(sk)->inet_id);
286 inet_sk(sk)->inet_id += 1 + more; 297 inet_sk(sk)->inet_id += 1 + more;
@@ -363,7 +374,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
363 struct ipv6_pinfo *np = inet6_sk(sk); 374 struct ipv6_pinfo *np = inet6_sk(sk);
364 375
365 memset(&np->saddr, 0, sizeof(np->saddr)); 376 memset(&np->saddr, 0, sizeof(np->saddr));
366 memset(&np->rcv_saddr, 0, sizeof(np->rcv_saddr)); 377 memset(&sk->sk_v6_rcv_saddr, 0, sizeof(sk->sk_v6_rcv_saddr));
367 } 378 }
368#endif 379#endif
369} 380}
@@ -386,7 +397,7 @@ static inline int sk_mc_loop(struct sock *sk)
386 return 1; 397 return 1;
387} 398}
388 399
389extern bool ip_call_ra_chain(struct sk_buff *skb); 400bool ip_call_ra_chain(struct sk_buff *skb);
390 401
391/* 402/*
392 * Functions provided by ip_fragment.c 403 * Functions provided by ip_fragment.c
@@ -424,50 +435,52 @@ int ip_frag_nqueues(struct net *net);
424 * Functions provided by ip_forward.c 435 * Functions provided by ip_forward.c
425 */ 436 */
426 437
427extern int ip_forward(struct sk_buff *skb); 438int ip_forward(struct sk_buff *skb);
428 439
429/* 440/*
430 * Functions provided by ip_options.c 441 * Functions provided by ip_options.c
431 */ 442 */
432 443
433extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, 444void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
434 __be32 daddr, struct rtable *rt, int is_frag); 445 __be32 daddr, struct rtable *rt, int is_frag);
435extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 446int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
436extern void ip_options_fragment(struct sk_buff *skb); 447void ip_options_fragment(struct sk_buff *skb);
437extern int ip_options_compile(struct net *net, 448int ip_options_compile(struct net *net, struct ip_options *opt,
438 struct ip_options *opt, struct sk_buff *skb); 449 struct sk_buff *skb);
439extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, 450int ip_options_get(struct net *net, struct ip_options_rcu **optp,
440 unsigned char *data, int optlen); 451 unsigned char *data, int optlen);
441extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, 452int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
442 unsigned char __user *data, int optlen); 453 unsigned char __user *data, int optlen);
443extern void ip_options_undo(struct ip_options * opt); 454void ip_options_undo(struct ip_options *opt);
444extern void ip_forward_options(struct sk_buff *skb); 455void ip_forward_options(struct sk_buff *skb);
445extern int ip_options_rcv_srr(struct sk_buff *skb); 456int ip_options_rcv_srr(struct sk_buff *skb);
446 457
447/* 458/*
448 * Functions provided by ip_sockglue.c 459 * Functions provided by ip_sockglue.c
449 */ 460 */
450 461
451extern void ipv4_pktinfo_prepare(struct sk_buff *skb); 462void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
452extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 463void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
453extern int ip_cmsg_send(struct net *net, 464int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc);
454 struct msghdr *msg, struct ipcm_cookie *ipc); 465int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
455extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); 466 unsigned int optlen);
456extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 467int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
457extern int compat_ip_setsockopt(struct sock *sk, int level, 468 int __user *optlen);
458 int optname, char __user *optval, unsigned int optlen); 469int compat_ip_setsockopt(struct sock *sk, int level, int optname,
459extern int compat_ip_getsockopt(struct sock *sk, int level, 470 char __user *optval, unsigned int optlen);
460 int optname, char __user *optval, int __user *optlen); 471int compat_ip_getsockopt(struct sock *sk, int level, int optname,
461extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 472 char __user *optval, int __user *optlen);
462 473int ip_ra_control(struct sock *sk, unsigned char on,
463extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 474 void (*destructor)(struct sock *));
464extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 475
465 __be16 port, u32 info, u8 *payload); 476int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
466extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, 477void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
467 u32 info); 478 u32 info, u8 *payload);
479void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
480 u32 info);
468 481
469#ifdef CONFIG_PROC_FS 482#ifdef CONFIG_PROC_FS
470extern int ip_misc_proc_init(void); 483int ip_misc_proc_init(void);
471#endif 484#endif
472 485
473#endif /* _IP_H */ 486#endif /* _IP_H */
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 7686e3f5033d..9e3c540c1b11 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
66 } 66 }
67} 67}
68 68
69#if IS_ENABLED(CONFIG_IPV6)
69static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 70static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
70{ 71{
71 struct ipv6_pinfo *np = inet6_sk(sk); 72 struct ipv6_pinfo *np = inet6_sk(sk);
72 73
73 __tcp_v6_send_check(skb, &np->saddr, &np->daddr); 74 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
74} 75}
76#endif
75 77
76int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
77#endif 79#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 48ec25a7fcb6..2182525e4d74 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
165static inline void rt6_clean_expires(struct rt6_info *rt) 165static inline void rt6_clean_expires(struct rt6_info *rt)
166{ 166{
167 rt->rt6i_flags &= ~RTF_EXPIRES; 167 rt->rt6i_flags &= ~RTF_EXPIRES;
168 rt->dst.expires = 0;
168} 169}
169 170
170static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 171static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
@@ -267,48 +268,39 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
267 * exported functions 268 * exported functions
268 */ 269 */
269 270
270extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 271struct fib6_table *fib6_get_table(struct net *net, u32 id);
271extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 272struct fib6_table *fib6_new_table(struct net *net, u32 id);
272extern struct dst_entry *fib6_rule_lookup(struct net *net, 273struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
273 struct flowi6 *fl6, int flags, 274 int flags, pol_lookup_t lookup);
274 pol_lookup_t lookup);
275 275
276extern struct fib6_node *fib6_lookup(struct fib6_node *root, 276struct fib6_node *fib6_lookup(struct fib6_node *root,
277 const struct in6_addr *daddr, 277 const struct in6_addr *daddr,
278 const struct in6_addr *saddr); 278 const struct in6_addr *saddr);
279 279
280struct fib6_node *fib6_locate(struct fib6_node *root, 280struct fib6_node *fib6_locate(struct fib6_node *root,
281 const struct in6_addr *daddr, int dst_len, 281 const struct in6_addr *daddr, int dst_len,
282 const struct in6_addr *saddr, int src_len); 282 const struct in6_addr *saddr, int src_len);
283 283
284extern void fib6_clean_all_ro(struct net *net, 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 int (*func)(struct rt6_info *, void *arg), 285 int prune, void *arg);
286 int prune, void *arg);
287 286
288extern void fib6_clean_all(struct net *net, 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info);
289 int (*func)(struct rt6_info *, void *arg),
290 int prune, void *arg);
291 288
292extern int fib6_add(struct fib6_node *root, 289int fib6_del(struct rt6_info *rt, struct nl_info *info);
293 struct rt6_info *rt,
294 struct nl_info *info);
295 290
296extern int fib6_del(struct rt6_info *rt, 291void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info);
297 struct nl_info *info);
298 292
299extern void inet6_rt_notify(int event, struct rt6_info *rt, 293void fib6_run_gc(unsigned long expires, struct net *net, bool force);
300 struct nl_info *info);
301 294
302extern void fib6_run_gc(unsigned long expires, 295void fib6_gc_cleanup(void);
303 struct net *net, bool force);
304 296
305extern void fib6_gc_cleanup(void); 297int fib6_init(void);
306 298
307extern int fib6_init(void); 299int ipv6_route_open(struct inode *inode, struct file *file);
308 300
309#ifdef CONFIG_IPV6_MULTIPLE_TABLES 301#ifdef CONFIG_IPV6_MULTIPLE_TABLES
310extern int fib6_rules_init(void); 302int fib6_rules_init(void);
311extern void fib6_rules_cleanup(void); 303void fib6_rules_cleanup(void);
312#else 304#else
313static inline int fib6_rules_init(void) 305static inline int fib6_rules_init(void)
314{ 306{
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f525e7038cca..733747ce163c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,7 +51,7 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 51 return (flags >> 3) & 7;
52} 52}
53 53
54extern void rt6_bind_peer(struct rt6_info *rt, int create); 54void rt6_bind_peer(struct rt6_info *rt, int create);
55 55
56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create) 56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
57{ 57{
@@ -72,70 +72,58 @@ static inline struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
72 return __rt6_get_peer(rt, 1); 72 return __rt6_get_peer(rt, 1);
73} 73}
74 74
75extern void ip6_route_input(struct sk_buff *skb); 75void ip6_route_input(struct sk_buff *skb);
76 76
77extern struct dst_entry * ip6_route_output(struct net *net, 77struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
78 const struct sock *sk, 78 struct flowi6 *fl6);
79 struct flowi6 *fl6); 79struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
80extern struct dst_entry * ip6_route_lookup(struct net *net, 80 int flags);
81 struct flowi6 *fl6, int flags);
82 81
83extern int ip6_route_init(void); 82int ip6_route_init(void);
84extern void ip6_route_cleanup(void); 83void ip6_route_cleanup(void);
85 84
86extern int ipv6_route_ioctl(struct net *net, 85int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
87 unsigned int cmd,
88 void __user *arg);
89 86
90extern int ip6_route_add(struct fib6_config *cfg); 87int ip6_route_add(struct fib6_config *cfg);
91extern int ip6_ins_rt(struct rt6_info *); 88int ip6_ins_rt(struct rt6_info *);
92extern int ip6_del_rt(struct rt6_info *); 89int ip6_del_rt(struct rt6_info *);
93 90
94extern int ip6_route_get_saddr(struct net *net, 91int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
95 struct rt6_info *rt, 92 const struct in6_addr *daddr, unsigned int prefs,
96 const struct in6_addr *daddr, 93 struct in6_addr *saddr);
97 unsigned int prefs,
98 struct in6_addr *saddr);
99 94
100extern struct rt6_info *rt6_lookup(struct net *net, 95struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
101 const struct in6_addr *daddr, 96 const struct in6_addr *saddr, int oif, int flags);
102 const struct in6_addr *saddr,
103 int oif, int flags);
104 97
105extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 98struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
106 struct flowi6 *fl6); 99int icmp6_dst_gc(void);
107extern int icmp6_dst_gc(void);
108 100
109extern void fib6_force_start_gc(struct net *net); 101void fib6_force_start_gc(struct net *net);
110 102
111extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 103struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
112 const struct in6_addr *addr, 104 const struct in6_addr *addr, bool anycast);
113 bool anycast);
114 105
115/* 106/*
116 * support functions for ND 107 * support functions for ND
117 * 108 *
118 */ 109 */
119extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr, 110struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr,
120 struct net_device *dev); 111 struct net_device *dev);
121extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr, 112struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr,
122 struct net_device *dev, 113 struct net_device *dev, unsigned int pref);
123 unsigned int pref); 114
124 115void rt6_purge_dflt_routers(struct net *net);
125extern void rt6_purge_dflt_routers(struct net *net); 116
126 117int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
127extern int rt6_route_rcv(struct net_device *dev, 118 const struct in6_addr *gwaddr);
128 u8 *opt, int len, 119
129 const struct in6_addr *gwaddr); 120void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
130 121 u32 mark);
131extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, 122void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
132 int oif, u32 mark); 123void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
133extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, 124void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
134 __be32 mtu); 125 u32 mark);
135extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark); 126void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
136extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
137 u32 mark);
138extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
139 127
140struct netlink_callback; 128struct netlink_callback;
141 129
@@ -145,10 +133,10 @@ struct rt6_rtnl_dump_arg {
145 struct net *net; 133 struct net *net;
146}; 134};
147 135
148extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 136int rt6_dump_route(struct rt6_info *rt, void *p_arg);
149extern void rt6_ifdown(struct net *net, struct net_device *dev); 137void rt6_ifdown(struct net *net, struct net_device *dev);
150extern void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 138void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
151extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 139void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
152 140
153 141
154/* 142/*
@@ -194,11 +182,9 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
194 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 182 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
195} 183}
196 184
197static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest) 185static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
198{ 186{
199 if (rt->rt6i_flags & RTF_GATEWAY) 187 return &rt->rt6i_gateway;
200 return &rt->rt6i_gateway;
201 return dest;
202} 188}
203 189
204#endif 190#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index cbf2be37c91a..9922093f575e 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -165,7 +165,7 @@ struct fib_result_nl {
165#define FIB_TABLE_HASHSZ 2 165#define FIB_TABLE_HASHSZ 2
166#endif 166#endif
167 167
168extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); 168__be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
169 169
170#define FIB_RES_SADDR(net, res) \ 170#define FIB_RES_SADDR(net, res) \
171 ((FIB_RES_NH(res).nh_saddr_genid == \ 171 ((FIB_RES_NH(res).nh_saddr_genid == \
@@ -187,14 +187,14 @@ struct fib_table {
187 unsigned long tb_data[0]; 187 unsigned long tb_data[0];
188}; 188};
189 189
190extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 190int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
191 struct fib_result *res, int fib_flags); 191 struct fib_result *res, int fib_flags);
192extern int fib_table_insert(struct fib_table *, struct fib_config *); 192int fib_table_insert(struct fib_table *, struct fib_config *);
193extern int fib_table_delete(struct fib_table *, struct fib_config *); 193int fib_table_delete(struct fib_table *, struct fib_config *);
194extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 194int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
195 struct netlink_callback *cb); 195 struct netlink_callback *cb);
196extern int fib_table_flush(struct fib_table *table); 196int fib_table_flush(struct fib_table *table);
197extern void fib_free_table(struct fib_table *tb); 197void fib_free_table(struct fib_table *tb);
198 198
199 199
200 200
@@ -234,14 +234,13 @@ static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
234} 234}
235 235
236#else /* CONFIG_IP_MULTIPLE_TABLES */ 236#else /* CONFIG_IP_MULTIPLE_TABLES */
237extern int __net_init fib4_rules_init(struct net *net); 237int __net_init fib4_rules_init(struct net *net);
238extern void __net_exit fib4_rules_exit(struct net *net); 238void __net_exit fib4_rules_exit(struct net *net);
239 239
240extern struct fib_table *fib_new_table(struct net *net, u32 id); 240struct fib_table *fib_new_table(struct net *net, u32 id);
241extern struct fib_table *fib_get_table(struct net *net, u32 id); 241struct fib_table *fib_get_table(struct net *net, u32 id);
242 242
243extern int __fib_lookup(struct net *net, struct flowi4 *flp, 243int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res);
244 struct fib_result *res);
245 244
246static inline int fib_lookup(struct net *net, struct flowi4 *flp, 245static inline int fib_lookup(struct net *net, struct flowi4 *flp,
247 struct fib_result *res) 246 struct fib_result *res)
@@ -269,12 +268,12 @@ static inline int fib_lookup(struct net *net, struct flowi4 *flp,
269 268
270/* Exported by fib_frontend.c */ 269/* Exported by fib_frontend.c */
271extern const struct nla_policy rtm_ipv4_policy[]; 270extern const struct nla_policy rtm_ipv4_policy[];
272extern void ip_fib_init(void); 271void ip_fib_init(void);
273extern __be32 fib_compute_spec_dst(struct sk_buff *skb); 272__be32 fib_compute_spec_dst(struct sk_buff *skb);
274extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, 273int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
275 u8 tos, int oif, struct net_device *dev, 274 u8 tos, int oif, struct net_device *dev,
276 struct in_device *idev, u32 *itag); 275 struct in_device *idev, u32 *itag);
277extern void fib_select_default(struct fib_result *res); 276void fib_select_default(struct fib_result *res);
278#ifdef CONFIG_IP_ROUTE_CLASSID 277#ifdef CONFIG_IP_ROUTE_CLASSID
279static inline int fib_num_tclassid_users(struct net *net) 278static inline int fib_num_tclassid_users(struct net *net)
280{ 279{
@@ -288,15 +287,15 @@ static inline int fib_num_tclassid_users(struct net *net)
288#endif 287#endif
289 288
290/* Exported by fib_semantics.c */ 289/* Exported by fib_semantics.c */
291extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 290int ip_fib_check_default(__be32 gw, struct net_device *dev);
292extern int fib_sync_down_dev(struct net_device *dev, int force); 291int fib_sync_down_dev(struct net_device *dev, int force);
293extern int fib_sync_down_addr(struct net *net, __be32 local); 292int fib_sync_down_addr(struct net *net, __be32 local);
294extern int fib_sync_up(struct net_device *dev); 293int fib_sync_up(struct net_device *dev);
295extern void fib_select_multipath(struct fib_result *res); 294void fib_select_multipath(struct fib_result *res);
296 295
297/* Exported by fib_trie.c */ 296/* Exported by fib_trie.c */
298extern void fib_trie_init(void); 297void fib_trie_init(void);
299extern struct fib_table *fib_trie_table(u32 id); 298struct fib_table *fib_trie_table(u32 id);
300 299
301static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) 300static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
302{ 301{
@@ -314,7 +313,7 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
314#endif 313#endif
315} 314}
316 315
317extern void free_fib_info(struct fib_info *fi); 316void free_fib_info(struct fib_info *fi);
318 317
319static inline void fib_info_put(struct fib_info *fi) 318static inline void fib_info_put(struct fib_info *fi)
320{ 319{
@@ -323,8 +322,8 @@ static inline void fib_info_put(struct fib_info *fi)
323} 322}
324 323
325#ifdef CONFIG_PROC_FS 324#ifdef CONFIG_PROC_FS
326extern int __net_init fib_proc_init(struct net *net); 325int __net_init fib_proc_init(struct net *net);
327extern void __net_exit fib_proc_exit(struct net *net); 326void __net_exit fib_proc_exit(struct net *net);
328#else 327#else
329static inline int fib_proc_init(struct net *net) 328static inline int fib_proc_init(struct net *net)
330{ 329{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index a0a4a100f5c9..732f8c6ae975 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -150,6 +150,9 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
150 __be32 src, __be32 dst, __u8 proto, 150 __be32 src, __be32 dst, __u8 proto,
151 __u8 tos, __u8 ttl, __be16 df, bool xnet); 151 __u8 tos, __u8 ttl, __be16 df, bool xnet);
152 152
153struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
154 int gso_type_mask);
155
153static inline void iptunnel_xmit_stats(int err, 156static inline void iptunnel_xmit_stats(int err,
154 struct net_device_stats *err_stats, 157 struct net_device_stats *err_stats,
155 struct pcpu_tstats __percpu *stats) 158 struct pcpu_tstats __percpu *stats)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index f0d70f066f3d..5679d927562b 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -109,7 +109,6 @@ extern int ip_vs_conn_tab_size;
109struct ip_vs_iphdr { 109struct ip_vs_iphdr {
110 __u32 len; /* IPv4 simply where L4 starts 110 __u32 len; /* IPv4 simply where L4 starts
111 IPv6 where L4 Transport Header starts */ 111 IPv6 where L4 Transport Header starts */
112 __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */
113 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
114 __s16 protocol; 113 __s16 protocol;
115 __s32 flags; 114 __s32 flags;
@@ -117,34 +116,12 @@ struct ip_vs_iphdr {
117 union nf_inet_addr daddr; 116 union nf_inet_addr daddr;
118}; 117};
119 118
120/* Dependency to module: nf_defrag_ipv6 */
121#if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
122static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
123{
124 return skb->nfct_reasm;
125}
126static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh)
129{
130 if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb)))
131 return skb_header_pointer(skb_nfct_reasm(skb),
132 ipvsh->thoff_reasm, len, buffer);
133
134 return skb_header_pointer(skb, offset, len, buffer);
135}
136#else
137static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
138{
139 return NULL;
140}
141static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, 119static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
142 int len, void *buffer, 120 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh) 121 const struct ip_vs_iphdr *ipvsh)
144{ 122{
145 return skb_header_pointer(skb, offset, len, buffer); 123 return skb_header_pointer(skb, offset, len, buffer);
146} 124}
147#endif
148 125
149static inline void 126static inline void
150ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) 127ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr)
@@ -171,19 +148,12 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
171 (struct ipv6hdr *)skb_network_header(skb); 148 (struct ipv6hdr *)skb_network_header(skb);
172 iphdr->saddr.in6 = iph->saddr; 149 iphdr->saddr.in6 = iph->saddr;
173 iphdr->daddr.in6 = iph->daddr; 150 iphdr->daddr.in6 = iph->daddr;
174 /* ipv6_find_hdr() updates len, flags, thoff_reasm */ 151 /* ipv6_find_hdr() updates len, flags */
175 iphdr->thoff_reasm = 0;
176 iphdr->len = 0; 152 iphdr->len = 0;
177 iphdr->flags = 0; 153 iphdr->flags = 0;
178 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, 154 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
179 &iphdr->fragoffs, 155 &iphdr->fragoffs,
180 &iphdr->flags); 156 &iphdr->flags);
181 /* get proto from re-assembled packet and it's offset */
182 if (skb_nfct_reasm(skb))
183 iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb),
184 &iphdr->thoff_reasm,
185 -1, NULL, NULL);
186
187 } else 157 } else
188#endif 158#endif
189 { 159 {
@@ -236,7 +206,7 @@ static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
236#ifdef CONFIG_IP_VS_DEBUG 206#ifdef CONFIG_IP_VS_DEBUG
237#include <linux/net.h> 207#include <linux/net.h>
238 208
239extern int ip_vs_get_debug_level(void); 209int ip_vs_get_debug_level(void);
240 210
241static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, 211static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
242 const union nf_inet_addr *addr, 212 const union nf_inet_addr *addr,
@@ -532,9 +502,9 @@ struct ip_vs_proto_data {
532 struct tcp_states_t *tcp_state_table; 502 struct tcp_states_t *tcp_state_table;
533}; 503};
534 504
535extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); 505struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
536extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, 506struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
537 unsigned short proto); 507 unsigned short proto);
538 508
539struct ip_vs_conn_param { 509struct ip_vs_conn_param {
540 struct net *net; 510 struct net *net;
@@ -723,8 +693,6 @@ struct ip_vs_dest_dst {
723 struct rcu_head rcu_head; 693 struct rcu_head rcu_head;
724}; 694};
725 695
726/* In grace period after removing */
727#define IP_VS_DEST_STATE_REMOVING 0x01
728/* 696/*
729 * The real server destination forwarding entry 697 * The real server destination forwarding entry
730 * with ip address, port number, and so on. 698 * with ip address, port number, and so on.
@@ -742,7 +710,7 @@ struct ip_vs_dest {
742 710
743 atomic_t refcnt; /* reference counter */ 711 atomic_t refcnt; /* reference counter */
744 struct ip_vs_stats stats; /* statistics */ 712 struct ip_vs_stats stats; /* statistics */
745 unsigned long state; /* state flags */ 713 unsigned long idle_start; /* start time, jiffies */
746 714
747 /* connection counters and thresholds */ 715 /* connection counters and thresholds */
748 atomic_t activeconns; /* active connections */ 716 atomic_t activeconns; /* active connections */
@@ -756,14 +724,13 @@ struct ip_vs_dest {
756 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ 724 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */
757 725
758 /* for virtual service */ 726 /* for virtual service */
759 struct ip_vs_service *svc; /* service it belongs to */ 727 struct ip_vs_service __rcu *svc; /* service it belongs to */
760 __u16 protocol; /* which protocol (TCP/UDP) */ 728 __u16 protocol; /* which protocol (TCP/UDP) */
761 __be16 vport; /* virtual port number */ 729 __be16 vport; /* virtual port number */
762 union nf_inet_addr vaddr; /* virtual IP address */ 730 union nf_inet_addr vaddr; /* virtual IP address */
763 __u32 vfwmark; /* firewall mark of service */ 731 __u32 vfwmark; /* firewall mark of service */
764 732
765 struct list_head t_list; /* in dest_trash */ 733 struct list_head t_list; /* in dest_trash */
766 struct rcu_head rcu_head;
767 unsigned int in_rs_table:1; /* we are in rs_table */ 734 unsigned int in_rs_table:1; /* we are in rs_table */
768}; 735};
769 736
@@ -1176,8 +1143,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1176 * IPVS core functions 1143 * IPVS core functions
1177 * (from ip_vs_core.c) 1144 * (from ip_vs_core.c)
1178 */ 1145 */
1179extern const char *ip_vs_proto_name(unsigned int proto); 1146const char *ip_vs_proto_name(unsigned int proto);
1180extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1147void ip_vs_init_hash_table(struct list_head *table, int rows);
1181#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) 1148#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
1182 1149
1183#define IP_VS_APP_TYPE_FTP 1 1150#define IP_VS_APP_TYPE_FTP 1
@@ -1240,22 +1207,22 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1240 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic_dec();
1241 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1242} 1209}
1243extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
1244extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 1211void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1245 1212
1246struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1213struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
1247 const union nf_inet_addr *daddr, 1214 const union nf_inet_addr *daddr,
1248 __be16 dport, unsigned int flags, 1215 __be16 dport, unsigned int flags,
1249 struct ip_vs_dest *dest, __u32 fwmark); 1216 struct ip_vs_dest *dest, __u32 fwmark);
1250extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1217void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1251 1218
1252extern const char * ip_vs_state_name(__u16 proto, int state); 1219const char *ip_vs_state_name(__u16 proto, int state);
1253 1220
1254extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); 1221void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
1255extern int ip_vs_check_template(struct ip_vs_conn *ct); 1222int ip_vs_check_template(struct ip_vs_conn *ct);
1256extern void ip_vs_random_dropentry(struct net *net); 1223void ip_vs_random_dropentry(struct net *net);
1257extern int ip_vs_conn_init(void); 1224int ip_vs_conn_init(void);
1258extern void ip_vs_conn_cleanup(void); 1225void ip_vs_conn_cleanup(void);
1259 1226
1260static inline void ip_vs_control_del(struct ip_vs_conn *cp) 1227static inline void ip_vs_control_del(struct ip_vs_conn *cp)
1261{ 1228{
@@ -1320,37 +1287,36 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1320/* 1287/*
1321 * IPVS netns init & cleanup functions 1288 * IPVS netns init & cleanup functions
1322 */ 1289 */
1323extern int ip_vs_estimator_net_init(struct net *net); 1290int ip_vs_estimator_net_init(struct net *net);
1324extern int ip_vs_control_net_init(struct net *net); 1291int ip_vs_control_net_init(struct net *net);
1325extern int ip_vs_protocol_net_init(struct net *net); 1292int ip_vs_protocol_net_init(struct net *net);
1326extern int ip_vs_app_net_init(struct net *net); 1293int ip_vs_app_net_init(struct net *net);
1327extern int ip_vs_conn_net_init(struct net *net); 1294int ip_vs_conn_net_init(struct net *net);
1328extern int ip_vs_sync_net_init(struct net *net); 1295int ip_vs_sync_net_init(struct net *net);
1329extern void ip_vs_conn_net_cleanup(struct net *net); 1296void ip_vs_conn_net_cleanup(struct net *net);
1330extern void ip_vs_app_net_cleanup(struct net *net); 1297void ip_vs_app_net_cleanup(struct net *net);
1331extern void ip_vs_protocol_net_cleanup(struct net *net); 1298void ip_vs_protocol_net_cleanup(struct net *net);
1332extern void ip_vs_control_net_cleanup(struct net *net); 1299void ip_vs_control_net_cleanup(struct net *net);
1333extern void ip_vs_estimator_net_cleanup(struct net *net); 1300void ip_vs_estimator_net_cleanup(struct net *net);
1334extern void ip_vs_sync_net_cleanup(struct net *net); 1301void ip_vs_sync_net_cleanup(struct net *net);
1335extern void ip_vs_service_net_cleanup(struct net *net); 1302void ip_vs_service_net_cleanup(struct net *net);
1336 1303
1337/* 1304/*
1338 * IPVS application functions 1305 * IPVS application functions
1339 * (from ip_vs_app.c) 1306 * (from ip_vs_app.c)
1340 */ 1307 */
1341#define IP_VS_APP_MAX_PORTS 8 1308#define IP_VS_APP_MAX_PORTS 8
1342extern struct ip_vs_app *register_ip_vs_app(struct net *net, 1309struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
1343 struct ip_vs_app *app); 1310void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1344extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); 1311int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1345extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1312void ip_vs_unbind_app(struct ip_vs_conn *cp);
1346extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1313int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
1347extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, 1314 __u16 port);
1348 __u16 proto, __u16 port); 1315int ip_vs_app_inc_get(struct ip_vs_app *inc);
1349extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 1316void ip_vs_app_inc_put(struct ip_vs_app *inc);
1350extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 1317
1351 1318int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1352extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1319int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1353extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1354 1320
1355int register_ip_vs_pe(struct ip_vs_pe *pe); 1321int register_ip_vs_pe(struct ip_vs_pe *pe);
1356int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1322int unregister_ip_vs_pe(struct ip_vs_pe *pe);
@@ -1371,17 +1337,15 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1371/* 1337/*
1372 * IPVS protocol functions (from ip_vs_proto.c) 1338 * IPVS protocol functions (from ip_vs_proto.c)
1373 */ 1339 */
1374extern int ip_vs_protocol_init(void); 1340int ip_vs_protocol_init(void);
1375extern void ip_vs_protocol_cleanup(void); 1341void ip_vs_protocol_cleanup(void);
1376extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1342void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
1377extern int *ip_vs_create_timeout_table(int *table, int size); 1343int *ip_vs_create_timeout_table(int *table, int size);
1378extern int 1344int ip_vs_set_state_timeout(int *table, int num, const char *const *names,
1379ip_vs_set_state_timeout(int *table, int num, const char *const *names, 1345 const char *name, int to);
1380 const char *name, int to); 1346void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
1381extern void 1347 const struct sk_buff *skb, int offset,
1382ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, 1348 const char *msg);
1383 const struct sk_buff *skb,
1384 int offset, const char *msg);
1385 1349
1386extern struct ip_vs_protocol ip_vs_protocol_tcp; 1350extern struct ip_vs_protocol ip_vs_protocol_tcp;
1387extern struct ip_vs_protocol ip_vs_protocol_udp; 1351extern struct ip_vs_protocol ip_vs_protocol_udp;
@@ -1394,22 +1358,22 @@ extern struct ip_vs_protocol ip_vs_protocol_sctp;
1394 * Registering/unregistering scheduler functions 1358 * Registering/unregistering scheduler functions
1395 * (from ip_vs_sched.c) 1359 * (from ip_vs_sched.c)
1396 */ 1360 */
1397extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1361int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1398extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1362int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1399extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1363int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1400 struct ip_vs_scheduler *scheduler); 1364 struct ip_vs_scheduler *scheduler);
1401extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, 1365void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1402 struct ip_vs_scheduler *sched); 1366 struct ip_vs_scheduler *sched);
1403extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1367struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1404extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1368void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1405extern struct ip_vs_conn * 1369struct ip_vs_conn *
1406ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1370ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1407 struct ip_vs_proto_data *pd, int *ignored, 1371 struct ip_vs_proto_data *pd, int *ignored,
1408 struct ip_vs_iphdr *iph); 1372 struct ip_vs_iphdr *iph);
1409extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1373int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1410 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); 1374 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1411 1375
1412extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1376void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1413 1377
1414 1378
1415/* 1379/*
@@ -1418,25 +1382,24 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1418extern struct ip_vs_stats ip_vs_stats; 1382extern struct ip_vs_stats ip_vs_stats;
1419extern int sysctl_ip_vs_sync_ver; 1383extern int sysctl_ip_vs_sync_ver;
1420 1384
1421extern struct ip_vs_service * 1385struct ip_vs_service *
1422ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, 1386ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,
1423 const union nf_inet_addr *vaddr, __be16 vport); 1387 const union nf_inet_addr *vaddr, __be16 vport);
1424 1388
1425extern bool 1389bool ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1426ip_vs_has_real_service(struct net *net, int af, __u16 protocol, 1390 const union nf_inet_addr *daddr, __be16 dport);
1427 const union nf_inet_addr *daddr, __be16 dport); 1391
1428 1392int ip_vs_use_count_inc(void);
1429extern int ip_vs_use_count_inc(void); 1393void ip_vs_use_count_dec(void);
1430extern void ip_vs_use_count_dec(void); 1394int ip_vs_register_nl_ioctl(void);
1431extern int ip_vs_register_nl_ioctl(void); 1395void ip_vs_unregister_nl_ioctl(void);
1432extern void ip_vs_unregister_nl_ioctl(void); 1396int ip_vs_control_init(void);
1433extern int ip_vs_control_init(void); 1397void ip_vs_control_cleanup(void);
1434extern void ip_vs_control_cleanup(void); 1398struct ip_vs_dest *
1435extern struct ip_vs_dest *
1436ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1399ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1437 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1400 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1438 __u16 protocol, __u32 fwmark, __u32 flags); 1401 __u16 protocol, __u32 fwmark, __u32 flags);
1439extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1402void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1440 1403
1441static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) 1404static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1442{ 1405{
@@ -1449,60 +1412,59 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1449 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1450} 1413}
1451 1414
1415static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
1416{
1417 if (atomic_dec_return(&dest->refcnt) < 0)
1418 kfree(dest);
1419}
1420
1452/* 1421/*
1453 * IPVS sync daemon data and function prototypes 1422 * IPVS sync daemon data and function prototypes
1454 * (from ip_vs_sync.c) 1423 * (from ip_vs_sync.c)
1455 */ 1424 */
1456extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, 1425int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
1457 __u8 syncid); 1426int stop_sync_thread(struct net *net, int state);
1458extern int stop_sync_thread(struct net *net, int state); 1427void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1459extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1460
1461 1428
1462/* 1429/*
1463 * IPVS rate estimator prototypes (from ip_vs_est.c) 1430 * IPVS rate estimator prototypes (from ip_vs_est.c)
1464 */ 1431 */
1465extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1432void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1466extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1433void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1467extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1434void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1468extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1435void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1469 struct ip_vs_stats *stats); 1436 struct ip_vs_stats *stats);
1470 1437
1471/* 1438/*
1472 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1439 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1473 */ 1440 */
1474extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1441int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1475 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1442 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1476extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1443int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1477 struct ip_vs_protocol *pp, 1444 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1478 struct ip_vs_iphdr *iph); 1445int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1479extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1446 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1480 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1447int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1481extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1448 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1482 struct ip_vs_protocol *pp, 1449int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1483 struct ip_vs_iphdr *iph); 1450 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1484extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1451int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1485 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1452 struct ip_vs_protocol *pp, int offset,
1486extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1453 unsigned int hooknum, struct ip_vs_iphdr *iph);
1487 struct ip_vs_protocol *pp, int offset, 1454void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1488 unsigned int hooknum, struct ip_vs_iphdr *iph);
1489extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1490 1455
1491#ifdef CONFIG_IP_VS_IPV6 1456#ifdef CONFIG_IP_VS_IPV6
1492extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1457int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1493 struct ip_vs_protocol *pp, 1458 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1494 struct ip_vs_iphdr *iph); 1459int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1495extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1460 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1496 struct ip_vs_protocol *pp, 1461int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1497 struct ip_vs_iphdr *iph); 1462 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1498extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1463int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1499 struct ip_vs_protocol *pp, 1464 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1500 struct ip_vs_iphdr *iph); 1465int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1501extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1466 struct ip_vs_protocol *pp, int offset,
1502 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1467 unsigned int hooknum, struct ip_vs_iphdr *iph);
1503extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1504 struct ip_vs_protocol *pp, int offset,
1505 unsigned int hooknum, struct ip_vs_iphdr *iph);
1506#endif 1468#endif
1507 1469
1508#ifdef CONFIG_SYSCTL 1470#ifdef CONFIG_SYSCTL
@@ -1551,15 +1513,15 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
1551 return fwd; 1513 return fwd;
1552} 1514}
1553 1515
1554extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 1516void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
1555 struct ip_vs_conn *cp, int dir); 1517 struct ip_vs_conn *cp, int dir);
1556 1518
1557#ifdef CONFIG_IP_VS_IPV6 1519#ifdef CONFIG_IP_VS_IPV6
1558extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, 1520void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,
1559 struct ip_vs_conn *cp, int dir); 1521 struct ip_vs_conn *cp, int dir);
1560#endif 1522#endif
1561 1523
1562extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 1524__sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
1563 1525
1564static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) 1526static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
1565{ 1527{
@@ -1618,13 +1580,13 @@ static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1618#endif 1580#endif
1619} 1581}
1620 1582
1621extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1583void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
1622 int outin); 1584 int outin);
1623extern int ip_vs_confirm_conntrack(struct sk_buff *skb); 1585int ip_vs_confirm_conntrack(struct sk_buff *skb);
1624extern void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, 1586void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct,
1625 struct ip_vs_conn *cp, u_int8_t proto, 1587 struct ip_vs_conn *cp, u_int8_t proto,
1626 const __be16 port, int from_rs); 1588 const __be16 port, int from_rs);
1627extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); 1589void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1628 1590
1629#else 1591#else
1630 1592
@@ -1649,7 +1611,7 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1649/* CONFIG_IP_VS_NFCT */ 1611/* CONFIG_IP_VS_NFCT */
1650#endif 1612#endif
1651 1613
1652static inline unsigned int 1614static inline int
1653ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1615ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1654{ 1616{
1655 /* 1617 /*
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index bbf1c8fb8511..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/mac802154.h b/include/net/mac802154.h
index d0d11df9cba1..807d6b7a943f 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -133,7 +133,7 @@ struct ieee802154_ops {
133 133
134/* Basic interface to register ieee802154 device */ 134/* Basic interface to register ieee802154 device */
135struct ieee802154_dev * 135struct ieee802154_dev *
136ieee802154_alloc_device(size_t priv_data_lex, struct ieee802154_ops *ops); 136ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops);
137void ieee802154_free_device(struct ieee802154_dev *dev); 137void ieee802154_free_device(struct ieee802154_dev *dev);
138int ieee802154_register_device(struct ieee802154_dev *dev); 138int ieee802154_register_device(struct ieee802154_dev *dev);
139void ieee802154_unregister_device(struct ieee802154_dev *dev); 139void ieee802154_unregister_device(struct ieee802154_dev *dev);
diff --git a/include/net/mrp.h b/include/net/mrp.h
index 4fbf02aa2ec1..31912c3be772 100644
--- a/include/net/mrp.h
+++ b/include/net/mrp.h
@@ -112,6 +112,7 @@ struct mrp_applicant {
112 struct mrp_application *app; 112 struct mrp_application *app;
113 struct net_device *dev; 113 struct net_device *dev;
114 struct timer_list join_timer; 114 struct timer_list join_timer;
115 struct timer_list periodic_timer;
115 116
116 spinlock_t lock; 117 spinlock_t lock;
117 struct sk_buff_head queue; 118 struct sk_buff_head queue;
@@ -125,19 +126,17 @@ struct mrp_port {
125 struct rcu_head rcu; 126 struct rcu_head rcu;
126}; 127};
127 128
128extern int mrp_register_application(struct mrp_application *app); 129int mrp_register_application(struct mrp_application *app);
129extern void mrp_unregister_application(struct mrp_application *app); 130void mrp_unregister_application(struct mrp_application *app);
130 131
131extern int mrp_init_applicant(struct net_device *dev, 132int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
132 struct mrp_application *app); 133void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
133extern void mrp_uninit_applicant(struct net_device *dev,
134 struct mrp_application *app);
135 134
136extern int mrp_request_join(const struct net_device *dev, 135int mrp_request_join(const struct net_device *dev,
137 const struct mrp_application *app, 136 const struct mrp_application *app,
138 const void *value, u8 len, u8 type); 137 const void *value, u8 len, u8 type);
139extern void mrp_request_leave(const struct net_device *dev, 138void mrp_request_leave(const struct net_device *dev,
140 const struct mrp_application *app, 139 const struct mrp_application *app,
141 const void *value, u8 len, u8 type); 140 const void *value, u8 len, u8 type);
142 141
143#endif /* _NET_MRP_H */ 142#endif /* _NET_MRP_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 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 1313456a0994..da68c9a90ac5 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -22,6 +22,7 @@
22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
23#include <net/netns/conntrack.h> 23#include <net/netns/conntrack.h>
24#endif 24#endif
25#include <net/netns/nftables.h>
25#include <net/netns/xfrm.h> 26#include <net/netns/xfrm.h>
26 27
27struct user_namespace; 28struct user_namespace;
@@ -74,6 +75,7 @@ struct net {
74 struct hlist_head *dev_index_head; 75 struct hlist_head *dev_index_head;
75 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 76 unsigned int dev_base_seq; /* protected by rtnl_mutex */
76 int ifindex; 77 int ifindex;
78 unsigned int dev_unreg_count;
77 79
78 /* core fib_rules */ 80 /* core fib_rules */
79 struct list_head rules_ops; 81 struct list_head rules_ops;
@@ -100,6 +102,9 @@ struct net {
100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 102#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
101 struct netns_ct ct; 103 struct netns_ct ct;
102#endif 104#endif
105#if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
106 struct netns_nftables nft;
107#endif
103#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 108#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
104 struct netns_nf_frag nf_frag; 109 struct netns_nf_frag nf_frag;
105#endif 110#endif
@@ -136,8 +141,8 @@ struct net {
136extern struct net init_net; 141extern struct net init_net;
137 142
138#ifdef CONFIG_NET_NS 143#ifdef CONFIG_NET_NS
139extern struct net *copy_net_ns(unsigned long flags, 144struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
140 struct user_namespace *user_ns, struct net *old_net); 145 struct net *old_net);
141 146
142#else /* CONFIG_NET_NS */ 147#else /* CONFIG_NET_NS */
143#include <linux/sched.h> 148#include <linux/sched.h>
@@ -154,11 +159,11 @@ static inline struct net *copy_net_ns(unsigned long flags,
154 159
155extern struct list_head net_namespace_list; 160extern struct list_head net_namespace_list;
156 161
157extern struct net *get_net_ns_by_pid(pid_t pid); 162struct net *get_net_ns_by_pid(pid_t pid);
158extern struct net *get_net_ns_by_fd(int pid); 163struct net *get_net_ns_by_fd(int pid);
159 164
160#ifdef CONFIG_NET_NS 165#ifdef CONFIG_NET_NS
161extern void __put_net(struct net *net); 166void __put_net(struct net *net);
162 167
163static inline struct net *get_net(struct net *net) 168static inline struct net *get_net(struct net *net)
164{ 169{
@@ -190,7 +195,7 @@ int net_eq(const struct net *net1, const struct net *net2)
190 return net1 == net2; 195 return net1 == net2;
191} 196}
192 197
193extern void net_drop_ns(void *); 198void net_drop_ns(void *);
194 199
195#else 200#else
196 201
@@ -307,19 +312,19 @@ struct pernet_operations {
307 * device which caused kernel oops, and panics during network 312 * device which caused kernel oops, and panics during network
308 * namespace cleanup. So please don't get this wrong. 313 * namespace cleanup. So please don't get this wrong.
309 */ 314 */
310extern int register_pernet_subsys(struct pernet_operations *); 315int register_pernet_subsys(struct pernet_operations *);
311extern void unregister_pernet_subsys(struct pernet_operations *); 316void unregister_pernet_subsys(struct pernet_operations *);
312extern int register_pernet_device(struct pernet_operations *); 317int register_pernet_device(struct pernet_operations *);
313extern void unregister_pernet_device(struct pernet_operations *); 318void unregister_pernet_device(struct pernet_operations *);
314 319
315struct ctl_table; 320struct ctl_table;
316struct ctl_table_header; 321struct ctl_table_header;
317 322
318#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
319extern int net_sysctl_init(void); 324int net_sysctl_init(void);
320extern struct ctl_table_header *register_net_sysctl(struct net *net, 325struct ctl_table_header *register_net_sysctl(struct net *net, const char *path,
321 const char *path, struct ctl_table *table); 326 struct ctl_table *table);
322extern void unregister_net_sysctl_table(struct ctl_table_header *header); 327void unregister_net_sysctl_table(struct ctl_table_header *header);
323#else 328#else
324static inline int net_sysctl_init(void) { return 0; } 329static inline int net_sysctl_init(void) { return 0; }
325static inline struct ctl_table_header *register_net_sysctl(struct net *net, 330static inline struct ctl_table_header *register_net_sysctl(struct net *net,
diff --git a/include/net/netevent.h b/include/net/netevent.h
index fe630dde35c3..d8bbb38584b6 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -26,8 +26,8 @@ enum netevent_notif_type {
26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ 26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
27}; 27};
28 28
29extern int register_netevent_notifier(struct notifier_block *nb); 29int register_netevent_notifier(struct notifier_block *nb);
30extern int unregister_netevent_notifier(struct notifier_block *nb); 30int unregister_netevent_notifier(struct notifier_block *nb);
31extern int call_netevent_notifiers(unsigned long val, void *v); 31int call_netevent_notifiers(unsigned long val, void *v);
32 32
33#endif 33#endif
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 7573d52a4346..6c3d12e2949f 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -16,9 +16,9 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; 16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp; 17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
18 18
19extern int nf_conntrack_ipv4_compat_init(void); 19int nf_conntrack_ipv4_compat_init(void);
20extern void nf_conntrack_ipv4_compat_fini(void); 20void nf_conntrack_ipv4_compat_fini(void);
21 21
22extern void need_ipv4_conntrack(void); 22void need_ipv4_conntrack(void);
23 23
24#endif /*_NF_CONNTRACK_IPV4_H*/ 24#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
index 6b00ea38546b..f01ef208dff6 100644
--- a/include/net/netfilter/ipv4/nf_defrag_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
@@ -1,6 +1,6 @@
1#ifndef _NF_DEFRAG_IPV4_H 1#ifndef _NF_DEFRAG_IPV4_H
2#define _NF_DEFRAG_IPV4_H 2#define _NF_DEFRAG_IPV4_H
3 3
4extern void nf_defrag_ipv4_enable(void); 4void nf_defrag_ipv4_enable(void);
5 5
6#endif /* _NF_DEFRAG_IPV4_H */ 6#endif /* _NF_DEFRAG_IPV4_H */
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
index fd79c9a1779d..27666d8a0bd0 100644
--- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -1,15 +1,12 @@
1#ifndef _NF_DEFRAG_IPV6_H 1#ifndef _NF_DEFRAG_IPV6_H
2#define _NF_DEFRAG_IPV6_H 2#define _NF_DEFRAG_IPV6_H
3 3
4extern void nf_defrag_ipv6_enable(void); 4void nf_defrag_ipv6_enable(void);
5 5
6extern int nf_ct_frag6_init(void); 6int nf_ct_frag6_init(void);
7extern void nf_ct_frag6_cleanup(void); 7void nf_ct_frag6_cleanup(void);
8extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user); 8struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
9extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, 9void nf_ct_frag6_consume_orig(struct sk_buff *skb);
10 struct net_device *in,
11 struct net_device *out,
12 int (*okfn)(struct sk_buff *));
13 10
14struct inet_frags_ctl; 11struct inet_frags_ctl;
15 12
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0c1288a50e8b..01ea6eed1bb1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -139,15 +139,13 @@ static inline struct net *nf_ct_net(const struct nf_conn *ct)
139} 139}
140 140
141/* Alter reply tuple (maybe alter helper). */ 141/* Alter reply tuple (maybe alter helper). */
142extern void 142void nf_conntrack_alter_reply(struct nf_conn *ct,
143nf_conntrack_alter_reply(struct nf_conn *ct, 143 const struct nf_conntrack_tuple *newreply);
144 const struct nf_conntrack_tuple *newreply);
145 144
146/* Is this tuple taken? (ignoring any belonging to the given 145/* Is this tuple taken? (ignoring any belonging to the given
147 conntrack). */ 146 conntrack). */
148extern int 147int nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
149nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, 148 const struct nf_conn *ignored_conntrack);
150 const struct nf_conn *ignored_conntrack);
151 149
152/* Return conntrack_info and tuple hash for given skb. */ 150/* Return conntrack_info and tuple hash for given skb. */
153static inline struct nf_conn * 151static inline struct nf_conn *
@@ -165,37 +163,34 @@ static inline void nf_ct_put(struct nf_conn *ct)
165} 163}
166 164
167/* Protocol module loading */ 165/* Protocol module loading */
168extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 166int nf_ct_l3proto_try_module_get(unsigned short l3proto);
169extern void nf_ct_l3proto_module_put(unsigned short l3proto); 167void nf_ct_l3proto_module_put(unsigned short l3proto);
170 168
171/* 169/*
172 * Allocate a hashtable of hlist_head (if nulls == 0), 170 * Allocate a hashtable of hlist_head (if nulls == 0),
173 * or hlist_nulls_head (if nulls == 1) 171 * or hlist_nulls_head (if nulls == 1)
174 */ 172 */
175extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls); 173void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
176 174
177extern void nf_ct_free_hashtable(void *hash, unsigned int size); 175void nf_ct_free_hashtable(void *hash, unsigned int size);
178 176
179extern struct nf_conntrack_tuple_hash * 177struct nf_conntrack_tuple_hash *
180__nf_conntrack_find(struct net *net, u16 zone, 178__nf_conntrack_find(struct net *net, u16 zone,
181 const struct nf_conntrack_tuple *tuple); 179 const struct nf_conntrack_tuple *tuple);
182 180
183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); 181int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report); 182bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report);
185 183
186extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report); 184void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
187 185
188extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 186bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
189 unsigned int nhoff, u_int16_t l3num, 187 u_int16_t l3num, struct nf_conntrack_tuple *tuple);
190 struct nf_conntrack_tuple *tuple); 188bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
191extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 189 const struct nf_conntrack_tuple *orig);
192 const struct nf_conntrack_tuple *orig);
193 190
194extern void __nf_ct_refresh_acct(struct nf_conn *ct, 191void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
195 enum ip_conntrack_info ctinfo, 192 const struct sk_buff *skb,
196 const struct sk_buff *skb, 193 unsigned long extra_jiffies, int do_acct);
197 unsigned long extra_jiffies,
198 int do_acct);
199 194
200/* Refresh conntrack for this many jiffies and do accounting */ 195/* Refresh conntrack for this many jiffies and do accounting */
201static inline void nf_ct_refresh_acct(struct nf_conn *ct, 196static inline void nf_ct_refresh_acct(struct nf_conn *ct,
@@ -214,10 +209,8 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
214 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); 209 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
215} 210}
216 211
217extern bool __nf_ct_kill_acct(struct nf_conn *ct, 212bool __nf_ct_kill_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
218 enum ip_conntrack_info ctinfo, 213 const struct sk_buff *skb, int do_acct);
219 const struct sk_buff *skb,
220 int do_acct);
221 214
222/* kill conntrack and do accounting */ 215/* kill conntrack and do accounting */
223static inline bool nf_ct_kill_acct(struct nf_conn *ct, 216static inline bool nf_ct_kill_acct(struct nf_conn *ct,
@@ -244,19 +237,17 @@ static inline struct nf_conn *nf_ct_untracked_get(void)
244{ 237{
245 return &__raw_get_cpu_var(nf_conntrack_untracked); 238 return &__raw_get_cpu_var(nf_conntrack_untracked);
246} 239}
247extern void nf_ct_untracked_status_or(unsigned long bits); 240void nf_ct_untracked_status_or(unsigned long bits);
248 241
249/* Iterate over all conntracks: if iter returns true, it's deleted. */ 242/* Iterate over all conntracks: if iter returns true, it's deleted. */
250extern void 243void nf_ct_iterate_cleanup(struct net *net,
251nf_ct_iterate_cleanup(struct net *net, 244 int (*iter)(struct nf_conn *i, void *data),
252 int (*iter)(struct nf_conn *i, void *data), 245 void *data, u32 portid, int report);
253 void *data, u32 portid, int report); 246void nf_conntrack_free(struct nf_conn *ct);
254extern void nf_conntrack_free(struct nf_conn *ct); 247struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone,
255extern struct nf_conn * 248 const struct nf_conntrack_tuple *orig,
256nf_conntrack_alloc(struct net *net, u16 zone, 249 const struct nf_conntrack_tuple *repl,
257 const struct nf_conntrack_tuple *orig, 250 gfp_t gfp);
258 const struct nf_conntrack_tuple *repl,
259 gfp_t gfp);
260 251
261static inline int nf_ct_is_template(const struct nf_conn *ct) 252static inline int nf_ct_is_template(const struct nf_conn *ct)
262{ 253{
@@ -287,7 +278,7 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
287 278
288struct kernel_param; 279struct kernel_param;
289 280
290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 281int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
291extern unsigned int nf_conntrack_htable_size; 282extern unsigned int nf_conntrack_htable_size;
292extern unsigned int nf_conntrack_max; 283extern unsigned int nf_conntrack_max;
293extern unsigned int nf_conntrack_hash_rnd; 284extern unsigned int nf_conntrack_hash_rnd;
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 2bdb7a15fe06..79d8d16732b4 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -19,17 +19,21 @@ struct nf_conn_counter {
19 atomic64_t bytes; 19 atomic64_t bytes;
20}; 20};
21 21
22struct nf_conn_acct {
23 struct nf_conn_counter counter[IP_CT_DIR_MAX];
24};
25
22static inline 26static inline
23struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) 27struct nf_conn_acct *nf_conn_acct_find(const struct nf_conn *ct)
24{ 28{
25 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT); 29 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT);
26} 30}
27 31
28static inline 32static inline
29struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) 33struct nf_conn_acct *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
30{ 34{
31 struct net *net = nf_ct_net(ct); 35 struct net *net = nf_ct_net(ct);
32 struct nf_conn_counter *acct; 36 struct nf_conn_acct *acct;
33 37
34 if (!net->ct.sysctl_acct) 38 if (!net->ct.sysctl_acct)
35 return NULL; 39 return NULL;
@@ -42,8 +46,8 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
42 return acct; 46 return acct;
43}; 47};
44 48
45extern unsigned int 49unsigned int seq_print_acct(struct seq_file *s, const struct nf_conn *ct,
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 50 int dir);
47 51
48/* Check if connection tracking accounting is enabled */ 52/* Check if connection tracking accounting is enabled */
49static inline bool nf_ct_acct_enabled(struct net *net) 53static inline bool nf_ct_acct_enabled(struct net *net)
@@ -57,9 +61,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
57 net->ct.sysctl_acct = enable; 61 net->ct.sysctl_acct = enable;
58} 62}
59 63
60extern int nf_conntrack_acct_pernet_init(struct net *net); 64int nf_conntrack_acct_pernet_init(struct net *net);
61extern void nf_conntrack_acct_pernet_fini(struct net *net); 65void nf_conntrack_acct_pernet_fini(struct net *net);
62 66
63extern int nf_conntrack_acct_init(void); 67int nf_conntrack_acct_init(void);
64extern void nf_conntrack_acct_fini(void); 68void nf_conntrack_acct_fini(void);
65#endif /* _NF_CONNTRACK_ACCT_H */ 69#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index fb2b6234e937..15308b8eb5b5 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -20,49 +20,42 @@
20/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
21 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
22 of connection tracking. */ 22 of connection tracking. */
23extern unsigned int nf_conntrack_in(struct net *net, 23unsigned int nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
24 u_int8_t pf, 24 struct sk_buff *skb);
25 unsigned int hooknum, 25
26 struct sk_buff *skb); 26int nf_conntrack_init_net(struct net *net);
27 27void nf_conntrack_cleanup_net(struct net *net);
28extern int nf_conntrack_init_net(struct net *net); 28void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
29extern void nf_conntrack_cleanup_net(struct net *net); 29
30extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list); 30int nf_conntrack_proto_pernet_init(struct net *net);
31 31void nf_conntrack_proto_pernet_fini(struct net *net);
32extern int nf_conntrack_proto_pernet_init(struct net *net); 32
33extern void nf_conntrack_proto_pernet_fini(struct net *net); 33int nf_conntrack_proto_init(void);
34 34void nf_conntrack_proto_fini(void);
35extern int nf_conntrack_proto_init(void); 35
36extern void nf_conntrack_proto_fini(void); 36int nf_conntrack_init_start(void);
37 37void nf_conntrack_cleanup_start(void);
38extern int nf_conntrack_init_start(void); 38
39extern void nf_conntrack_cleanup_start(void); 39void nf_conntrack_init_end(void);
40 40void nf_conntrack_cleanup_end(void);
41extern void nf_conntrack_init_end(void); 41
42extern void nf_conntrack_cleanup_end(void); 42bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff,
43 43 unsigned int dataoff, u_int16_t l3num, u_int8_t protonum,
44extern bool 44 struct nf_conntrack_tuple *tuple,
45nf_ct_get_tuple(const struct sk_buff *skb, 45 const struct nf_conntrack_l3proto *l3proto,
46 unsigned int nhoff, 46 const struct nf_conntrack_l4proto *l4proto);
47 unsigned int dataoff, 47
48 u_int16_t l3num, 48bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 u_int8_t protonum, 49 const struct nf_conntrack_tuple *orig,
50 struct nf_conntrack_tuple *tuple, 50 const struct nf_conntrack_l3proto *l3proto,
51 const struct nf_conntrack_l3proto *l3proto, 51 const struct nf_conntrack_l4proto *l4proto);
52 const struct nf_conntrack_l4proto *l4proto);
53
54extern bool
55nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
56 const struct nf_conntrack_tuple *orig,
57 const struct nf_conntrack_l3proto *l3proto,
58 const struct nf_conntrack_l4proto *l4proto);
59 52
60/* Find a connection corresponding to a tuple. */ 53/* Find a connection corresponding to a tuple. */
61extern struct nf_conntrack_tuple_hash * 54struct nf_conntrack_tuple_hash *
62nf_conntrack_find_get(struct net *net, u16 zone, 55nf_conntrack_find_get(struct net *net, u16 zone,
63 const struct nf_conntrack_tuple *tuple); 56 const struct nf_conntrack_tuple *tuple);
64 57
65extern int __nf_conntrack_confirm(struct sk_buff *skb); 58int __nf_conntrack_confirm(struct sk_buff *skb);
66 59
67/* Confirm a connection: returns NF_DROP if packet must be dropped. */ 60/* Confirm a connection: returns NF_DROP if packet must be dropped. */
68static inline int nf_conntrack_confirm(struct sk_buff *skb) 61static inline int nf_conntrack_confirm(struct sk_buff *skb)
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 092dc651689f..0e3d08e4b1d3 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -68,10 +68,12 @@ struct nf_ct_event_notifier {
68 int (*fcn)(unsigned int events, struct nf_ct_event *item); 68 int (*fcn)(unsigned int events, struct nf_ct_event *item);
69}; 69};
70 70
71extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); 71int nf_conntrack_register_notifier(struct net *net,
72extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); 72 struct nf_ct_event_notifier *nb);
73void nf_conntrack_unregister_notifier(struct net *net,
74 struct nf_ct_event_notifier *nb);
73 75
74extern void nf_ct_deliver_cached_events(struct nf_conn *ct); 76void nf_ct_deliver_cached_events(struct nf_conn *ct);
75 77
76static inline void 78static inline void
77nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 79nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
@@ -166,8 +168,10 @@ struct nf_exp_event_notifier {
166 int (*fcn)(unsigned int events, struct nf_exp_event *item); 168 int (*fcn)(unsigned int events, struct nf_exp_event *item);
167}; 169};
168 170
169extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); 171int nf_ct_expect_register_notifier(struct net *net,
170extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); 172 struct nf_exp_event_notifier *nb);
173void nf_ct_expect_unregister_notifier(struct net *net,
174 struct nf_exp_event_notifier *nb);
171 175
172static inline void 176static inline void
173nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 177nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -207,11 +211,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207 nf_ct_expect_event_report(event, exp, 0, 0); 211 nf_ct_expect_event_report(event, exp, 0, 0);
208} 212}
209 213
210extern int nf_conntrack_ecache_pernet_init(struct net *net); 214int nf_conntrack_ecache_pernet_init(struct net *net);
211extern void nf_conntrack_ecache_pernet_fini(struct net *net); 215void nf_conntrack_ecache_pernet_fini(struct net *net);
212 216
213extern int nf_conntrack_ecache_init(void); 217int nf_conntrack_ecache_init(void);
214extern void nf_conntrack_ecache_fini(void); 218void nf_conntrack_ecache_fini(void);
215#else /* CONFIG_NF_CONNTRACK_EVENTS */ 219#else /* CONFIG_NF_CONNTRACK_EVENTS */
216 220
217static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 221static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index ff95434e50ca..956b175523ff 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -36,7 +36,7 @@ enum nf_ct_ext_id {
36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj 38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj
39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_acct
40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
@@ -73,7 +73,7 @@ static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id))) 73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
74 74
75/* Destroy all relationships */ 75/* Destroy all relationships */
76extern void __nf_ct_ext_destroy(struct nf_conn *ct); 76void __nf_ct_ext_destroy(struct nf_conn *ct);
77static inline void nf_ct_ext_destroy(struct nf_conn *ct) 77static inline void nf_ct_ext_destroy(struct nf_conn *ct)
78{ 78{
79 if (ct->ext) 79 if (ct->ext)
@@ -86,7 +86,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct)
86static inline void nf_ct_ext_free(struct nf_conn *ct) 86static inline void nf_ct_ext_free(struct nf_conn *ct)
87{ 87{
88 if (ct->ext) 88 if (ct->ext)
89 kfree(ct->ext); 89 kfree_rcu(ct->ext, rcu);
90} 90}
91 91
92/* Add this type, returns pointer to data or NULL. */ 92/* Add this type, returns pointer to data or NULL. */
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 26c4ae5bfbb8..6cf614bc0029 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -52,21 +52,24 @@ struct nf_conntrack_helper {
52 unsigned int queue_num; /* For user-space helpers. */ 52 unsigned int queue_num; /* For user-space helpers. */
53}; 53};
54 54
55extern struct nf_conntrack_helper * 55struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
56__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum); 56 u16 l3num, u8 protonum);
57 57
58extern struct nf_conntrack_helper * 58struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
59nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum); 59 u16 l3num,
60 u8 protonum);
60 61
61extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 62int nf_conntrack_helper_register(struct nf_conntrack_helper *);
62extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 63void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
63 64
64extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp); 65struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct,
66 struct nf_conntrack_helper *helper,
67 gfp_t gfp);
65 68
66extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, 69int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
67 gfp_t flags); 70 gfp_t flags);
68 71
69extern void nf_ct_helper_destroy(struct nf_conn *ct); 72void nf_ct_helper_destroy(struct nf_conn *ct);
70 73
71static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 74static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
72{ 75{
@@ -82,17 +85,16 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
82 return (void *)help->data; 85 return (void *)help->data;
83} 86}
84 87
85extern int nf_conntrack_helper_pernet_init(struct net *net); 88int nf_conntrack_helper_pernet_init(struct net *net);
86extern void nf_conntrack_helper_pernet_fini(struct net *net); 89void nf_conntrack_helper_pernet_fini(struct net *net);
87 90
88extern int nf_conntrack_helper_init(void); 91int nf_conntrack_helper_init(void);
89extern void nf_conntrack_helper_fini(void); 92void nf_conntrack_helper_fini(void);
90 93
91extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 94int nf_conntrack_broadcast_help(struct sk_buff *skb, unsigned int protoff,
92 unsigned int protoff, 95 struct nf_conn *ct,
93 struct nf_conn *ct, 96 enum ip_conntrack_info ctinfo,
94 enum ip_conntrack_info ctinfo, 97 unsigned int timeout);
95 unsigned int timeout);
96 98
97struct nf_ct_helper_expectfn { 99struct nf_ct_helper_expectfn {
98 struct list_head head; 100 struct list_head head;
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 3bb89eac3fa1..3efab704b7eb 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -77,17 +77,17 @@ struct nf_conntrack_l3proto {
77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
78 78
79/* Protocol pernet registration. */ 79/* Protocol pernet registration. */
80extern int nf_ct_l3proto_pernet_register(struct net *net, 80int nf_ct_l3proto_pernet_register(struct net *net,
81 struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_ct_l3proto_pernet_unregister(struct net *net, 82void nf_ct_l3proto_pernet_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto); 83 struct nf_conntrack_l3proto *proto);
84 84
85/* Protocol global registration. */ 85/* Protocol global registration. */
86extern int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto); 86int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
87extern void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto); 87void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
88 88
89extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 89struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
90extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 90void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
91 91
92/* Existing built-in protocols */ 92/* Existing built-in protocols */
93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic; 93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index b411d7b17dec..4c8d573830b7 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -114,22 +114,22 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
114 114
115#define MAX_NF_CT_PROTO 256 115#define MAX_NF_CT_PROTO 256
116 116
117extern struct nf_conntrack_l4proto * 117struct nf_conntrack_l4proto *__nf_ct_l4proto_find(u_int16_t l3proto,
118__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 118 u_int8_t l4proto);
119 119
120extern struct nf_conntrack_l4proto * 120struct nf_conntrack_l4proto *nf_ct_l4proto_find_get(u_int16_t l3proto,
121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); 121 u_int8_t l4proto);
122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
123 123
124/* Protocol pernet registration. */ 124/* Protocol pernet registration. */
125extern int nf_ct_l4proto_pernet_register(struct net *net, 125int nf_ct_l4proto_pernet_register(struct net *net,
126 struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_ct_l4proto_pernet_unregister(struct net *net, 127void nf_ct_l4proto_pernet_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto); 128 struct nf_conntrack_l4proto *proto);
129 129
130/* Protocol global registration. */ 130/* Protocol global registration. */
131extern int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto); 131int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto);
132extern void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto); 132void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto);
133 133
134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn) 134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
135{ 135{
@@ -140,11 +140,11 @@ static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
140} 140}
141 141
142/* Generic netlink helpers */ 142/* Generic netlink helpers */
143extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, 143int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
144 const struct nf_conntrack_tuple *tuple); 144 const struct nf_conntrack_tuple *tuple);
145extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 145int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
146 struct nf_conntrack_tuple *t); 146 struct nf_conntrack_tuple *t);
147extern int nf_ct_port_nlattr_tuple_size(void); 147int nf_ct_port_nlattr_tuple_size(void);
148extern const struct nla_policy nf_ct_port_nla_policy[]; 148extern const struct nla_policy nf_ct_port_nla_policy[];
149 149
150#ifdef CONFIG_SYSCTL 150#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_seqadj.h b/include/net/netfilter/nf_conntrack_seqadj.h
index f6177a5fe0ca..4b3362991a25 100644
--- a/include/net/netfilter/nf_conntrack_seqadj.h
+++ b/include/net/netfilter/nf_conntrack_seqadj.h
@@ -30,22 +30,18 @@ static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)
30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC); 30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC);
31} 31}
32 32
33extern int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 33int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
34 s32 off); 34 s32 off);
35extern int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 35int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
36 __be32 seq, s32 off); 36 __be32 seq, s32 off);
37extern void nf_ct_tcp_seqadj_set(struct sk_buff *skb, 37void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct,
38 struct nf_conn *ct, 38 enum ip_conntrack_info ctinfo, s32 off);
39 enum ip_conntrack_info ctinfo, 39
40 s32 off); 40int nf_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
41 41 enum ip_conntrack_info ctinfo, unsigned int protoff);
42extern int nf_ct_seq_adjust(struct sk_buff *skb, 42s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, u32 seq);
43 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 43
44 unsigned int protoff); 44int nf_conntrack_seqadj_init(void);
45extern s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, 45void nf_conntrack_seqadj_fini(void);
46 u32 seq);
47
48extern int nf_conntrack_seqadj_init(void);
49extern void nf_conntrack_seqadj_fini(void);
50 46
51#endif /* _NF_CONNTRACK_SEQADJ_H */ 47#endif /* _NF_CONNTRACK_SEQADJ_H */
diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h
index 806f54a290d6..6793614e6502 100644
--- a/include/net/netfilter/nf_conntrack_synproxy.h
+++ b/include/net/netfilter/nf_conntrack_synproxy.h
@@ -56,22 +56,20 @@ struct synproxy_options {
56 56
57struct tcphdr; 57struct tcphdr;
58struct xt_synproxy_info; 58struct xt_synproxy_info;
59extern void synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, 59bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
60 const struct tcphdr *th, 60 const struct tcphdr *th,
61 struct synproxy_options *opts); 61 struct synproxy_options *opts);
62extern unsigned int synproxy_options_size(const struct synproxy_options *opts); 62unsigned int synproxy_options_size(const struct synproxy_options *opts);
63extern void synproxy_build_options(struct tcphdr *th, 63void synproxy_build_options(struct tcphdr *th,
64 const struct synproxy_options *opts); 64 const struct synproxy_options *opts);
65 65
66extern void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, 66void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info,
67 struct synproxy_options *opts); 67 struct synproxy_options *opts);
68extern void synproxy_check_timestamp_cookie(struct synproxy_options *opts); 68void synproxy_check_timestamp_cookie(struct synproxy_options *opts);
69 69
70extern unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, 70unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
71 unsigned int protoff, 71 struct tcphdr *th, struct nf_conn *ct,
72 struct tcphdr *th, 72 enum ip_conntrack_info ctinfo,
73 struct nf_conn *ct, 73 const struct nf_conn_synproxy *synproxy);
74 enum ip_conntrack_info ctinfo,
75 const struct nf_conn_synproxy *synproxy);
76 74
77#endif /* _NF_CONNTRACK_SYNPROXY_H */ 75#endif /* _NF_CONNTRACK_SYNPROXY_H */
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index d23aceb16d94..62308713dd7f 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -76,8 +76,8 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
76} 76}
77 77
78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
79extern int nf_conntrack_timeout_init(void); 79int nf_conntrack_timeout_init(void);
80extern void nf_conntrack_timeout_fini(void); 80void nf_conntrack_timeout_fini(void);
81#else 81#else
82static inline int nf_conntrack_timeout_init(void) 82static inline int nf_conntrack_timeout_init(void)
83{ 83{
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
index b00461413efd..300ae2209f25 100644
--- a/include/net/netfilter/nf_conntrack_timestamp.h
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -48,11 +48,11 @@ static inline void nf_ct_set_tstamp(struct net *net, bool enable)
48} 48}
49 49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_pernet_init(struct net *net); 51int nf_conntrack_tstamp_pernet_init(struct net *net);
52extern void nf_conntrack_tstamp_pernet_fini(struct net *net); 52void nf_conntrack_tstamp_pernet_fini(struct net *net);
53 53
54extern int nf_conntrack_tstamp_init(void); 54int nf_conntrack_tstamp_init(void);
55extern void nf_conntrack_tstamp_fini(void); 55void nf_conntrack_tstamp_fini(void);
56#else 56#else
57static inline int nf_conntrack_tstamp_pernet_init(struct net *net) 57static inline int nf_conntrack_tstamp_pernet_init(struct net *net)
58{ 58{
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 59a192420053..07eaaf604092 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -41,13 +41,16 @@ struct nf_conn_nat {
41}; 41};
42 42
43/* Set up the info structure to map into this range. */ 43/* Set up the info structure to map into this range. */
44extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 44unsigned int nf_nat_setup_info(struct nf_conn *ct,
45 const struct nf_nat_range *range, 45 const struct nf_nat_range *range,
46 enum nf_nat_manip_type maniptype); 46 enum nf_nat_manip_type maniptype);
47
48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
49 unsigned int hooknum);
47 50
48/* Is this tuple already taken? (not by us)*/ 51/* Is this tuple already taken? (not by us)*/
49extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 52int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
50 const struct nf_conn *ignored_conntrack); 53 const struct nf_conn *ignored_conntrack);
51 54
52static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) 55static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
53{ 56{
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 972e1e47ec79..fbfd1ba4254e 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -7,12 +7,10 @@
7/* This header used to share core functionality between the standalone 7/* This header used to share core functionality between the standalone
8 NAT module, and the compatibility layer's use of NAT for masquerading. */ 8 NAT module, and the compatibility layer's use of NAT for masquerading. */
9 9
10extern unsigned int nf_nat_packet(struct nf_conn *ct, 10unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
11 enum ip_conntrack_info ctinfo, 11 unsigned int hooknum, struct sk_buff *skb);
12 unsigned int hooknum,
13 struct sk_buff *skb);
14 12
15extern int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family); 13int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family);
16 14
17static inline int nf_nat_initialized(struct nf_conn *ct, 15static inline int nf_nat_initialized(struct nf_conn *ct,
18 enum nf_nat_manip_type manip) 16 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 404324d1d0c4..01bcc6bfbcc9 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,14 +7,11 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
11 struct nf_conn *ct, 11 enum ip_conntrack_info ctinfo,
12 enum ip_conntrack_info ctinfo, 12 unsigned int protoff, unsigned int match_offset,
13 unsigned int protoff, 13 unsigned int match_len, const char *rep_buffer,
14 unsigned int match_offset, 14 unsigned int rep_len, bool adjust);
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len, bool adjust);
18 15
19static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 16static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
20 struct nf_conn *ct, 17 struct nf_conn *ct,
@@ -30,18 +27,14 @@ static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
30 rep_buffer, rep_len, true); 27 rep_buffer, rep_len, true);
31} 28}
32 29
33extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 30int nf_nat_mangle_udp_packet(struct sk_buff *skb, struct nf_conn *ct,
34 struct nf_conn *ct, 31 enum ip_conntrack_info ctinfo,
35 enum ip_conntrack_info ctinfo, 32 unsigned int protoff, unsigned int match_offset,
36 unsigned int protoff, 33 unsigned int match_len, const char *rep_buffer,
37 unsigned int match_offset, 34 unsigned int rep_len);
38 unsigned int match_len,
39 const char *rep_buffer,
40 unsigned int rep_len);
41 35
42/* Setup NAT on this expected conntrack so it follows master, but goes 36/* Setup NAT on this expected conntrack so it follows master, but goes
43 * to port ct->master->saved_proto. */ 37 * to port ct->master->saved_proto. */
44extern void nf_nat_follow_master(struct nf_conn *ct, 38void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this);
45 struct nf_conntrack_expect *this);
46 39
47#endif 40#endif
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index bd3b97e02c82..5a2919b2e09a 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -35,18 +35,15 @@ struct nf_nat_l3proto {
35 struct nf_nat_range *range); 35 struct nf_nat_range *range);
36}; 36};
37 37
38extern int nf_nat_l3proto_register(const struct nf_nat_l3proto *); 38int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39extern void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *); 39void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40extern const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto); 40const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
41 41
42extern int nf_nat_icmp_reply_translation(struct sk_buff *skb, 42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 struct nf_conn *ct, 43 enum ip_conntrack_info ctinfo,
44 enum ip_conntrack_info ctinfo, 44 unsigned int hooknum);
45 unsigned int hooknum); 45int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
46extern int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, 46 enum ip_conntrack_info ctinfo,
47 struct nf_conn *ct, 47 unsigned int hooknum, unsigned int hdrlen);
48 enum ip_conntrack_info ctinfo,
49 unsigned int hooknum,
50 unsigned int hdrlen);
51 48
52#endif /* _NF_NAT_L3PROTO_H */ 49#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
index 24feb68d1bcc..12f4cc841b6e 100644
--- a/include/net/netfilter/nf_nat_l4proto.h
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -42,10 +42,11 @@ struct nf_nat_l4proto {
42}; 42};
43 43
44/* Protocol registration. */ 44/* Protocol registration. */
45extern int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto); 45int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
46extern void nf_nat_l4proto_unregister(u8 l3proto, const struct nf_nat_l4proto *l4proto); 46void nf_nat_l4proto_unregister(u8 l3proto,
47 const struct nf_nat_l4proto *l4proto);
47 48
48extern const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto); 49const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
49 50
50/* Built-in protocols. */ 51/* Built-in protocols. */
51extern const struct nf_nat_l4proto nf_nat_l4proto_tcp; 52extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
@@ -54,19 +55,18 @@ extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6; 55extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
55extern const struct nf_nat_l4proto nf_nat_l4proto_unknown; 56extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
56 57
57extern bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple, 58bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype, 59 enum nf_nat_manip_type maniptype,
59 const union nf_conntrack_man_proto *min, 60 const union nf_conntrack_man_proto *min,
60 const union nf_conntrack_man_proto *max); 61 const union nf_conntrack_man_proto *max);
61 62
62extern void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, 63void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
63 struct nf_conntrack_tuple *tuple, 64 struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range, 65 const struct nf_nat_range *range,
65 enum nf_nat_manip_type maniptype, 66 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct, 67 const struct nf_conn *ct, u16 *rover);
67 u16 *rover);
68 68
69extern int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[], 69int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
70 struct nf_nat_range *range); 70 struct nf_nat_range *range);
71 71
72#endif /*_NF_NAT_L4PROTO_H*/ 72#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index aaba4bbcdda0..c1d5b3e34a21 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -28,7 +28,7 @@ struct nf_queue_handler {
28 28
29void nf_register_queue_handler(const struct nf_queue_handler *qh); 29void nf_register_queue_handler(const struct nf_queue_handler *qh);
30void nf_unregister_queue_handler(void); 30void nf_unregister_queue_handler(void);
31extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 31void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
32 32
33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); 33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry);
34void nf_queue_entry_release_refs(struct nf_queue_entry *entry); 34void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
new file mode 100644
index 000000000000..5a91abfc0c30
--- /dev/null
+++ b/include/net/netfilter/nf_tables.h
@@ -0,0 +1,519 @@
1#ifndef _NET_NF_TABLES_H
2#define _NET_NF_TABLES_H
3
4#include <linux/list.h>
5#include <linux/netfilter.h>
6#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h>
9
10#define NFT_JUMP_STACK_SIZE 16
11
12struct nft_pktinfo {
13 struct sk_buff *skb;
14 const struct net_device *in;
15 const struct net_device *out;
16 u8 hooknum;
17 u8 nhoff;
18 u8 thoff;
19 /* for x_tables compatibility */
20 struct xt_action_param xt;
21};
22
23static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
24 const struct nf_hook_ops *ops,
25 struct sk_buff *skb,
26 const struct net_device *in,
27 const struct net_device *out)
28{
29 pkt->skb = skb;
30 pkt->in = pkt->xt.in = in;
31 pkt->out = pkt->xt.out = out;
32 pkt->hooknum = pkt->xt.hooknum = ops->hooknum;
33 pkt->xt.family = ops->pf;
34}
35
36struct nft_data {
37 union {
38 u32 data[4];
39 struct {
40 u32 verdict;
41 struct nft_chain *chain;
42 };
43 };
44} __attribute__((aligned(__alignof__(u64))));
45
46static inline int nft_data_cmp(const struct nft_data *d1,
47 const struct nft_data *d2,
48 unsigned int len)
49{
50 return memcmp(d1->data, d2->data, len);
51}
52
53static inline void nft_data_copy(struct nft_data *dst,
54 const struct nft_data *src)
55{
56 BUILD_BUG_ON(__alignof__(*dst) != __alignof__(u64));
57 *(u64 *)&dst->data[0] = *(u64 *)&src->data[0];
58 *(u64 *)&dst->data[2] = *(u64 *)&src->data[2];
59}
60
61static inline void nft_data_debug(const struct nft_data *data)
62{
63 pr_debug("data[0]=%x data[1]=%x data[2]=%x data[3]=%x\n",
64 data->data[0], data->data[1],
65 data->data[2], data->data[3]);
66}
67
68/**
69 * struct nft_ctx - nf_tables rule/set context
70 *
71 * @net: net namespace
72 * @skb: netlink skb
73 * @nlh: netlink message header
74 * @afi: address family info
75 * @table: the table the chain is contained in
76 * @chain: the chain the rule is contained in
77 * @nla: netlink attributes
78 */
79struct nft_ctx {
80 struct net *net;
81 const struct sk_buff *skb;
82 const struct nlmsghdr *nlh;
83 const struct nft_af_info *afi;
84 const struct nft_table *table;
85 const struct nft_chain *chain;
86 const struct nlattr * const *nla;
87};
88
89struct nft_data_desc {
90 enum nft_data_types type;
91 unsigned int len;
92};
93
94int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data,
95 struct nft_data_desc *desc, const struct nlattr *nla);
96void nft_data_uninit(const struct nft_data *data, enum nft_data_types type);
97int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
98 enum nft_data_types type, unsigned int len);
99
100static inline enum nft_data_types nft_dreg_to_type(enum nft_registers reg)
101{
102 return reg == NFT_REG_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE;
103}
104
105static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
106{
107 return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1;
108}
109
110int nft_validate_input_register(enum nft_registers reg);
111int nft_validate_output_register(enum nft_registers reg);
112int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg,
113 const struct nft_data *data,
114 enum nft_data_types type);
115
116/**
117 * struct nft_set_elem - generic representation of set elements
118 *
119 * @cookie: implementation specific element cookie
120 * @key: element key
121 * @data: element data (maps only)
122 * @flags: element flags (end of interval)
123 *
124 * The cookie can be used to store a handle to the element for subsequent
125 * removal.
126 */
127struct nft_set_elem {
128 void *cookie;
129 struct nft_data key;
130 struct nft_data data;
131 u32 flags;
132};
133
134struct nft_set;
135struct nft_set_iter {
136 unsigned int count;
137 unsigned int skip;
138 int err;
139 int (*fn)(const struct nft_ctx *ctx,
140 const struct nft_set *set,
141 const struct nft_set_iter *iter,
142 const struct nft_set_elem *elem);
143};
144
145/**
146 * struct nft_set_ops - nf_tables set operations
147 *
148 * @lookup: look up an element within the set
149 * @insert: insert new element into set
150 * @remove: remove element from set
151 * @walk: iterate over all set elemeennts
152 * @privsize: function to return size of set private data
153 * @init: initialize private data of new set instance
154 * @destroy: destroy private data of set instance
155 * @list: nf_tables_set_ops list node
156 * @owner: module reference
157 * @features: features supported by the implementation
158 */
159struct nft_set_ops {
160 bool (*lookup)(const struct nft_set *set,
161 const struct nft_data *key,
162 struct nft_data *data);
163 int (*get)(const struct nft_set *set,
164 struct nft_set_elem *elem);
165 int (*insert)(const struct nft_set *set,
166 const struct nft_set_elem *elem);
167 void (*remove)(const struct nft_set *set,
168 const struct nft_set_elem *elem);
169 void (*walk)(const struct nft_ctx *ctx,
170 const struct nft_set *set,
171 struct nft_set_iter *iter);
172
173 unsigned int (*privsize)(const struct nlattr * const nla[]);
174 int (*init)(const struct nft_set *set,
175 const struct nlattr * const nla[]);
176 void (*destroy)(const struct nft_set *set);
177
178 struct list_head list;
179 struct module *owner;
180 u32 features;
181};
182
183int nft_register_set(struct nft_set_ops *ops);
184void nft_unregister_set(struct nft_set_ops *ops);
185
186/**
187 * struct nft_set - nf_tables set instance
188 *
189 * @list: table set list node
190 * @bindings: list of set bindings
191 * @name: name of the set
192 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
193 * @dtype: data type (verdict or numeric type defined by userspace)
194 * @ops: set ops
195 * @flags: set flags
196 * @klen: key length
197 * @dlen: data length
198 * @data: private set data
199 */
200struct nft_set {
201 struct list_head list;
202 struct list_head bindings;
203 char name[IFNAMSIZ];
204 u32 ktype;
205 u32 dtype;
206 /* runtime data below here */
207 const struct nft_set_ops *ops ____cacheline_aligned;
208 u16 flags;
209 u8 klen;
210 u8 dlen;
211 unsigned char data[]
212 __attribute__((aligned(__alignof__(u64))));
213};
214
215static inline void *nft_set_priv(const struct nft_set *set)
216{
217 return (void *)set->data;
218}
219
220struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
221 const struct nlattr *nla);
222
223/**
224 * struct nft_set_binding - nf_tables set binding
225 *
226 * @list: set bindings list node
227 * @chain: chain containing the rule bound to the set
228 *
229 * A set binding contains all information necessary for validation
230 * of new elements added to a bound set.
231 */
232struct nft_set_binding {
233 struct list_head list;
234 const struct nft_chain *chain;
235};
236
237int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
238 struct nft_set_binding *binding);
239void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
240 struct nft_set_binding *binding);
241
242
243/**
244 * struct nft_expr_type - nf_tables expression type
245 *
246 * @select_ops: function to select nft_expr_ops
247 * @ops: default ops, used when no select_ops functions is present
248 * @list: used internally
249 * @name: Identifier
250 * @owner: module reference
251 * @policy: netlink attribute policy
252 * @maxattr: highest netlink attribute number
253 */
254struct nft_expr_type {
255 const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *,
256 const struct nlattr * const tb[]);
257 const struct nft_expr_ops *ops;
258 struct list_head list;
259 const char *name;
260 struct module *owner;
261 const struct nla_policy *policy;
262 unsigned int maxattr;
263};
264
265/**
266 * struct nft_expr_ops - nf_tables expression operations
267 *
268 * @eval: Expression evaluation function
269 * @size: full expression size, including private data size
270 * @init: initialization function
271 * @destroy: destruction function
272 * @dump: function to dump parameters
273 * @type: expression type
274 * @validate: validate expression, called during loop detection
275 * @data: extra data to attach to this expression operation
276 */
277struct nft_expr;
278struct nft_expr_ops {
279 void (*eval)(const struct nft_expr *expr,
280 struct nft_data data[NFT_REG_MAX + 1],
281 const struct nft_pktinfo *pkt);
282 unsigned int size;
283
284 int (*init)(const struct nft_ctx *ctx,
285 const struct nft_expr *expr,
286 const struct nlattr * const tb[]);
287 void (*destroy)(const struct nft_expr *expr);
288 int (*dump)(struct sk_buff *skb,
289 const struct nft_expr *expr);
290 int (*validate)(const struct nft_ctx *ctx,
291 const struct nft_expr *expr,
292 const struct nft_data **data);
293 const struct nft_expr_type *type;
294 void *data;
295};
296
297#define NFT_EXPR_MAXATTR 16
298#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
299 ALIGN(size, __alignof__(struct nft_expr)))
300
301/**
302 * struct nft_expr - nf_tables expression
303 *
304 * @ops: expression ops
305 * @data: expression private data
306 */
307struct nft_expr {
308 const struct nft_expr_ops *ops;
309 unsigned char data[];
310};
311
312static inline void *nft_expr_priv(const struct nft_expr *expr)
313{
314 return (void *)expr->data;
315}
316
317/**
318 * struct nft_rule - nf_tables rule
319 *
320 * @list: used internally
321 * @rcu_head: used internally for rcu
322 * @handle: rule handle
323 * @genmask: generation mask
324 * @dlen: length of expression data
325 * @data: expression data
326 */
327struct nft_rule {
328 struct list_head list;
329 struct rcu_head rcu_head;
330 u64 handle:46,
331 genmask:2,
332 dlen:16;
333 unsigned char data[]
334 __attribute__((aligned(__alignof__(struct nft_expr))));
335};
336
337/**
338 * struct nft_rule_trans - nf_tables rule update in transaction
339 *
340 * @list: used internally
341 * @rule: rule that needs to be updated
342 * @chain: chain that this rule belongs to
343 * @table: table for which this chain applies
344 * @nlh: netlink header of the message that contain this update
345 * @family: family expressesed as AF_*
346 */
347struct nft_rule_trans {
348 struct list_head list;
349 struct nft_rule *rule;
350 const struct nft_chain *chain;
351 const struct nft_table *table;
352 const struct nlmsghdr *nlh;
353 u8 family;
354};
355
356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
357{
358 return (struct nft_expr *)&rule->data[0];
359}
360
361static inline struct nft_expr *nft_expr_next(const struct nft_expr *expr)
362{
363 return ((void *)expr) + expr->ops->size;
364}
365
366static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
367{
368 return (struct nft_expr *)&rule->data[rule->dlen];
369}
370
371/*
372 * The last pointer isn't really necessary, but the compiler isn't able to
373 * determine that the result of nft_expr_last() is always the same since it
374 * can't assume that the dlen value wasn't changed within calls in the loop.
375 */
376#define nft_rule_for_each_expr(expr, last, rule) \
377 for ((expr) = nft_expr_first(rule), (last) = nft_expr_last(rule); \
378 (expr) != (last); \
379 (expr) = nft_expr_next(expr))
380
381enum nft_chain_flags {
382 NFT_BASE_CHAIN = 0x1,
383};
384
385/**
386 * struct nft_chain - nf_tables chain
387 *
388 * @rules: list of rules in the chain
389 * @list: used internally
390 * @rcu_head: used internally
391 * @net: net namespace that this chain belongs to
392 * @table: table that this chain belongs to
393 * @handle: chain handle
394 * @flags: bitmask of enum nft_chain_flags
395 * @use: number of jump references to this chain
396 * @level: length of longest path to this chain
397 * @name: name of the chain
398 */
399struct nft_chain {
400 struct list_head rules;
401 struct list_head list;
402 struct rcu_head rcu_head;
403 struct net *net;
404 struct nft_table *table;
405 u64 handle;
406 u8 flags;
407 u16 use;
408 u16 level;
409 char name[NFT_CHAIN_MAXNAMELEN];
410};
411
412enum nft_chain_type {
413 NFT_CHAIN_T_DEFAULT = 0,
414 NFT_CHAIN_T_ROUTE,
415 NFT_CHAIN_T_NAT,
416 NFT_CHAIN_T_MAX
417};
418
419struct nft_stats {
420 u64 bytes;
421 u64 pkts;
422};
423
424/**
425 * struct nft_base_chain - nf_tables base chain
426 *
427 * @ops: netfilter hook ops
428 * @type: chain type
429 * @policy: default policy
430 * @stats: per-cpu chain stats
431 * @chain: the chain
432 */
433struct nft_base_chain {
434 struct nf_hook_ops ops;
435 enum nft_chain_type type;
436 u8 policy;
437 struct nft_stats __percpu *stats;
438 struct nft_chain chain;
439};
440
441static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain)
442{
443 return container_of(chain, struct nft_base_chain, chain);
444}
445
446unsigned int nft_do_chain_pktinfo(struct nft_pktinfo *pkt,
447 const struct nf_hook_ops *ops);
448
449/**
450 * struct nft_table - nf_tables table
451 *
452 * @list: used internally
453 * @chains: chains in the table
454 * @sets: sets in the table
455 * @hgenerator: handle generator state
456 * @use: number of chain references to this table
457 * @flags: table flag (see enum nft_table_flags)
458 * @name: name of the table
459 */
460struct nft_table {
461 struct list_head list;
462 struct list_head chains;
463 struct list_head sets;
464 u64 hgenerator;
465 u32 use;
466 u16 flags;
467 char name[];
468};
469
470/**
471 * struct nft_af_info - nf_tables address family info
472 *
473 * @list: used internally
474 * @family: address family
475 * @nhooks: number of hooks in this family
476 * @owner: module owner
477 * @tables: used internally
478 * @hooks: hookfn overrides for packet validation
479 */
480struct nft_af_info {
481 struct list_head list;
482 int family;
483 unsigned int nhooks;
484 struct module *owner;
485 struct list_head tables;
486 nf_hookfn *hooks[NF_MAX_HOOKS];
487};
488
489int nft_register_afinfo(struct net *, struct nft_af_info *);
490void nft_unregister_afinfo(struct nft_af_info *);
491
492struct nf_chain_type {
493 unsigned int hook_mask;
494 const char *name;
495 enum nft_chain_type type;
496 nf_hookfn *fn[NF_MAX_HOOKS];
497 struct module *me;
498 int family;
499};
500
501int nft_register_chain_type(struct nf_chain_type *);
502void nft_unregister_chain_type(struct nf_chain_type *);
503
504int nft_register_expr(struct nft_expr_type *);
505void nft_unregister_expr(struct nft_expr_type *);
506
507#define MODULE_ALIAS_NFT_FAMILY(family) \
508 MODULE_ALIAS("nft-afinfo-" __stringify(family))
509
510#define MODULE_ALIAS_NFT_CHAIN(family, name) \
511 MODULE_ALIAS("nft-chain-" __stringify(family) "-" name)
512
513#define MODULE_ALIAS_NFT_EXPR(name) \
514 MODULE_ALIAS("nft-expr-" name)
515
516#define MODULE_ALIAS_NFT_SET() \
517 MODULE_ALIAS("nft-set")
518
519#endif /* _NET_NF_TABLES_H */
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
new file mode 100644
index 000000000000..cf2b7ae2b9d8
--- /dev/null
+++ b/include/net/netfilter/nf_tables_core.h
@@ -0,0 +1,42 @@
1#ifndef _NET_NF_TABLES_CORE_H
2#define _NET_NF_TABLES_CORE_H
3
4int nf_tables_core_module_init(void);
5void nf_tables_core_module_exit(void);
6
7int nft_immediate_module_init(void);
8void nft_immediate_module_exit(void);
9
10struct nft_cmp_fast_expr {
11 u32 data;
12 enum nft_registers sreg:8;
13 u8 len;
14};
15
16extern const struct nft_expr_ops nft_cmp_fast_ops;
17
18int nft_cmp_module_init(void);
19void nft_cmp_module_exit(void);
20
21int nft_lookup_module_init(void);
22void nft_lookup_module_exit(void);
23
24int nft_bitwise_module_init(void);
25void nft_bitwise_module_exit(void);
26
27int nft_byteorder_module_init(void);
28void nft_byteorder_module_exit(void);
29
30struct nft_payload {
31 enum nft_payload_bases base:8;
32 u8 offset;
33 u8 len;
34 enum nft_registers dreg:8;
35};
36
37extern const struct nft_expr_ops nft_payload_fast_ops;
38
39int nft_payload_module_init(void);
40void nft_payload_module_exit(void);
41
42#endif /* _NET_NF_TABLES_CORE_H */
diff --git a/include/net/netfilter/nf_tables_ipv4.h b/include/net/netfilter/nf_tables_ipv4.h
new file mode 100644
index 000000000000..1be1c2c197ee
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv4.h
@@ -0,0 +1,23 @@
1#ifndef _NF_TABLES_IPV4_H_
2#define _NF_TABLES_IPV4_H_
3
4#include <net/netfilter/nf_tables.h>
5#include <net/ip.h>
6
7static inline void
8nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 struct iphdr *ip;
15
16 nft_set_pktinfo(pkt, ops, skb, in, out);
17
18 pkt->xt.thoff = ip_hdrlen(pkt->skb);
19 ip = ip_hdr(pkt->skb);
20 pkt->xt.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
21}
22
23#endif
diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
new file mode 100644
index 000000000000..4a9b88a65963
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv6.h
@@ -0,0 +1,30 @@
1#ifndef _NF_TABLES_IPV6_H_
2#define _NF_TABLES_IPV6_H_
3
4#include <linux/netfilter_ipv6/ip6_tables.h>
5#include <net/ipv6.h>
6
7static inline int
8nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 int protohdr, thoff = 0;
15 unsigned short frag_off;
16
17 nft_set_pktinfo(pkt, ops, skb, in, out);
18
19 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
20 /* If malformed, drop it */
21 if (protohdr < 0)
22 return -1;
23
24 pkt->xt.thoff = thoff;
25 pkt->xt.fragoff = frag_off;
26
27 return 0;
28}
29
30#endif
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 495c71f66e7e..79f45e19f31e 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -16,7 +16,7 @@ struct xt_rateest {
16 struct rcu_head rcu; 16 struct rcu_head rcu;
17}; 17};
18 18
19extern struct xt_rateest *xt_rateest_lookup(const char *name); 19struct xt_rateest *xt_rateest_lookup(const char *name);
20extern void xt_rateest_put(struct xt_rateest *est); 20void xt_rateest_put(struct xt_rateest *est);
21 21
22#endif /* _XT_RATEEST_H */ 22#endif /* _XT_RATEEST_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 9690b0f6698a..2b47eaadba8f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -225,44 +225,31 @@ struct nl_info {
225 u32 portid; 225 u32 portid;
226}; 226};
227 227
228extern int netlink_rcv_skb(struct sk_buff *skb, 228int netlink_rcv_skb(struct sk_buff *skb,
229 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *, struct nlmsghdr *));
230 struct nlmsghdr *)); 230int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231 unsigned int group, int report, gfp_t flags);
232 u32 portid, unsigned int group, int report, 232
233 gfp_t flags); 233int nla_validate(const struct nlattr *head, int len, int maxtype,
234 234 const struct nla_policy *policy);
235extern int nla_validate(const struct nlattr *head, 235int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
236 int len, int maxtype, 236 int len, const struct nla_policy *policy);
237 const struct nla_policy *policy); 237int nla_policy_len(const struct nla_policy *, int);
238extern int nla_parse(struct nlattr **tb, int maxtype, 238struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype);
239 const struct nlattr *head, int len, 239size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize);
240 const struct nla_policy *policy); 240int nla_memcpy(void *dest, const struct nlattr *src, int count);
241extern int nla_policy_len(const struct nla_policy *, int); 241int nla_memcmp(const struct nlattr *nla, const void *data, size_t size);
242extern struct nlattr * nla_find(const struct nlattr *head, 242int nla_strcmp(const struct nlattr *nla, const char *str);
243 int len, int attrtype); 243struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
244extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 244void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
245 size_t dstsize); 245struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
246extern int nla_memcpy(void *dest, const struct nlattr *src, int count); 246void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
247extern int nla_memcmp(const struct nlattr *nla, const void *data, 247void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
248 size_t size); 248 const void *data);
249extern int nla_strcmp(const struct nlattr *nla, const char *str); 249void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
250extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, 250int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
251 int attrlen); 251int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
252extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen); 252int nla_append(struct sk_buff *skb, int attrlen, const void *data);
253extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype,
254 int attrlen);
255extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
256extern void __nla_put(struct sk_buff *skb, int attrtype,
257 int attrlen, const void *data);
258extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen,
259 const void *data);
260extern int nla_put(struct sk_buff *skb, int attrtype,
261 int attrlen, const void *data);
262extern int nla_put_nohdr(struct sk_buff *skb, int attrlen,
263 const void *data);
264extern int nla_append(struct sk_buff *skb, int attrlen,
265 const void *data);
266 253
267/************************************************************************** 254/**************************************************************************
268 * Netlink Messages 255 * Netlink Messages
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index bf2ec2202c56..ee520cba2ec2 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -15,6 +15,10 @@ struct fib_rules_ops;
15struct hlist_head; 15struct hlist_head;
16struct fib_table; 16struct fib_table;
17struct sock; 17struct sock;
18struct local_ports {
19 seqlock_t lock;
20 int range[2];
21};
18 22
19struct netns_ipv4 { 23struct netns_ipv4 {
20#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
@@ -62,10 +66,11 @@ struct netns_ipv4 {
62 int sysctl_icmp_ratemask; 66 int sysctl_icmp_ratemask;
63 int sysctl_icmp_errors_use_inbound_ifaddr; 67 int sysctl_icmp_errors_use_inbound_ifaddr;
64 68
69 struct local_ports sysctl_local_ports;
70
65 int sysctl_tcp_ecn; 71 int sysctl_tcp_ecn;
66 72
67 kgid_t sysctl_ping_group_range[2]; 73 kgid_t sysctl_ping_group_range[2];
68 long sysctl_tcp_mem[3];
69 74
70 atomic_t dev_addr_genid; 75 atomic_t dev_addr_genid;
71 76
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
new file mode 100644
index 000000000000..15d056d534e3
--- /dev/null
+++ b/include/net/netns/nftables.h
@@ -0,0 +1,19 @@
1#ifndef _NETNS_NFTABLES_H_
2#define _NETNS_NFTABLES_H_
3
4#include <linux/list.h>
5
6struct nft_af_info;
7
8struct netns_nftables {
9 struct list_head af_info;
10 struct list_head commit_list;
11 struct nft_af_info *ipv4;
12 struct nft_af_info *ipv6;
13 struct nft_af_info *arp;
14 struct nft_af_info *bridge;
15 u8 gencursor;
16 u8 genctr;
17};
18
19#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 121dcf854db5..110350aca3df 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -183,51 +183,50 @@ extern int sysctl_netrom_routing_control;
183extern int sysctl_netrom_link_fails_count; 183extern int sysctl_netrom_link_fails_count;
184extern int sysctl_netrom_reset_circuit; 184extern int sysctl_netrom_reset_circuit;
185 185
186extern int nr_rx_frame(struct sk_buff *, struct net_device *); 186int nr_rx_frame(struct sk_buff *, struct net_device *);
187extern void nr_destroy_socket(struct sock *); 187void nr_destroy_socket(struct sock *);
188 188
189/* nr_dev.c */ 189/* nr_dev.c */
190extern int nr_rx_ip(struct sk_buff *, struct net_device *); 190int nr_rx_ip(struct sk_buff *, struct net_device *);
191extern void nr_setup(struct net_device *); 191void nr_setup(struct net_device *);
192 192
193/* nr_in.c */ 193/* nr_in.c */
194extern int nr_process_rx_frame(struct sock *, struct sk_buff *); 194int nr_process_rx_frame(struct sock *, struct sk_buff *);
195 195
196/* nr_loopback.c */ 196/* nr_loopback.c */
197extern void nr_loopback_init(void); 197void nr_loopback_init(void);
198extern void nr_loopback_clear(void); 198void nr_loopback_clear(void);
199extern int nr_loopback_queue(struct sk_buff *); 199int nr_loopback_queue(struct sk_buff *);
200 200
201/* nr_out.c */ 201/* nr_out.c */
202extern void nr_output(struct sock *, struct sk_buff *); 202void nr_output(struct sock *, struct sk_buff *);
203extern void nr_send_nak_frame(struct sock *); 203void nr_send_nak_frame(struct sock *);
204extern void nr_kick(struct sock *); 204void nr_kick(struct sock *);
205extern void nr_transmit_buffer(struct sock *, struct sk_buff *); 205void nr_transmit_buffer(struct sock *, struct sk_buff *);
206extern void nr_establish_data_link(struct sock *); 206void nr_establish_data_link(struct sock *);
207extern void nr_enquiry_response(struct sock *); 207void nr_enquiry_response(struct sock *);
208extern void nr_check_iframes_acked(struct sock *, unsigned short); 208void nr_check_iframes_acked(struct sock *, unsigned short);
209 209
210/* nr_route.c */ 210/* nr_route.c */
211extern void nr_rt_device_down(struct net_device *); 211void nr_rt_device_down(struct net_device *);
212extern struct net_device *nr_dev_first(void); 212struct net_device *nr_dev_first(void);
213extern struct net_device *nr_dev_get(ax25_address *); 213struct net_device *nr_dev_get(ax25_address *);
214extern int nr_rt_ioctl(unsigned int, void __user *); 214int nr_rt_ioctl(unsigned int, void __user *);
215extern void nr_link_failed(ax25_cb *, int); 215void nr_link_failed(ax25_cb *, int);
216extern int nr_route_frame(struct sk_buff *, ax25_cb *); 216int nr_route_frame(struct sk_buff *, ax25_cb *);
217extern const struct file_operations nr_nodes_fops; 217extern const struct file_operations nr_nodes_fops;
218extern const struct file_operations nr_neigh_fops; 218extern const struct file_operations nr_neigh_fops;
219extern void nr_rt_free(void); 219void nr_rt_free(void);
220 220
221/* nr_subr.c */ 221/* nr_subr.c */
222extern void nr_clear_queues(struct sock *); 222void nr_clear_queues(struct sock *);
223extern void nr_frames_acked(struct sock *, unsigned short); 223void nr_frames_acked(struct sock *, unsigned short);
224extern void nr_requeue_frames(struct sock *); 224void nr_requeue_frames(struct sock *);
225extern int nr_validate_nr(struct sock *, unsigned short); 225int nr_validate_nr(struct sock *, unsigned short);
226extern int nr_in_rx_window(struct sock *, unsigned short); 226int nr_in_rx_window(struct sock *, unsigned short);
227extern void nr_write_internal(struct sock *, int); 227void nr_write_internal(struct sock *, int);
228 228
229extern void __nr_transmit_reply(struct sk_buff *skb, int mine, 229void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags);
230 unsigned char cmdflags);
231 230
232/* 231/*
233 * This routine is called when a Connect Acknowledge with the Choke Flag 232 * This routine is called when a Connect Acknowledge with the Choke Flag
@@ -247,24 +246,24 @@ do { \
247 __nr_transmit_reply((skb), (mine), NR_RESET); \ 246 __nr_transmit_reply((skb), (mine), NR_RESET); \
248} while (0) 247} while (0)
249 248
250extern void nr_disconnect(struct sock *, int); 249void nr_disconnect(struct sock *, int);
251 250
252/* nr_timer.c */ 251/* nr_timer.c */
253extern void nr_init_timers(struct sock *sk); 252void nr_init_timers(struct sock *sk);
254extern void nr_start_heartbeat(struct sock *); 253void nr_start_heartbeat(struct sock *);
255extern void nr_start_t1timer(struct sock *); 254void nr_start_t1timer(struct sock *);
256extern void nr_start_t2timer(struct sock *); 255void nr_start_t2timer(struct sock *);
257extern void nr_start_t4timer(struct sock *); 256void nr_start_t4timer(struct sock *);
258extern void nr_start_idletimer(struct sock *); 257void nr_start_idletimer(struct sock *);
259extern void nr_stop_heartbeat(struct sock *); 258void nr_stop_heartbeat(struct sock *);
260extern void nr_stop_t1timer(struct sock *); 259void nr_stop_t1timer(struct sock *);
261extern void nr_stop_t2timer(struct sock *); 260void nr_stop_t2timer(struct sock *);
262extern void nr_stop_t4timer(struct sock *); 261void nr_stop_t4timer(struct sock *);
263extern void nr_stop_idletimer(struct sock *); 262void nr_stop_idletimer(struct sock *);
264extern int nr_t1timer_running(struct sock *); 263int nr_t1timer_running(struct sock *);
265 264
266/* sysctl_net_netrom.c */ 265/* sysctl_net_netrom.c */
267extern void nr_register_sysctl(void); 266void nr_register_sysctl(void);
268extern void nr_unregister_sysctl(void); 267void nr_unregister_sysctl(void);
269 268
270#endif 269#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
new file mode 100644
index 000000000000..36acecd5f06c
--- /dev/null
+++ b/include/net/nfc/digital.h
@@ -0,0 +1,227 @@
1/*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __NFC_DIGITAL_H
17#define __NFC_DIGITAL_H
18
19#include <linux/skbuff.h>
20#include <net/nfc/nfc.h>
21
22/**
23 * Configuration types for in_configure_hw and tg_configure_hw.
24 */
25enum {
26 NFC_DIGITAL_CONFIG_RF_TECH = 0,
27 NFC_DIGITAL_CONFIG_FRAMING,
28};
29
30/**
31 * RF technology values passed as param argument to in_configure_hw and
32 * tg_configure_hw for NFC_DIGITAL_CONFIG_RF_TECH configuration type.
33 */
34enum {
35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F,
38
39 NFC_DIGITAL_RF_TECH_LAST,
40};
41
42/**
43 * Framing configuration passed as param argument to in_configure_hw and
44 * tg_configure_hw for NFC_DIGITAL_CONFIG_FRAMING configuration type.
45 */
46enum {
47 NFC_DIGITAL_FRAMING_NFCA_SHORT = 0,
48 NFC_DIGITAL_FRAMING_NFCA_STANDARD,
49 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A,
50
51 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54
55 NFC_DIGITAL_FRAMING_NFCF,
56 NFC_DIGITAL_FRAMING_NFCF_T3T,
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59
60 NFC_DIGITAL_FRAMING_LAST,
61};
62
63#define DIGITAL_MDAA_NFCID1_SIZE 3
64
65struct digital_tg_mdaa_params {
66 u16 sens_res;
67 u8 nfcid1[DIGITAL_MDAA_NFCID1_SIZE];
68 u8 sel_res;
69
70 u8 nfcid2[NFC_NFCID2_MAXSIZE];
71 u16 sc;
72};
73
74struct nfc_digital_dev;
75
76/**
77 * nfc_digital_cmd_complete_t - Definition of command result callback
78 *
79 * @ddev: nfc_digital_device ref
80 * @arg: user data
81 * @resp: response data
82 *
83 * resp pointer can be an error code and will be checked with IS_ERR() macro.
84 * The callback is responsible for freeing resp sk_buff.
85 */
86typedef void (*nfc_digital_cmd_complete_t)(struct nfc_digital_dev *ddev,
87 void *arg, struct sk_buff *resp);
88
89/**
90 * Device side NFC Digital operations
91 *
92 * Initiator mode:
93 * @in_configure_hw: Hardware configuration for RF technology and communication
94 * framing in initiator mode. This is a synchronous function.
95 * @in_send_cmd: Initiator mode data exchange using RF technology and framing
96 * previously set with in_configure_hw. The peer response is returned
97 * through callback cb. If an io error occurs or the peer didn't reply
98 * within the specified timeout (ms), the error code is passed back through
99 * the resp pointer. This is an asynchronous function.
100 *
101 * Target mode: Only NFC-DEP protocol is supported in target mode.
102 * @tg_configure_hw: Hardware configuration for RF technology and communication
103 * framing in target mode. This is a synchronous function.
104 * @tg_send_cmd: Target mode data exchange using RF technology and framing
105 * previously set with tg_configure_hw. The peer next command is returned
106 * through callback cb. If an io error occurs or the peer didn't reply
107 * within the specified timeout (ms), the error code is passed back through
108 * the resp pointer. This is an asynchronous function.
109 * @tg_listen: Put the device in listen mode waiting for data from the peer
110 * device. This is an asynchronous function.
111 * @tg_listen_mdaa: If supported, put the device in automatic listen mode with
112 * mode detection and automatic anti-collision. In this mode, the device
113 * automatically detects the RF technology and executes the anti-collision
114 * detection using the command responses specified in mdaa_params. The
115 * mdaa_params structure contains SENS_RES, NFCID1, and SEL_RES for 106A RF
116 * tech. NFCID2 and system code (sc) for 212F and 424F. The driver returns
117 * the NFC-DEP ATR_REQ command through cb. The digital stack deducts the RF
118 * tech by analyzing the SoD of the frame containing the ATR_REQ command.
119 * This is an asynchronous function.
120 *
121 * @switch_rf: Turns device radio on or off. The stack does not call explicitly
122 * switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
123 * the device radio on.
124 * @abort_cmd: Discard the last sent command.
125 */
126struct nfc_digital_ops {
127 int (*in_configure_hw)(struct nfc_digital_dev *ddev, int type,
128 int param);
129 int (*in_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
130 u16 timeout, nfc_digital_cmd_complete_t cb,
131 void *arg);
132
133 int (*tg_configure_hw)(struct nfc_digital_dev *ddev, int type,
134 int param);
135 int (*tg_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
136 u16 timeout, nfc_digital_cmd_complete_t cb,
137 void *arg);
138 int (*tg_listen)(struct nfc_digital_dev *ddev, u16 timeout,
139 nfc_digital_cmd_complete_t cb, void *arg);
140 int (*tg_listen_mdaa)(struct nfc_digital_dev *ddev,
141 struct digital_tg_mdaa_params *mdaa_params,
142 u16 timeout, nfc_digital_cmd_complete_t cb,
143 void *arg);
144
145 int (*switch_rf)(struct nfc_digital_dev *ddev, bool on);
146 void (*abort_cmd)(struct nfc_digital_dev *ddev);
147};
148
149#define NFC_DIGITAL_POLL_MODE_COUNT_MAX 6 /* 106A, 212F, and 424F in & tg */
150
151typedef int (*digital_poll_t)(struct nfc_digital_dev *ddev, u8 rf_tech);
152
153struct digital_poll_tech {
154 u8 rf_tech;
155 digital_poll_t poll_func;
156};
157
158/**
159 * Driver capabilities - bit mask made of the following values
160 *
161 * @NFC_DIGITAL_DRV_CAPS_IN_CRC: The driver handles CRC calculation in initiator
162 * mode.
163 * @NFC_DIGITAL_DRV_CAPS_TG_CRC: The driver handles CRC calculation in target
164 * mode.
165 */
166#define NFC_DIGITAL_DRV_CAPS_IN_CRC 0x0001
167#define NFC_DIGITAL_DRV_CAPS_TG_CRC 0x0002
168
169struct nfc_digital_dev {
170 struct nfc_dev *nfc_dev;
171 struct nfc_digital_ops *ops;
172
173 u32 protocols;
174
175 int tx_headroom;
176 int tx_tailroom;
177
178 u32 driver_capabilities;
179 void *driver_data;
180
181 struct digital_poll_tech poll_techs[NFC_DIGITAL_POLL_MODE_COUNT_MAX];
182 u8 poll_tech_count;
183 u8 poll_tech_index;
184 struct mutex poll_lock;
185
186 struct work_struct cmd_work;
187 struct work_struct cmd_complete_work;
188 struct list_head cmd_queue;
189 struct mutex cmd_lock;
190
191 struct work_struct poll_work;
192
193 u8 curr_protocol;
194 u8 curr_rf_tech;
195 u8 curr_nfc_dep_pni;
196
197 int (*skb_check_crc)(struct sk_buff *skb);
198 void (*skb_add_crc)(struct sk_buff *skb);
199};
200
201struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
202 __u32 supported_protocols,
203 __u32 driver_capabilities,
204 int tx_headroom,
205 int tx_tailroom);
206void nfc_digital_free_device(struct nfc_digital_dev *ndev);
207int nfc_digital_register_device(struct nfc_digital_dev *ndev);
208void nfc_digital_unregister_device(struct nfc_digital_dev *ndev);
209
210static inline void nfc_digital_set_parent_dev(struct nfc_digital_dev *ndev,
211 struct device *dev)
212{
213 nfc_set_parent_dev(ndev->nfc_dev, dev);
214}
215
216static inline void nfc_digital_set_drvdata(struct nfc_digital_dev *dev,
217 void *data)
218{
219 dev->driver_data = data;
220}
221
222static inline void *nfc_digital_get_drvdata(struct nfc_digital_dev *dev)
223{
224 return dev->driver_data;
225}
226
227#endif /* __NFC_DIGITAL_H */
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b64b7bce4b94..2eca2960ca9c 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -24,12 +24,6 @@
24 24
25#include <net/nfc/nfc.h> 25#include <net/nfc/nfc.h>
26 26
27struct nfc_phy_ops {
28 int (*write)(void *dev_id, struct sk_buff *skb);
29 int (*enable)(void *dev_id);
30 void (*disable)(void *dev_id);
31};
32
33struct nfc_hci_dev; 27struct nfc_hci_dev;
34 28
35struct nfc_hci_ops { 29struct nfc_hci_ops {
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 88785e5c6b2c..e5aa5acafea0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -166,6 +166,10 @@
166#define NCI_GID_NFCEE_MGMT 0x2 166#define NCI_GID_NFCEE_MGMT 0x2
167#define NCI_GID_PROPRIETARY 0xf 167#define NCI_GID_PROPRIETARY 0xf
168 168
169/* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */
170#define NCI_SPI_HDR_LEN 4
171#define NCI_SPI_CRC_LEN 2
172
169/* ---- NCI Packet structures ---- */ 173/* ---- NCI Packet structures ---- */
170#define NCI_CTRL_HDR_SIZE 3 174#define NCI_CTRL_HDR_SIZE 3
171#define NCI_DATA_HDR_SIZE 3 175#define NCI_DATA_HDR_SIZE 3
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 99fc1f3a392a..6126f1f992b4 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -207,19 +207,9 @@ int nci_to_errno(__u8 code);
207#define NCI_SPI_CRC_ENABLED 0x01 207#define NCI_SPI_CRC_ENABLED 0x01
208 208
209/* ----- NCI SPI structures ----- */ 209/* ----- NCI SPI structures ----- */
210struct nci_spi_dev; 210struct nci_spi {
211 211 struct nci_dev *ndev;
212struct nci_spi_ops {
213 int (*open)(struct nci_spi_dev *ndev);
214 int (*close)(struct nci_spi_dev *ndev);
215 void (*assert_int)(struct nci_spi_dev *ndev);
216 void (*deassert_int)(struct nci_spi_dev *ndev);
217};
218
219struct nci_spi_dev {
220 struct nci_dev *nci_dev;
221 struct spi_device *spi; 212 struct spi_device *spi;
222 struct nci_spi_ops *ops;
223 213
224 unsigned int xfer_udelay; /* microseconds delay between 214 unsigned int xfer_udelay; /* microseconds delay between
225 transactions */ 215 transactions */
@@ -227,31 +217,15 @@ struct nci_spi_dev {
227 217
228 struct completion req_completion; 218 struct completion req_completion;
229 u8 req_result; 219 u8 req_result;
230
231 void *driver_data;
232}; 220};
233 221
234/* ----- NCI SPI Devices ----- */ 222/* ----- NCI SPI ----- */
235struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi, 223struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
236 struct nci_spi_ops *ops, 224 u8 acknowledge_mode, unsigned int delay,
237 u32 supported_protocols, 225 struct nci_dev *ndev);
238 u32 supported_se, 226int nci_spi_send(struct nci_spi *nspi,
239 u8 acknowledge_mode, 227 struct completion *write_handshake_completion,
240 unsigned int delay); 228 struct sk_buff *skb);
241void nci_spi_free_device(struct nci_spi_dev *ndev); 229struct sk_buff *nci_spi_read(struct nci_spi *nspi);
242int nci_spi_register_device(struct nci_spi_dev *ndev);
243void nci_spi_unregister_device(struct nci_spi_dev *ndev);
244int nci_spi_recv_frame(struct nci_spi_dev *ndev);
245
246static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
247 void *data)
248{
249 ndev->driver_data = data;
250}
251
252static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
253{
254 return ndev->driver_data;
255}
256 230
257#endif /* __NCI_CORE_H */ 231#endif /* __NCI_CORE_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index f68ee68e4e3e..82fc4e43fc6e 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -28,9 +28,14 @@
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30 30
31#define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg) 31#define nfc_info(dev, fmt, ...) dev_info((dev), "NFC: " fmt, ##__VA_ARGS__)
32#define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg) 32#define nfc_err(dev, fmt, ...) dev_err((dev), "NFC: " fmt, ##__VA_ARGS__)
33#define nfc_dev_dbg(dev, fmt, arg...) dev_dbg((dev), fmt "\n", ## arg) 33
34struct nfc_phy_ops {
35 int (*write)(void *dev_id, struct sk_buff *skb);
36 int (*enable)(void *dev_id);
37 void (*disable)(void *dev_id);
38};
34 39
35struct nfc_dev; 40struct nfc_dev;
36 41
@@ -48,6 +53,8 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 53typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 54 int err);
50 55
56typedef void (*se_io_cb_t)(void *context, u8 *apdu, size_t apdu_len, int err);
57
51struct nfc_target; 58struct nfc_target;
52 59
53struct nfc_ops { 60struct nfc_ops {
@@ -74,12 +81,23 @@ struct nfc_ops {
74 int (*discover_se)(struct nfc_dev *dev); 81 int (*discover_se)(struct nfc_dev *dev);
75 int (*enable_se)(struct nfc_dev *dev, u32 se_idx); 82 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
76 int (*disable_se)(struct nfc_dev *dev, u32 se_idx); 83 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
84 int (*se_io) (struct nfc_dev *dev, u32 se_idx,
85 u8 *apdu, size_t apdu_length,
86 se_io_cb_t cb, void *cb_context);
77}; 87};
78 88
79#define NFC_TARGET_IDX_ANY -1 89#define NFC_TARGET_IDX_ANY -1
80#define NFC_MAX_GT_LEN 48 90#define NFC_MAX_GT_LEN 48
81#define NFC_ATR_RES_GT_OFFSET 15 91#define NFC_ATR_RES_GT_OFFSET 15
82 92
93/**
94 * struct nfc_target - NFC target descriptiom
95 *
96 * @sens_res: 2 bytes describing the target SENS_RES response, if the target
97 * is a type A one. The %sens_res most significant byte must be byte 2
98 * as described by the NFC Forum digital specification (i.e. the platform
99 * configuration one) while %sens_res least significant byte is byte 1.
100 */
83struct nfc_target { 101struct nfc_target {
84 u32 idx; 102 u32 idx;
85 u32 supported_protocols; 103 u32 supported_protocols;
@@ -243,5 +261,6 @@ void nfc_driver_failure(struct nfc_dev *dev, int err);
243 261
244int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type); 262int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
245int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 263int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
264struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
246 265
247#endif /* __NET_NFC_H */ 266#endif /* __NET_NFC_H */
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 42e9fac51b31..05e41383856b 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -1,13 +1,13 @@
1#ifndef _NET_P8022_H 1#ifndef _NET_P8022_H
2#define _NET_P8022_H 2#define _NET_P8022_H
3extern struct datalink_proto * 3struct datalink_proto *
4 register_8022_client(unsigned char type, 4register_8022_client(unsigned char type,
5 int (*func)(struct sk_buff *skb, 5 int (*func)(struct sk_buff *skb,
6 struct net_device *dev, 6 struct net_device *dev,
7 struct packet_type *pt, 7 struct packet_type *pt,
8 struct net_device *orig_dev)); 8 struct net_device *orig_dev));
9extern void unregister_8022_client(struct datalink_proto *proto); 9void unregister_8022_client(struct datalink_proto *proto);
10 10
11extern struct datalink_proto *make_8023_client(void); 11struct datalink_proto *make_8023_client(void);
12extern void destroy_8023_client(struct datalink_proto *dl); 12void destroy_8023_client(struct datalink_proto *dl);
13#endif 13#endif
diff --git a/include/net/ping.h b/include/net/ping.h
index 5db0224b73ac..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 6ca975bebd37..f257486f17be 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,19 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern void net_secret_init(void); 6__u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ip_id(__be32 daddr); 7__u32 secure_ipv6_id(const __be32 daddr[4]);
8extern __u32 secure_ipv6_id(const __be32 daddr[4]); 8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 10 __be16 dport);
11 __be16 dport); 11__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
12extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, 12 __be16 sport, __be16 dport);
13 __be16 sport, __be16 dport); 13__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
14extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, 14 __be16 sport, __be16 dport);
15 __be16 sport, __be16 dport); 15u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
16extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, 16 __be16 sport, __be16 dport);
17 __be16 sport, __be16 dport); 17u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
18extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, 18 __be16 sport, __be16 dport);
19 __be16 sport, __be16 dport);
20 19
21#endif /* _NET_SECURE_SEQ */ 20#endif /* _NET_SECURE_SEQ */
diff --git a/include/net/sock.h b/include/net/sock.h
index 6ba2e7b0e2b1..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;
@@ -409,6 +426,11 @@ struct sock {
409 void (*sk_destruct)(struct sock *sk); 426 void (*sk_destruct)(struct sock *sk);
410}; 427};
411 428
429#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data)))
430
431#define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk)))
432#define rcu_assign_sk_user_data(sk, ptr) rcu_assign_pointer(__sk_user_data((sk)), ptr)
433
412/* 434/*
413 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK 435 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK
414 * or not whether his port will be reused by someone else. SK_FORCE_REUSE 436 * or not whether his port will be reused by someone else. SK_FORCE_REUSE
@@ -746,7 +768,7 @@ static inline int sk_stream_wspace(const struct sock *sk)
746 return sk->sk_sndbuf - sk->sk_wmem_queued; 768 return sk->sk_sndbuf - sk->sk_wmem_queued;
747} 769}
748 770
749extern void sk_stream_write_space(struct sock *sk); 771void sk_stream_write_space(struct sock *sk);
750 772
751/* OOB backlog add */ 773/* OOB backlog add */
752static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 774static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
@@ -788,7 +810,7 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
788 return 0; 810 return 0;
789} 811}
790 812
791extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb); 813int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
792 814
793static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) 815static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
794{ 816{
@@ -853,15 +875,15 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
853 __rc; \ 875 __rc; \
854 }) 876 })
855 877
856extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); 878int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
857extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); 879int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
858extern void sk_stream_wait_close(struct sock *sk, long timeo_p); 880void sk_stream_wait_close(struct sock *sk, long timeo_p);
859extern int sk_stream_error(struct sock *sk, int flags, int err); 881int sk_stream_error(struct sock *sk, int flags, int err);
860extern void sk_stream_kill_queues(struct sock *sk); 882void sk_stream_kill_queues(struct sock *sk);
861extern void sk_set_memalloc(struct sock *sk); 883void sk_set_memalloc(struct sock *sk);
862extern void sk_clear_memalloc(struct sock *sk); 884void sk_clear_memalloc(struct sock *sk);
863 885
864extern int sk_wait_data(struct sock *sk, long *timeo); 886int sk_wait_data(struct sock *sk, long *timeo);
865 887
866struct request_sock_ops; 888struct request_sock_ops;
867struct timewait_sock_ops; 889struct timewait_sock_ops;
@@ -1014,10 +1036,10 @@ enum cg_proto_flags {
1014 1036
1015struct cg_proto { 1037struct cg_proto {
1016 void (*enter_memory_pressure)(struct sock *sk); 1038 void (*enter_memory_pressure)(struct sock *sk);
1017 struct res_counter *memory_allocated; /* Current allocated memory. */ 1039 struct res_counter memory_allocated; /* Current allocated memory. */
1018 struct percpu_counter *sockets_allocated; /* Current number of sockets. */ 1040 struct percpu_counter sockets_allocated; /* Current number of sockets. */
1019 int *memory_pressure; 1041 int memory_pressure;
1020 long *sysctl_mem; 1042 long sysctl_mem[3];
1021 unsigned long flags; 1043 unsigned long flags;
1022 /* 1044 /*
1023 * memcg field is used to find which memcg we belong directly 1045 * memcg field is used to find which memcg we belong directly
@@ -1031,8 +1053,8 @@ struct cg_proto {
1031 struct mem_cgroup *memcg; 1053 struct mem_cgroup *memcg;
1032}; 1054};
1033 1055
1034extern int proto_register(struct proto *prot, int alloc_slab); 1056int proto_register(struct proto *prot, int alloc_slab);
1035extern void proto_unregister(struct proto *prot); 1057void proto_unregister(struct proto *prot);
1036 1058
1037static inline bool memcg_proto_active(struct cg_proto *cg_proto) 1059static inline bool memcg_proto_active(struct cg_proto *cg_proto)
1038{ 1060{
@@ -1113,7 +1135,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk)
1113 return false; 1135 return false;
1114 1136
1115 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1137 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1116 return !!*sk->sk_cgrp->memory_pressure; 1138 return !!sk->sk_cgrp->memory_pressure;
1117 1139
1118 return !!*sk->sk_prot->memory_pressure; 1140 return !!*sk->sk_prot->memory_pressure;
1119} 1141}
@@ -1133,8 +1155,8 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
1133 struct proto *prot = sk->sk_prot; 1155 struct proto *prot = sk->sk_prot;
1134 1156
1135 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1157 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1136 if (*cg_proto->memory_pressure) 1158 if (cg_proto->memory_pressure)
1137 *cg_proto->memory_pressure = 0; 1159 cg_proto->memory_pressure = 0;
1138 } 1160 }
1139 1161
1140} 1162}
@@ -1170,7 +1192,7 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1170 struct res_counter *fail; 1192 struct res_counter *fail;
1171 int ret; 1193 int ret;
1172 1194
1173 ret = res_counter_charge_nofail(prot->memory_allocated, 1195 ret = res_counter_charge_nofail(&prot->memory_allocated,
1174 amt << PAGE_SHIFT, &fail); 1196 amt << PAGE_SHIFT, &fail);
1175 if (ret < 0) 1197 if (ret < 0)
1176 *parent_status = OVER_LIMIT; 1198 *parent_status = OVER_LIMIT;
@@ -1179,13 +1201,13 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1179static inline void memcg_memory_allocated_sub(struct cg_proto *prot, 1201static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1180 unsigned long amt) 1202 unsigned long amt)
1181{ 1203{
1182 res_counter_uncharge(prot->memory_allocated, amt << PAGE_SHIFT); 1204 res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT);
1183} 1205}
1184 1206
1185static inline u64 memcg_memory_allocated_read(struct cg_proto *prot) 1207static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1186{ 1208{
1187 u64 ret; 1209 u64 ret;
1188 ret = res_counter_read_u64(prot->memory_allocated, RES_USAGE); 1210 ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE);
1189 return ret >> PAGE_SHIFT; 1211 return ret >> PAGE_SHIFT;
1190} 1212}
1191 1213
@@ -1233,7 +1255,7 @@ static inline void sk_sockets_allocated_dec(struct sock *sk)
1233 struct cg_proto *cg_proto = sk->sk_cgrp; 1255 struct cg_proto *cg_proto = sk->sk_cgrp;
1234 1256
1235 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1257 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1236 percpu_counter_dec(cg_proto->sockets_allocated); 1258 percpu_counter_dec(&cg_proto->sockets_allocated);
1237 } 1259 }
1238 1260
1239 percpu_counter_dec(prot->sockets_allocated); 1261 percpu_counter_dec(prot->sockets_allocated);
@@ -1247,7 +1269,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk)
1247 struct cg_proto *cg_proto = sk->sk_cgrp; 1269 struct cg_proto *cg_proto = sk->sk_cgrp;
1248 1270
1249 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1271 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1250 percpu_counter_inc(cg_proto->sockets_allocated); 1272 percpu_counter_inc(&cg_proto->sockets_allocated);
1251 } 1273 }
1252 1274
1253 percpu_counter_inc(prot->sockets_allocated); 1275 percpu_counter_inc(prot->sockets_allocated);
@@ -1259,7 +1281,7 @@ sk_sockets_allocated_read_positive(struct sock *sk)
1259 struct proto *prot = sk->sk_prot; 1281 struct proto *prot = sk->sk_prot;
1260 1282
1261 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1283 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1262 return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); 1284 return percpu_counter_read_positive(&sk->sk_cgrp->sockets_allocated);
1263 1285
1264 return percpu_counter_read_positive(prot->sockets_allocated); 1286 return percpu_counter_read_positive(prot->sockets_allocated);
1265} 1287}
@@ -1287,8 +1309,8 @@ proto_memory_pressure(struct proto *prot)
1287 1309
1288#ifdef CONFIG_PROC_FS 1310#ifdef CONFIG_PROC_FS
1289/* Called with local bh disabled */ 1311/* Called with local bh disabled */
1290extern 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);
1291extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1313int sock_prot_inuse_get(struct net *net, struct proto *proto);
1292#else 1314#else
1293static 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,
1294 int inc) 1316 int inc)
@@ -1364,8 +1386,8 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
1364/* 1386/*
1365 * Functions for memory accounting 1387 * Functions for memory accounting
1366 */ 1388 */
1367extern int __sk_mem_schedule(struct sock *sk, int size, int kind); 1389int __sk_mem_schedule(struct sock *sk, int size, int kind);
1368extern void __sk_mem_reclaim(struct sock *sk); 1390void __sk_mem_reclaim(struct sock *sk);
1369 1391
1370#define SK_MEM_QUANTUM ((int)PAGE_SIZE) 1392#define SK_MEM_QUANTUM ((int)PAGE_SIZE)
1371#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) 1393#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
@@ -1473,14 +1495,14 @@ do { \
1473 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1495 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1474} while (0) 1496} while (0)
1475 1497
1476extern void lock_sock_nested(struct sock *sk, int subclass); 1498void lock_sock_nested(struct sock *sk, int subclass);
1477 1499
1478static inline void lock_sock(struct sock *sk) 1500static inline void lock_sock(struct sock *sk)
1479{ 1501{
1480 lock_sock_nested(sk, 0); 1502 lock_sock_nested(sk, 0);
1481} 1503}
1482 1504
1483extern void release_sock(struct sock *sk); 1505void release_sock(struct sock *sk);
1484 1506
1485/* BH context may only use the following locking interface. */ 1507/* BH context may only use the following locking interface. */
1486#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 1508#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
@@ -1489,7 +1511,7 @@ extern void release_sock(struct sock *sk);
1489 SINGLE_DEPTH_NESTING) 1511 SINGLE_DEPTH_NESTING)
1490#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1512#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
1491 1513
1492extern bool lock_sock_fast(struct sock *sk); 1514bool lock_sock_fast(struct sock *sk);
1493/** 1515/**
1494 * unlock_sock_fast - complement of lock_sock_fast 1516 * unlock_sock_fast - complement of lock_sock_fast
1495 * @sk: socket 1517 * @sk: socket
@@ -1507,108 +1529,84 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
1507} 1529}
1508 1530
1509 1531
1510extern struct sock *sk_alloc(struct net *net, int family, 1532struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1511 gfp_t priority, 1533 struct proto *prot);
1512 struct proto *prot); 1534void sk_free(struct sock *sk);
1513extern void sk_free(struct sock *sk); 1535void sk_release_kernel(struct sock *sk);
1514extern void sk_release_kernel(struct sock *sk); 1536struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1515extern struct sock *sk_clone_lock(const struct sock *sk, 1537
1516 const gfp_t priority); 1538struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1517 1539 gfp_t priority);
1518extern struct sk_buff *sock_wmalloc(struct sock *sk, 1540struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1519 unsigned long size, int force, 1541 gfp_t priority);
1520 gfp_t priority); 1542void sock_wfree(struct sk_buff *skb);
1521extern struct sk_buff *sock_rmalloc(struct sock *sk, 1543void skb_orphan_partial(struct sk_buff *skb);
1522 unsigned long size, int force, 1544void sock_rfree(struct sk_buff *skb);
1523 gfp_t priority); 1545void sock_edemux(struct sk_buff *skb);
1524extern void sock_wfree(struct sk_buff *skb); 1546
1525extern void skb_orphan_partial(struct sk_buff *skb); 1547int sock_setsockopt(struct socket *sock, int level, int op,
1526extern void sock_rfree(struct sk_buff *skb); 1548 char __user *optval, unsigned int optlen);
1527extern void sock_edemux(struct sk_buff *skb); 1549
1528 1550int sock_getsockopt(struct socket *sock, int level, int op,
1529extern int sock_setsockopt(struct socket *sock, int level, 1551 char __user *optval, int __user *optlen);
1530 int op, char __user *optval, 1552struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1531 unsigned int optlen); 1553 int noblock, int *errcode);
1532 1554struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1533extern int sock_getsockopt(struct socket *sock, int level, 1555 unsigned long data_len, int noblock,
1534 int op, char __user *optval, 1556 int *errcode, int max_page_order);
1535 int __user *optlen); 1557void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1536extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1558void sock_kfree_s(struct sock *sk, void *mem, int size);
1537 unsigned long size, 1559void sk_send_sigurg(struct sock *sk);
1538 int noblock,
1539 int *errcode);
1540extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1541 unsigned long header_len,
1542 unsigned long data_len,
1543 int noblock,
1544 int *errcode,
1545 int max_page_order);
1546extern void *sock_kmalloc(struct sock *sk, int size,
1547 gfp_t priority);
1548extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1549extern void sk_send_sigurg(struct sock *sk);
1550 1560
1551/* 1561/*
1552 * 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
1553 * does not implement a particular function. 1563 * does not implement a particular function.
1554 */ 1564 */
1555extern int sock_no_bind(struct socket *, 1565int sock_no_bind(struct socket *, struct sockaddr *, int);
1556 struct sockaddr *, int); 1566int sock_no_connect(struct socket *, struct sockaddr *, int, int);
1557extern int sock_no_connect(struct socket *, 1567int sock_no_socketpair(struct socket *, struct socket *);
1558 struct sockaddr *, int, int); 1568int sock_no_accept(struct socket *, struct socket *, int);
1559extern int sock_no_socketpair(struct socket *, 1569int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1560 struct socket *); 1570unsigned int sock_no_poll(struct file *, struct socket *,
1561extern int sock_no_accept(struct socket *, 1571 struct poll_table_struct *);
1562 struct socket *, int); 1572int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1563extern int sock_no_getname(struct socket *, 1573int sock_no_listen(struct socket *, int);
1564 struct sockaddr *, int *, int); 1574int sock_no_shutdown(struct socket *, int);
1565extern unsigned int sock_no_poll(struct file *, struct socket *, 1575int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1566 struct poll_table_struct *); 1576int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1567extern int sock_no_ioctl(struct socket *, unsigned int, 1577int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t);
1568 unsigned long); 1578int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t,
1569extern int sock_no_listen(struct socket *, int); 1579 int);
1570extern int sock_no_shutdown(struct socket *, int); 1580int sock_no_mmap(struct file *file, struct socket *sock,
1571extern int sock_no_getsockopt(struct socket *, int , int, 1581 struct vm_area_struct *vma);
1572 char __user *, int __user *); 1582ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1573extern int sock_no_setsockopt(struct socket *, int, int, 1583 size_t size, int flags);
1574 char __user *, unsigned int);
1575extern int sock_no_sendmsg(struct kiocb *, struct socket *,
1576 struct msghdr *, size_t);
1577extern int sock_no_recvmsg(struct kiocb *, struct socket *,
1578 struct msghdr *, size_t, int);
1579extern int sock_no_mmap(struct file *file,
1580 struct socket *sock,
1581 struct vm_area_struct *vma);
1582extern ssize_t sock_no_sendpage(struct socket *sock,
1583 struct page *page,
1584 int offset, size_t size,
1585 int flags);
1586 1584
1587/* 1585/*
1588 * 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
1589 * uses the inet style. 1587 * uses the inet style.
1590 */ 1588 */
1591extern int sock_common_getsockopt(struct socket *sock, int level, int optname, 1589int sock_common_getsockopt(struct socket *sock, int level, int optname,
1592 char __user *optval, int __user *optlen); 1590 char __user *optval, int __user *optlen);
1593extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1591int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1594 struct msghdr *msg, size_t size, int flags); 1592 struct msghdr *msg, size_t size, int flags);
1595extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1593int sock_common_setsockopt(struct socket *sock, int level, int optname,
1596 char __user *optval, unsigned int optlen); 1594 char __user *optval, unsigned int optlen);
1597extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1595int compat_sock_common_getsockopt(struct socket *sock, int level,
1598 int optname, char __user *optval, int __user *optlen); 1596 int optname, char __user *optval, int __user *optlen);
1599extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1597int compat_sock_common_setsockopt(struct socket *sock, int level,
1600 int optname, char __user *optval, unsigned int optlen); 1598 int optname, char __user *optval, unsigned int optlen);
1601 1599
1602extern void sk_common_release(struct sock *sk); 1600void sk_common_release(struct sock *sk);
1603 1601
1604/* 1602/*
1605 * Default socket callbacks and setup code 1603 * Default socket callbacks and setup code
1606 */ 1604 */
1607 1605
1608/* Initialise core socket variables */ 1606/* Initialise core socket variables */
1609extern void sock_init_data(struct socket *sock, struct sock *sk); 1607void sock_init_data(struct socket *sock, struct sock *sk);
1610 1608
1611extern void sk_filter_release_rcu(struct rcu_head *rcu); 1609void sk_filter_release_rcu(struct rcu_head *rcu);
1612 1610
1613/** 1611/**
1614 * sk_filter_release - release a socket filter 1612 * sk_filter_release - release a socket filter
@@ -1625,16 +1623,14 @@ static inline void sk_filter_release(struct sk_filter *fp)
1625 1623
1626static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1624static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
1627{ 1625{
1628 unsigned int size = sk_filter_len(fp); 1626 atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1629
1630 atomic_sub(size, &sk->sk_omem_alloc);
1631 sk_filter_release(fp); 1627 sk_filter_release(fp);
1632} 1628}
1633 1629
1634static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 1630static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
1635{ 1631{
1636 atomic_inc(&fp->refcnt); 1632 atomic_inc(&fp->refcnt);
1637 atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); 1633 atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1638} 1634}
1639 1635
1640/* 1636/*
@@ -1668,9 +1664,12 @@ static inline void sock_put(struct sock *sk)
1668 if (atomic_dec_and_test(&sk->sk_refcnt)) 1664 if (atomic_dec_and_test(&sk->sk_refcnt))
1669 sk_free(sk); 1665 sk_free(sk);
1670} 1666}
1667/* Generic version of sock_put(), dealing with all sockets
1668 * (TCP_TIMEWAIT, ESTABLISHED...)
1669 */
1670void sock_gen_put(struct sock *sk);
1671 1671
1672extern 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);
1673 const int nested);
1674 1673
1675static 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)
1676{ 1675{
@@ -1724,8 +1723,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1724 write_unlock_bh(&sk->sk_callback_lock); 1723 write_unlock_bh(&sk->sk_callback_lock);
1725} 1724}
1726 1725
1727extern kuid_t sock_i_uid(struct sock *sk); 1726kuid_t sock_i_uid(struct sock *sk);
1728extern unsigned long sock_i_ino(struct sock *sk); 1727unsigned long sock_i_ino(struct sock *sk);
1729 1728
1730static inline struct dst_entry * 1729static inline struct dst_entry *
1731__sk_dst_get(struct sock *sk) 1730__sk_dst_get(struct sock *sk)
@@ -1747,8 +1746,6 @@ sk_dst_get(struct sock *sk)
1747 return dst; 1746 return dst;
1748} 1747}
1749 1748
1750extern void sk_reset_txq(struct sock *sk);
1751
1752static inline void dst_negative_advice(struct sock *sk) 1749static inline void dst_negative_advice(struct sock *sk)
1753{ 1750{
1754 struct dst_entry *ndst, *dst = __sk_dst_get(sk); 1751 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
@@ -1758,7 +1755,7 @@ static inline void dst_negative_advice(struct sock *sk)
1758 1755
1759 if (ndst != dst) { 1756 if (ndst != dst) {
1760 rcu_assign_pointer(sk->sk_dst_cache, ndst); 1757 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1761 sk_reset_txq(sk); 1758 sk_tx_queue_clear(sk);
1762 } 1759 }
1763 } 1760 }
1764} 1761}
@@ -1800,16 +1797,16 @@ sk_dst_reset(struct sock *sk)
1800 spin_unlock(&sk->sk_dst_lock); 1797 spin_unlock(&sk->sk_dst_lock);
1801} 1798}
1802 1799
1803extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1800struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1804 1801
1805extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1802struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1806 1803
1807static inline bool sk_can_gso(const struct sock *sk) 1804static inline bool sk_can_gso(const struct sock *sk)
1808{ 1805{
1809 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);
1810} 1807}
1811 1808
1812extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1809void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1813 1810
1814static 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)
1815{ 1812{
@@ -2022,14 +2019,14 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2022 sk_mem_charge(sk, skb->truesize); 2019 sk_mem_charge(sk, skb->truesize);
2023} 2020}
2024 2021
2025extern void sk_reset_timer(struct sock *sk, struct timer_list *timer, 2022void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2026 unsigned long expires); 2023 unsigned long expires);
2027 2024
2028extern void sk_stop_timer(struct sock *sk, struct timer_list *timer); 2025void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2029 2026
2030extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 2027int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2031 2028
2032extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); 2029int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2033 2030
2034/* 2031/*
2035 * Recover an error report and clear atomically 2032 * Recover an error report and clear atomically
@@ -2097,7 +2094,7 @@ static inline struct page_frag *sk_page_frag(struct sock *sk)
2097 return &sk->sk_frag; 2094 return &sk->sk_frag;
2098} 2095}
2099 2096
2100extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); 2097bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2101 2098
2102/* 2099/*
2103 * 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
@@ -2135,10 +2132,10 @@ static inline int sock_intr_errno(long timeo)
2135 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 2132 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2136} 2133}
2137 2134
2138extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 2135void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2139 struct sk_buff *skb); 2136 struct sk_buff *skb);
2140extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2137void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2141 struct sk_buff *skb); 2138 struct sk_buff *skb);
2142 2139
2143static inline void 2140static inline void
2144sock_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)
@@ -2171,8 +2168,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2171 __sock_recv_wifi_status(msg, sk, skb); 2168 __sock_recv_wifi_status(msg, sk, skb);
2172} 2169}
2173 2170
2174extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2171void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2175 struct sk_buff *skb); 2172 struct sk_buff *skb);
2176 2173
2177static 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,
2178 struct sk_buff *skb) 2175 struct sk_buff *skb)
@@ -2197,7 +2194,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2197 * 2194 *
2198 * Currently only depends on SOCK_TIMESTAMPING* flags. 2195 * Currently only depends on SOCK_TIMESTAMPING* flags.
2199 */ 2196 */
2200extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2197void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2201 2198
2202/** 2199/**
2203 * 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
@@ -2261,11 +2258,11 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2261 return NULL; 2258 return NULL;
2262} 2259}
2263 2260
2264extern void sock_enable_timestamp(struct sock *sk, int flag); 2261void sock_enable_timestamp(struct sock *sk, int flag);
2265extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2262int sock_get_timestamp(struct sock *, struct timeval __user *);
2266extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2263int sock_get_timestampns(struct sock *, struct timespec __user *);
2267extern 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,
2268 int level, int type); 2265 int type);
2269 2266
2270/* 2267/*
2271 * 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/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 fe66533e9b7a..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
@@ -68,6 +67,7 @@ struct rsnd_scu_platform_info {
68 * 67 *
69 * A : generation 68 * A : generation
70 */ 69 */
70#define RSND_GEN_MASK (0xF << 0)
71#define RSND_GEN1 (1 << 0) /* fixme */ 71#define RSND_GEN1 (1 << 0) /* fixme */
72#define RSND_GEN2 (2 << 0) /* fixme */ 72#define RSND_GEN2 (2 << 0) /* fixme */
73 73
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index ae9a227d35d3..800c101bb096 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -105,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
105int snd_soc_dai_set_pll(struct snd_soc_dai *dai, 105int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
106 int pll_id, int source, unsigned int freq_in, unsigned int freq_out); 106 int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
107 107
108int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
109
108/* Digital Audio interface formatting */ 110/* Digital Audio interface formatting */
109int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); 111int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
110 112
@@ -131,6 +133,7 @@ struct snd_soc_dai_ops {
131 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source, 133 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
132 unsigned int freq_in, unsigned int freq_out); 134 unsigned int freq_in, unsigned int freq_out);
133 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); 135 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
136 int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
134 137
135 /* 138 /*
136 * DAI format configuration 139 * DAI format configuration
@@ -166,6 +169,13 @@ struct snd_soc_dai_ops {
166 struct snd_soc_dai *); 169 struct snd_soc_dai *);
167 int (*prepare)(struct snd_pcm_substream *, 170 int (*prepare)(struct snd_pcm_substream *,
168 struct snd_soc_dai *); 171 struct snd_soc_dai *);
172 /*
173 * NOTE: Commands passed to the trigger function are not necessarily
174 * compatible with the current state of the dai. For example this
175 * sequence of commands is possible: START STOP STOP.
176 * So do not unconditionally use refcounting functions in the trigger
177 * function, e.g. clk_enable/disable.
178 */
169 int (*trigger)(struct snd_pcm_substream *, int, 179 int (*trigger)(struct snd_pcm_substream *, int,
170 struct snd_soc_dai *); 180 struct snd_soc_dai *);
171 int (*bespoke_trigger)(struct snd_pcm_substream *, int, 181 int (*bespoke_trigger)(struct snd_pcm_substream *, int,
@@ -276,6 +286,13 @@ static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
276 dai->capture_dma_data = data; 286 dai->capture_dma_data = data;
277} 287}
278 288
289static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai,
290 void *playback, void *capture)
291{
292 dai->playback_dma_data = playback;
293 dai->capture_dma_data = capture;
294}
295
279static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai, 296static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,
280 void *data) 297 void *data)
281{ 298{
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 27a72d5d4b00..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/block.h b/include/trace/events/block.h
index 60ae7c3db912..4c2301d2ef1a 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
618 __field( unsigned int, nr_sector ) 618 __field( unsigned int, nr_sector )
619 __field( dev_t, old_dev ) 619 __field( dev_t, old_dev )
620 __field( sector_t, old_sector ) 620 __field( sector_t, old_sector )
621 __field( unsigned int, nr_bios )
621 __array( char, rwbs, RWBS_LEN) 622 __array( char, rwbs, RWBS_LEN)
622 ), 623 ),
623 624
@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
627 __entry->nr_sector = blk_rq_sectors(rq); 628 __entry->nr_sector = blk_rq_sectors(rq);
628 __entry->old_dev = dev; 629 __entry->old_dev = dev;
629 __entry->old_sector = from; 630 __entry->old_sector = from;
631 __entry->nr_bios = blk_rq_count_bios(rq);
630 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); 632 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
631 ), 633 ),
632 634
633 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 635 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
634 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 636 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
635 (unsigned long long)__entry->sector, 637 (unsigned long long)__entry->sector,
636 __entry->nr_sector, 638 __entry->nr_sector,
637 MAJOR(__entry->old_dev), MINOR(__entry->old_dev), 639 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
638 (unsigned long long)__entry->old_sector) 640 (unsigned long long)__entry->old_sector, __entry->nr_bios)
639); 641);
640 642
641#endif /* _TRACE_BLOCK_H */ 643#endif /* _TRACE_BLOCK_H */
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 45702c3c3837..f18b3b76e01e 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -42,6 +42,7 @@ struct extent_buffer;
42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
45 { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \
45 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 46 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
46 47
47#define show_root_type(obj) \ 48#define show_root_type(obj) \
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/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/rcu.h b/include/trace/events/rcu.h
index ee2376cfaab3..aca382266411 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -39,15 +39,26 @@ TRACE_EVENT(rcu_utilization,
39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
40 40
41/* 41/*
42 * Tracepoint for grace-period events: starting and ending a grace 42 * Tracepoint for grace-period events. Takes a string identifying the
43 * period ("start" and "end", respectively), a CPU noting the start 43 * RCU flavor, the grace-period number, and a string identifying the
44 * of a new grace period or the end of an old grace period ("cpustart" 44 * grace-period-related event as follows:
45 * and "cpuend", respectively), a CPU passing through a quiescent 45 *
46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" 46 * "AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
47 * and "cpuofl", respectively), a CPU being kicked for being too 47 * "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
48 * long in dyntick-idle mode ("kick"), a CPU accelerating its new 48 * "newreq": Request a new grace period.
49 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU 49 * "start": Start a grace period.
50 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB"). 50 * "cpustart": CPU first notices a grace-period start.
51 * "cpuqs": CPU passes through a quiescent state.
52 * "cpuonl": CPU comes online.
53 * "cpuofl": CPU goes offline.
54 * "reqwait": GP kthread sleeps waiting for grace-period request.
55 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
56 * "fqswait": GP kthread waiting until time to force quiescent states.
57 * "fqsstart": GP kthread starts forcing quiescent states.
58 * "fqsend": GP kthread done forcing quiescent states.
59 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
60 * "end": End a grace period.
61 * "cpuend": CPU first notices a grace-period end.
51 */ 62 */
52TRACE_EVENT(rcu_grace_period, 63TRACE_EVENT(rcu_grace_period,
53 64
@@ -161,6 +172,46 @@ TRACE_EVENT(rcu_grace_period_init,
161); 172);
162 173
163/* 174/*
175 * Tracepoint for RCU no-CBs CPU callback handoffs. This event is intended
176 * to assist debugging of these handoffs.
177 *
178 * The first argument is the name of the RCU flavor, and the second is
179 * the number of the offloaded CPU are extracted. The third and final
180 * argument is a string as follows:
181 *
182 * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
183 * "WakeOvf": Wake rcuo kthread, CB list is huge.
184 * "WakeNot": Don't wake rcuo kthread.
185 * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
186 * "Poll": Start of new polling cycle for rcu_nocb_poll.
187 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
188 * "WokeEmpty": rcuo kthread woke to find empty list.
189 * "WokeNonEmpty": rcuo kthread woke to find non-empty list.
190 * "WaitQueue": Enqueue partially done, timed wait for it to complete.
191 * "WokeQueue": Partial enqueue now complete.
192 */
193TRACE_EVENT(rcu_nocb_wake,
194
195 TP_PROTO(const char *rcuname, int cpu, const char *reason),
196
197 TP_ARGS(rcuname, cpu, reason),
198
199 TP_STRUCT__entry(
200 __field(const char *, rcuname)
201 __field(int, cpu)
202 __field(const char *, reason)
203 ),
204
205 TP_fast_assign(
206 __entry->rcuname = rcuname;
207 __entry->cpu = cpu;
208 __entry->reason = reason;
209 ),
210
211 TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
212);
213
214/*
164 * Tracepoint for tasks blocking within preemptible-RCU read-side 215 * Tracepoint for tasks blocking within preemptible-RCU read-side
165 * critical sections. Track the type of RCU (which one day might 216 * critical sections. Track the type of RCU (which one day might
166 * include SRCU), the grace-period number that the task is blocking 217 * include SRCU), the grace-period number that the task is blocking
@@ -540,17 +591,17 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
540TRACE_EVENT(rcu_batch_end, 591TRACE_EVENT(rcu_batch_end,
541 592
542 TP_PROTO(const char *rcuname, int callbacks_invoked, 593 TP_PROTO(const char *rcuname, int callbacks_invoked,
543 bool cb, bool nr, bool iit, bool risk), 594 char cb, char nr, char iit, char risk),
544 595
545 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), 596 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
546 597
547 TP_STRUCT__entry( 598 TP_STRUCT__entry(
548 __field(const char *, rcuname) 599 __field(const char *, rcuname)
549 __field(int, callbacks_invoked) 600 __field(int, callbacks_invoked)
550 __field(bool, cb) 601 __field(char, cb)
551 __field(bool, nr) 602 __field(char, nr)
552 __field(bool, iit) 603 __field(char, iit)
553 __field(bool, risk) 604 __field(char, risk)
554 ), 605 ),
555 606
556 TP_fast_assign( 607 TP_fast_assign(
@@ -656,6 +707,7 @@ TRACE_EVENT(rcu_barrier,
656#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \ 707#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
657 level, grplo, grphi, event) \ 708 level, grplo, grphi, event) \
658 do { } while (0) 709 do { } while (0)
710#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
659#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) 711#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
660#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 712#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
661#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ 713#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 2e7d9947a10d..613381bcde40 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
100 /* 100 /*
101 * For all intents and purposes a preempted task is a running task. 101 * For all intents and purposes a preempted task is a running task.
102 */ 102 */
103 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE) 103 if (task_preempt_count(p) & PREEMPT_ACTIVE)
104 state = TASK_RUNNING | TASK_STATE_MAX; 104 state = TASK_RUNNING | TASK_STATE_MAX;
105#endif 105#endif
106 106
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/target.h b/include/trace/events/target.h
index aef8fc354025..da9cc0f05c93 100644
--- a/include/trace/events/target.h
+++ b/include/trace/events/target.h
@@ -144,7 +144,7 @@ TRACE_EVENT(target_sequencer_start,
144 ), 144 ),
145 145
146 TP_fast_assign( 146 TP_fast_assign(
147 __entry->unpacked_lun = cmd->se_lun->unpacked_lun; 147 __entry->unpacked_lun = cmd->orig_fe_lun;
148 __entry->opcode = cmd->t_task_cdb[0]; 148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length; 149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr; 150 __entry->task_attribute = cmd->sam_task_attr;
@@ -182,7 +182,7 @@ TRACE_EVENT(target_cmd_complete,
182 ), 182 ),
183 183
184 TP_fast_assign( 184 TP_fast_assign(
185 __entry->unpacked_lun = cmd->se_lun->unpacked_lun; 185 __entry->unpacked_lun = cmd->orig_fe_lun;
186 __entry->opcode = cmd->t_task_cdb[0]; 186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length; 187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr; 188 __entry->task_attribute = cmd->sam_task_attr;
diff --git a/include/trace/events/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/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/drm_mode.h b/include/uapi/drm/drm_mode.h
index 550811712f78..28acbaf4a81e 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -223,6 +223,8 @@ struct drm_mode_get_connector {
223 __u32 connection; 223 __u32 connection;
224 __u32 mm_width, mm_height; /**< HxW in millimeters */ 224 __u32 mm_width, mm_height; /**< HxW in millimeters */
225 __u32 subpixel; 225 __u32 subpixel;
226
227 __u32 pad;
226}; 228};
227 229
228#define DRM_MODE_PROP_PENDING (1<<0) 230#define DRM_MODE_PROP_PENDING (1<<0)
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index fa8b3adf9ffb..46d41e8b0dcc 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -1007,4 +1007,6 @@ struct drm_radeon_info {
1007#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3 1007#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3
1008#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2 1008#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2
1009 1009
1010#define CIK_TILE_MODE_DEPTH_STENCIL_1D 5
1011
1010#endif 1012#endif
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 115add2515aa..33d2b8fe166d 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -241,6 +241,8 @@ header-y += media.h
241header-y += mei.h 241header-y += mei.h
242header-y += mempolicy.h 242header-y += mempolicy.h
243header-y += meye.h 243header-y += meye.h
244header-y += mic_common.h
245header-y += mic_ioctl.h
244header-y += mii.h 246header-y += mii.h
245header-y += minix_fs.h 247header-y += minix_fs.h
246header-y += mman.h 248header-y += mman.h
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/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/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/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/mic_common.h b/include/uapi/linux/mic_common.h
new file mode 100644
index 000000000000..17e7d95e4f53
--- /dev/null
+++ b/include/uapi/linux/mic_common.h
@@ -0,0 +1,240 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC driver.
19 *
20 */
21#ifndef __MIC_COMMON_H_
22#define __MIC_COMMON_H_
23
24#include <linux/virtio_ring.h>
25
26#ifndef __KERNEL__
27#define ALIGN(a, x) (((a) + (x) - 1) & ~((x) - 1))
28#define __aligned(x) __attribute__ ((aligned(x)))
29#endif
30
31#define mic_aligned_size(x) ALIGN(sizeof(x), 8)
32
33/**
34 * struct mic_device_desc: Virtio device information shared between the
35 * virtio driver and userspace backend
36 *
37 * @type: Device type: console/network/disk etc. Type 0/-1 terminates.
38 * @num_vq: Number of virtqueues.
39 * @feature_len: Number of bytes of feature bits. Multiply by 2: one for
40 host features and one for guest acknowledgements.
41 * @config_len: Number of bytes of the config array after virtqueues.
42 * @status: A status byte, written by the Guest.
43 * @config: Start of the following variable length config.
44 */
45struct mic_device_desc {
46 __s8 type;
47 __u8 num_vq;
48 __u8 feature_len;
49 __u8 config_len;
50 __u8 status;
51 __u64 config[0];
52} __aligned(8);
53
54/**
55 * struct mic_device_ctrl: Per virtio device information in the device page
56 * used internally by the host and card side drivers.
57 *
58 * @vdev: Used for storing MIC vdev information by the guest.
59 * @config_change: Set to 1 by host when a config change is requested.
60 * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset.
61 * @guest_ack: Set to 1 by guest to ack a command.
62 * @host_ack: Set to 1 by host to ack a command.
63 * @used_address_updated: Set to 1 by guest when the used address should be
64 * updated.
65 * @c2h_vdev_db: The doorbell number to be used by guest. Set by host.
66 * @h2c_vdev_db: The doorbell number to be used by host. Set by guest.
67 */
68struct mic_device_ctrl {
69 __u64 vdev;
70 __u8 config_change;
71 __u8 vdev_reset;
72 __u8 guest_ack;
73 __u8 host_ack;
74 __u8 used_address_updated;
75 __s8 c2h_vdev_db;
76 __s8 h2c_vdev_db;
77} __aligned(8);
78
79/**
80 * struct mic_bootparam: Virtio device independent information in device page
81 *
82 * @magic: A magic value used by the card to ensure it can see the host
83 * @c2h_shutdown_db: Card to Host shutdown doorbell set by host
84 * @h2c_shutdown_db: Host to Card shutdown doorbell set by card
85 * @h2c_config_db: Host to Card Virtio config doorbell set by card
86 * @shutdown_status: Card shutdown status set by card
87 * @shutdown_card: Set to 1 by the host when a card shutdown is initiated
88 */
89struct mic_bootparam {
90 __u32 magic;
91 __s8 c2h_shutdown_db;
92 __s8 h2c_shutdown_db;
93 __s8 h2c_config_db;
94 __u8 shutdown_status;
95 __u8 shutdown_card;
96} __aligned(8);
97
98/**
99 * struct mic_device_page: High level representation of the device page
100 *
101 * @bootparam: The bootparam structure is used for sharing information and
102 * status updates between MIC host and card drivers.
103 * @desc: Array of MIC virtio device descriptors.
104 */
105struct mic_device_page {
106 struct mic_bootparam bootparam;
107 struct mic_device_desc desc[0];
108};
109/**
110 * struct mic_vqconfig: This is how we expect the device configuration field
111 * for a virtqueue to be laid out in config space.
112 *
113 * @address: Guest/MIC physical address of the virtio ring
114 * (avail and desc rings)
115 * @used_address: Guest/MIC physical address of the used ring
116 * @num: The number of entries in the virtio_ring
117 */
118struct mic_vqconfig {
119 __u64 address;
120 __u64 used_address;
121 __u16 num;
122} __aligned(8);
123
124/*
125 * The alignment to use between consumer and producer parts of vring.
126 * This is pagesize for historical reasons.
127 */
128#define MIC_VIRTIO_RING_ALIGN 4096
129
130#define MIC_MAX_VRINGS 4
131#define MIC_VRING_ENTRIES 128
132
133/*
134 * Max vring entries (power of 2) to ensure desc and avail rings
135 * fit in a single page
136 */
137#define MIC_MAX_VRING_ENTRIES 128
138
139/**
140 * Max size of the desc block in bytes: includes:
141 * - struct mic_device_desc
142 * - struct mic_vqconfig (num_vq of these)
143 * - host and guest features
144 * - virtio device config space
145 */
146#define MIC_MAX_DESC_BLK_SIZE 256
147
148/**
149 * struct _mic_vring_info - Host vring info exposed to userspace backend
150 * for the avail index and magic for the card.
151 *
152 * @avail_idx: host avail idx
153 * @magic: A magic debug cookie.
154 */
155struct _mic_vring_info {
156 __u16 avail_idx;
157 int magic;
158};
159
160/**
161 * struct mic_vring - Vring information.
162 *
163 * @vr: The virtio ring.
164 * @info: Host vring information exposed to the userspace backend for the
165 * avail index and magic for the card.
166 * @va: The va for the buffer allocated for vr and info.
167 * @len: The length of the buffer required for allocating vr and info.
168 */
169struct mic_vring {
170 struct vring vr;
171 struct _mic_vring_info *info;
172 void *va;
173 int len;
174};
175
176#define mic_aligned_desc_size(d) ALIGN(mic_desc_size(d), 8)
177
178#ifndef INTEL_MIC_CARD
179static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
180{
181 return mic_aligned_size(*desc)
182 + desc->num_vq * mic_aligned_size(struct mic_vqconfig)
183 + desc->feature_len * 2
184 + desc->config_len;
185}
186
187static inline struct mic_vqconfig *
188mic_vq_config(const struct mic_device_desc *desc)
189{
190 return (struct mic_vqconfig *)(desc + 1);
191}
192
193static inline __u8 *mic_vq_features(const struct mic_device_desc *desc)
194{
195 return (__u8 *)(mic_vq_config(desc) + desc->num_vq);
196}
197
198static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
199{
200 return mic_vq_features(desc) + desc->feature_len * 2;
201}
202static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
203{
204 return mic_aligned_desc_size(desc) +
205 mic_aligned_size(struct mic_device_ctrl);
206}
207#endif
208
209/* Device page size */
210#define MIC_DP_SIZE 4096
211
212#define MIC_MAGIC 0xc0ffee00
213
214/**
215 * enum mic_states - MIC states.
216 */
217enum mic_states {
218 MIC_OFFLINE = 0,
219 MIC_ONLINE,
220 MIC_SHUTTING_DOWN,
221 MIC_RESET_FAILED,
222 MIC_SUSPENDING,
223 MIC_SUSPENDED,
224 MIC_LAST
225};
226
227/**
228 * enum mic_status - MIC status reported by card after
229 * a host or card initiated shutdown or a card crash.
230 */
231enum mic_status {
232 MIC_NOP = 0,
233 MIC_CRASHED,
234 MIC_HALTED,
235 MIC_POWER_OFF,
236 MIC_RESTART,
237 MIC_STATUS_LAST
238};
239
240#endif
diff --git a/include/uapi/linux/mic_ioctl.h b/include/uapi/linux/mic_ioctl.h
new file mode 100644
index 000000000000..7fabba5059cf
--- /dev/null
+++ b/include/uapi/linux/mic_ioctl.h
@@ -0,0 +1,76 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC Host driver.
19 *
20 */
21#ifndef _MIC_IOCTL_H_
22#define _MIC_IOCTL_H_
23
24#include <linux/types.h>
25
26/*
27 * mic_copy - MIC virtio descriptor copy.
28 *
29 * @iov: An array of IOVEC structures containing user space buffers.
30 * @iovcnt: Number of IOVEC structures in iov.
31 * @vr_idx: The vring index.
32 * @update_used: A non zero value results in used index being updated.
33 * @out_len: The aggregate of the total length written to or read from
34 * the virtio device.
35 */
36struct mic_copy_desc {
37#ifdef __KERNEL__
38 struct iovec __user *iov;
39#else
40 struct iovec *iov;
41#endif
42 int iovcnt;
43 __u8 vr_idx;
44 __u8 update_used;
45 __u32 out_len;
46};
47
48/*
49 * Add a new virtio device
50 * The (struct mic_device_desc *) pointer points to a device page entry
51 * for the virtio device consisting of:
52 * - struct mic_device_desc
53 * - struct mic_vqconfig (num_vq of these)
54 * - host and guest features
55 * - virtio device config space
56 * The total size referenced by the pointer should equal the size returned
57 * by desc_size() in mic_common.h
58 */
59#define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
60
61/*
62 * Copy the number of entries in the iovec and update the used index
63 * if requested by the user.
64 */
65#define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *)
66
67/*
68 * Notify virtio device of a config change
69 * The (__u8 *) pointer points to config space values for the device
70 * as they should be written into the device page. The total size
71 * referenced by the pointer should equal the config_len field of struct
72 * mic_device_desc.
73 */
74#define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
75
76#endif
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 174915420d3f..17c3af2c4bb9 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -5,6 +5,8 @@ header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h 6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h 7header-y += nf_conntrack_tuple_common.h
8header-y += nf_tables.h
9header-y += nf_tables_compat.h
8header-y += nf_nat.h 10header-y += nf_nat.h
9header-y += nfnetlink.h 11header-y += nfnetlink.h
10header-y += nfnetlink_acct.h 12header-y += nfnetlink_acct.h
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index 8024cdf13b70..25d3b2f79c02 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -10,12 +10,14 @@
10#ifndef _UAPI_IP_SET_H 10#ifndef _UAPI_IP_SET_H
11#define _UAPI_IP_SET_H 11#define _UAPI_IP_SET_H
12 12
13
14#include <linux/types.h> 13#include <linux/types.h>
15 14
16/* The protocol version */ 15/* The protocol version */
17#define IPSET_PROTOCOL 6 16#define IPSET_PROTOCOL 6
18 17
18/* The maximum permissible comment length we will accept over netlink */
19#define IPSET_MAX_COMMENT_SIZE 255
20
19/* The max length of strings including NUL: set and type identifiers */ 21/* The max length of strings including NUL: set and type identifiers */
20#define IPSET_MAXNAMELEN 32 22#define IPSET_MAXNAMELEN 32
21 23
@@ -110,6 +112,7 @@ enum {
110 IPSET_ATTR_IFACE, 112 IPSET_ATTR_IFACE,
111 IPSET_ATTR_BYTES, 113 IPSET_ATTR_BYTES,
112 IPSET_ATTR_PACKETS, 114 IPSET_ATTR_PACKETS,
115 IPSET_ATTR_COMMENT,
113 __IPSET_ATTR_ADT_MAX, 116 __IPSET_ATTR_ADT_MAX,
114}; 117};
115#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) 118#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -140,6 +143,7 @@ enum ipset_errno {
140 IPSET_ERR_IPADDR_IPV4, 143 IPSET_ERR_IPADDR_IPV4,
141 IPSET_ERR_IPADDR_IPV6, 144 IPSET_ERR_IPADDR_IPV6,
142 IPSET_ERR_COUNTER, 145 IPSET_ERR_COUNTER,
146 IPSET_ERR_COMMENT,
143 147
144 /* Type specific error codes */ 148 /* Type specific error codes */
145 IPSET_ERR_TYPE_SPECIFIC = 4352, 149 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -176,6 +180,8 @@ enum ipset_cadt_flags {
176 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), 180 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
177 IPSET_FLAG_BIT_WITH_COUNTERS = 3, 181 IPSET_FLAG_BIT_WITH_COUNTERS = 3,
178 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), 182 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
183 IPSET_FLAG_BIT_WITH_COMMENT = 4,
184 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
179 IPSET_FLAG_CADT_MAX = 15, 185 IPSET_FLAG_CADT_MAX = 15,
180}; 186};
181 187
@@ -250,6 +256,14 @@ struct ip_set_req_get_set {
250#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ 256#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
251/* Uses ip_set_req_get_set */ 257/* Uses ip_set_req_get_set */
252 258
259#define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */
260struct ip_set_req_get_set_family {
261 unsigned int op;
262 unsigned int version;
263 unsigned int family;
264 union ip_set_name_index set;
265};
266
253#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ 267#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
254struct ip_set_req_version { 268struct ip_set_req_version {
255 unsigned int op; 269 unsigned int op;
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 8dd803818ebe..319f47128db8 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -25,6 +25,10 @@ enum ip_conntrack_info {
25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
26}; 26};
27 27
28#define NF_CT_STATE_INVALID_BIT (1 << 0)
29#define NF_CT_STATE_BIT(ctinfo) (1 << ((ctinfo) % IP_CT_IS_REPLY + 1))
30#define NF_CT_STATE_UNTRACKED_BIT (1 << (IP_CT_NUMBER + 1))
31
28/* Bitset representing status of connection. */ 32/* Bitset representing status of connection. */
29enum ip_conntrack_status { 33enum ip_conntrack_status {
30 /* It's an expected connection: bit 0 set. This bit never changed */ 34 /* It's an expected connection: bit 0 set. This bit never changed */
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
new file mode 100644
index 000000000000..fbfd229a8e99
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -0,0 +1,718 @@
1#ifndef _LINUX_NF_TABLES_H
2#define _LINUX_NF_TABLES_H
3
4#define NFT_CHAIN_MAXNAMELEN 32
5
6enum nft_registers {
7 NFT_REG_VERDICT,
8 NFT_REG_1,
9 NFT_REG_2,
10 NFT_REG_3,
11 NFT_REG_4,
12 __NFT_REG_MAX
13};
14#define NFT_REG_MAX (__NFT_REG_MAX - 1)
15
16/**
17 * enum nft_verdicts - nf_tables internal verdicts
18 *
19 * @NFT_CONTINUE: continue evaluation of the current rule
20 * @NFT_BREAK: terminate evaluation of the current rule
21 * @NFT_JUMP: push the current chain on the jump stack and jump to a chain
22 * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack
23 * @NFT_RETURN: return to the topmost chain on the jump stack
24 *
25 * The nf_tables verdicts share their numeric space with the netfilter verdicts.
26 */
27enum nft_verdicts {
28 NFT_CONTINUE = -1,
29 NFT_BREAK = -2,
30 NFT_JUMP = -3,
31 NFT_GOTO = -4,
32 NFT_RETURN = -5,
33};
34
35/**
36 * enum nf_tables_msg_types - nf_tables netlink message types
37 *
38 * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes)
39 * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes)
40 * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes)
41 * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes)
42 * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes)
43 * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes)
44 * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes)
45 * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes)
46 * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes)
47 * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes)
48 * @NFT_MSG_GETSET: get a set (enum nft_set_attributes)
49 * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes)
50 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
51 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
52 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
53 */
54enum nf_tables_msg_types {
55 NFT_MSG_NEWTABLE,
56 NFT_MSG_GETTABLE,
57 NFT_MSG_DELTABLE,
58 NFT_MSG_NEWCHAIN,
59 NFT_MSG_GETCHAIN,
60 NFT_MSG_DELCHAIN,
61 NFT_MSG_NEWRULE,
62 NFT_MSG_GETRULE,
63 NFT_MSG_DELRULE,
64 NFT_MSG_NEWSET,
65 NFT_MSG_GETSET,
66 NFT_MSG_DELSET,
67 NFT_MSG_NEWSETELEM,
68 NFT_MSG_GETSETELEM,
69 NFT_MSG_DELSETELEM,
70 NFT_MSG_MAX,
71};
72
73/**
74 * enum nft_list_attributes - nf_tables generic list netlink attributes
75 *
76 * @NFTA_LIST_ELEM: list element (NLA_NESTED)
77 */
78enum nft_list_attributes {
79 NFTA_LIST_UNPEC,
80 NFTA_LIST_ELEM,
81 __NFTA_LIST_MAX
82};
83#define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1)
84
85/**
86 * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes
87 *
88 * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32)
89 * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32)
90 */
91enum nft_hook_attributes {
92 NFTA_HOOK_UNSPEC,
93 NFTA_HOOK_HOOKNUM,
94 NFTA_HOOK_PRIORITY,
95 __NFTA_HOOK_MAX
96};
97#define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
98
99/**
100 * enum nft_table_flags - nf_tables table flags
101 *
102 * @NFT_TABLE_F_DORMANT: this table is not active
103 */
104enum nft_table_flags {
105 NFT_TABLE_F_DORMANT = 0x1,
106};
107
108/**
109 * enum nft_table_attributes - nf_tables table netlink attributes
110 *
111 * @NFTA_TABLE_NAME: name of the table (NLA_STRING)
112 * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32)
113 */
114enum nft_table_attributes {
115 NFTA_TABLE_UNSPEC,
116 NFTA_TABLE_NAME,
117 NFTA_TABLE_FLAGS,
118 __NFTA_TABLE_MAX
119};
120#define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1)
121
122/**
123 * enum nft_chain_attributes - nf_tables chain netlink attributes
124 *
125 * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING)
126 * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64)
127 * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING)
128 * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes)
129 * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32)
130 * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32)
131 * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING)
132 * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes)
133 */
134enum nft_chain_attributes {
135 NFTA_CHAIN_UNSPEC,
136 NFTA_CHAIN_TABLE,
137 NFTA_CHAIN_HANDLE,
138 NFTA_CHAIN_NAME,
139 NFTA_CHAIN_HOOK,
140 NFTA_CHAIN_POLICY,
141 NFTA_CHAIN_USE,
142 NFTA_CHAIN_TYPE,
143 NFTA_CHAIN_COUNTERS,
144 __NFTA_CHAIN_MAX
145};
146#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
147
148/**
149 * enum nft_rule_attributes - nf_tables rule netlink attributes
150 *
151 * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING)
152 * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING)
153 * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64)
154 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
155 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
156 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
157 */
158enum nft_rule_attributes {
159 NFTA_RULE_UNSPEC,
160 NFTA_RULE_TABLE,
161 NFTA_RULE_CHAIN,
162 NFTA_RULE_HANDLE,
163 NFTA_RULE_EXPRESSIONS,
164 NFTA_RULE_COMPAT,
165 NFTA_RULE_POSITION,
166 __NFTA_RULE_MAX
167};
168#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
169
170/**
171 * enum nft_rule_compat_flags - nf_tables rule compat flags
172 *
173 * @NFT_RULE_COMPAT_F_INV: invert the check result
174 */
175enum nft_rule_compat_flags {
176 NFT_RULE_COMPAT_F_INV = (1 << 1),
177 NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
178};
179
180/**
181 * enum nft_rule_compat_attributes - nf_tables rule compat attributes
182 *
183 * @NFTA_RULE_COMPAT_PROTO: numerice value of handled protocol (NLA_U32)
184 * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32)
185 */
186enum nft_rule_compat_attributes {
187 NFTA_RULE_COMPAT_UNSPEC,
188 NFTA_RULE_COMPAT_PROTO,
189 NFTA_RULE_COMPAT_FLAGS,
190 __NFTA_RULE_COMPAT_MAX
191};
192#define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1)
193
194/**
195 * enum nft_set_flags - nf_tables set flags
196 *
197 * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink
198 * @NFT_SET_CONSTANT: set contents may not change while bound
199 * @NFT_SET_INTERVAL: set contains intervals
200 * @NFT_SET_MAP: set is used as a dictionary
201 */
202enum nft_set_flags {
203 NFT_SET_ANONYMOUS = 0x1,
204 NFT_SET_CONSTANT = 0x2,
205 NFT_SET_INTERVAL = 0x4,
206 NFT_SET_MAP = 0x8,
207};
208
209/**
210 * enum nft_set_attributes - nf_tables set netlink attributes
211 *
212 * @NFTA_SET_TABLE: table name (NLA_STRING)
213 * @NFTA_SET_NAME: set name (NLA_STRING)
214 * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32)
215 * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32)
216 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
217 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
218 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
219 */
220enum nft_set_attributes {
221 NFTA_SET_UNSPEC,
222 NFTA_SET_TABLE,
223 NFTA_SET_NAME,
224 NFTA_SET_FLAGS,
225 NFTA_SET_KEY_TYPE,
226 NFTA_SET_KEY_LEN,
227 NFTA_SET_DATA_TYPE,
228 NFTA_SET_DATA_LEN,
229 __NFTA_SET_MAX
230};
231#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
232
233/**
234 * enum nft_set_elem_flags - nf_tables set element flags
235 *
236 * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval
237 */
238enum nft_set_elem_flags {
239 NFT_SET_ELEM_INTERVAL_END = 0x1,
240};
241
242/**
243 * enum nft_set_elem_attributes - nf_tables set element netlink attributes
244 *
245 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
246 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
247 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
248 */
249enum nft_set_elem_attributes {
250 NFTA_SET_ELEM_UNSPEC,
251 NFTA_SET_ELEM_KEY,
252 NFTA_SET_ELEM_DATA,
253 NFTA_SET_ELEM_FLAGS,
254 __NFTA_SET_ELEM_MAX
255};
256#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
257
258/**
259 * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes
260 *
261 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
262 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
263 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
264 */
265enum nft_set_elem_list_attributes {
266 NFTA_SET_ELEM_LIST_UNSPEC,
267 NFTA_SET_ELEM_LIST_TABLE,
268 NFTA_SET_ELEM_LIST_SET,
269 NFTA_SET_ELEM_LIST_ELEMENTS,
270 __NFTA_SET_ELEM_LIST_MAX
271};
272#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
273
274/**
275 * enum nft_data_types - nf_tables data types
276 *
277 * @NFT_DATA_VALUE: generic data
278 * @NFT_DATA_VERDICT: netfilter verdict
279 *
280 * The type of data is usually determined by the kernel directly and is not
281 * explicitly specified by userspace. The only difference are sets, where
282 * userspace specifies the key and mapping data types.
283 *
284 * The values 0xffffff00-0xffffffff are reserved for internally used types.
285 * The remaining range can be freely used by userspace to encode types, all
286 * values are equivalent to NFT_DATA_VALUE.
287 */
288enum nft_data_types {
289 NFT_DATA_VALUE,
290 NFT_DATA_VERDICT = 0xffffff00U,
291};
292
293#define NFT_DATA_RESERVED_MASK 0xffffff00U
294
295/**
296 * enum nft_data_attributes - nf_tables data netlink attributes
297 *
298 * @NFTA_DATA_VALUE: generic data (NLA_BINARY)
299 * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes)
300 */
301enum nft_data_attributes {
302 NFTA_DATA_UNSPEC,
303 NFTA_DATA_VALUE,
304 NFTA_DATA_VERDICT,
305 __NFTA_DATA_MAX
306};
307#define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
308
309/**
310 * enum nft_verdict_attributes - nf_tables verdict netlink attributes
311 *
312 * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts)
313 * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING)
314 */
315enum nft_verdict_attributes {
316 NFTA_VERDICT_UNSPEC,
317 NFTA_VERDICT_CODE,
318 NFTA_VERDICT_CHAIN,
319 __NFTA_VERDICT_MAX
320};
321#define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1)
322
323/**
324 * enum nft_expr_attributes - nf_tables expression netlink attributes
325 *
326 * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING)
327 * @NFTA_EXPR_DATA: type specific data (NLA_NESTED)
328 */
329enum nft_expr_attributes {
330 NFTA_EXPR_UNSPEC,
331 NFTA_EXPR_NAME,
332 NFTA_EXPR_DATA,
333 __NFTA_EXPR_MAX
334};
335#define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1)
336
337/**
338 * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes
339 *
340 * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32)
341 * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes)
342 */
343enum nft_immediate_attributes {
344 NFTA_IMMEDIATE_UNSPEC,
345 NFTA_IMMEDIATE_DREG,
346 NFTA_IMMEDIATE_DATA,
347 __NFTA_IMMEDIATE_MAX
348};
349#define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
350
351/**
352 * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes
353 *
354 * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers)
355 * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers)
356 * @NFTA_BITWISE_LEN: length of operands (NLA_U32)
357 * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
358 * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
359 *
360 * The bitwise expression performs the following operation:
361 *
362 * dreg = (sreg & mask) ^ xor
363 *
364 * which allow to express all bitwise operations:
365 *
366 * mask xor
367 * NOT: 1 1
368 * OR: 0 x
369 * XOR: 1 x
370 * AND: x 0
371 */
372enum nft_bitwise_attributes {
373 NFTA_BITWISE_UNSPEC,
374 NFTA_BITWISE_SREG,
375 NFTA_BITWISE_DREG,
376 NFTA_BITWISE_LEN,
377 NFTA_BITWISE_MASK,
378 NFTA_BITWISE_XOR,
379 __NFTA_BITWISE_MAX
380};
381#define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
382
383/**
384 * enum nft_byteorder_ops - nf_tables byteorder operators
385 *
386 * @NFT_BYTEORDER_NTOH: network to host operator
387 * @NFT_BYTEORDER_HTON: host to network opertaor
388 */
389enum nft_byteorder_ops {
390 NFT_BYTEORDER_NTOH,
391 NFT_BYTEORDER_HTON,
392};
393
394/**
395 * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes
396 *
397 * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers)
398 * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers)
399 * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops)
400 * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32)
401 * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4)
402 */
403enum nft_byteorder_attributes {
404 NFTA_BYTEORDER_UNSPEC,
405 NFTA_BYTEORDER_SREG,
406 NFTA_BYTEORDER_DREG,
407 NFTA_BYTEORDER_OP,
408 NFTA_BYTEORDER_LEN,
409 NFTA_BYTEORDER_SIZE,
410 __NFTA_BYTEORDER_MAX
411};
412#define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1)
413
414/**
415 * enum nft_cmp_ops - nf_tables relational operator
416 *
417 * @NFT_CMP_EQ: equal
418 * @NFT_CMP_NEQ: not equal
419 * @NFT_CMP_LT: less than
420 * @NFT_CMP_LTE: less than or equal to
421 * @NFT_CMP_GT: greater than
422 * @NFT_CMP_GTE: greater than or equal to
423 */
424enum nft_cmp_ops {
425 NFT_CMP_EQ,
426 NFT_CMP_NEQ,
427 NFT_CMP_LT,
428 NFT_CMP_LTE,
429 NFT_CMP_GT,
430 NFT_CMP_GTE,
431};
432
433/**
434 * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes
435 *
436 * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers)
437 * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops)
438 * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes)
439 */
440enum nft_cmp_attributes {
441 NFTA_CMP_UNSPEC,
442 NFTA_CMP_SREG,
443 NFTA_CMP_OP,
444 NFTA_CMP_DATA,
445 __NFTA_CMP_MAX
446};
447#define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1)
448
449/**
450 * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes
451 *
452 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
453 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
454 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
455 */
456enum nft_lookup_attributes {
457 NFTA_LOOKUP_UNSPEC,
458 NFTA_LOOKUP_SET,
459 NFTA_LOOKUP_SREG,
460 NFTA_LOOKUP_DREG,
461 __NFTA_LOOKUP_MAX
462};
463#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
464
465/**
466 * enum nft_payload_bases - nf_tables payload expression offset bases
467 *
468 * @NFT_PAYLOAD_LL_HEADER: link layer header
469 * @NFT_PAYLOAD_NETWORK_HEADER: network header
470 * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header
471 */
472enum nft_payload_bases {
473 NFT_PAYLOAD_LL_HEADER,
474 NFT_PAYLOAD_NETWORK_HEADER,
475 NFT_PAYLOAD_TRANSPORT_HEADER,
476};
477
478/**
479 * enum nft_payload_attributes - nf_tables payload expression netlink attributes
480 *
481 * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
482 * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
483 * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
484 * @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
485 */
486enum nft_payload_attributes {
487 NFTA_PAYLOAD_UNSPEC,
488 NFTA_PAYLOAD_DREG,
489 NFTA_PAYLOAD_BASE,
490 NFTA_PAYLOAD_OFFSET,
491 NFTA_PAYLOAD_LEN,
492 __NFTA_PAYLOAD_MAX
493};
494#define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
495
496/**
497 * enum nft_exthdr_attributes - nf_tables IPv6 extension header expression netlink attributes
498 *
499 * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers)
500 * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8)
501 * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32)
502 * @NFTA_EXTHDR_LEN: extension header length (NLA_U32)
503 */
504enum nft_exthdr_attributes {
505 NFTA_EXTHDR_UNSPEC,
506 NFTA_EXTHDR_DREG,
507 NFTA_EXTHDR_TYPE,
508 NFTA_EXTHDR_OFFSET,
509 NFTA_EXTHDR_LEN,
510 __NFTA_EXTHDR_MAX
511};
512#define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1)
513
514/**
515 * enum nft_meta_keys - nf_tables meta expression keys
516 *
517 * @NFT_META_LEN: packet length (skb->len)
518 * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT
519 * @NFT_META_PRIORITY: packet priority (skb->priority)
520 * @NFT_META_MARK: packet mark (skb->mark)
521 * @NFT_META_IIF: packet input interface index (dev->ifindex)
522 * @NFT_META_OIF: packet output interface index (dev->ifindex)
523 * @NFT_META_IIFNAME: packet input interface name (dev->name)
524 * @NFT_META_OIFNAME: packet output interface name (dev->name)
525 * @NFT_META_IIFTYPE: packet input interface type (dev->type)
526 * @NFT_META_OIFTYPE: packet output interface type (dev->type)
527 * @NFT_META_SKUID: originating socket UID (fsuid)
528 * @NFT_META_SKGID: originating socket GID (fsgid)
529 * @NFT_META_NFTRACE: packet nftrace bit
530 * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid)
531 * @NFT_META_SECMARK: packet secmark (skb->secmark)
532 */
533enum nft_meta_keys {
534 NFT_META_LEN,
535 NFT_META_PROTOCOL,
536 NFT_META_PRIORITY,
537 NFT_META_MARK,
538 NFT_META_IIF,
539 NFT_META_OIF,
540 NFT_META_IIFNAME,
541 NFT_META_OIFNAME,
542 NFT_META_IIFTYPE,
543 NFT_META_OIFTYPE,
544 NFT_META_SKUID,
545 NFT_META_SKGID,
546 NFT_META_NFTRACE,
547 NFT_META_RTCLASSID,
548 NFT_META_SECMARK,
549};
550
551/**
552 * enum nft_meta_attributes - nf_tables meta expression netlink attributes
553 *
554 * @NFTA_META_DREG: destination register (NLA_U32)
555 * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys)
556 */
557enum nft_meta_attributes {
558 NFTA_META_UNSPEC,
559 NFTA_META_DREG,
560 NFTA_META_KEY,
561 __NFTA_META_MAX
562};
563#define NFTA_META_MAX (__NFTA_META_MAX - 1)
564
565/**
566 * enum nft_ct_keys - nf_tables ct expression keys
567 *
568 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
569 * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir)
570 * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status)
571 * @NFT_CT_MARK: conntrack mark value
572 * @NFT_CT_SECMARK: conntrack secmark value
573 * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
574 * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
575 * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
576 * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address)
577 * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address)
578 * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
579 * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
580 * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
581 */
582enum nft_ct_keys {
583 NFT_CT_STATE,
584 NFT_CT_DIRECTION,
585 NFT_CT_STATUS,
586 NFT_CT_MARK,
587 NFT_CT_SECMARK,
588 NFT_CT_EXPIRATION,
589 NFT_CT_HELPER,
590 NFT_CT_L3PROTOCOL,
591 NFT_CT_SRC,
592 NFT_CT_DST,
593 NFT_CT_PROTOCOL,
594 NFT_CT_PROTO_SRC,
595 NFT_CT_PROTO_DST,
596};
597
598/**
599 * enum nft_ct_attributes - nf_tables ct expression netlink attributes
600 *
601 * @NFTA_CT_DREG: destination register (NLA_U32)
602 * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys)
603 * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8)
604 */
605enum nft_ct_attributes {
606 NFTA_CT_UNSPEC,
607 NFTA_CT_DREG,
608 NFTA_CT_KEY,
609 NFTA_CT_DIRECTION,
610 __NFTA_CT_MAX
611};
612#define NFTA_CT_MAX (__NFTA_CT_MAX - 1)
613
614/**
615 * enum nft_limit_attributes - nf_tables limit expression netlink attributes
616 *
617 * @NFTA_LIMIT_RATE: refill rate (NLA_U64)
618 * @NFTA_LIMIT_UNIT: refill unit (NLA_U64)
619 */
620enum nft_limit_attributes {
621 NFTA_LIMIT_UNSPEC,
622 NFTA_LIMIT_RATE,
623 NFTA_LIMIT_UNIT,
624 __NFTA_LIMIT_MAX
625};
626#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
627
628/**
629 * enum nft_counter_attributes - nf_tables counter expression netlink attributes
630 *
631 * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64)
632 * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64)
633 */
634enum nft_counter_attributes {
635 NFTA_COUNTER_UNSPEC,
636 NFTA_COUNTER_BYTES,
637 NFTA_COUNTER_PACKETS,
638 __NFTA_COUNTER_MAX
639};
640#define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1)
641
642/**
643 * enum nft_log_attributes - nf_tables log expression netlink attributes
644 *
645 * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32)
646 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
647 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
648 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
649 */
650enum nft_log_attributes {
651 NFTA_LOG_UNSPEC,
652 NFTA_LOG_GROUP,
653 NFTA_LOG_PREFIX,
654 NFTA_LOG_SNAPLEN,
655 NFTA_LOG_QTHRESHOLD,
656 __NFTA_LOG_MAX
657};
658#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
659
660/**
661 * enum nft_reject_types - nf_tables reject expression reject types
662 *
663 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
664 * @NFT_REJECT_TCP_RST: reject using TCP RST
665 */
666enum nft_reject_types {
667 NFT_REJECT_ICMP_UNREACH,
668 NFT_REJECT_TCP_RST,
669};
670
671/**
672 * enum nft_reject_attributes - nf_tables reject expression netlink attributes
673 *
674 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
675 * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8)
676 */
677enum nft_reject_attributes {
678 NFTA_REJECT_UNSPEC,
679 NFTA_REJECT_TYPE,
680 NFTA_REJECT_ICMP_CODE,
681 __NFTA_REJECT_MAX
682};
683#define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1)
684
685/**
686 * enum nft_nat_types - nf_tables nat expression NAT types
687 *
688 * @NFT_NAT_SNAT: source NAT
689 * @NFT_NAT_DNAT: destination NAT
690 */
691enum nft_nat_types {
692 NFT_NAT_SNAT,
693 NFT_NAT_DNAT,
694};
695
696/**
697 * enum nft_nat_attributes - nf_tables nat expression netlink attributes
698 *
699 * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types)
700 * @NFTA_NAT_FAMILY: NAT family (NLA_U32)
701 * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers)
702 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
703 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
704 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
705 */
706enum nft_nat_attributes {
707 NFTA_NAT_UNSPEC,
708 NFTA_NAT_TYPE,
709 NFTA_NAT_FAMILY,
710 NFTA_NAT_REG_ADDR_MIN,
711 NFTA_NAT_REG_ADDR_MAX,
712 NFTA_NAT_REG_PROTO_MIN,
713 NFTA_NAT_REG_PROTO_MAX,
714 __NFTA_NAT_MAX
715};
716#define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
717
718#endif /* _LINUX_NF_TABLES_H */
diff --git a/include/uapi/linux/netfilter/nf_tables_compat.h b/include/uapi/linux/netfilter/nf_tables_compat.h
new file mode 100644
index 000000000000..8310f5f76551
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_tables_compat.h
@@ -0,0 +1,38 @@
1#ifndef _NFT_COMPAT_NFNETLINK_H_
2#define _NFT_COMPAT_NFNETLINK_H_
3
4enum nft_target_attributes {
5 NFTA_TARGET_UNSPEC,
6 NFTA_TARGET_NAME,
7 NFTA_TARGET_REV,
8 NFTA_TARGET_INFO,
9 __NFTA_TARGET_MAX
10};
11#define NFTA_TARGET_MAX (__NFTA_TARGET_MAX - 1)
12
13enum nft_match_attributes {
14 NFTA_MATCH_UNSPEC,
15 NFTA_MATCH_NAME,
16 NFTA_MATCH_REV,
17 NFTA_MATCH_INFO,
18 __NFTA_MATCH_MAX
19};
20#define NFTA_MATCH_MAX (__NFTA_MATCH_MAX - 1)
21
22#define NFT_COMPAT_NAME_MAX 32
23
24enum {
25 NFNL_MSG_COMPAT_GET,
26 NFNL_MSG_COMPAT_MAX
27};
28
29enum {
30 NFTA_COMPAT_UNSPEC = 0,
31 NFTA_COMPAT_NAME,
32 NFTA_COMPAT_REV,
33 NFTA_COMPAT_TYPE,
34 __NFTA_COMPAT_MAX,
35};
36#define NFTA_COMPAT_MAX (__NFTA_COMPAT_MAX - 1)
37
38#endif
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
index 4a4efafad5f4..596ddd45253c 100644
--- a/include/uapi/linux/netfilter/nfnetlink.h
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -18,6 +18,8 @@ enum nfnetlink_groups {
18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE 18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
19 NFNLGRP_CONNTRACK_EXP_DESTROY, 19 NFNLGRP_CONNTRACK_EXP_DESTROY,
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY 20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 NFNLGRP_NFTABLES,
22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
21 __NFNLGRP_MAX, 23 __NFNLGRP_MAX,
22}; 24};
23#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 25#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
@@ -51,6 +53,12 @@ struct nfgenmsg {
51#define NFNL_SUBSYS_ACCT 7 53#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 54#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_CTHELPER 9 55#define NFNL_SUBSYS_CTHELPER 9
54#define NFNL_SUBSYS_COUNT 10 56#define NFNL_SUBSYS_NFTABLES 10
57#define NFNL_SUBSYS_NFT_COMPAT 11
58#define NFNL_SUBSYS_COUNT 12
59
60/* Reserved control nfnetlink messages */
61#define NFNL_MSG_BATCH_BEGIN NLMSG_MIN_TYPE
62#define NFNL_MSG_BATCH_END NLMSG_MIN_TYPE+1
55 63
56#endif /* _UAPI_NFNETLINK_H */ 64#endif /* _UAPI_NFNETLINK_H */
diff --git a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
index a2810a7c5e30..1ab0b97b3a1e 100644
--- a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
@@ -6,6 +6,8 @@ enum ctnl_timeout_msg_types {
6 IPCTNL_MSG_TIMEOUT_NEW, 6 IPCTNL_MSG_TIMEOUT_NEW,
7 IPCTNL_MSG_TIMEOUT_GET, 7 IPCTNL_MSG_TIMEOUT_GET,
8 IPCTNL_MSG_TIMEOUT_DELETE, 8 IPCTNL_MSG_TIMEOUT_DELETE,
9 IPCTNL_MSG_TIMEOUT_DEFAULT_SET,
10 IPCTNL_MSG_TIMEOUT_DEFAULT_GET,
9 11
10 IPCTNL_MSG_TIMEOUT_MAX 12 IPCTNL_MSG_TIMEOUT_MAX
11}; 13};
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 29bed72a4ac4..6ad6cc03ccd3 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -85,6 +85,7 @@
85 * a specific SE notifies us about the end of a transaction. The parameter 85 * a specific SE notifies us about the end of a transaction. The parameter
86 * for this event is the application ID (AID). 86 * for this event is the application ID (AID).
87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. 87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller.
88 * @NFC_CMD_SE_IO: Send/Receive APDUs to/from the selected secure element.
88 */ 89 */
89enum nfc_commands { 90enum nfc_commands {
90 NFC_CMD_UNSPEC, 91 NFC_CMD_UNSPEC,
@@ -114,6 +115,7 @@ enum nfc_commands {
114 NFC_EVENT_SE_CONNECTIVITY, 115 NFC_EVENT_SE_CONNECTIVITY,
115 NFC_EVENT_SE_TRANSACTION, 116 NFC_EVENT_SE_TRANSACTION,
116 NFC_CMD_GET_SE, 117 NFC_CMD_GET_SE,
118 NFC_CMD_SE_IO,
117/* private: internal use only */ 119/* private: internal use only */
118 __NFC_CMD_AFTER_LAST 120 __NFC_CMD_AFTER_LAST
119}; 121};
@@ -147,6 +149,7 @@ enum nfc_commands {
147 * @NFC_ATTR_SE_INDEX: Secure element index 149 * @NFC_ATTR_SE_INDEX: Secure element index
148 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) 150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
149 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status 151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status
152 * @NFC_ATTR_APDU: Secure element APDU
150 */ 153 */
151enum nfc_attrs { 154enum nfc_attrs {
152 NFC_ATTR_UNSPEC, 155 NFC_ATTR_UNSPEC,
@@ -174,6 +177,7 @@ enum nfc_attrs {
174 NFC_ATTR_SE_TYPE, 177 NFC_ATTR_SE_TYPE,
175 NFC_ATTR_SE_AID, 178 NFC_ATTR_SE_AID,
176 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, 179 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
180 NFC_ATTR_SE_APDU,
177/* private: internal use only */ 181/* private: internal use only */
178 __NFC_ATTR_AFTER_LAST 182 __NFC_ATTR_AFTER_LAST
179}; 183};
diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h
index 576bddd72e04..64b0f22f5c4c 100644
--- a/include/uapi/linux/nfs_mount.h
+++ b/include/uapi/linux/nfs_mount.h
@@ -60,7 +60,7 @@ struct nfs_mount_data {
60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ 60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
61#define NFS_MOUNT_NOACL 0x0800 /* 4 */ 61#define NFS_MOUNT_NOACL 0x0800 /* 4 */
62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */
64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ 64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ 65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
66#define NFS_MOUNT_FLAGMASK 0xFFFF 66#define NFS_MOUNT_FLAGMASK 0xFFFF
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fde2c021b26d..f752e9821e71 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -988,7 +988,7 @@ enum nl80211_commands {
988 * to query the CRDA to retrieve one regulatory domain. This attribute can 988 * to query the CRDA to retrieve one regulatory domain. This attribute can
989 * also be used by userspace to query the kernel for the currently set 989 * also be used by userspace to query the kernel for the currently set
990 * regulatory domain. We chose an alpha2 as that is also used by the 990 * regulatory domain. We chose an alpha2 as that is also used by the
991 * IEEE-802.11d country information element to identify a country. 991 * IEEE-802.11 country information element to identify a country.
992 * Users can also simply ask the wireless core to set regulatory domain 992 * Users can also simply ask the wireless core to set regulatory domain
993 * to a specific alpha2. 993 * to a specific alpha2.
994 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory 994 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
@@ -1496,6 +1496,18 @@ enum nl80211_commands {
1496 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. 1496 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
1497 * As specified in the &enum nl80211_rxmgmt_flags. 1497 * As specified in the &enum nl80211_rxmgmt_flags.
1498 * 1498 *
1499 * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
1500 *
1501 * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
1502 * supported operating classes.
1503 *
1504 * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space
1505 * controls DFS operation in IBSS mode. If the flag is included in
1506 * %NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS
1507 * channels and reports radar events to userspace. Userspace is required
1508 * to react to radar events, e.g. initiate a channel switch or leave the
1509 * IBSS network.
1510 *
1499 * @NL80211_ATTR_MAX: highest attribute number currently defined 1511 * @NL80211_ATTR_MAX: highest attribute number currently defined
1500 * @__NL80211_ATTR_AFTER_LAST: internal use 1512 * @__NL80211_ATTR_AFTER_LAST: internal use
1501 */ 1513 */
@@ -1806,6 +1818,12 @@ enum nl80211_attrs {
1806 1818
1807 NL80211_ATTR_RXMGMT_FLAGS, 1819 NL80211_ATTR_RXMGMT_FLAGS,
1808 1820
1821 NL80211_ATTR_STA_SUPPORTED_CHANNELS,
1822
1823 NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
1824
1825 NL80211_ATTR_HANDLE_DFS,
1826
1809 /* add attributes here, update the policy in nl80211.c */ 1827 /* add attributes here, update the policy in nl80211.c */
1810 1828
1811 __NL80211_ATTR_AFTER_LAST, 1829 __NL80211_ATTR_AFTER_LAST,
@@ -3860,13 +3878,12 @@ enum nl80211_radar_event {
3860 * 3878 *
3861 * Channel states used by the DFS code. 3879 * Channel states used by the DFS code.
3862 * 3880 *
3863 * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability 3881 * @NL80211_DFS_USABLE: The channel can be used, but channel availability
3864 * check (CAC) must be performed before using it for AP or IBSS. 3882 * check (CAC) must be performed before using it for AP or IBSS.
3865 * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it 3883 * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
3866 * is therefore marked as not available. 3884 * is therefore marked as not available.
3867 * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available. 3885 * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
3868 */ 3886 */
3869
3870enum nl80211_dfs_state { 3887enum nl80211_dfs_state {
3871 NL80211_DFS_USABLE, 3888 NL80211_DFS_USABLE,
3872 NL80211_DFS_UNAVAILABLE, 3889 NL80211_DFS_UNAVAILABLE,
diff --git a/include/uapi/linux/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/perf_event.h b/include/uapi/linux/perf_event.h
index ca1d90bcb74d..e1802d6153ae 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -136,8 +136,9 @@ enum perf_event_sample_format {
136 PERF_SAMPLE_WEIGHT = 1U << 14, 136 PERF_SAMPLE_WEIGHT = 1U << 14,
137 PERF_SAMPLE_DATA_SRC = 1U << 15, 137 PERF_SAMPLE_DATA_SRC = 1U << 15,
138 PERF_SAMPLE_IDENTIFIER = 1U << 16, 138 PERF_SAMPLE_IDENTIFIER = 1U << 16,
139 PERF_SAMPLE_TRANSACTION = 1U << 17,
139 140
140 PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */ 141 PERF_SAMPLE_MAX = 1U << 18, /* non-ABI */
141}; 142};
142 143
143/* 144/*
@@ -181,6 +182,28 @@ enum perf_sample_regs_abi {
181}; 182};
182 183
183/* 184/*
185 * Values for the memory transaction event qualifier, mostly for
186 * abort events. Multiple bits can be set.
187 */
188enum {
189 PERF_TXN_ELISION = (1 << 0), /* From elision */
190 PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */
191 PERF_TXN_SYNC = (1 << 2), /* Instruction is related */
192 PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */
193 PERF_TXN_RETRY = (1 << 4), /* Retry possible */
194 PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */
195 PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */
196 PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */
197
198 PERF_TXN_MAX = (1 << 8), /* non-ABI */
199
200 /* bits 32..63 are reserved for the abort code */
201
202 PERF_TXN_ABORT_MASK = (0xffffffffULL << 32),
203 PERF_TXN_ABORT_SHIFT = 32,
204};
205
206/*
184 * The format of the data returned by read() on a perf event fd, 207 * The format of the data returned by read() on a perf event fd,
185 * as specified by attr.read_format: 208 * as specified by attr.read_format:
186 * 209 *
@@ -324,7 +347,7 @@ struct perf_event_attr {
324#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) 347#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
325#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) 348#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
326#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) 349#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
327#define PERF_EVENT_IOC_ID _IOR('$', 7, u64 *) 350#define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *)
328 351
329enum perf_event_ioc_flags { 352enum perf_event_ioc_flags {
330 PERF_IOC_FLAG_GROUP = 1U << 0, 353 PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -380,10 +403,13 @@ struct perf_event_mmap_page {
380 union { 403 union {
381 __u64 capabilities; 404 __u64 capabilities;
382 struct { 405 struct {
383 __u64 cap_usr_time : 1, 406 __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
384 cap_usr_rdpmc : 1, 407 cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */
385 cap_usr_time_zero : 1, 408
386 cap_____res : 61; 409 cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
410 cap_user_time : 1, /* The time_* fields are used */
411 cap_user_time_zero : 1, /* The time_zero field is used */
412 cap_____res : 59;
387 }; 413 };
388 }; 414 };
389 415
@@ -442,23 +468,26 @@ struct perf_event_mmap_page {
442 * ((rem * time_mult) >> time_shift); 468 * ((rem * time_mult) >> time_shift);
443 */ 469 */
444 __u64 time_zero; 470 __u64 time_zero;
471 __u32 size; /* Header size up to __reserved[] fields. */
445 472
446 /* 473 /*
447 * Hole for extension of the self monitor capabilities 474 * Hole for extension of the self monitor capabilities
448 */ 475 */
449 476
450 __u64 __reserved[119]; /* align to 1k */ 477 __u8 __reserved[118*8+4]; /* align to 1k. */
451 478
452 /* 479 /*
453 * Control data for the mmap() data buffer. 480 * Control data for the mmap() data buffer.
454 * 481 *
455 * User-space reading the @data_head value should issue an rmb(), on 482 * User-space reading the @data_head value should issue an smp_rmb(),
456 * SMP capable platforms, after reading this value -- see 483 * after reading this value.
457 * perf_event_wakeup().
458 * 484 *
459 * When the mapping is PROT_WRITE the @data_tail value should be 485 * When the mapping is PROT_WRITE the @data_tail value should be
460 * written by userspace to reflect the last read data. In this case 486 * written by userspace to reflect the last read data, after issueing
461 * the kernel will not over-write unread data. 487 * an smp_mb() to separate the data read from the ->data_tail store.
488 * In this case the kernel will not over-write unread data.
489 *
490 * See perf_output_put_handle() for the data ordering.
462 */ 491 */
463 __u64 data_head; /* head in the data section */ 492 __u64 data_head; /* head in the data section */
464 __u64 data_tail; /* user-space written tail */ 493 __u64 data_tail; /* user-space written tail */
@@ -528,6 +557,7 @@ enum perf_event_type {
528 * u64 len; 557 * u64 len;
529 * u64 pgoff; 558 * u64 pgoff;
530 * char filename[]; 559 * char filename[];
560 * struct sample_id sample_id;
531 * }; 561 * };
532 */ 562 */
533 PERF_RECORD_MMAP = 1, 563 PERF_RECORD_MMAP = 1,
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 082eafaf026b..25731dfb3fcc 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -388,6 +388,20 @@ enum {
388 388
389#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) 389#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
390 390
391/* BPF classifier */
392
393enum {
394 TCA_BPF_UNSPEC,
395 TCA_BPF_ACT,
396 TCA_BPF_POLICE,
397 TCA_BPF_CLASSID,
398 TCA_BPF_OPS_LEN,
399 TCA_BPF_OPS,
400 __TCA_BPF_MAX,
401};
402
403#define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
404
391/* Extended Matches */ 405/* Extended Matches */
392 406
393struct tcf_ematch_tree_hdr { 407struct tcf_ematch_tree_hdr {
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 9b829134d422..307f293477e8 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
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/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 0623ec4e728f..56f121605c99 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -1,5 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += tc_csum.h 2header-y += tc_csum.h
3header-y += tc_defact.h
3header-y += tc_gact.h 4header-y += tc_gact.h
4header-y += tc_ipt.h 5header-y += tc_ipt.h
5header-y += tc_mirred.h 6header-y += tc_mirred.h
diff --git a/include/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h
index 6f65d07c7ce2..17dddb40f740 100644
--- a/include/linux/tc_act/tc_defact.h
+++ b/include/uapi/linux/tc_act/tc_defact.h
@@ -6,7 +6,7 @@
6struct tc_defact { 6struct tc_defact {
7 tc_gen; 7 tc_gen;
8}; 8};
9 9
10enum { 10enum {
11 TCA_DEF_UNSPEC, 11 TCA_DEF_UNSPEC,
12 TCA_DEF_TM, 12 TCA_DEF_TM,
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 0b233c56b0e4..e3ddd86c90a6 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -87,8 +87,10 @@ 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 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, 91 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
91 IB_USER_VERBS_CMD_DESTROY_FLOW 92 IB_USER_VERBS_CMD_DESTROY_FLOW
93#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */
92}; 94};
93 95
94/* 96/*
@@ -126,6 +128,7 @@ struct ib_uverbs_cmd_hdr {
126 __u16 out_words; 128 __u16 out_words;
127}; 129};
128 130
131#ifdef CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING
129struct ib_uverbs_cmd_hdr_ex { 132struct ib_uverbs_cmd_hdr_ex {
130 __u32 command; 133 __u32 command;
131 __u16 in_words; 134 __u16 in_words;
@@ -134,6 +137,7 @@ struct ib_uverbs_cmd_hdr_ex {
134 __u16 provider_out_words; 137 __u16 provider_out_words;
135 __u32 cmd_hdr_reserved; 138 __u32 cmd_hdr_reserved;
136}; 139};
140#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */
137 141
138struct ib_uverbs_get_context { 142struct ib_uverbs_get_context {
139 __u64 response; 143 __u64 response;
@@ -696,6 +700,7 @@ struct ib_uverbs_detach_mcast {
696 __u64 driver_data[0]; 700 __u64 driver_data[0];
697}; 701};
698 702
703#ifdef CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING
699struct ib_kern_eth_filter { 704struct ib_kern_eth_filter {
700 __u8 dst_mac[6]; 705 __u8 dst_mac[6];
701 __u8 src_mac[6]; 706 __u8 src_mac[6];
@@ -780,6 +785,7 @@ struct ib_uverbs_destroy_flow {
780 __u32 comp_mask; 785 __u32 comp_mask;
781 __u32 flow_handle; 786 __u32 flow_handle;
782}; 787};
788#endif /* CONFIG_INFINIBAND_EXPERIMENTAL_UVERBS_FLOW_STEERING */
783 789
784struct ib_uverbs_create_srq { 790struct ib_uverbs_create_srq {
785 __u64 response; 791 __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/exynos_dp.h b/include/video/exynos_dp.h
deleted file mode 100644
index bd8cabd344db..000000000000
--- a/include/video/exynos_dp.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Samsung SoC DP device support
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EXYNOS_DP_H
13#define _EXYNOS_DP_H
14
15#define DP_TIMEOUT_LOOP_COUNT 100
16#define MAX_CR_LOOP 5
17#define MAX_EQ_LOOP 5
18
19enum link_rate_type {
20 LINK_RATE_1_62GBPS = 0x06,
21 LINK_RATE_2_70GBPS = 0x0a
22};
23
24enum link_lane_count_type {
25 LANE_COUNT1 = 1,
26 LANE_COUNT2 = 2,
27 LANE_COUNT4 = 4
28};
29
30enum link_training_state {
31 START,
32 CLOCK_RECOVERY,
33 EQUALIZER_TRAINING,
34 FINISHED,
35 FAILED
36};
37
38enum voltage_swing_level {
39 VOLTAGE_LEVEL_0,
40 VOLTAGE_LEVEL_1,
41 VOLTAGE_LEVEL_2,
42 VOLTAGE_LEVEL_3,
43};
44
45enum pre_emphasis_level {
46 PRE_EMPHASIS_LEVEL_0,
47 PRE_EMPHASIS_LEVEL_1,
48 PRE_EMPHASIS_LEVEL_2,
49 PRE_EMPHASIS_LEVEL_3,
50};
51
52enum pattern_set {
53 PRBS7,
54 D10_2,
55 TRAINING_PTN1,
56 TRAINING_PTN2,
57 DP_NONE
58};
59
60enum color_space {
61 COLOR_RGB,
62 COLOR_YCBCR422,
63 COLOR_YCBCR444
64};
65
66enum color_depth {
67 COLOR_6,
68 COLOR_8,
69 COLOR_10,
70 COLOR_12
71};
72
73enum color_coefficient {
74 COLOR_YCBCR601,
75 COLOR_YCBCR709
76};
77
78enum dynamic_range {
79 VESA,
80 CEA
81};
82
83enum pll_status {
84 PLL_UNLOCKED,
85 PLL_LOCKED
86};
87
88enum clock_recovery_m_value_type {
89 CALCULATED_M,
90 REGISTER_M
91};
92
93enum video_timing_recognition_type {
94 VIDEO_TIMING_FROM_CAPTURE,
95 VIDEO_TIMING_FROM_REGISTER
96};
97
98enum analog_power_block {
99 AUX_BLOCK,
100 CH0_BLOCK,
101 CH1_BLOCK,
102 CH2_BLOCK,
103 CH3_BLOCK,
104 ANALOG_TOTAL,
105 POWER_ALL
106};
107
108struct video_info {
109 char *name;
110
111 bool h_sync_polarity;
112 bool v_sync_polarity;
113 bool interlaced;
114
115 enum color_space color_space;
116 enum dynamic_range dynamic_range;
117 enum color_coefficient ycbcr_coeff;
118 enum color_depth color_depth;
119
120 enum link_rate_type link_rate;
121 enum link_lane_count_type lane_count;
122};
123
124struct exynos_dp_platdata {
125 struct video_info *video_info;
126
127 void (*phy_init)(void);
128 void (*phy_exit)(void);
129};
130
131#endif /* _EXYNOS_DP_H */
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
index 89dc88a171af..6a578f8a1b3e 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -216,6 +216,7 @@ struct mipi_dsim_config {
216 * automatically. 216 * automatically.
217 * @e_clk_src: select byte clock source. 217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data. 218 * @pd: pointer to MIPI-DSI driver platform data.
219 * @phy: pointer to the MIPI-DSI PHY
219 */ 220 */
220struct mipi_dsim_device { 221struct mipi_dsim_device {
221 struct device *dev; 222 struct device *dev;
@@ -236,6 +237,7 @@ struct mipi_dsim_device {
236 bool suspended; 237 bool suspended;
237 238
238 struct mipi_dsim_platform_data *pd; 239 struct mipi_dsim_platform_data *pd;
240 struct phy *phy;
239}; 241};
240 242
241/* 243/*
@@ -248,7 +250,6 @@ struct mipi_dsim_device {
248 * @enabled: indicate whether mipi controller got enabled or not. 250 * @enabled: indicate whether mipi controller got enabled or not.
249 * @lcd_panel_info: pointer for lcd panel specific structure. 251 * @lcd_panel_info: pointer for lcd panel specific structure.
250 * this structure specifies width, height, timing and polarity and so on. 252 * this structure specifies width, height, timing and polarity and so on.
251 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
252 */ 253 */
253struct mipi_dsim_platform_data { 254struct mipi_dsim_platform_data {
254 char lcd_panel_name[PANEL_NAME_SIZE]; 255 char lcd_panel_name[PANEL_NAME_SIZE];
@@ -256,8 +257,6 @@ struct mipi_dsim_platform_data {
256 struct mipi_dsim_config *dsim_config; 257 struct mipi_dsim_config *dsim_config;
257 unsigned int enabled; 258 unsigned int enabled;
258 void *lcd_panel_info; 259 void *lcd_panel_info;
259
260 int (*phy_enable)(struct platform_device *pdev, bool on);
261}; 260};
262 261
263/* 262/*
diff --git a/include/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