aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-bus-mdio29
-rw-r--r--Documentation/ABI/testing/sysfs-class-net-phydev19
-rw-r--r--Documentation/admin-guide/mm/index.rst1
-rw-r--r--Documentation/admin-guide/mm/numaperf.rst2
-rw-r--r--Documentation/conf.py2
-rw-r--r--Documentation/firmware-guide/acpi/enumeration.rst2
-rw-r--r--Documentation/networking/device_drivers/index.rst30
-rw-r--r--Documentation/networking/index.rst16
-rw-r--r--Documentation/networking/tls-offload-layers.svg1
-rw-r--r--Documentation/networking/tls-offload-reorder-bad.svg1
-rw-r--r--Documentation/networking/tls-offload-reorder-good.svg1
-rw-r--r--Documentation/networking/tls-offload.rst482
-rw-r--r--Documentation/networking/tls.rst (renamed from Documentation/networking/tls.txt)44
-rw-r--r--Documentation/sphinx/kerneldoc.py44
-rw-r--r--Documentation/sphinx/kernellog.py28
-rw-r--r--Documentation/sphinx/kfigure.py40
-rw-r--r--Documentation/usb/rio.txt66
-rw-r--r--arch/arm64/include/asm/syscall.h2
-rw-r--r--arch/arm64/include/asm/syscall_wrapper.h18
-rw-r--r--arch/arm64/kernel/module.c38
-rw-r--r--arch/arm64/kernel/sys.c16
-rw-r--r--arch/arm64/kernel/sys32.c7
-rw-r--r--arch/arm64/kernel/traps.c5
-rw-r--r--arch/ia64/mm/numa.c1
-rw-r--r--drivers/clk/imx/clk-imx8mm.c12
-rw-r--r--drivers/clk/sifive/Kconfig1
-rw-r--r--drivers/clk/ti/clkctrl.c8
-rw-r--r--drivers/gpio/Kconfig1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c3
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c12
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_dump.c5
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h6
-rw-r--r--drivers/gpu/drm/i915/intel_workarounds.c2
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c13
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.h1
-rw-r--r--drivers/gpu/drm/qxl/qxl_prime.c1
-rw-r--r--drivers/iio/adc/npcm_adc.c2
-rw-r--r--drivers/iio/adc/ti-ads124s08.c2
-rw-r--r--drivers/iio/adc/ti-ads8688.c2
-rw-r--r--drivers/iio/dac/ds4424.c2
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c46
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h20
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c3
-rw-r--r--drivers/isdn/mISDN/dsp_cmx.c427
-rw-r--r--drivers/isdn/mISDN/socket.c5
-rw-r--r--drivers/media/usb/siano/smsusb.c33
-rw-r--r--drivers/net/bonding/bond_main.c15
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c2
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_ring.c51
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c64
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c30
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.h6
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c2
-rw-r--r--drivers/net/ethernet/cadence/macb.h7
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c111
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c5
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c11
-rw-r--r--drivers/net/ethernet/dec/tulip/de4x5.c1
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_eth.c9
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c4
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c4
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h2
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c3
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c2
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c4
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c3
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.c24
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c11
-rw-r--r--drivers/net/ethernet/mscc/ocelot.c43
-rw-r--r--drivers/net/ethernet/mscc/ocelot.h4
-rw-r--r--drivers/net/ethernet/realtek/r8169.c3
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c7
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c5
-rw-r--r--drivers/net/hyperv/netvsc_drv.c6
-rw-r--r--drivers/net/phy/dp83867.c41
-rw-r--r--drivers/net/phy/marvell10g.c13
-rw-r--r--drivers/net/phy/phylink.c10
-rw-r--r--drivers/pinctrl/Kconfig2
-rw-r--r--drivers/pinctrl/intel/pinctrl-intel.c45
-rw-r--r--drivers/staging/erofs/super.c1
-rw-r--r--drivers/staging/kpc2000/Kconfig2
-rw-r--r--drivers/staging/kpc2000/kpc_dma/fileops.c4
-rw-r--r--drivers/staging/vc04_services/bcm2835-camera/controls.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c9
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.c8
-rw-r--r--drivers/staging/wlan-ng/hfa384x_usb.c3
-rw-r--r--drivers/tty/serial/imx.c1
-rw-r--r--drivers/tty/serial/max310x.c2
-rw-r--r--drivers/tty/serial/msm_serial.c5
-rw-r--r--drivers/tty/serial/sh-sci.c7
-rw-r--r--drivers/tty/vt/vt.c11
-rw-r--r--drivers/usb/core/config.c4
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/host/xhci-debugfs.c3
-rw-r--r--drivers/usb/host/xhci-ring.c26
-rw-r--r--drivers/usb/host/xhci.c24
-rw-r--r--drivers/usb/host/xhci.h3
-rw-r--r--drivers/usb/misc/rio500.c80
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c15
-rw-r--r--drivers/usb/mtu3/mtu3_debugfs.c3
-rw-r--r--drivers/usb/usbip/stub_dev.c75
-rw-r--r--drivers/video/fbdev/core/fbcon.c2
-rw-r--r--fs/btrfs/dev-replace.c35
-rw-r--r--fs/btrfs/inode.c14
-rw-r--r--fs/btrfs/qgroup.c8
-rw-r--r--fs/btrfs/relocation.c27
-rw-r--r--fs/btrfs/send.c52
-rw-r--r--fs/btrfs/tree-log.c20
-rw-r--r--fs/btrfs/zstd.c20
-rw-r--r--fs/configfs/dir.c14
-rw-r--r--include/linux/ethtool.h9
-rw-r--r--include/net/netfilter/nft_fib.h2
-rw-r--r--include/net/udp.h9
-rw-r--r--kernel/trace/trace_events_filter.c8
-rw-r--r--lib/list_sort.c3
-rw-r--r--net/core/dev.c60
-rw-r--r--net/core/ethtool.c8
-rw-r--r--net/core/skbuff.c6
-rw-r--r--net/dsa/tag_8021q.c79
-rw-r--r--net/hsr/hsr_framereg.c8
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/igmp.c47
-rw-r--r--net/ipv4/ip_output.c4
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/netfilter/nft_fib_ipv4.c23
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv6/addrconf.c57
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/netfilter/nft_fib_ipv6.c16
-rw-r--r--net/ipv6/route.c6
-rw-r--r--net/llc/llc_output.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c2
-rw-r--r--net/netfilter/nf_flow_table_ip.c3
-rw-r--r--net/netfilter/nf_nat_helper.c2
-rw-r--r--net/netfilter/nf_queue.c1
-rw-r--r--net/netfilter/nf_tables_api.c20
-rw-r--r--net/netfilter/nft_fib.c6
-rw-r--r--net/netfilter/nft_flow_offload.c31
-rw-r--r--net/sched/act_api.c3
-rw-r--r--net/tls/tls_device.c24
-rw-r--r--net/tls/tls_sw.c19
-rwxr-xr-xscripts/sphinx-pre-install86
-rw-r--r--sound/firewire/fireface/ff-protocol-latter.c10
-rw-r--r--sound/pci/hda/hda_intel.c5
-rw-r--r--sound/pci/hda/patch_realtek.c38
-rw-r--r--sound/usb/line6/driver.c12
-rw-r--r--sound/usb/line6/driver.h4
-rw-r--r--sound/usb/line6/toneport.c15
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest1
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc2
-rw-r--r--tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc21
-rw-r--r--tools/testing/selftests/kselftest_harness.h17
-rwxr-xr-xtools/testing/selftests/net/pmtu.sh14
-rw-r--r--tools/testing/selftests/net/tls.c34
-rw-r--r--tools/testing/selftests/netfilter/Makefile2
-rwxr-xr-xtools/testing/selftests/netfilter/nft_flowtable.sh324
-rwxr-xr-xtools/testing/selftests/netfilter/nft_nat.sh6
-rw-r--r--tools/testing/selftests/rtc/rtctest.c6
169 files changed, 2566 insertions, 1086 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-mdio b/Documentation/ABI/testing/sysfs-bus-mdio
deleted file mode 100644
index 491baaf4285f..000000000000
--- a/Documentation/ABI/testing/sysfs-bus-mdio
+++ /dev/null
@@ -1,29 +0,0 @@
1What: /sys/bus/mdio_bus/devices/.../phy_id
2Date: November 2012
3KernelVersion: 3.8
4Contact: netdev@vger.kernel.org
5Description:
6 This attribute contains the 32-bit PHY Identifier as reported
7 by the device during bus enumeration, encoded in hexadecimal.
8 This ID is used to match the device with the appropriate
9 driver.
10
11What: /sys/bus/mdio_bus/devices/.../phy_interface
12Date: February 2014
13KernelVersion: 3.15
14Contact: netdev@vger.kernel.org
15Description:
16 This attribute contains the PHY interface as configured by the
17 Ethernet driver during bus enumeration, encoded in string.
18 This interface mode is used to configure the Ethernet MAC with the
19 appropriate mode for its data lines to the PHY hardware.
20
21What: /sys/bus/mdio_bus/devices/.../phy_has_fixups
22Date: February 2014
23KernelVersion: 3.15
24Contact: netdev@vger.kernel.org
25Description:
26 This attribute contains the boolean value whether a given PHY
27 device has had any "fixup" workaround running on it, encoded as
28 a boolean. This information is provided to help troubleshooting
29 PHY configurations.
diff --git a/Documentation/ABI/testing/sysfs-class-net-phydev b/Documentation/ABI/testing/sysfs-class-net-phydev
index 6ebabfb27912..2a5723343aba 100644
--- a/Documentation/ABI/testing/sysfs-class-net-phydev
+++ b/Documentation/ABI/testing/sysfs-class-net-phydev
@@ -11,24 +11,31 @@ Date: February 2014
11KernelVersion: 3.15 11KernelVersion: 3.15
12Contact: netdev@vger.kernel.org 12Contact: netdev@vger.kernel.org
13Description: 13Description:
14 Boolean value indicating whether the PHY device has 14 This attribute contains the boolean value whether a given PHY
15 any fixups registered against it (phy_register_fixup) 15 device has had any "fixup" workaround running on it, encoded as
16 a boolean. This information is provided to help troubleshooting
17 PHY configurations.
16 18
17What: /sys/class/mdio_bus/<bus>/<device>/phy_id 19What: /sys/class/mdio_bus/<bus>/<device>/phy_id
18Date: November 2012 20Date: November 2012
19KernelVersion: 3.8 21KernelVersion: 3.8
20Contact: netdev@vger.kernel.org 22Contact: netdev@vger.kernel.org
21Description: 23Description:
22 32-bit hexadecimal value corresponding to the PHY device's OUI, 24 This attribute contains the 32-bit PHY Identifier as reported
23 model and revision number. 25 by the device during bus enumeration, encoded in hexadecimal.
26 This ID is used to match the device with the appropriate
27 driver.
24 28
25What: /sys/class/mdio_bus/<bus>/<device>/phy_interface 29What: /sys/class/mdio_bus/<bus>/<device>/phy_interface
26Date: February 2014 30Date: February 2014
27KernelVersion: 3.15 31KernelVersion: 3.15
28Contact: netdev@vger.kernel.org 32Contact: netdev@vger.kernel.org
29Description: 33Description:
30 String value indicating the PHY interface, possible 34 This attribute contains the PHY interface as configured by the
31 values are:. 35 Ethernet driver during bus enumeration, encoded in string.
36 This interface mode is used to configure the Ethernet MAC with the
37 appropriate mode for its data lines to the PHY hardware.
38 Possible values are:
32 <empty> (not available), mii, gmii, sgmii, tbi, rev-mii, 39 <empty> (not available), mii, gmii, sgmii, tbi, rev-mii,
33 rmii, rgmii, rgmii-id, rgmii-rxid, rgmii-txid, rtbi, smii 40 rmii, rgmii, rgmii-id, rgmii-rxid, rgmii-txid, rtbi, smii
34 xgmii, moca, qsgmii, trgmii, 1000base-x, 2500base-x, rxaui, 41 xgmii, moca, qsgmii, trgmii, 1000base-x, 2500base-x, rxaui,
diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst
index 8edb35f11317..ddf8d8d33377 100644
--- a/Documentation/admin-guide/mm/index.rst
+++ b/Documentation/admin-guide/mm/index.rst
@@ -31,6 +31,7 @@ the Linux memory management.
31 ksm 31 ksm
32 memory-hotplug 32 memory-hotplug
33 numa_memory_policy 33 numa_memory_policy
34 numaperf
34 pagemap 35 pagemap
35 soft-dirty 36 soft-dirty
36 transhuge 37 transhuge
diff --git a/Documentation/admin-guide/mm/numaperf.rst b/Documentation/admin-guide/mm/numaperf.rst
index b79f70c04397..c067ed145158 100644
--- a/Documentation/admin-guide/mm/numaperf.rst
+++ b/Documentation/admin-guide/mm/numaperf.rst
@@ -15,7 +15,7 @@ characteristics. Some memory may share the same node as a CPU, and others
15are provided as memory only nodes. While memory only nodes do not provide 15are provided as memory only nodes. While memory only nodes do not provide
16CPUs, they may still be local to one or more compute nodes relative to 16CPUs, they may still be local to one or more compute nodes relative to
17other nodes. The following diagram shows one such example of two compute 17other nodes. The following diagram shows one such example of two compute
18nodes with local memory and a memory only node for each of compute node: 18nodes with local memory and a memory only node for each of compute node::
19 19
20 +------------------+ +------------------+ 20 +------------------+ +------------------+
21 | Compute Node 0 +-----+ Compute Node 1 | 21 | Compute Node 0 +-----+ Compute Node 1 |
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 72647a38b5c2..7ace3f8852bd 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -37,7 +37,7 @@ needs_sphinx = '1.3'
37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig'] 37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig']
38 38
39# The name of the math extension changed on Sphinx 1.4 39# The name of the math extension changed on Sphinx 1.4
40if major == 1 and minor > 3: 40if (major == 1 and minor > 3) or (major > 1):
41 extensions.append("sphinx.ext.imgmath") 41 extensions.append("sphinx.ext.imgmath")
42else: 42else:
43 extensions.append("sphinx.ext.pngmath") 43 extensions.append("sphinx.ext.pngmath")
diff --git a/Documentation/firmware-guide/acpi/enumeration.rst b/Documentation/firmware-guide/acpi/enumeration.rst
index 6b32b7be8c85..850be9696931 100644
--- a/Documentation/firmware-guide/acpi/enumeration.rst
+++ b/Documentation/firmware-guide/acpi/enumeration.rst
@@ -423,7 +423,7 @@ will be enumerated to depends on the device ID returned by _HID.
423 423
424For example, the following ACPI sample might be used to enumerate an lm75-type 424For example, the following ACPI sample might be used to enumerate an lm75-type
425I2C temperature sensor and match it to the driver using the Device Tree 425I2C temperature sensor and match it to the driver using the Device Tree
426namespace link: 426namespace link::
427 427
428 Device (TMP0) 428 Device (TMP0)
429 { 429 {
diff --git a/Documentation/networking/device_drivers/index.rst b/Documentation/networking/device_drivers/index.rst
new file mode 100644
index 000000000000..75fa537763a4
--- /dev/null
+++ b/Documentation/networking/device_drivers/index.rst
@@ -0,0 +1,30 @@
1.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2
3Vendor Device Drivers
4=====================
5
6Contents:
7
8.. toctree::
9 :maxdepth: 2
10
11 freescale/dpaa2/index
12 intel/e100
13 intel/e1000
14 intel/e1000e
15 intel/fm10k
16 intel/igb
17 intel/igbvf
18 intel/ixgb
19 intel/ixgbe
20 intel/ixgbevf
21 intel/i40e
22 intel/iavf
23 intel/ice
24
25.. only:: subproject
26
27 Indices
28 =======
29
30 * :ref:`genindex`
diff --git a/Documentation/networking/index.rst b/Documentation/networking/index.rst
index f390fe3cfdfb..a46fca264bee 100644
--- a/Documentation/networking/index.rst
+++ b/Documentation/networking/index.rst
@@ -11,19 +11,7 @@ Contents:
11 batman-adv 11 batman-adv
12 can 12 can
13 can_ucan_protocol 13 can_ucan_protocol
14 device_drivers/freescale/dpaa2/index 14 device_drivers/index
15 device_drivers/intel/e100
16 device_drivers/intel/e1000
17 device_drivers/intel/e1000e
18 device_drivers/intel/fm10k
19 device_drivers/intel/igb
20 device_drivers/intel/igbvf
21 device_drivers/intel/ixgb
22 device_drivers/intel/ixgbe
23 device_drivers/intel/ixgbevf
24 device_drivers/intel/i40e
25 device_drivers/intel/iavf
26 device_drivers/intel/ice
27 dsa/index 15 dsa/index
28 devlink-info-versions 16 devlink-info-versions
29 ieee802154 17 ieee802154
@@ -40,6 +28,8 @@ Contents:
40 checksum-offloads 28 checksum-offloads
41 segmentation-offloads 29 segmentation-offloads
42 scaling 30 scaling
31 tls
32 tls-offload
43 33
44.. only:: subproject 34.. only:: subproject
45 35
diff --git a/Documentation/networking/tls-offload-layers.svg b/Documentation/networking/tls-offload-layers.svg
new file mode 100644
index 000000000000..cf72f05dbb21
--- /dev/null
+++ b/Documentation/networking/tls-offload-layers.svg
@@ -0,0 +1 @@
<svg version="1.1" viewBox="0.0 0.0 460.0 500.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m117.02887 0l72.28346 0l0 40.25197l-72.28346 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m117.02887 0l72.28346 0l0 40.25197l-72.28346 0z" fill-rule="evenodd"/><path fill="#000000" d="m135.71944 27.045982l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm12.853302 -3.109375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm15.453842 4.578125q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm10.469467 4.859375l0 -1.21875q-0.90625 1.4375 -2.703125 1.4375q-1.15625 0 -2.125 -0.640625q-0.96875 -0.640625 -1.5 -1.78125q-0.53125 -1.140625 -0.53125 -2.625q0 -1.453125 0.484375 -2.625q0.484375 -1.1875 1.4375 -1.8125q0.96875 -0.625 2.171875 -0.625q0.875 0 1.546875 0.375q0.6875 0.359375 1.109375 0.953125l0 -4.796875l1.640625 0l0 13.359375l-1.53125 0zm-5.171875 -4.828125q0 1.859375 0.78125 2.78125q0.78125 0.921875 1.84375 0.921875q1.078125 0 1.828125 -0.875q0.75 -0.890625 0.75 -2.6875q0 -1.984375 -0.765625 -2.90625q-0.765625 -0.9375 -1.890625 -0.9375q-1.078125 0 -1.8125 0.890625q-0.734375 0.890625 -0.734375 2.8125z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m309.02887 0l72.28348 0l0 40.25197l-72.28348 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m309.02887 0l72.28348 0l0 40.25197l-72.28348 0z" fill-rule="evenodd"/><path fill="#000000" d="m328.4915 27.045982l-2.96875 -9.671875l1.703125 0l1.53125 5.578125l0.578125 2.078125q0.046875 -0.15625 0.5 -2.0l1.546875 -5.65625l1.6875 0l1.4375 5.609375l0.484375 1.84375l0.5625 -1.859375l1.65625 -5.59375l1.59375 0l-3.03125 9.671875l-1.703125 0l-1.53125 -5.796875l-0.375 -1.640625l-1.953125 7.4375l-1.71875 0zm11.676086 0l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 -11.46875l0 -1.890625l1.640625 0l0 1.890625l-1.640625 0zm0 11.46875l0 -9.671875l1.640625 0l0 9.671875l-1.640625 0zm7.722931 -1.46875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm8.230194 -1.640625l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 101.46588l351.0551 0l0 53.70079l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 101.46588l351.0551 0l0 53.70079l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m215.67503 135.23627l0 -13.359367l1.640625 0l0 7.6249924l3.890625 -3.9374924l2.109375 0l-3.6875 3.5937424l4.0625 6.078125l-2.015625 0l-3.203125 -4.953125l-1.15625 1.125l0 3.828125l-1.640625 0zm12.90625 -1.46875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.5781174l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.6718674q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm1.5583038 1.46875l0 -13.359367l1.640625 0l0 13.359367l-1.640625 0zm3.5354462 -2.890625l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.6406174 0.296875 -1.1874924q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.4999924l-1.609375 0.21875q-0.109375 -0.7499924 -0.640625 -1.1718674q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.31249237 0.1875 0.5781174q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm24.136429 -10.468742l1.765625 0l0 7.7187424q0 2.015625 -0.453125 3.203125q-0.453125 1.1875 -1.640625 1.9375q-1.1875 0.734375 -3.125 0.734375q-1.875 0 -3.078125 -0.640625q-1.1875 -0.65625 -1.703125 -1.875q-0.5 -1.234375 -0.5 -3.359375l0 -7.7187424l1.765625 0l0 7.7187424q0 1.734375 0.3125 2.5625q0.328125 0.8125 1.109375 1.265625q0.796875 0.453125 1.9375 0.453125q1.953125 0 2.78125 -0.890625q0.828125 -0.890625 0.828125 -3.390625l0 -7.7187424zm4.629181 13.359367l0 -13.359367l1.78125 0l0 11.781242l6.5625 0l0 1.578125l-8.34375 0zm10.453857 0l0 -13.359367l5.046875 0q1.328125 0 2.03125 0.125q0.96875 0.171875 1.640625 0.640625q0.671875 0.453125 1.078125 1.28125q0.40625 0.828125 0.40625 1.828125q0 1.703125 -1.09375 2.8906174q-1.078125 1.171875 -3.921875 1.171875l-3.421875 0l0 5.421875l-1.765625 0zm1.765625 -7.0l3.453125 0q1.71875 0 2.4375 -0.6406174q0.71875 -0.640625 0.71875 -1.796875q0 -0.84375 -0.421875 -1.4375q-0.421875 -0.59375 -1.125 -0.78125q-0.4375 -0.125 -1.640625 -0.125l-3.421875 0l0 4.7812424z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 216.38058l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 216.38058l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m211.16338 250.15097l0 -11.78125l-4.40625 0l0 -1.578125l10.578125 0l0 1.578125l-4.40625 0l0 11.78125l-1.765625 0zm17.52098 -4.6875l1.765625 0.453125q-0.5625 2.171875 -2.0 3.328125q-1.4375 1.140625 -3.53125 1.140625q-2.15625 0 -3.515625 -0.875q-1.34375 -0.890625 -2.0625 -2.546875q-0.703125 -1.671875 -0.703125 -3.59375q0 -2.078125 0.796875 -3.625q0.796875 -1.5625 2.265625 -2.359375q1.484375 -0.8125 3.25 -0.8125q2.0 0 3.359375 1.015625q1.375 1.015625 1.90625 2.875l-1.734375 0.40625q-0.46875 -1.453125 -1.359375 -2.109375q-0.875 -0.671875 -2.203125 -0.671875q-1.546875 0 -2.578125 0.734375q-1.03125 0.734375 -1.453125 1.984375q-0.421875 1.234375 -0.421875 2.5625q0 1.703125 0.5 2.96875q0.5 1.265625 1.546875 1.90625q1.046875 0.625 2.265625 0.625q1.484375 0 2.515625 -0.859375q1.03125 -0.859375 1.390625 -2.546875zm3.9416962 4.6875l0 -13.359375l5.046875 0q1.328125 0 2.03125 0.125q0.96875 0.171875 1.640625 0.640625q0.671875 0.453125 1.078125 1.28125q0.40625 0.828125 0.40625 1.828125q0 1.703125 -1.09375 2.890625q-1.078125 1.171875 -3.921875 1.171875l-3.421875 0l0 5.421875l-1.765625 0zm1.765625 -7.0l3.453125 0q1.71875 0 2.4375 -0.640625q0.71875 -0.640625 0.71875 -1.796875q0 -0.84375 -0.421875 -1.4375q-0.421875 -0.59375 -1.125 -0.78125q-0.4375 -0.125 -1.640625 -0.125l-3.421875 0l0 4.78125zm14.664642 4.109375l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.2656097 0.890625q0.421875 0.5625 0.578125 1.5l-1.6093597 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.68748474 0.296875 1.0781097 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.3749847 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm13.562485 1.421875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm7.917694 0.28125q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm10.516327 1.3125l1.609375 0.21875q-0.265625 1.65625 -1.359375 2.609375q-1.078125 0.9375 -2.671875 0.9375q-1.984375 0 -3.1875 -1.296875q-1.203125 -1.296875 -1.203125 -3.71875q0 -1.578125 0.515625 -2.75q0.515625 -1.171875 1.578125 -1.75q1.0625 -0.59375 2.3125 -0.59375q1.578125 0 2.578125 0.796875q1.0 0.796875 1.28125 2.265625l-1.59375 0.234375q-0.234375 -0.96875 -0.8125 -1.453125q-0.578125 -0.5 -1.390625 -0.5q-1.234375 0 -2.015625 0.890625q-0.78125 0.890625 -0.78125 2.8125q0 1.953125 0.75 2.84375q0.75 0.875 1.953125 0.875q0.96875 0 1.609375 -0.59375q0.65625 -0.59375 0.828125 -1.828125zm3.015625 3.546875l0 -13.359375l1.640625 0l0 7.625l3.890625 -3.9375l2.109375 0l-3.6875 3.59375l4.0625 6.078125l-2.015625 0l-3.203125 -4.953125l-1.15625 1.125l0 3.828125l-1.640625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 331.2953l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 331.2953l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m225.73463 365.06567l0 -13.359375l4.609375 0q1.546875 0 2.375 0.203125q1.140625 0.25 1.953125 0.953125q1.0625 0.890625 1.578125 2.28125q0.53125 1.390625 0.53125 3.171875q0 1.515625 -0.359375 2.703125q-0.359375 1.171875 -0.921875 1.9375q-0.546875 0.765625 -1.203125 1.21875q-0.65625 0.4375 -1.59375 0.671875q-0.9375 0.21875 -2.140625 0.21875l-4.828125 0zm1.765625 -1.578125l2.859375 0q1.3125 0 2.0625 -0.234375q0.75 -0.25 1.203125 -0.703125q0.625 -0.625 0.96875 -1.6875q0.359375 -1.0625 0.359375 -2.578125q0 -2.09375 -0.6875 -3.21875q-0.6875 -1.125 -1.671875 -1.5q-0.703125 -0.28125 -2.28125 -0.28125l-2.8125 0l0 10.203125zm11.488571 1.578125l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 -11.46875l0 -1.890625l1.640625 0l0 1.890625l-1.640625 0zm0 11.46875l0 -9.671875l1.640625 0l0 9.671875l-1.640625 0zm6.832321 0l-3.6875 -9.671875l1.734375 0l2.078125 5.796875q0.328125 0.9375 0.625 1.9375q0.203125 -0.765625 0.609375 -1.828125l2.140625 -5.90625l1.6874847 0l-3.6562347 9.671875l-1.53125 0zm13.26561 -3.109375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm9.125732 5.765625l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 446.20996l351.0551 0l0 53.700806l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 446.20996l351.0551 0l0 53.700806l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m222.09538 479.98038l0 -13.359375l4.609375 0q1.546875 0 2.375 0.203125q1.140625 0.25 1.953125 0.953125q1.0625 0.890625 1.578125 2.28125q0.53125 1.390625 0.53125 3.171875q0 1.515625 -0.359375 2.703125q-0.359375 1.171875 -0.921875 1.9375q-0.546875 0.765625 -1.203125 1.21875q-0.65625 0.4375 -1.59375 0.671875q-0.9375 0.21875 -2.140625 0.21875l-4.828125 0zm1.765625 -1.578125l2.859375 0q1.3125 0 2.0625 -0.234375q0.75 -0.25 1.203125 -0.703125q0.625 -0.625 0.96875 -1.6875q0.359375 -1.0625 0.359375 -2.578125q0 -2.09375 -0.6875 -3.21875q-0.6875 -1.125 -1.671875 -1.5q-0.703125 -0.28125 -2.28125 -0.28125l-2.8125 0l0 10.203125zm18.129196 -1.53125l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm11.828842 5.765625l-3.6875 -9.671875l1.734375 0l2.078125 5.796875q0.328125 0.9375 0.625 1.9375q0.203125 -0.765625 0.609375 -1.828125l2.140625 -5.90625l1.6875 0l-3.65625 9.671875l-1.53125 0zm6.640625 -11.46875l0 -1.890625l1.6406097 0l0 1.890625l-1.6406097 0zm0 11.46875l0 -9.671875l1.6406097 0l0 9.671875l-1.6406097 0zm10.457321 -3.546875l1.609375 0.21875q-0.265625 1.65625 -1.359375 2.609375q-1.078125 0.9375 -2.671875 0.9375q-1.984375 0 -3.1875 -1.296875q-1.203125 -1.296875 -1.203125 -3.71875q0 -1.578125 0.515625 -2.75q0.515625 -1.171875 1.578125 -1.75q1.0625 -0.59375 2.3125 -0.59375q1.578125 0 2.578125 0.796875q1.0 0.796875 1.28125 2.265625l-1.59375 0.234375q-0.234375 -0.96875 -0.8125 -1.453125q-0.578125 -0.5 -1.390625 -0.5q-1.234375 0 -2.015625 0.890625q-0.78125 0.890625 -0.78125 2.8125q0 1.953125 0.75 2.84375q0.75 0.875 1.953125 0.875q0.96875 0 1.609375 -0.59375q0.65625 -0.59375 0.828125 -1.828125zm9.640625 0.4375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m153.17061 40.25197l0 0" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m153.17061 40.25197l0 0" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m48.435696 73.03937l402.67715 0" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m48.435696 73.03937l402.67715 0" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 71.49061l-12.393707 0l0 12.897636l-24.7874 0l0 -12.897636l-12.393692 0l24.7874 -12.89764z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 71.49061l-12.393707 0l0 12.897636l-24.7874 0l0 -12.897636l-12.393692 0l24.7874 -12.89764z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 71.49061l12.393707 0l0 -12.89764l24.787384 0l0 12.89764l12.393707 0l-24.787415 12.897636z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 71.49061l12.393707 0l0 -12.89764l24.787384 0l0 12.89764l12.393707 0l-24.787415 12.897636z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 188.3931l-12.393707 0l0 12.897629l-24.7874 0l0 -12.897629l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 188.3931l-12.393707 0l0 12.897629l-24.7874 0l0 -12.897629l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 188.3931l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897629z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 188.3931l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897629z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 301.4256l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 301.4256l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 301.4256l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 301.4256l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 415.4906l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 415.4906l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 415.4906l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 415.4906l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 44.009186l109.44881 0l0 53.70079l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m224.98174 70.929184l2.78125 -13.359375l1.65625 0l-1.0 4.78125q0.78125 -0.71875 1.421875 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.703125 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59375 0.640625 1.484375 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.734375 0.6875 -1.234375 2.125q-0.375 1.0625 -0.375 1.78125zm14.531967 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.000717 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.183304 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm12.058319 -3.28125l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0zm6.368927 -3.3125l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 164.00919l109.44881 0l0 53.70079l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m211.6696 187.61668l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm15.84375 -0.21875l1.65625 0.171875q-0.625 1.8125 -1.765625 2.703125q-1.140625 0.875 -2.609375 0.875q-1.578125 0 -2.5625 -1.015625q-0.96875 -1.03125 -0.96875 -2.859375q0 -1.578125 0.625 -3.109375q0.640625 -1.53125 1.796875 -2.328125q1.171875 -0.796875 2.6875 -0.796875q1.546875 0 2.453125 0.875q0.921875 0.875 0.921875 2.328125l-1.625 0.109375q-0.015625 -0.921875 -0.546875 -1.4375q-0.515625 -0.515625 -1.359375 -0.515625q-1.0 0 -1.734375 0.625q-0.71875 0.625 -1.140625 1.90625q-0.40625 1.28125 -0.40625 2.46875q0 1.234375 0.546875 1.859375q0.546875 0.609375 1.34375 0.609375q0.796875 0 1.53125 -0.609375q0.734375 -0.609375 1.15625 -1.859375zm9.171875 2.328125q-0.859375 0.734375 -1.65625 1.078125q-0.78125 0.34375 -1.6875 0.34375q-1.34375 0 -2.171875 -0.78125q-0.8125 -0.796875 -0.8125 -2.03125q0 -0.796875 0.375 -1.421875q0.375 -0.625 0.984375 -1.0q0.609375 -0.390625 1.484375 -0.546875q0.5625 -0.109375 2.109375 -0.171875q1.5625 -0.0625 2.234375 -0.328125q0.1875 -0.671875 0.1875 -1.125q0 -0.578125 -0.421875 -0.90625q-0.5625 -0.453125 -1.671875 -0.453125q-1.03125 0 -1.703125 0.46875q-0.65625 0.453125 -0.953125 1.296875l-1.671875 -0.140625q0.515625 -1.4375 1.609375 -2.203125q1.109375 -0.765625 2.796875 -0.765625q1.796875 0 2.84375 0.859375q0.796875 0.625 0.796875 1.65625q0 0.765625 -0.21875 1.796875l-0.53125 2.40625q-0.265625 1.140625 -0.265625 1.859375q0 0.453125 0.203125 1.3125l-1.671875 0q-0.125 -0.46875 -0.1875 -1.203125zm0.609375 -3.703125q-0.34375 0.140625 -0.75 0.21875q-0.390625 0.0625 -1.3125 0.15625q-1.4375 0.125 -2.03125 0.328125q-0.59375 0.1875 -0.90625 0.625q-0.296875 0.421875 -0.296875 0.9375q0 0.6875 0.484375 1.140625q0.484375 0.4375 1.359375 0.4375q0.828125 0 1.578125 -0.421875q0.75 -0.4375 1.1875 -1.203125q0.4375 -0.78125 0.6875 -2.21875zm7.094467 3.5625l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm5.183304 0l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm8.433304 -1.9375l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0zm11.255371 0l2.796875 -13.359375l1.640625 0l-2.78125 13.359375l-1.65625 0zm6.613556 -11.484375l0.40625 -1.875l1.625 0l-0.390625 1.875l-1.640625 0zm-2.390625 11.484375l2.015625 -9.671875l1.65625 0l-2.03125 9.671875l-1.640625 0zm4.3635864 -3.3125l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm13.015625 1.96875l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 280.1392l109.44881 0l0 53.700806l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m223.58026 303.7467l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm9.1875 3.3125l2.796875 -13.359375l1.640625 0l-1.734375 8.28125l4.8125 -4.59375l2.171875 0l-4.125 3.609375l2.5 6.0625l-1.8125 0l-1.921875 -4.96875l-2.015625 1.734375l-0.671875 3.234375l-1.640625 0zm7.5 3.703125l0 -1.1875l10.875 0l0 1.1875l-10.875 0zm12.188217 -3.703125l2.78125 -13.359375l1.6562653 0l-1.0000153 4.78125q0.78126526 -0.71875 1.4218903 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.7031403 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59376526 0.640625 1.4843903 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.73439026 0.6875 -1.2343903 2.125q-0.375 1.0625 -0.375 1.78125zm14.531967 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.0007324 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.1832886 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m163.81627 395.2362l178.11024 0l0 53.700806l-178.11024 0z" fill-rule="evenodd"/><path fill="#000000" d="m195.60925 418.62497l1.65625 0.171875q-0.625 1.8125 -1.765625 2.703125q-1.140625 0.875 -2.609375 0.875q-1.578125 0 -2.5625 -1.015625q-0.96875 -1.03125 -0.96875 -2.859375q0 -1.578125 0.625 -3.109375q0.640625 -1.53125 1.796875 -2.328125q1.171875 -0.796875 2.6875 -0.796875q1.546875 0 2.453125 0.875q0.921875 0.875 0.921875 2.328125l-1.625 0.109375q-0.015625 -0.921875 -0.546875 -1.4375q-0.515625 -0.515625 -1.359375 -0.515625q-1.0 0 -1.734375 0.625q-0.71875 0.625 -1.140625 1.90625q-0.40625 1.28125 -0.40625 2.46875q0 1.234375 0.546875 1.859375q0.546875 0.609375 1.34375 0.609375q0.796875 0 1.53125 -0.609375q0.734375 -0.609375 1.15625 -1.859375zm2.9375 -0.140625q0 -2.828125 1.671875 -4.6875q1.375 -1.53125 3.609375 -1.53125q1.75 0 2.8125 1.09375q1.078125 1.09375 1.078125 2.953125q0 1.65625 -0.671875 3.09375q-0.671875 1.4375 -1.921875 2.203125q-1.25 0.765625 -2.625 0.765625q-1.125 0 -2.046875 -0.484375q-0.921875 -0.484375 -1.421875 -1.359375q-0.484375 -0.890625 -0.484375 -2.046875zm1.65625 -0.15625q0 1.359375 0.65625 2.0625q0.65625 0.703125 1.65625 0.703125q0.53125 0 1.046875 -0.203125q0.53125 -0.21875 0.96875 -0.65625q0.453125 -0.4375 0.765625 -1.0q0.3125 -0.5625 0.5 -1.203125q0.28125 -0.90625 0.28125 -1.734375q0 -1.3125 -0.65625 -2.03125q-0.65625 -0.734375 -1.65625 -0.734375q-0.78125 0 -1.421875 0.375q-0.625 0.375 -1.140625 1.09375q-0.515625 0.703125 -0.765625 1.640625q-0.234375 0.9375 -0.234375 1.6875zm8.438217 3.828125l2.015625 -9.671875l1.5 0l-0.359375 1.6875q0.96875 -1.0 1.8125 -1.453125q0.859375 -0.453125 1.734375 -0.453125q1.1875 0 1.84375 0.640625q0.671875 0.625 0.671875 1.703125q0 0.53125 -0.234375 1.6875l-1.234375 5.859375l-1.640625 0l1.28125 -6.125q0.1875 -0.890625 0.1875 -1.328125q0 -0.484375 -0.328125 -0.78125q-0.328125 -0.296875 -0.953125 -0.296875q-1.28125 0 -2.265625 0.90625q-0.984375 0.90625 -1.453125 3.125l-0.9375 4.5l-1.640625 0zm14.219467 -1.34375l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm8.433304 -1.9375l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm7.406967 5.6875l4.21875 -4.90625l-2.421875 -4.765625l1.828125 0l0.8125 1.71875q0.453125 0.96875 0.828125 1.84375l2.78125 -3.5625l2.015625 0l-4.0625 4.890625l2.4375 4.78125l-1.8125 0l-0.96875 -1.96875q-0.3125 -0.625 -0.703125 -1.5625l-2.875 3.53125l-2.078125 0zm13.828125 -1.34375l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm11.210358 -0.8125l0 -3.671875l-3.640625 0l0 -1.515625l3.640625 0l0 -3.640625l1.546875 0l0 3.640625l3.640625 0l0 1.515625l-3.640625 0l0 3.671875l-1.546875 0zm11.390778 2.15625l2.78125 -13.359375l1.65625 0l-1.0 4.78125q0.78125 -0.71875 1.421875 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.703125 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59375 0.640625 1.484375 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.734375 0.6875 -1.234375 2.125q-0.375 1.0625 -0.375 1.78125zm14.531952 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.0007324 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.1832886 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm12.058319 -3.28125l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m0 165.96588l118.74016 0l0 40.25197l-118.74016 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 165.96588l118.74016 0l0 40.25197l-118.74016 0z" fill-rule="evenodd"/><path fill="#000000" d="m23.145836 190.12123l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.5l-1.609375 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm13.5625 1.421875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm1.5895538 1.46875l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 3.703125l0 -13.375l1.484375 0l0 1.25q0.53125 -0.734375 1.1875 -1.09375q0.671875 -0.375 1.625 -0.375q1.234375 0 2.171875 0.640625q0.953125 0.625 1.4375 1.796875q0.484375 1.15625 0.484375 2.546875q0 1.484375 -0.53125 2.671875q-0.53125 1.1875 -1.546875 1.828125q-1.015625 0.625 -2.140625 0.625q-0.8125 0 -1.46875 -0.34375q-0.65625 -0.34375 -1.0625 -0.875l0 4.703125l-1.640625 0zm1.484375 -8.484375q0 1.859375 0.75 2.765625q0.765625 0.890625 1.828125 0.890625q1.09375 0 1.875 -0.921875q0.78125 -0.9375 0.78125 -2.875q0 -1.84375 -0.765625 -2.765625q-0.75 -0.921875 -1.8125 -0.921875q-1.046875 0 -1.859375 0.984375q-0.796875 0.96875 -0.796875 2.84375zm15.203842 3.59375q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm4.188217 4.859375l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm5.572052 -2.890625l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.5l-1.609375 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm16.609375 -0.21875l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm9.125717 5.765625l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0z" fill-rule="nonzero"/></g></svg>
diff --git a/Documentation/networking/tls-offload-reorder-bad.svg b/Documentation/networking/tls-offload-reorder-bad.svg
new file mode 100644
index 000000000000..d107aaf0f71e
--- /dev/null
+++ b/Documentation/networking/tls-offload-reorder-bad.svg
@@ -0,0 +1 @@
<svg version="1.1" viewBox="0.0 0.0 672.0 68.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#b6d7a8" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m15.953125 52.942722l-1.640625 0l0 -10.453125q-0.59375 0.5625 -1.5625 1.140625q-0.953125 0.5625 -1.71875 0.84375l0 -1.59375q1.375 -0.640625 2.40625 -1.5625q1.03125 -0.921875 1.453125 -1.78125l1.0625 0l0 13.40625z" fill-rule="nonzero"/><path fill="#c9daf8" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m355.73022 52.942722l0 -3.203125l-5.796875 0l0 -1.5l6.09375 -8.65625l1.34375 0l0 8.65625l1.796875 0l0 1.5l-1.796875 0l0 3.203125l-1.640625 0zm0 -4.703125l0 -6.015625l-4.1875 6.015625l4.1875 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m235.15652 49.411472l1.640625 -0.21875q0.28125 1.40625 0.953125 2.015625q0.6875 0.609375 1.65625 0.609375q1.15625 0 1.953125 -0.796875q0.796875 -0.796875 0.796875 -1.984375q0 -1.125 -0.734375 -1.859375q-0.734375 -0.734375 -1.875 -0.734375q-0.46875 0 -1.15625 0.171875l0.1875 -1.4375q0.15625 0.015625 0.265625 0.015625q1.046875 0 1.875 -0.546875q0.84375 -0.546875 0.84375 -1.671875q0 -0.90625 -0.609375 -1.5q-0.609375 -0.59375 -1.578125 -0.59375q-0.953125 0 -1.59375 0.609375q-0.640625 0.59375 -0.8125 1.796875l-1.640625 -0.296875q0.296875 -1.640625 1.359375 -2.546875q1.0625 -0.90625 2.65625 -0.90625q1.09375 0 2.0 0.46875q0.921875 0.46875 1.40625 1.28125q0.5 0.8125 0.5 1.71875q0 0.859375 -0.46875 1.578125q-0.46875 0.703125 -1.375 1.125q1.1875 0.28125 1.84375 1.140625q0.65625 0.859375 0.65625 2.15625q0 1.734375 -1.28125 2.953125q-1.265625 1.21875 -3.21875 1.21875q-1.765625 0 -2.921875 -1.046875q-1.15625 -1.046875 -1.328125 -2.71875z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m590.72015 51.364597l0 1.578125l-8.828125 0q-0.015625 -0.59375 0.1875 -1.140625q0.34375 -0.90625 1.078125 -1.78125q0.75 -0.875 2.15625 -2.015625q2.171875 -1.78125 2.9375 -2.828125q0.765625 -1.046875 0.765625 -1.96875q0 -0.984375 -0.703125 -1.640625q-0.6875 -0.671875 -1.8125 -0.671875q-1.1875 0 -1.90625 0.71875q-0.703125 0.703125 -0.703125 1.953125l-1.6875 -0.171875q0.171875 -1.890625 1.296875 -2.875q1.140625 -0.984375 3.03125 -0.984375q1.921875 0 3.046875 1.0625q1.125 1.0625 1.125 2.640625q0 0.796875 -0.328125 1.578125q-0.328125 0.78125 -1.09375 1.640625q-0.75 0.84375 -2.53125 2.34375q-1.46875 1.234375 -1.890625 1.6875q-0.421875 0.4375 -0.6875 0.875l6.546875 0z" fill-rule="nonzero"/><path fill="#e06666" d="m615.56793 24.999102l6.5512085 0l0 42.04725l-6.5512085 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m615.56793 24.999102l6.5512085 0l0 42.04725l-6.5512085 0z" fill-rule="evenodd"/><path fill="#c9daf8" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path fill="#000000" d="m466.2955 49.442722l1.71875 -0.140625q0.1875 1.25 0.875 1.890625q0.703125 0.625 1.6875 0.625q1.1875 0 2.0 -0.890625q0.828125 -0.890625 0.828125 -2.359375q0 -1.40625 -0.796875 -2.21875q-0.78125 -0.8125 -2.0625 -0.8125q-0.78125 0 -1.421875 0.359375q-0.640625 0.359375 -1.0 0.9375l-1.546875 -0.203125l1.296875 -6.859375l6.640625 0l0 1.5625l-5.328125 0l-0.71875 3.59375q1.203125 -0.84375 2.515625 -0.84375q1.75 0 2.953125 1.21875q1.203125 1.203125 1.203125 3.109375q0 1.8125 -1.046875 3.140625q-1.296875 1.625 -3.515625 1.625q-1.8125 0 -2.96875 -1.015625q-1.15625 -1.03125 -1.3125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m391.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m391.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m163.95024 24.999102c0 -12.5 114.47246 -25.007874 228.9449 -25.0c114.47241 0.007874016 228.94489 12.531496 228.94489 25.062992" fill-rule="evenodd"/><path stroke="#000000" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m163.95024 24.9991c0 -12.499998 114.47246 -25.007872 228.9449 -24.999998c57.236206 0.003937008 114.47244 3.136811 157.3996 7.835138c21.463562 2.3491635 39.349915 5.0896897 51.8703 8.026144c3.130127 0.7341137 5.9248657 1.4804726 8.356262 2.236023c0.30395508 0.09444237 0.6022339 0.1890316 0.89471436 0.28375435l0.37457275 0.12388611" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="2.0" stroke-linecap="butt" d="m609.98517 21.270555l9.406311 2.1936665l-5.7955933 -7.7266836z" fill-rule="evenodd"/><path fill="#e06666" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/></g></svg>
diff --git a/Documentation/networking/tls-offload-reorder-good.svg b/Documentation/networking/tls-offload-reorder-good.svg
new file mode 100644
index 000000000000..10e17d91f70c
--- /dev/null
+++ b/Documentation/networking/tls-offload-reorder-good.svg
@@ -0,0 +1 @@
<svg version="1.1" viewBox="0.0 0.0 672.0 68.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#b6d7a8" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m15.953125 52.942722l-1.640625 0l0 -10.453125q-0.59375 0.5625 -1.5625 1.140625q-0.953125 0.5625 -1.71875 0.84375l0 -1.59375q1.375 -0.640625 2.40625 -1.5625q1.03125 -0.921875 1.453125 -1.78125l1.0625 0l0 13.40625z" fill-rule="nonzero"/><path fill="#b6d7a8" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m355.73022 52.942722l0 -3.203125l-5.796875 0l0 -1.5l6.09375 -8.65625l1.34375 0l0 8.65625l1.796875 0l0 1.5l-1.796875 0l0 3.203125l-1.640625 0zm0 -4.703125l0 -6.015625l-4.1875 6.015625l4.1875 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m235.15652 49.411472l1.640625 -0.21875q0.28125 1.40625 0.953125 2.015625q0.6875 0.609375 1.65625 0.609375q1.15625 0 1.953125 -0.796875q0.796875 -0.796875 0.796875 -1.984375q0 -1.125 -0.734375 -1.859375q-0.734375 -0.734375 -1.875 -0.734375q-0.46875 0 -1.15625 0.171875l0.1875 -1.4375q0.15625 0.015625 0.265625 0.015625q1.046875 0 1.875 -0.546875q0.84375 -0.546875 0.84375 -1.671875q0 -0.90625 -0.609375 -1.5q-0.609375 -0.59375 -1.578125 -0.59375q-0.953125 0 -1.59375 0.609375q-0.640625 0.59375 -0.8125 1.796875l-1.640625 -0.296875q0.296875 -1.640625 1.359375 -2.546875q1.0625 -0.90625 2.65625 -0.90625q1.09375 0 2.0 0.46875q0.921875 0.46875 1.40625 1.28125q0.5 0.8125 0.5 1.71875q0 0.859375 -0.46875 1.578125q-0.46875 0.703125 -1.375 1.125q1.1875 0.28125 1.84375 1.140625q0.65625 0.859375 0.65625 2.15625q0 1.734375 -1.28125 2.953125q-1.265625 1.21875 -3.21875 1.21875q-1.765625 0 -2.921875 -1.046875q-1.15625 -1.046875 -1.328125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m271.56793 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m271.56793 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m590.72015 51.364597l0 1.578125l-8.828125 0q-0.015625 -0.59375 0.1875 -1.140625q0.34375 -0.90625 1.078125 -1.78125q0.75 -0.875 2.15625 -2.015625q2.171875 -1.78125 2.9375 -2.828125q0.765625 -1.046875 0.765625 -1.96875q0 -0.984375 -0.703125 -1.640625q-0.6875 -0.671875 -1.8125 -0.671875q-1.1875 0 -1.90625 0.71875q-0.703125 0.703125 -0.703125 1.953125l-1.6875 -0.171875q0.171875 -1.890625 1.296875 -2.875q1.140625 -0.984375 3.03125 -0.984375q1.921875 0 3.046875 1.0625q1.125 1.0625 1.125 2.640625q0 0.796875 -0.328125 1.578125q-0.328125 0.78125 -1.09375 1.640625q-0.75 0.84375 -2.53125 2.34375q-1.46875 1.234375 -1.890625 1.6875q-0.421875 0.4375 -0.6875 0.875l6.546875 0z" fill-rule="nonzero"/><path fill="#b6d7a8" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path fill="#000000" d="m466.2955 49.442722l1.71875 -0.140625q0.1875 1.25 0.875 1.890625q0.703125 0.625 1.6875 0.625q1.1875 0 2.0 -0.890625q0.828125 -0.890625 0.828125 -2.359375q0 -1.40625 -0.796875 -2.21875q-0.78125 -0.8125 -2.0625 -0.8125q-0.78125 0 -1.421875 0.359375q-0.640625 0.359375 -1.0 0.9375l-1.546875 -0.203125l1.296875 -6.859375l6.640625 0l0 1.5625l-5.328125 0l-0.71875 3.59375q1.203125 -0.84375 2.515625 -0.84375q1.75 0 2.953125 1.21875q1.203125 1.203125 1.203125 3.109375q0 1.8125 -1.046875 3.140625q-1.296875 1.625 -3.515625 1.625q-1.8125 0 -2.96875 -1.015625q-1.15625 -1.03125 -1.3125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m503.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m503.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m163.95024 24.999102c0 -12.5 114.47246 -25.007874 228.9449 -25.0c114.47241 0.007874016 228.94489 12.531496 228.94489 25.062992" fill-rule="evenodd"/><path stroke="#000000" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m163.95024 24.9991c0 -12.499998 114.47246 -25.007872 228.9449 -24.999998c57.236206 0.003937008 114.47244 3.136811 157.3996 7.835138c21.463562 2.3491635 39.349915 5.0896897 51.8703 8.026144c3.130127 0.7341137 5.9248657 1.4804726 8.356262 2.236023c0.30395508 0.09444237 0.6022339 0.1890316 0.89471436 0.28375435l0.37457275 0.12388611" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="2.0" stroke-linecap="butt" d="m609.98517 21.270555l9.406311 2.1936665l-5.7955933 -7.7266836z" fill-rule="evenodd"/><path fill="#e06666" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/></g></svg>
diff --git a/Documentation/networking/tls-offload.rst b/Documentation/networking/tls-offload.rst
new file mode 100644
index 000000000000..cb85af559dff
--- /dev/null
+++ b/Documentation/networking/tls-offload.rst
@@ -0,0 +1,482 @@
1.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2
3==================
4Kernel TLS offload
5==================
6
7Kernel TLS operation
8====================
9
10Linux kernel provides TLS connection offload infrastructure. Once a TCP
11connection is in ``ESTABLISHED`` state user space can enable the TLS Upper
12Layer Protocol (ULP) and install the cryptographic connection state.
13For details regarding the user-facing interface refer to the TLS
14documentation in :ref:`Documentation/networking/tls.rst <kernel_tls>`.
15
16``ktls`` can operate in three modes:
17
18 * Software crypto mode (``TLS_SW``) - CPU handles the cryptography.
19 In most basic cases only crypto operations synchronous with the CPU
20 can be used, but depending on calling context CPU may utilize
21 asynchronous crypto accelerators. The use of accelerators introduces extra
22 latency on socket reads (decryption only starts when a read syscall
23 is made) and additional I/O load on the system.
24 * Packet-based NIC offload mode (``TLS_HW``) - the NIC handles crypto
25 on a packet by packet basis, provided the packets arrive in order.
26 This mode integrates best with the kernel stack and is described in detail
27 in the remaining part of this document
28 (``ethtool`` flags ``tls-hw-tx-offload`` and ``tls-hw-rx-offload``).
29 * Full TCP NIC offload mode (``TLS_HW_RECORD``) - mode of operation where
30 NIC driver and firmware replace the kernel networking stack
31 with its own TCP handling, it is not usable in production environments
32 making use of the Linux networking stack for example any firewalling
33 abilities or QoS and packet scheduling (``ethtool`` flag ``tls-hw-record``).
34
35The operation mode is selected automatically based on device configuration,
36offload opt-in or opt-out on per-connection basis is not currently supported.
37
38TX
39--
40
41At a high level user write requests are turned into a scatter list, the TLS ULP
42intercepts them, inserts record framing, performs encryption (in ``TLS_SW``
43mode) and then hands the modified scatter list to the TCP layer. From this
44point on the TCP stack proceeds as normal.
45
46In ``TLS_HW`` mode the encryption is not performed in the TLS ULP.
47Instead packets reach a device driver, the driver will mark the packets
48for crypto offload based on the socket the packet is attached to,
49and send them to the device for encryption and transmission.
50
51RX
52--
53
54On the receive side if the device handled decryption and authentication
55successfully, the driver will set the decrypted bit in the associated
56:c:type:`struct sk_buff <sk_buff>`. The packets reach the TCP stack and
57are handled normally. ``ktls`` is informed when data is queued to the socket
58and the ``strparser`` mechanism is used to delineate the records. Upon read
59request, records are retrieved from the socket and passed to decryption routine.
60If device decrypted all the segments of the record the decryption is skipped,
61otherwise software path handles decryption.
62
63.. kernel-figure:: tls-offload-layers.svg
64 :alt: TLS offload layers
65 :align: center
66 :figwidth: 28em
67
68 Layers of Kernel TLS stack
69
70Device configuration
71====================
72
73During driver initialization device sets the ``NETIF_F_HW_TLS_RX`` and
74``NETIF_F_HW_TLS_TX`` features and installs its
75:c:type:`struct tlsdev_ops <tlsdev_ops>`
76pointer in the :c:member:`tlsdev_ops` member of the
77:c:type:`struct net_device <net_device>`.
78
79When TLS cryptographic connection state is installed on a ``ktls`` socket
80(note that it is done twice, once for RX and once for TX direction,
81and the two are completely independent), the kernel checks if the underlying
82network device is offload-capable and attempts the offload. In case offload
83fails the connection is handled entirely in software using the same mechanism
84as if the offload was never tried.
85
86Offload request is performed via the :c:member:`tls_dev_add` callback of
87:c:type:`struct tlsdev_ops <tlsdev_ops>`:
88
89.. code-block:: c
90
91 int (*tls_dev_add)(struct net_device *netdev, struct sock *sk,
92 enum tls_offload_ctx_dir direction,
93 struct tls_crypto_info *crypto_info,
94 u32 start_offload_tcp_sn);
95
96``direction`` indicates whether the cryptographic information is for
97the received or transmitted packets. Driver uses the ``sk`` parameter
98to retrieve the connection 5-tuple and socket family (IPv4 vs IPv6).
99Cryptographic information in ``crypto_info`` includes the key, iv, salt
100as well as TLS record sequence number. ``start_offload_tcp_sn`` indicates
101which TCP sequence number corresponds to the beginning of the record with
102sequence number from ``crypto_info``. The driver can add its state
103at the end of kernel structures (see :c:member:`driver_state` members
104in ``include/net/tls.h``) to avoid additional allocations and pointer
105dereferences.
106
107TX
108--
109
110After TX state is installed, the stack guarantees that the first segment
111of the stream will start exactly at the ``start_offload_tcp_sn`` sequence
112number, simplifying TCP sequence number matching.
113
114TX offload being fully initialized does not imply that all segments passing
115through the driver and which belong to the offloaded socket will be after
116the expected sequence number and will have kernel record information.
117In particular, already encrypted data may have been queued to the socket
118before installing the connection state in the kernel.
119
120RX
121--
122
123In RX direction local networking stack has little control over the segmentation,
124so the initial records' TCP sequence number may be anywhere inside the segment.
125
126Normal operation
127================
128
129At the minimum the device maintains the following state for each connection, in
130each direction:
131
132 * crypto secrets (key, iv, salt)
133 * crypto processing state (partial blocks, partial authentication tag, etc.)
134 * record metadata (sequence number, processing offset and length)
135 * expected TCP sequence number
136
137There are no guarantees on record length or record segmentation. In particular
138segments may start at any point of a record and contain any number of records.
139Assuming segments are received in order, the device should be able to perform
140crypto operations and authentication regardless of segmentation. For this
141to be possible device has to keep small amount of segment-to-segment state.
142This includes at least:
143
144 * partial headers (if a segment carried only a part of the TLS header)
145 * partial data block
146 * partial authentication tag (all data had been seen but part of the
147 authentication tag has to be written or read from the subsequent segment)
148
149Record reassembly is not necessary for TLS offload. If the packets arrive
150in order the device should be able to handle them separately and make
151forward progress.
152
153TX
154--
155
156The kernel stack performs record framing reserving space for the authentication
157tag and populating all other TLS header and tailer fields.
158
159Both the device and the driver maintain expected TCP sequence numbers
160due to the possibility of retransmissions and the lack of software fallback
161once the packet reaches the device.
162For segments passed in order, the driver marks the packets with
163a connection identifier (note that a 5-tuple lookup is insufficient to identify
164packets requiring HW offload, see the :ref:`5tuple_problems` section)
165and hands them to the device. The device identifies the packet as requiring
166TLS handling and confirms the sequence number matches its expectation.
167The device performs encryption and authentication of the record data.
168It replaces the authentication tag and TCP checksum with correct values.
169
170RX
171--
172
173Before a packet is DMAed to the host (but after NIC's embedded switching
174and packet transformation functions) the device validates the Layer 4
175checksum and performs a 5-tuple lookup to find any TLS connection the packet
176may belong to (technically a 4-tuple
177lookup is sufficient - IP addresses and TCP port numbers, as the protocol
178is always TCP). If connection is matched device confirms if the TCP sequence
179number is the expected one and proceeds to TLS handling (record delineation,
180decryption, authentication for each record in the packet). The device leaves
181the record framing unmodified, the stack takes care of record decapsulation.
182Device indicates successful handling of TLS offload in the per-packet context
183(descriptor) passed to the host.
184
185Upon reception of a TLS offloaded packet, the driver sets
186the :c:member:`decrypted` mark in :c:type:`struct sk_buff <sk_buff>`
187corresponding to the segment. Networking stack makes sure decrypted
188and non-decrypted segments do not get coalesced (e.g. by GRO or socket layer)
189and takes care of partial decryption.
190
191Resync handling
192===============
193
194In presence of packet drops or network packet reordering, the device may lose
195synchronization with the TLS stream, and require a resync with the kernel's
196TCP stack.
197
198Note that resync is only attempted for connections which were successfully
199added to the device table and are in TLS_HW mode. For example,
200if the table was full when cryptographic state was installed in the kernel,
201such connection will never get offloaded. Therefore the resync request
202does not carry any cryptographic connection state.
203
204TX
205--
206
207Segments transmitted from an offloaded socket can get out of sync
208in similar ways to the receive side-retransmissions - local drops
209are possible, though network reorders are not.
210
211Whenever an out of order segment is transmitted the driver provides
212the device with enough information to perform cryptographic operations.
213This means most likely that the part of the record preceding the current
214segment has to be passed to the device as part of the packet context,
215together with its TCP sequence number and TLS record number. The device
216can then initialize its crypto state, process and discard the preceding
217data (to be able to insert the authentication tag) and move onto handling
218the actual packet.
219
220In this mode depending on the implementation the driver can either ask
221for a continuation with the crypto state and the new sequence number
222(next expected segment is the one after the out of order one), or continue
223with the previous stream state - assuming that the out of order segment
224was just a retransmission. The former is simpler, and does not require
225retransmission detection therefore it is the recommended method until
226such time it is proven inefficient.
227
228RX
229--
230
231A small amount of RX reorder events may not require a full resynchronization.
232In particular the device should not lose synchronization
233when record boundary can be recovered:
234
235.. kernel-figure:: tls-offload-reorder-good.svg
236 :alt: reorder of non-header segment
237 :align: center
238
239 Reorder of non-header segment
240
241Green segments are successfully decrypted, blue ones are passed
242as received on wire, red stripes mark start of new records.
243
244In above case segment 1 is received and decrypted successfully.
245Segment 2 was dropped so 3 arrives out of order. The device knows
246the next record starts inside 3, based on record length in segment 1.
247Segment 3 is passed untouched, because due to lack of data from segment 2
248the remainder of the previous record inside segment 3 cannot be handled.
249The device can, however, collect the authentication algorithm's state
250and partial block from the new record in segment 3 and when 4 and 5
251arrive continue decryption. Finally when 2 arrives it's completely outside
252of expected window of the device so it's passed as is without special
253handling. ``ktls`` software fallback handles the decryption of record
254spanning segments 1, 2 and 3. The device did not get out of sync,
255even though two segments did not get decrypted.
256
257Kernel synchronization may be necessary if the lost segment contained
258a record header and arrived after the next record header has already passed:
259
260.. kernel-figure:: tls-offload-reorder-bad.svg
261 :alt: reorder of header segment
262 :align: center
263
264 Reorder of segment with a TLS header
265
266In this example segment 2 gets dropped, and it contains a record header.
267Device can only detect that segment 4 also contains a TLS header
268if it knows the length of the previous record from segment 2. In this case
269the device will lose synchronization with the stream.
270
271When the device gets out of sync and the stream reaches TCP sequence
272numbers more than a max size record past the expected TCP sequence number,
273the device starts scanning for a known header pattern. For example
274for TLS 1.2 and TLS 1.3 subsequent bytes of value ``0x03 0x03`` occur
275in the SSL/TLS version field of the header. Once pattern is matched
276the device continues attempting parsing headers at expected locations
277(based on the length fields at guessed locations).
278Whenever the expected location does not contain a valid header the scan
279is restarted.
280
281When the header is matched the device sends a confirmation request
282to the kernel, asking if the guessed location is correct (if a TLS record
283really starts there), and which record sequence number the given header had.
284The kernel confirms the guessed location was correct and tells the device
285the record sequence number. Meanwhile, the device had been parsing
286and counting all records since the just-confirmed one, it adds the number
287of records it had seen to the record number provided by the kernel.
288At this point the device is in sync and can resume decryption at next
289segment boundary.
290
291In a pathological case the device may latch onto a sequence of matching
292headers and never hear back from the kernel (there is no negative
293confirmation from the kernel). The implementation may choose to periodically
294restart scan. Given how unlikely falsely-matching stream is, however,
295periodic restart is not deemed necessary.
296
297Special care has to be taken if the confirmation request is passed
298asynchronously to the packet stream and record may get processed
299by the kernel before the confirmation request.
300
301Error handling
302==============
303
304TX
305--
306
307Packets may be redirected or rerouted by the stack to a different
308device than the selected TLS offload device. The stack will handle
309such condition using the :c:func:`sk_validate_xmit_skb` helper
310(TLS offload code installs :c:func:`tls_validate_xmit_skb` at this hook).
311Offload maintains information about all records until the data is
312fully acknowledged, so if skbs reach the wrong device they can be handled
313by software fallback.
314
315Any device TLS offload handling error on the transmission side must result
316in the packet being dropped. For example if a packet got out of order
317due to a bug in the stack or the device, reached the device and can't
318be encrypted such packet must be dropped.
319
320RX
321--
322
323If the device encounters any problems with TLS offload on the receive
324side it should pass the packet to the host's networking stack as it was
325received on the wire.
326
327For example authentication failure for any record in the segment should
328result in passing the unmodified packet to the software fallback. This means
329packets should not be modified "in place". Splitting segments to handle partial
330decryption is not advised. In other words either all records in the packet
331had been handled successfully and authenticated or the packet has to be passed
332to the host's stack as it was on the wire (recovering original packet in the
333driver if device provides precise error is sufficient).
334
335The Linux networking stack does not provide a way of reporting per-packet
336decryption and authentication errors, packets with errors must simply not
337have the :c:member:`decrypted` mark set.
338
339A packet should also not be handled by the TLS offload if it contains
340incorrect checksums.
341
342Performance metrics
343===================
344
345TLS offload can be characterized by the following basic metrics:
346
347 * max connection count
348 * connection installation rate
349 * connection installation latency
350 * total cryptographic performance
351
352Note that each TCP connection requires a TLS session in both directions,
353the performance may be reported treating each direction separately.
354
355Max connection count
356--------------------
357
358The number of connections device can support can be exposed via
359``devlink resource`` API.
360
361Total cryptographic performance
362-------------------------------
363
364Offload performance may depend on segment and record size.
365
366Overload of the cryptographic subsystem of the device should not have
367significant performance impact on non-offloaded streams.
368
369Statistics
370==========
371
372Following minimum set of TLS-related statistics should be reported
373by the driver:
374
375 * ``rx_tls_decrypted`` - number of successfully decrypted TLS segments
376 * ``tx_tls_encrypted`` - number of in-order TLS segments passed to device
377 for encryption
378 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream
379 but did not arrive in the expected order
380 * ``tx_tls_drop_no_sync_data`` - number of TX packets dropped because
381 they arrived out of order and associated record could not be found
382 (see also :ref:`pre_tls_data`)
383
384Notable corner cases, exceptions and additional requirements
385============================================================
386
387.. _5tuple_problems:
388
3895-tuple matching limitations
390----------------------------
391
392The device can only recognize received packets based on the 5-tuple
393of the socket. Current ``ktls`` implementation will not offload sockets
394routed through software interfaces such as those used for tunneling
395or virtual networking. However, many packet transformations performed
396by the networking stack (most notably any BPF logic) do not require
397any intermediate software device, therefore a 5-tuple match may
398consistently miss at the device level. In such cases the device
399should still be able to perform TX offload (encryption) and should
400fallback cleanly to software decryption (RX).
401
402Out of order
403------------
404
405Introducing extra processing in NICs should not cause packets to be
406transmitted or received out of order, for example pure ACK packets
407should not be reordered with respect to data segments.
408
409Ingress reorder
410---------------
411
412A device is permitted to perform packet reordering for consecutive
413TCP segments (i.e. placing packets in the correct order) but any form
414of additional buffering is disallowed.
415
416Coexistence with standard networking offload features
417-----------------------------------------------------
418
419Offloaded ``ktls`` sockets should support standard TCP stack features
420transparently. Enabling device TLS offload should not cause any difference
421in packets as seen on the wire.
422
423Transport layer transparency
424----------------------------
425
426The device should not modify any packet headers for the purpose
427of the simplifying TLS offload.
428
429The device should not depend on any packet headers beyond what is strictly
430necessary for TLS offload.
431
432Segment drops
433-------------
434
435Dropping packets is acceptable only in the event of catastrophic
436system errors and should never be used as an error handling mechanism
437in cases arising from normal operation. In other words, reliance
438on TCP retransmissions to handle corner cases is not acceptable.
439
440TLS device features
441-------------------
442
443Drivers should ignore the changes to TLS the device feature flags.
444These flags will be acted upon accordingly by the core ``ktls`` code.
445TLS device feature flags only control adding of new TLS connection
446offloads, old connections will remain active after flags are cleared.
447
448Known bugs
449==========
450
451skb_orphan() leaks clear text
452-----------------------------
453
454Currently drivers depend on the :c:member:`sk` member of
455:c:type:`struct sk_buff <sk_buff>` to identify segments requiring
456encryption. Any operation which removes or does not preserve the socket
457association such as :c:func:`skb_orphan` or :c:func:`skb_clone`
458will cause the driver to miss the packets and lead to clear text leaks.
459
460Redirects leak clear text
461-------------------------
462
463In the RX direction, if segment has already been decrypted by the device
464and it gets redirected or mirrored - clear text will be transmitted out.
465
466.. _pre_tls_data:
467
468Transmission of pre-TLS data
469----------------------------
470
471User can enqueue some already encrypted and framed records before enabling
472``ktls`` on the socket. Those records have to get sent as they are. This is
473perfectly easy to handle in the software case - such data will be waiting
474in the TCP layer, TLS ULP won't see it. In the offloaded case when pre-queued
475segment reaches transmission point it appears to be out of order (before the
476expected TCP sequence number) and the stack does not have a record information
477associated.
478
479All segments without record information cannot, however, be assumed to be
480pre-queued data, because a race condition exists between TCP stack queuing
481a retransmission, the driver seeing the retransmission and TCP ACK arriving
482for the retransmitted data.
diff --git a/Documentation/networking/tls.txt b/Documentation/networking/tls.rst
index 58b5ef75f1b7..5bcbf75e2025 100644
--- a/Documentation/networking/tls.txt
+++ b/Documentation/networking/tls.rst
@@ -1,3 +1,9 @@
1.. _kernel_tls:
2
3==========
4Kernel TLS
5==========
6
1Overview 7Overview
2======== 8========
3 9
@@ -12,6 +18,8 @@ Creating a TLS connection
12 18
13First create a new TCP socket and set the TLS ULP. 19First create a new TCP socket and set the TLS ULP.
14 20
21.. code-block:: c
22
15 sock = socket(AF_INET, SOCK_STREAM, 0); 23 sock = socket(AF_INET, SOCK_STREAM, 0);
16 setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls")); 24 setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls"));
17 25
@@ -21,6 +29,8 @@ handshake is complete, we have all the parameters required to move the
21data-path to the kernel. There is a separate socket option for moving 29data-path to the kernel. There is a separate socket option for moving
22the transmit and the receive into the kernel. 30the transmit and the receive into the kernel.
23 31
32.. code-block:: c
33
24 /* From linux/tls.h */ 34 /* From linux/tls.h */
25 struct tls_crypto_info { 35 struct tls_crypto_info {
26 unsigned short version; 36 unsigned short version;
@@ -58,6 +68,8 @@ After setting the TLS_TX socket option all application data sent over this
58socket is encrypted using TLS and the parameters provided in the socket option. 68socket is encrypted using TLS and the parameters provided in the socket option.
59For example, we can send an encrypted hello world record as follows: 69For example, we can send an encrypted hello world record as follows:
60 70
71.. code-block:: c
72
61 const char *msg = "hello world\n"; 73 const char *msg = "hello world\n";
62 send(sock, msg, strlen(msg)); 74 send(sock, msg, strlen(msg));
63 75
@@ -67,6 +79,8 @@ to the encrypted kernel send buffer if possible.
67The sendfile system call will send the file's data over TLS records of maximum 79The sendfile system call will send the file's data over TLS records of maximum
68length (2^14). 80length (2^14).
69 81
82.. code-block:: c
83
70 file = open(filename, O_RDONLY); 84 file = open(filename, O_RDONLY);
71 fstat(file, &stat); 85 fstat(file, &stat);
72 sendfile(sock, file, &offset, stat.st_size); 86 sendfile(sock, file, &offset, stat.st_size);
@@ -89,6 +103,8 @@ After setting the TLS_RX socket option, all recv family socket calls
89are decrypted using TLS parameters provided. A full TLS record must 103are decrypted using TLS parameters provided. A full TLS record must
90be received before decryption can happen. 104be received before decryption can happen.
91 105
106.. code-block:: c
107
92 char buffer[16384]; 108 char buffer[16384];
93 recv(sock, buffer, 16384); 109 recv(sock, buffer, 16384);
94 110
@@ -97,12 +113,12 @@ large enough, and no additional allocations occur. If the userspace
97buffer is too small, data is decrypted in the kernel and copied to 113buffer is too small, data is decrypted in the kernel and copied to
98userspace. 114userspace.
99 115
100EINVAL is returned if the TLS version in the received message does not 116``EINVAL`` is returned if the TLS version in the received message does not
101match the version passed in setsockopt. 117match the version passed in setsockopt.
102 118
103EMSGSIZE is returned if the received message is too big. 119``EMSGSIZE`` is returned if the received message is too big.
104 120
105EBADMSG is returned if decryption failed for any other reason. 121``EBADMSG`` is returned if decryption failed for any other reason.
106 122
107Send TLS control messages 123Send TLS control messages
108------------------------- 124-------------------------
@@ -113,9 +129,11 @@ These messages can be sent over the socket by providing the TLS record type
113via a CMSG. For example the following function sends @data of @length bytes 129via a CMSG. For example the following function sends @data of @length bytes
114using a record of type @record_type. 130using a record of type @record_type.
115 131
116/* send TLS control message using record_type */ 132.. code-block:: c
133
134 /* send TLS control message using record_type */
117 static int klts_send_ctrl_message(int sock, unsigned char record_type, 135 static int klts_send_ctrl_message(int sock, unsigned char record_type,
118 void *data, size_t length) 136 void *data, size_t length)
119 { 137 {
120 struct msghdr msg = {0}; 138 struct msghdr msg = {0};
121 int cmsg_len = sizeof(record_type); 139 int cmsg_len = sizeof(record_type);
@@ -151,6 +169,8 @@ type passed via cmsg. If no cmsg buffer is provided, an error is
151returned if a control message is received. Data messages may be 169returned if a control message is received. Data messages may be
152received without a cmsg buffer set. 170received without a cmsg buffer set.
153 171
172.. code-block:: c
173
154 char buffer[16384]; 174 char buffer[16384];
155 char cmsg[CMSG_SPACE(sizeof(unsigned char))]; 175 char cmsg[CMSG_SPACE(sizeof(unsigned char))];
156 struct msghdr msg = {0}; 176 struct msghdr msg = {0};
@@ -186,12 +206,10 @@ Integrating in to userspace TLS library
186At a high level, the kernel TLS ULP is a replacement for the record 206At a high level, the kernel TLS ULP is a replacement for the record
187layer of a userspace TLS library. 207layer of a userspace TLS library.
188 208
189A patchset to OpenSSL to use ktls as the record layer is here: 209A patchset to OpenSSL to use ktls as the record layer is
190 210`here <https://github.com/Mellanox/openssl/commits/tls_rx2>`_.
191https://github.com/Mellanox/openssl/commits/tls_rx2
192
193An example of calling send directly after a handshake using
194gnutls. Since it doesn't implement a full record layer, control
195messages are not supported:
196 211
197https://github.com/ktls/af_ktls-tool/commits/RX 212`An example <https://github.com/ktls/af_ktls-tool/commits/RX>`_
213of calling send directly after a handshake using gnutls.
214Since it doesn't implement a full record layer, control
215messages are not supported.
diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
index 9d0a7f08f93b..1159405cb920 100644
--- a/Documentation/sphinx/kerneldoc.py
+++ b/Documentation/sphinx/kerneldoc.py
@@ -37,7 +37,19 @@ import glob
37from docutils import nodes, statemachine 37from docutils import nodes, statemachine
38from docutils.statemachine import ViewList 38from docutils.statemachine import ViewList
39from docutils.parsers.rst import directives, Directive 39from docutils.parsers.rst import directives, Directive
40from sphinx.ext.autodoc import AutodocReporter 40
41#
42# AutodocReporter is only good up to Sphinx 1.7
43#
44import sphinx
45
46Use_SSI = sphinx.__version__[:3] >= '1.7'
47if Use_SSI:
48 from sphinx.util.docutils import switch_source_input
49else:
50 from sphinx.ext.autodoc import AutodocReporter
51
52import kernellog
41 53
42__version__ = '1.0' 54__version__ = '1.0'
43 55
@@ -90,7 +102,8 @@ class KernelDocDirective(Directive):
90 cmd += [filename] 102 cmd += [filename]
91 103
92 try: 104 try:
93 env.app.verbose('calling kernel-doc \'%s\'' % (" ".join(cmd))) 105 kernellog.verbose(env.app,
106 'calling kernel-doc \'%s\'' % (" ".join(cmd)))
94 107
95 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 108 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
96 out, err = p.communicate() 109 out, err = p.communicate()
@@ -100,7 +113,8 @@ class KernelDocDirective(Directive):
100 if p.returncode != 0: 113 if p.returncode != 0:
101 sys.stderr.write(err) 114 sys.stderr.write(err)
102 115
103 env.app.warn('kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode)) 116 kernellog.warn(env.app,
117 'kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode))
104 return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))] 118 return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
105 elif env.config.kerneldoc_verbosity > 0: 119 elif env.config.kerneldoc_verbosity > 0:
106 sys.stderr.write(err) 120 sys.stderr.write(err)
@@ -121,20 +135,28 @@ class KernelDocDirective(Directive):
121 lineoffset += 1 135 lineoffset += 1
122 136
123 node = nodes.section() 137 node = nodes.section()
124 buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter 138 self.do_parse(result, node)
139
140 return node.children
141
142 except Exception as e: # pylint: disable=W0703
143 kernellog.warn(env.app, 'kernel-doc \'%s\' processing failed with: %s' %
144 (" ".join(cmd), str(e)))
145 return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
146
147 def do_parse(self, result, node):
148 if Use_SSI:
149 with switch_source_input(self.state, result):
150 self.state.nested_parse(result, 0, node, match_titles=1)
151 else:
152 save = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
125 self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter) 153 self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
126 self.state.memo.title_styles, self.state.memo.section_level = [], 0 154 self.state.memo.title_styles, self.state.memo.section_level = [], 0
127 try: 155 try:
128 self.state.nested_parse(result, 0, node, match_titles=1) 156 self.state.nested_parse(result, 0, node, match_titles=1)
129 finally: 157 finally:
130 self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf 158 self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = save
131 159
132 return node.children
133
134 except Exception as e: # pylint: disable=W0703
135 env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
136 (" ".join(cmd), str(e)))
137 return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
138 160
139def setup(app): 161def setup(app):
140 app.add_config_value('kerneldoc_bin', None, 'env') 162 app.add_config_value('kerneldoc_bin', None, 'env')
diff --git a/Documentation/sphinx/kernellog.py b/Documentation/sphinx/kernellog.py
new file mode 100644
index 000000000000..af924f51a7dc
--- /dev/null
+++ b/Documentation/sphinx/kernellog.py
@@ -0,0 +1,28 @@
1# SPDX-License-Identifier: GPL-2.0
2#
3# Sphinx has deprecated its older logging interface, but the replacement
4# only goes back to 1.6. So here's a wrapper layer to keep around for
5# as long as we support 1.4.
6#
7import sphinx
8
9if sphinx.__version__[:3] >= '1.6':
10 UseLogging = True
11 from sphinx.util import logging
12 logger = logging.getLogger('kerneldoc')
13else:
14 UseLogging = False
15
16def warn(app, message):
17 if UseLogging:
18 logger.warning(message)
19 else:
20 app.warn(message)
21
22def verbose(app, message):
23 if UseLogging:
24 logger.verbose(message)
25 else:
26 app.verbose(message)
27
28
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
index b97228d2cc0e..fbfe6693bb60 100644
--- a/Documentation/sphinx/kfigure.py
+++ b/Documentation/sphinx/kfigure.py
@@ -60,6 +60,8 @@ import sphinx
60from sphinx.util.nodes import clean_astext 60from sphinx.util.nodes import clean_astext
61from six import iteritems 61from six import iteritems
62 62
63import kernellog
64
63PY3 = sys.version_info[0] == 3 65PY3 = sys.version_info[0] == 3
64 66
65if PY3: 67if PY3:
@@ -171,20 +173,20 @@ def setupTools(app):
171 This function is called once, when the builder is initiated. 173 This function is called once, when the builder is initiated.
172 """ 174 """
173 global dot_cmd, convert_cmd # pylint: disable=W0603 175 global dot_cmd, convert_cmd # pylint: disable=W0603
174 app.verbose("kfigure: check installed tools ...") 176 kernellog.verbose(app, "kfigure: check installed tools ...")
175 177
176 dot_cmd = which('dot') 178 dot_cmd = which('dot')
177 convert_cmd = which('convert') 179 convert_cmd = which('convert')
178 180
179 if dot_cmd: 181 if dot_cmd:
180 app.verbose("use dot(1) from: " + dot_cmd) 182 kernellog.verbose(app, "use dot(1) from: " + dot_cmd)
181 else: 183 else:
182 app.warn("dot(1) not found, for better output quality install " 184 kernellog.warn(app, "dot(1) not found, for better output quality install "
183 "graphviz from http://www.graphviz.org") 185 "graphviz from http://www.graphviz.org")
184 if convert_cmd: 186 if convert_cmd:
185 app.verbose("use convert(1) from: " + convert_cmd) 187 kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
186 else: 188 else:
187 app.warn( 189 kernellog.warn(app,
188 "convert(1) not found, for SVG to PDF conversion install " 190 "convert(1) not found, for SVG to PDF conversion install "
189 "ImageMagick (https://www.imagemagick.org)") 191 "ImageMagick (https://www.imagemagick.org)")
190 192
@@ -220,12 +222,13 @@ def convert_image(img_node, translator, src_fname=None):
220 222
221 # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages 223 # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages
222 224
223 app.verbose('assert best format for: ' + img_node['uri']) 225 kernellog.verbose(app, 'assert best format for: ' + img_node['uri'])
224 226
225 if in_ext == '.dot': 227 if in_ext == '.dot':
226 228
227 if not dot_cmd: 229 if not dot_cmd:
228 app.verbose("dot from graphviz not available / include DOT raw.") 230 kernellog.verbose(app,
231 "dot from graphviz not available / include DOT raw.")
229 img_node.replace_self(file2literal(src_fname)) 232 img_node.replace_self(file2literal(src_fname))
230 233
231 elif translator.builder.format == 'latex': 234 elif translator.builder.format == 'latex':
@@ -252,7 +255,8 @@ def convert_image(img_node, translator, src_fname=None):
252 255
253 if translator.builder.format == 'latex': 256 if translator.builder.format == 'latex':
254 if convert_cmd is None: 257 if convert_cmd is None:
255 app.verbose("no SVG to PDF conversion available / include SVG raw.") 258 kernellog.verbose(app,
259 "no SVG to PDF conversion available / include SVG raw.")
256 img_node.replace_self(file2literal(src_fname)) 260 img_node.replace_self(file2literal(src_fname))
257 else: 261 else:
258 dst_fname = path.join(translator.builder.outdir, fname + '.pdf') 262 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
@@ -265,18 +269,19 @@ def convert_image(img_node, translator, src_fname=None):
265 _name = dst_fname[len(translator.builder.outdir) + 1:] 269 _name = dst_fname[len(translator.builder.outdir) + 1:]
266 270
267 if isNewer(dst_fname, src_fname): 271 if isNewer(dst_fname, src_fname):
268 app.verbose("convert: {out}/%s already exists and is newer" % _name) 272 kernellog.verbose(app,
273 "convert: {out}/%s already exists and is newer" % _name)
269 274
270 else: 275 else:
271 ok = False 276 ok = False
272 mkdir(path.dirname(dst_fname)) 277 mkdir(path.dirname(dst_fname))
273 278
274 if in_ext == '.dot': 279 if in_ext == '.dot':
275 app.verbose('convert DOT to: {out}/' + _name) 280 kernellog.verbose(app, 'convert DOT to: {out}/' + _name)
276 ok = dot2format(app, src_fname, dst_fname) 281 ok = dot2format(app, src_fname, dst_fname)
277 282
278 elif in_ext == '.svg': 283 elif in_ext == '.svg':
279 app.verbose('convert SVG to: {out}/' + _name) 284 kernellog.verbose(app, 'convert SVG to: {out}/' + _name)
280 ok = svg2pdf(app, src_fname, dst_fname) 285 ok = svg2pdf(app, src_fname, dst_fname)
281 286
282 if not ok: 287 if not ok:
@@ -305,7 +310,8 @@ def dot2format(app, dot_fname, out_fname):
305 with open(out_fname, "w") as out: 310 with open(out_fname, "w") as out:
306 exit_code = subprocess.call(cmd, stdout = out) 311 exit_code = subprocess.call(cmd, stdout = out)
307 if exit_code != 0: 312 if exit_code != 0:
308 app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd))) 313 kernellog.warn(app,
314 "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
309 return bool(exit_code == 0) 315 return bool(exit_code == 0)
310 316
311def svg2pdf(app, svg_fname, pdf_fname): 317def svg2pdf(app, svg_fname, pdf_fname):
@@ -322,7 +328,7 @@ def svg2pdf(app, svg_fname, pdf_fname):
322 # use stdout and stderr from parent 328 # use stdout and stderr from parent
323 exit_code = subprocess.call(cmd) 329 exit_code = subprocess.call(cmd)
324 if exit_code != 0: 330 if exit_code != 0:
325 app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd))) 331 kernellog.warn(app, "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
326 return bool(exit_code == 0) 332 return bool(exit_code == 0)
327 333
328 334
@@ -415,15 +421,15 @@ def visit_kernel_render(self, node):
415 app = self.builder.app 421 app = self.builder.app
416 srclang = node.get('srclang') 422 srclang = node.get('srclang')
417 423
418 app.verbose('visit kernel-render node lang: "%s"' % (srclang)) 424 kernellog.verbose(app, 'visit kernel-render node lang: "%s"' % (srclang))
419 425
420 tmp_ext = RENDER_MARKUP_EXT.get(srclang, None) 426 tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
421 if tmp_ext is None: 427 if tmp_ext is None:
422 app.warn('kernel-render: "%s" unknown / include raw.' % (srclang)) 428 kernellog.warn(app, 'kernel-render: "%s" unknown / include raw.' % (srclang))
423 return 429 return
424 430
425 if not dot_cmd and tmp_ext == '.dot': 431 if not dot_cmd and tmp_ext == '.dot':
426 app.verbose("dot from graphviz not available / include raw.") 432 kernellog.verbose(app, "dot from graphviz not available / include raw.")
427 return 433 return
428 434
429 literal_block = node[0] 435 literal_block = node[0]
diff --git a/Documentation/usb/rio.txt b/Documentation/usb/rio.txt
index ca9adcf56355..ea73475471db 100644
--- a/Documentation/usb/rio.txt
+++ b/Documentation/usb/rio.txt
@@ -76,70 +76,30 @@ Additional Information and userspace tools
76Requirements 76Requirements
77============ 77============
78 78
79A host with a USB port. Ideally, either a UHCI (Intel) or OHCI 79A host with a USB port running a Linux kernel with RIO 500 support enabled.
80(Compaq and others) hardware port should work.
81 80
82A Linux development kernel (2.3.x) with USB support enabled or a 81The driver is a module called rio500, which should be automatically loaded
83backported version to linux-2.2.x. See http://www.linux-usb.org for 82as you plug in your device. If that fails you can manually load it with
84more information on accomplishing this.
85 83
86A Linux kernel with RIO 500 support enabled. 84 modprobe rio500
87 85
88'lspci' which is only needed to determine the type of USB hardware 86Udev should automatically create a device node as soon as plug in your device.
89available in your machine. 87If that fails, you can manually add a device for the USB rio500::
90
91Configuration
92
93Using `lspci -v`, determine the type of USB hardware available.
94
95 If you see something like::
96
97 USB Controller: ......
98 Flags: .....
99 I/O ports at ....
100
101 Then you have a UHCI based controller.
102
103 If you see something like::
104
105 USB Controller: .....
106 Flags: ....
107 Memory at .....
108
109 Then you have a OHCI based controller.
110
111Using `make menuconfig` or your preferred method for configuring the
112kernel, select 'Support for USB', 'OHCI/UHCI' depending on your
113hardware (determined from the steps above), 'USB Diamond Rio500 support', and
114'Preliminary USB device filesystem'. Compile and install the modules
115(you may need to execute `depmod -a` to update the module
116dependencies).
117
118Add a device for the USB rio500::
119 88
120 mknod /dev/usb/rio500 c 180 64 89 mknod /dev/usb/rio500 c 180 64
121 90
122Set appropriate permissions for /dev/usb/rio500 (don't forget about 91In that case, set appropriate permissions for /dev/usb/rio500 (don't forget
123group and world permissions). Both read and write permissions are 92about group and world permissions). Both read and write permissions are
124required for proper operation. 93required for proper operation.
125 94
126Load the appropriate modules (if compiled as modules):
127
128 OHCI::
129
130 modprobe usbcore
131 modprobe usb-ohci
132 modprobe rio500
133
134 UHCI::
135
136 modprobe usbcore
137 modprobe usb-uhci (or uhci)
138 modprobe rio500
139
140That's it. The Rio500 Utils at: http://rio500.sourceforge.net should 95That's it. The Rio500 Utils at: http://rio500.sourceforge.net should
141be able to access the rio500. 96be able to access the rio500.
142 97
98Limits
99======
100
101You can use only a single rio500 device at a time with your computer.
102
143Bugs 103Bugs
144==== 104====
145 105
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index a65167f5cded..e8bcb9ecede9 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -20,7 +20,7 @@
20#include <linux/compat.h> 20#include <linux/compat.h>
21#include <linux/err.h> 21#include <linux/err.h>
22 22
23typedef long (*syscall_fn_t)(struct pt_regs *regs); 23typedef long (*syscall_fn_t)(const struct pt_regs *regs);
24 24
25extern const syscall_fn_t sys_call_table[]; 25extern const syscall_fn_t sys_call_table[];
26 26
diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h
index a4477e515b79..507d0ee6bc69 100644
--- a/arch/arm64/include/asm/syscall_wrapper.h
+++ b/arch/arm64/include/asm/syscall_wrapper.h
@@ -30,10 +30,10 @@
30 } \ 30 } \
31 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 31 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
32 32
33#define COMPAT_SYSCALL_DEFINE0(sname) \ 33#define COMPAT_SYSCALL_DEFINE0(sname) \
34 asmlinkage long __arm64_compat_sys_##sname(void); \ 34 asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused); \
35 ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \ 35 ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \
36 asmlinkage long __arm64_compat_sys_##sname(void) 36 asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused)
37 37
38#define COND_SYSCALL_COMPAT(name) \ 38#define COND_SYSCALL_COMPAT(name) \
39 cond_syscall(__arm64_compat_sys_##name); 39 cond_syscall(__arm64_compat_sys_##name);
@@ -62,11 +62,11 @@
62 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 62 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
63 63
64#ifndef SYSCALL_DEFINE0 64#ifndef SYSCALL_DEFINE0
65#define SYSCALL_DEFINE0(sname) \ 65#define SYSCALL_DEFINE0(sname) \
66 SYSCALL_METADATA(_##sname, 0); \ 66 SYSCALL_METADATA(_##sname, 0); \
67 asmlinkage long __arm64_sys_##sname(void); \ 67 asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused); \
68 ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \ 68 ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \
69 asmlinkage long __arm64_sys_##sname(void) 69 asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
70#endif 70#endif
71 71
72#ifndef COND_SYSCALL 72#ifndef COND_SYSCALL
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index f32359cffb01..dd080837e6a9 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -98,10 +98,10 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
98 98
99 /* 99 /*
100 * The ELF psABI for AArch64 documents the 16-bit and 32-bit place 100 * The ELF psABI for AArch64 documents the 16-bit and 32-bit place
101 * relative relocations as having a range of [-2^15, 2^16) or 101 * relative and absolute relocations as having a range of [-2^15, 2^16)
102 * [-2^31, 2^32), respectively. However, in order to be able to detect 102 * or [-2^31, 2^32), respectively. However, in order to be able to
103 * overflows reliably, we have to choose whether we interpret such 103 * detect overflows reliably, we have to choose whether we interpret
104 * quantities as signed or as unsigned, and stick with it. 104 * such quantities as signed or as unsigned, and stick with it.
105 * The way we organize our address space requires a signed 105 * The way we organize our address space requires a signed
106 * interpretation of 32-bit relative references, so let's use that 106 * interpretation of 32-bit relative references, so let's use that
107 * for all R_AARCH64_PRELxx relocations. This means our upper 107 * for all R_AARCH64_PRELxx relocations. This means our upper
@@ -111,13 +111,35 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
111 switch (len) { 111 switch (len) {
112 case 16: 112 case 16:
113 *(s16 *)place = sval; 113 *(s16 *)place = sval;
114 if (sval < S16_MIN || sval > S16_MAX) 114 switch (op) {
115 return -ERANGE; 115 case RELOC_OP_ABS:
116 if (sval < 0 || sval > U16_MAX)
117 return -ERANGE;
118 break;
119 case RELOC_OP_PREL:
120 if (sval < S16_MIN || sval > S16_MAX)
121 return -ERANGE;
122 break;
123 default:
124 pr_err("Invalid 16-bit data relocation (%d)\n", op);
125 return 0;
126 }
116 break; 127 break;
117 case 32: 128 case 32:
118 *(s32 *)place = sval; 129 *(s32 *)place = sval;
119 if (sval < S32_MIN || sval > S32_MAX) 130 switch (op) {
120 return -ERANGE; 131 case RELOC_OP_ABS:
132 if (sval < 0 || sval > U32_MAX)
133 return -ERANGE;
134 break;
135 case RELOC_OP_PREL:
136 if (sval < S32_MIN || sval > S32_MAX)
137 return -ERANGE;
138 break;
139 default:
140 pr_err("Invalid 32-bit data relocation (%d)\n", op);
141 return 0;
142 }
121 break; 143 break;
122 case 64: 144 case 64:
123 *(s64 *)place = sval; 145 *(s64 *)place = sval;
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 6f91e8116514..fe20c461582a 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -47,22 +47,26 @@ SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
47 return ksys_personality(personality); 47 return ksys_personality(personality);
48} 48}
49 49
50asmlinkage long sys_ni_syscall(void);
51
52asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
53{
54 return sys_ni_syscall();
55}
56
50/* 57/*
51 * Wrappers to pass the pt_regs argument. 58 * Wrappers to pass the pt_regs argument.
52 */ 59 */
53#define sys_personality sys_arm64_personality 60#define __arm64_sys_personality __arm64_sys_arm64_personality
54
55asmlinkage long sys_ni_syscall(const struct pt_regs *);
56#define __arm64_sys_ni_syscall sys_ni_syscall
57 61
58#undef __SYSCALL 62#undef __SYSCALL
59#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *); 63#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
60#include <asm/unistd.h> 64#include <asm/unistd.h>
61 65
62#undef __SYSCALL 66#undef __SYSCALL
63#define __SYSCALL(nr, sym) [nr] = (syscall_fn_t)__arm64_##sym, 67#define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
64 68
65const syscall_fn_t sys_call_table[__NR_syscalls] = { 69const syscall_fn_t sys_call_table[__NR_syscalls] = {
66 [0 ... __NR_syscalls - 1] = (syscall_fn_t)sys_ni_syscall, 70 [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
67#include <asm/unistd.h> 71#include <asm/unistd.h>
68}; 72};
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
index 0f8bcb7de700..3c80a40c1c9d 100644
--- a/arch/arm64/kernel/sys32.c
+++ b/arch/arm64/kernel/sys32.c
@@ -133,17 +133,14 @@ COMPAT_SYSCALL_DEFINE6(aarch32_fallocate, int, fd, int, mode,
133 return ksys_fallocate(fd, mode, arg_u64(offset), arg_u64(len)); 133 return ksys_fallocate(fd, mode, arg_u64(offset), arg_u64(len));
134} 134}
135 135
136asmlinkage long sys_ni_syscall(const struct pt_regs *);
137#define __arm64_sys_ni_syscall sys_ni_syscall
138
139#undef __SYSCALL 136#undef __SYSCALL
140#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *); 137#define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
141#include <asm/unistd32.h> 138#include <asm/unistd32.h>
142 139
143#undef __SYSCALL 140#undef __SYSCALL
144#define __SYSCALL(nr, sym) [nr] = (syscall_fn_t)__arm64_##sym, 141#define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
145 142
146const syscall_fn_t compat_sys_call_table[__NR_compat_syscalls] = { 143const syscall_fn_t compat_sys_call_table[__NR_compat_syscalls] = {
147 [0 ... __NR_compat_syscalls - 1] = (syscall_fn_t)sys_ni_syscall, 144 [0 ... __NR_compat_syscalls - 1] = __arm64_sys_ni_syscall,
148#include <asm/unistd32.h> 145#include <asm/unistd32.h>
149}; 146};
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index e6be1a6efc0a..177c0f6ebabf 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -252,7 +252,10 @@ void arm64_force_sig_fault(int signo, int code, void __user *addr,
252 const char *str) 252 const char *str)
253{ 253{
254 arm64_show_signal(signo, str); 254 arm64_show_signal(signo, str);
255 force_sig_fault(signo, code, addr, current); 255 if (signo == SIGKILL)
256 force_sig(SIGKILL, current);
257 else
258 force_sig_fault(signo, code, addr, current);
256} 259}
257 260
258void arm64_force_sig_mceerr(int code, void __user *addr, short lsb, 261void arm64_force_sig_mceerr(int code, void __user *addr, short lsb,
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index a03803506b0c..5e1015eb6d0d 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -55,6 +55,7 @@ paddr_to_nid(unsigned long paddr)
55 55
56 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); 56 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
57} 57}
58EXPORT_SYMBOL(paddr_to_nid);
58 59
59#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA) 60#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)
60/* 61/*
diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index 1ef8438e3d6d..122a81ab8e48 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -449,12 +449,12 @@ static int __init imx8mm_clocks_init(struct device_node *ccm_node)
449 clks[IMX8MM_AUDIO_PLL2_OUT] = imx_clk_gate("audio_pll2_out", "audio_pll2_bypass", base + 0x14, 13); 449 clks[IMX8MM_AUDIO_PLL2_OUT] = imx_clk_gate("audio_pll2_out", "audio_pll2_bypass", base + 0x14, 13);
450 clks[IMX8MM_VIDEO_PLL1_OUT] = imx_clk_gate("video_pll1_out", "video_pll1_bypass", base + 0x28, 13); 450 clks[IMX8MM_VIDEO_PLL1_OUT] = imx_clk_gate("video_pll1_out", "video_pll1_bypass", base + 0x28, 13);
451 clks[IMX8MM_DRAM_PLL_OUT] = imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13); 451 clks[IMX8MM_DRAM_PLL_OUT] = imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13);
452 clks[IMX8MM_GPU_PLL_OUT] = imx_clk_gate("gpu_pll_out", "gpu_pll_bypass", base + 0x64, 13); 452 clks[IMX8MM_GPU_PLL_OUT] = imx_clk_gate("gpu_pll_out", "gpu_pll_bypass", base + 0x64, 11);
453 clks[IMX8MM_VPU_PLL_OUT] = imx_clk_gate("vpu_pll_out", "vpu_pll_bypass", base + 0x74, 13); 453 clks[IMX8MM_VPU_PLL_OUT] = imx_clk_gate("vpu_pll_out", "vpu_pll_bypass", base + 0x74, 11);
454 clks[IMX8MM_ARM_PLL_OUT] = imx_clk_gate("arm_pll_out", "arm_pll_bypass", base + 0x84, 13); 454 clks[IMX8MM_ARM_PLL_OUT] = imx_clk_gate("arm_pll_out", "arm_pll_bypass", base + 0x84, 11);
455 clks[IMX8MM_SYS_PLL1_OUT] = imx_clk_gate("sys_pll1_out", "sys_pll1_bypass", base + 0x94, 13); 455 clks[IMX8MM_SYS_PLL1_OUT] = imx_clk_gate("sys_pll1_out", "sys_pll1_bypass", base + 0x94, 11);
456 clks[IMX8MM_SYS_PLL2_OUT] = imx_clk_gate("sys_pll2_out", "sys_pll2_bypass", base + 0x104, 13); 456 clks[IMX8MM_SYS_PLL2_OUT] = imx_clk_gate("sys_pll2_out", "sys_pll2_bypass", base + 0x104, 11);
457 clks[IMX8MM_SYS_PLL3_OUT] = imx_clk_gate("sys_pll3_out", "sys_pll3_bypass", base + 0x114, 13); 457 clks[IMX8MM_SYS_PLL3_OUT] = imx_clk_gate("sys_pll3_out", "sys_pll3_bypass", base + 0x114, 11);
458 458
459 /* SYS PLL fixed output */ 459 /* SYS PLL fixed output */
460 clks[IMX8MM_SYS_PLL1_40M] = imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20); 460 clks[IMX8MM_SYS_PLL1_40M] = imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20);
diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig
index 8db4a3eb4782..f3b4eb9cb0f5 100644
--- a/drivers/clk/sifive/Kconfig
+++ b/drivers/clk/sifive/Kconfig
@@ -2,6 +2,7 @@
2 2
3menuconfig CLK_SIFIVE 3menuconfig CLK_SIFIVE
4 bool "SiFive SoC driver support" 4 bool "SiFive SoC driver support"
5 depends on RISCV || COMPILE_TEST
5 help 6 help
6 SoC drivers for SiFive Linux-capable SoCs. 7 SoC drivers for SiFive Linux-capable SoCs.
7 8
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 96d65a1cf7be..8e834317c97d 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -137,9 +137,6 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
137 int ret; 137 int ret;
138 union omap4_timeout timeout = { 0 }; 138 union omap4_timeout timeout = { 0 };
139 139
140 if (!clk->enable_bit)
141 return 0;
142
143 if (clk->clkdm) { 140 if (clk->clkdm) {
144 ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk); 141 ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk);
145 if (ret) { 142 if (ret) {
@@ -151,6 +148,9 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
151 } 148 }
152 } 149 }
153 150
151 if (!clk->enable_bit)
152 return 0;
153
154 val = ti_clk_ll_ops->clk_readl(&clk->enable_reg); 154 val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);
155 155
156 val &= ~OMAP4_MODULEMODE_MASK; 156 val &= ~OMAP4_MODULEMODE_MASK;
@@ -179,7 +179,7 @@ static void _omap4_clkctrl_clk_disable(struct clk_hw *hw)
179 union omap4_timeout timeout = { 0 }; 179 union omap4_timeout timeout = { 0 };
180 180
181 if (!clk->enable_bit) 181 if (!clk->enable_bit)
182 return; 182 goto exit;
183 183
184 val = ti_clk_ll_ops->clk_readl(&clk->enable_reg); 184 val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);
185 185
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index be832eb73627..acd40eb51c46 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -823,6 +823,7 @@ config GPIO_ADP5588
823config GPIO_ADP5588_IRQ 823config GPIO_ADP5588_IRQ
824 bool "Interrupt controller support for ADP5588" 824 bool "Interrupt controller support for ADP5588"
825 depends on GPIO_ADP5588=y 825 depends on GPIO_ADP5588=y
826 select GPIOLIB_IRQCHIP
826 help 827 help
827 Say yes here to enable the adp5588 to be used as an interrupt 828 Say yes here to enable the adp5588 to be used as an interrupt
828 controller. It requires the driver to be built in the kernel. 829 controller. It requires the driver to be built in the kernel.
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 3b7370d914a5..72837b8c7031 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -624,9 +624,8 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
624 */ 624 */
625 switch (adev->asic_type) { 625 switch (adev->asic_type) {
626 case CHIP_VEGA10: 626 case CHIP_VEGA10:
627 return true;
628 case CHIP_RAVEN: 627 case CHIP_RAVEN:
629 return (adev->pdev->device == 0x15d8); 628 return true;
630 case CHIP_VEGA12: 629 case CHIP_VEGA12:
631 case CHIP_VEGA20: 630 case CHIP_VEGA20:
632 default: 631 default:
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 995f9df66142..bcb1a93c0b4c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -29,6 +29,7 @@
29#include "dm_services_types.h" 29#include "dm_services_types.h"
30#include "dc.h" 30#include "dc.h"
31#include "dc/inc/core_types.h" 31#include "dc/inc/core_types.h"
32#include "dal_asic_id.h"
32 33
33#include "vid.h" 34#include "vid.h"
34#include "amdgpu.h" 35#include "amdgpu.h"
@@ -640,7 +641,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
640 641
641static int load_dmcu_fw(struct amdgpu_device *adev) 642static int load_dmcu_fw(struct amdgpu_device *adev)
642{ 643{
643 const char *fw_name_dmcu; 644 const char *fw_name_dmcu = NULL;
644 int r; 645 int r;
645 const struct dmcu_firmware_header_v1_0 *hdr; 646 const struct dmcu_firmware_header_v1_0 *hdr;
646 647
@@ -663,7 +664,14 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
663 case CHIP_VEGA20: 664 case CHIP_VEGA20:
664 return 0; 665 return 0;
665 case CHIP_RAVEN: 666 case CHIP_RAVEN:
666 fw_name_dmcu = FIRMWARE_RAVEN_DMCU; 667#if defined(CONFIG_DRM_AMD_DC_DCN1_01)
668 if (ASICREV_IS_PICASSO(adev->external_rev_id))
669 fw_name_dmcu = FIRMWARE_RAVEN_DMCU;
670 else if (ASICREV_IS_RAVEN2(adev->external_rev_id))
671 fw_name_dmcu = FIRMWARE_RAVEN_DMCU;
672 else
673#endif
674 return 0;
667 break; 675 break;
668 default: 676 default:
669 DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type); 677 DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index 33854c94cb85..515515ef24f9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -125,6 +125,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
125 return; 125 return;
126 etnaviv_dump_core = false; 126 etnaviv_dump_core = false;
127 127
128 mutex_lock(&gpu->mmu->lock);
129
128 mmu_size = etnaviv_iommu_dump_size(gpu->mmu); 130 mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
129 131
130 /* We always dump registers, mmu, ring and end marker */ 132 /* We always dump registers, mmu, ring and end marker */
@@ -167,6 +169,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
167 iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, 169 iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY,
168 PAGE_KERNEL); 170 PAGE_KERNEL);
169 if (!iter.start) { 171 if (!iter.start) {
172 mutex_unlock(&gpu->mmu->lock);
170 dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); 173 dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
171 return; 174 return;
172 } 175 }
@@ -234,6 +237,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
234 obj->base.size); 237 obj->base.size);
235 } 238 }
236 239
240 mutex_unlock(&gpu->mmu->lock);
241
237 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); 242 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
238 243
239 dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); 244 dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index b74824f0b5b1..249d35c12a75 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -35,7 +35,7 @@
35 * macros. Do **not** mass change existing definitions just to update the style. 35 * macros. Do **not** mass change existing definitions just to update the style.
36 * 36 *
37 * Layout 37 * Layout
38 * '''''' 38 * ~~~~~~
39 * 39 *
40 * Keep helper macros near the top. For example, _PIPE() and friends. 40 * Keep helper macros near the top. For example, _PIPE() and friends.
41 * 41 *
@@ -79,7 +79,7 @@
79 * style. Use lower case in hexadecimal values. 79 * style. Use lower case in hexadecimal values.
80 * 80 *
81 * Naming 81 * Naming
82 * '''''' 82 * ~~~~~~
83 * 83 *
84 * Try to name registers according to the specs. If the register name changes in 84 * Try to name registers according to the specs. If the register name changes in
85 * the specs from platform to another, stick to the original name. 85 * the specs from platform to another, stick to the original name.
@@ -97,7 +97,7 @@
97 * suffix to the name. For example, ``_SKL`` or ``_GEN8``. 97 * suffix to the name. For example, ``_SKL`` or ``_GEN8``.
98 * 98 *
99 * Examples 99 * Examples
100 * '''''''' 100 * ~~~~~~~~
101 * 101 *
102 * (Note that the values in the example are indented using spaces instead of 102 * (Note that the values in the example are indented using spaces instead of
103 * TABs to avoid misalignment in generated documentation. Use TABs in the 103 * TABs to avoid misalignment in generated documentation. Use TABs in the
diff --git a/drivers/gpu/drm/i915/intel_workarounds.c b/drivers/gpu/drm/i915/intel_workarounds.c
index 9682dd575152..6decd432f4d3 100644
--- a/drivers/gpu/drm/i915/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/intel_workarounds.c
@@ -37,7 +37,7 @@
37 * costly and simplifies things. We can revisit this in the future. 37 * costly and simplifies things. We can revisit this in the future.
38 * 38 *
39 * Layout 39 * Layout
40 * '''''' 40 * ~~~~~~
41 * 41 *
42 * Keep things in this file ordered by WA type, as per the above (context, GT, 42 * Keep things in this file ordered by WA type, as per the above (context, GT,
43 * display, register whitelist, batchbuffer). Then, inside each type, keep the 43 * display, register whitelist, batchbuffer). Then, inside each type, keep the
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index d7a727a6e3d7..91edfe2498a6 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -605,7 +605,6 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
605 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch); 605 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch);
606 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba); 606 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba);
607 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active); 607 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active);
608 ipu_plane->next_buf = !active;
609 if (ipu_plane_separate_alpha(ipu_plane)) { 608 if (ipu_plane_separate_alpha(ipu_plane)) {
610 active = ipu_idmac_get_current_buffer(ipu_plane->alpha_ch); 609 active = ipu_idmac_get_current_buffer(ipu_plane->alpha_ch);
611 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, !active, 610 ipu_cpmem_set_buffer(ipu_plane->alpha_ch, !active,
@@ -710,7 +709,6 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
710 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 1, eba); 709 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 1, eba);
711 ipu_idmac_lock_enable(ipu_plane->ipu_ch, num_bursts); 710 ipu_idmac_lock_enable(ipu_plane->ipu_ch, num_bursts);
712 ipu_plane_enable(ipu_plane); 711 ipu_plane_enable(ipu_plane);
713 ipu_plane->next_buf = -1;
714} 712}
715 713
716static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = { 714static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = {
@@ -732,10 +730,15 @@ bool ipu_plane_atomic_update_pending(struct drm_plane *plane)
732 730
733 if (ipu_state->use_pre) 731 if (ipu_state->use_pre)
734 return ipu_prg_channel_configure_pending(ipu_plane->ipu_ch); 732 return ipu_prg_channel_configure_pending(ipu_plane->ipu_ch);
735 else if (ipu_plane->next_buf >= 0)
736 return ipu_idmac_get_current_buffer(ipu_plane->ipu_ch) !=
737 ipu_plane->next_buf;
738 733
734 /*
735 * Pretend no update is pending in the non-PRE/PRG case. For this to
736 * happen, an atomic update would have to be deferred until after the
737 * start of the next frame and simultaneously interrupt latency would
738 * have to be high enough to let the atomic update finish and issue an
739 * event before the previous end of frame interrupt handler can be
740 * executed.
741 */
739 return false; 742 return false;
740} 743}
741int ipu_planes_assign_pre(struct drm_device *dev, 744int ipu_planes_assign_pre(struct drm_device *dev,
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.h b/drivers/gpu/drm/imx/ipuv3-plane.h
index 15e85e15d35c..ffacbcdd2f98 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.h
+++ b/drivers/gpu/drm/imx/ipuv3-plane.h
@@ -27,7 +27,6 @@ struct ipu_plane {
27 int dp_flow; 27 int dp_flow;
28 28
29 bool disabling; 29 bool disabling;
30 int next_buf;
31}; 30};
32 31
33struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, 32struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
diff --git a/drivers/gpu/drm/qxl/qxl_prime.c b/drivers/gpu/drm/qxl/qxl_prime.c
index 114653b471c6..7d3816fca5a8 100644
--- a/drivers/gpu/drm/qxl/qxl_prime.c
+++ b/drivers/gpu/drm/qxl/qxl_prime.c
@@ -77,6 +77,5 @@ void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
77int qxl_gem_prime_mmap(struct drm_gem_object *obj, 77int qxl_gem_prime_mmap(struct drm_gem_object *obj,
78 struct vm_area_struct *area) 78 struct vm_area_struct *area)
79{ 79{
80 WARN_ONCE(1, "not implemented");
81 return -ENOSYS; 80 return -ENOSYS;
82} 81}
diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c
index 9e25bbec9c70..193b3b81de4d 100644
--- a/drivers/iio/adc/npcm_adc.c
+++ b/drivers/iio/adc/npcm_adc.c
@@ -149,7 +149,7 @@ static int npcm_adc_read_raw(struct iio_dev *indio_dev,
149 } 149 }
150 return IIO_VAL_INT; 150 return IIO_VAL_INT;
151 case IIO_CHAN_INFO_SCALE: 151 case IIO_CHAN_INFO_SCALE:
152 if (info->vref) { 152 if (!IS_ERR(info->vref)) {
153 vref_uv = regulator_get_voltage(info->vref); 153 vref_uv = regulator_get_voltage(info->vref);
154 *val = vref_uv / 1000; 154 *val = vref_uv / 1000;
155 } else { 155 } else {
diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index 53f17e4f2f23..552c2be8d87a 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -202,7 +202,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
202 }; 202 };
203 203
204 priv->data[0] = ADS124S08_CMD_RDATA; 204 priv->data[0] = ADS124S08_CMD_RDATA;
205 memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data)); 205 memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data) - 1);
206 206
207 ret = spi_sync_transfer(priv->spi, t, ARRAY_SIZE(t)); 207 ret = spi_sync_transfer(priv->spi, t, ARRAY_SIZE(t));
208 if (ret < 0) 208 if (ret < 0)
diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c
index f9461070a74a..8cb7a2034982 100644
--- a/drivers/iio/adc/ti-ads8688.c
+++ b/drivers/iio/adc/ti-ads8688.c
@@ -397,7 +397,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p)
397 } 397 }
398 398
399 iio_push_to_buffers_with_timestamp(indio_dev, buffer, 399 iio_push_to_buffers_with_timestamp(indio_dev, buffer,
400 pf->timestamp); 400 iio_get_time_ns(indio_dev));
401 401
402 iio_trigger_notify_done(indio_dev->trig); 402 iio_trigger_notify_done(indio_dev->trig);
403 403
diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index 883a47562055..714a97f91319 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -166,7 +166,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
166{ 166{
167 int ret, val; 167 int ret, val;
168 168
169 ret = ds4424_get_value(indio_dev, &val, DS4424_DAC_ADDR(0)); 169 ret = ds4424_get_value(indio_dev, &val, 0);
170 if (ret < 0) 170 if (ret < 0)
171 dev_err(&indio_dev->dev, 171 dev_err(&indio_dev->dev,
172 "%s failed. ret: %d\n", __func__, ret); 172 "%s failed. ret: %d\n", __func__, ret);
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 6138a6d86afb..c2916d2d552c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -471,7 +471,10 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
471 return IIO_VAL_INT_PLUS_MICRO; 471 return IIO_VAL_INT_PLUS_MICRO;
472 case IIO_TEMP: 472 case IIO_TEMP:
473 *val = 0; 473 *val = 0;
474 *val2 = INV_MPU6050_TEMP_SCALE; 474 if (st->chip_type == INV_ICM20602)
475 *val2 = INV_ICM20602_TEMP_SCALE;
476 else
477 *val2 = INV_MPU6050_TEMP_SCALE;
475 478
476 return IIO_VAL_INT_PLUS_MICRO; 479 return IIO_VAL_INT_PLUS_MICRO;
477 default: 480 default:
@@ -480,7 +483,10 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
480 case IIO_CHAN_INFO_OFFSET: 483 case IIO_CHAN_INFO_OFFSET:
481 switch (chan->type) { 484 switch (chan->type) {
482 case IIO_TEMP: 485 case IIO_TEMP:
483 *val = INV_MPU6050_TEMP_OFFSET; 486 if (st->chip_type == INV_ICM20602)
487 *val = INV_ICM20602_TEMP_OFFSET;
488 else
489 *val = INV_MPU6050_TEMP_OFFSET;
484 490
485 return IIO_VAL_INT; 491 return IIO_VAL_INT;
486 default: 492 default:
@@ -847,6 +853,32 @@ static const struct iio_chan_spec inv_mpu_channels[] = {
847 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z), 853 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z),
848}; 854};
849 855
856static const struct iio_chan_spec inv_icm20602_channels[] = {
857 IIO_CHAN_SOFT_TIMESTAMP(INV_ICM20602_SCAN_TIMESTAMP),
858 {
859 .type = IIO_TEMP,
860 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW)
861 | BIT(IIO_CHAN_INFO_OFFSET)
862 | BIT(IIO_CHAN_INFO_SCALE),
863 .scan_index = INV_ICM20602_SCAN_TEMP,
864 .scan_type = {
865 .sign = 's',
866 .realbits = 16,
867 .storagebits = 16,
868 .shift = 0,
869 .endianness = IIO_BE,
870 },
871 },
872
873 INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_X, INV_ICM20602_SCAN_GYRO_X),
874 INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_Y, INV_ICM20602_SCAN_GYRO_Y),
875 INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_Z, INV_ICM20602_SCAN_GYRO_Z),
876
877 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Y, INV_ICM20602_SCAN_ACCL_Y),
878 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_X, INV_ICM20602_SCAN_ACCL_X),
879 INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_ICM20602_SCAN_ACCL_Z),
880};
881
850/* 882/*
851 * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and 883 * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and
852 * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the 884 * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the
@@ -1102,8 +1134,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
1102 indio_dev->name = name; 1134 indio_dev->name = name;
1103 else 1135 else
1104 indio_dev->name = dev_name(dev); 1136 indio_dev->name = dev_name(dev);
1105 indio_dev->channels = inv_mpu_channels; 1137
1106 indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); 1138 if (chip_type == INV_ICM20602) {
1139 indio_dev->channels = inv_icm20602_channels;
1140 indio_dev->num_channels = ARRAY_SIZE(inv_icm20602_channels);
1141 } else {
1142 indio_dev->channels = inv_mpu_channels;
1143 indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels);
1144 }
1107 1145
1108 indio_dev->info = &mpu_info; 1146 indio_dev->info = &mpu_info;
1109 indio_dev->modes = INDIO_BUFFER_TRIGGERED; 1147 indio_dev->modes = INDIO_BUFFER_TRIGGERED;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index 325afd9f5f61..3d5fe4474378 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -208,6 +208,9 @@ struct inv_mpu6050_state {
208#define INV_MPU6050_BYTES_PER_3AXIS_SENSOR 6 208#define INV_MPU6050_BYTES_PER_3AXIS_SENSOR 6
209#define INV_MPU6050_FIFO_COUNT_BYTE 2 209#define INV_MPU6050_FIFO_COUNT_BYTE 2
210 210
211/* ICM20602 FIFO samples include temperature readings */
212#define INV_ICM20602_BYTES_PER_TEMP_SENSOR 2
213
211/* mpu6500 registers */ 214/* mpu6500 registers */
212#define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D 215#define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D
213#define INV_MPU6500_REG_ACCEL_OFFSET 0x77 216#define INV_MPU6500_REG_ACCEL_OFFSET 0x77
@@ -229,6 +232,9 @@ struct inv_mpu6050_state {
229#define INV_MPU6050_GYRO_CONFIG_FSR_SHIFT 3 232#define INV_MPU6050_GYRO_CONFIG_FSR_SHIFT 3
230#define INV_MPU6050_ACCL_CONFIG_FSR_SHIFT 3 233#define INV_MPU6050_ACCL_CONFIG_FSR_SHIFT 3
231 234
235#define INV_ICM20602_TEMP_OFFSET 8170
236#define INV_ICM20602_TEMP_SCALE 3060
237
232/* 6 + 6 round up and plus 8 */ 238/* 6 + 6 round up and plus 8 */
233#define INV_MPU6050_OUTPUT_DATA_SIZE 24 239#define INV_MPU6050_OUTPUT_DATA_SIZE 24
234 240
@@ -270,7 +276,7 @@ struct inv_mpu6050_state {
270#define INV_ICM20608_WHOAMI_VALUE 0xAF 276#define INV_ICM20608_WHOAMI_VALUE 0xAF
271#define INV_ICM20602_WHOAMI_VALUE 0x12 277#define INV_ICM20602_WHOAMI_VALUE 0x12
272 278
273/* scan element definition */ 279/* scan element definition for generic MPU6xxx devices */
274enum inv_mpu6050_scan { 280enum inv_mpu6050_scan {
275 INV_MPU6050_SCAN_ACCL_X, 281 INV_MPU6050_SCAN_ACCL_X,
276 INV_MPU6050_SCAN_ACCL_Y, 282 INV_MPU6050_SCAN_ACCL_Y,
@@ -281,6 +287,18 @@ enum inv_mpu6050_scan {
281 INV_MPU6050_SCAN_TIMESTAMP, 287 INV_MPU6050_SCAN_TIMESTAMP,
282}; 288};
283 289
290/* scan element definition for ICM20602, which includes temperature */
291enum inv_icm20602_scan {
292 INV_ICM20602_SCAN_ACCL_X,
293 INV_ICM20602_SCAN_ACCL_Y,
294 INV_ICM20602_SCAN_ACCL_Z,
295 INV_ICM20602_SCAN_TEMP,
296 INV_ICM20602_SCAN_GYRO_X,
297 INV_ICM20602_SCAN_GYRO_Y,
298 INV_ICM20602_SCAN_GYRO_Z,
299 INV_ICM20602_SCAN_TIMESTAMP,
300};
301
284enum inv_mpu6050_filter_e { 302enum inv_mpu6050_filter_e {
285 INV_MPU6050_FILTER_256HZ_NOLPF2 = 0, 303 INV_MPU6050_FILTER_256HZ_NOLPF2 = 0,
286 INV_MPU6050_FILTER_188HZ, 304 INV_MPU6050_FILTER_188HZ,
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 548e042f7b5b..57bd11bde56b 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -207,6 +207,9 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
207 if (st->chip_config.gyro_fifo_enable) 207 if (st->chip_config.gyro_fifo_enable)
208 bytes_per_datum += INV_MPU6050_BYTES_PER_3AXIS_SENSOR; 208 bytes_per_datum += INV_MPU6050_BYTES_PER_3AXIS_SENSOR;
209 209
210 if (st->chip_type == INV_ICM20602)
211 bytes_per_datum += INV_ICM20602_BYTES_PER_TEMP_SENSOR;
212
210 /* 213 /*
211 * read fifo_count register to know how many bytes are inside the FIFO 214 * read fifo_count register to know how many bytes are inside the FIFO
212 * right now 215 * right now
diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c
index d4b6f01a3f0e..6d2088fbaf69 100644
--- a/drivers/isdn/mISDN/dsp_cmx.c
+++ b/drivers/isdn/mISDN/dsp_cmx.c
@@ -1676,9 +1676,9 @@ dsp_cmx_send(void *arg)
1676#ifdef CMX_CONF_DEBUG 1676#ifdef CMX_CONF_DEBUG
1677 if (conf->software && members > 1) 1677 if (conf->software && members > 1)
1678#else 1678#else
1679 if (conf->software && members > 2) 1679 if (conf->software && members > 2)
1680#endif 1680#endif
1681 mustmix = 1; 1681 mustmix = 1;
1682 } 1682 }
1683 1683
1684 /* transmission required */ 1684 /* transmission required */
@@ -1699,263 +1699,262 @@ dsp_cmx_send(void *arg)
1699#ifdef CMX_CONF_DEBUG 1699#ifdef CMX_CONF_DEBUG
1700 if (conf->software && members > 1) { 1700 if (conf->software && members > 1) {
1701#else 1701#else
1702 if (conf->software && members > 2) { 1702 if (conf->software && members > 2) {
1703#endif 1703#endif
1704 /* check for hdlc conf */ 1704 /* check for hdlc conf */
1705 member = list_entry(conf->mlist.next, 1705 member = list_entry(conf->mlist.next,
1706 struct dsp_conf_member, list); 1706 struct dsp_conf_member, list);
1707 if (member->dsp->hdlc) 1707 if (member->dsp->hdlc)
1708 continue; 1708 continue;
1709 /* mix all data */ 1709 /* mix all data */
1710 memset(mixbuffer, 0, length * sizeof(s32)); 1710 memset(mixbuffer, 0, length * sizeof(s32));
1711 list_for_each_entry(member, &conf->mlist, list) { 1711 list_for_each_entry(member, &conf->mlist, list) {
1712 dsp = member->dsp; 1712 dsp = member->dsp;
1713 /* get range of data to mix */ 1713 /* get range of data to mix */
1714 c = mixbuffer; 1714 c = mixbuffer;
1715 q = dsp->rx_buff; 1715 q = dsp->rx_buff;
1716 r = dsp->rx_R; 1716 r = dsp->rx_R;
1717 rr = (r + length) & CMX_BUFF_MASK; 1717 rr = (r + length) & CMX_BUFF_MASK;
1718 /* add member's data */ 1718 /* add member's data */
1719 while (r != rr) { 1719 while (r != rr) {
1720 *c++ += dsp_audio_law_to_s32[q[r]]; 1720 *c++ += dsp_audio_law_to_s32[q[r]];
1721 r = (r + 1) & CMX_BUFF_MASK; 1721 r = (r + 1) & CMX_BUFF_MASK;
1722 }
1723 } 1722 }
1723 }
1724 1724
1725 /* process each member */ 1725 /* process each member */
1726 list_for_each_entry(member, &conf->mlist, list) { 1726 list_for_each_entry(member, &conf->mlist, list) {
1727 /* transmission */ 1727 /* transmission */
1728 dsp_cmx_send_member(member->dsp, length, 1728 dsp_cmx_send_member(member->dsp, length,
1729 mixbuffer, members); 1729 mixbuffer, members);
1730 } 1730 }
1731 }
1732 }
1733
1734 /* delete rx-data, increment buffers, change pointers */
1735 list_for_each_entry(dsp, &dsp_ilist, list) {
1736 if (dsp->hdlc)
1737 continue;
1738 p = dsp->rx_buff;
1739 q = dsp->tx_buff;
1740 r = dsp->rx_R;
1741 /* move receive pointer when receiving */
1742 if (!dsp->rx_is_off) {
1743 rr = (r + length) & CMX_BUFF_MASK;
1744 /* delete rx-data */
1745 while (r != rr) {
1746 p[r] = dsp_silence;
1747 r = (r + 1) & CMX_BUFF_MASK;
1731 } 1748 }
1749 /* increment rx-buffer pointer */
1750 dsp->rx_R = r; /* write incremented read pointer */
1732 } 1751 }
1733 1752
1734 /* delete rx-data, increment buffers, change pointers */ 1753 /* check current rx_delay */
1735 list_for_each_entry(dsp, &dsp_ilist, list) { 1754 delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
1736 if (dsp->hdlc) 1755 if (delay >= CMX_BUFF_HALF)
1737 continue; 1756 delay = 0; /* will be the delay before next write */
1738 p = dsp->rx_buff; 1757 /* check for lower delay */
1739 q = dsp->tx_buff; 1758 if (delay < dsp->rx_delay[0])
1740 r = dsp->rx_R; 1759 dsp->rx_delay[0] = delay;
1741 /* move receive pointer when receiving */ 1760 /* check current tx_delay */
1742 if (!dsp->rx_is_off) { 1761 delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
1743 rr = (r + length) & CMX_BUFF_MASK; 1762 if (delay >= CMX_BUFF_HALF)
1763 delay = 0; /* will be the delay before next write */
1764 /* check for lower delay */
1765 if (delay < dsp->tx_delay[0])
1766 dsp->tx_delay[0] = delay;
1767 if (jittercheck) {
1768 /* find the lowest of all rx_delays */
1769 delay = dsp->rx_delay[0];
1770 i = 1;
1771 while (i < MAX_SECONDS_JITTER_CHECK) {
1772 if (delay > dsp->rx_delay[i])
1773 delay = dsp->rx_delay[i];
1774 i++;
1775 }
1776 /*
1777 * remove rx_delay only if we have delay AND we
1778 * have not preset cmx_delay AND
1779 * the delay is greater dsp_poll
1780 */
1781 if (delay > dsp_poll && !dsp->cmx_delay) {
1782 if (dsp_debug & DEBUG_DSP_CLOCK)
1783 printk(KERN_DEBUG
1784 "%s lowest rx_delay of %d bytes for"
1785 " dsp %s are now removed.\n",
1786 __func__, delay,
1787 dsp->name);
1788 r = dsp->rx_R;
1789 rr = (r + delay - (dsp_poll >> 1))
1790 & CMX_BUFF_MASK;
1744 /* delete rx-data */ 1791 /* delete rx-data */
1745 while (r != rr) { 1792 while (r != rr) {
1746 p[r] = dsp_silence; 1793 p[r] = dsp_silence;
1747 r = (r + 1) & CMX_BUFF_MASK; 1794 r = (r + 1) & CMX_BUFF_MASK;
1748 } 1795 }
1749 /* increment rx-buffer pointer */ 1796 /* increment rx-buffer pointer */
1750 dsp->rx_R = r; /* write incremented read pointer */ 1797 dsp->rx_R = r;
1798 /* write incremented read pointer */
1751 } 1799 }
1752 1800 /* find the lowest of all tx_delays */
1753 /* check current rx_delay */ 1801 delay = dsp->tx_delay[0];
1754 delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK; 1802 i = 1;
1755 if (delay >= CMX_BUFF_HALF) 1803 while (i < MAX_SECONDS_JITTER_CHECK) {
1756 delay = 0; /* will be the delay before next write */ 1804 if (delay > dsp->tx_delay[i])
1757 /* check for lower delay */ 1805 delay = dsp->tx_delay[i];
1758 if (delay < dsp->rx_delay[0]) 1806 i++;
1759 dsp->rx_delay[0] = delay; 1807 }
1760 /* check current tx_delay */ 1808 /*
1761 delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK; 1809 * remove delay only if we have delay AND we
1762 if (delay >= CMX_BUFF_HALF) 1810 * have enabled tx_dejitter
1763 delay = 0; /* will be the delay before next write */ 1811 */
1764 /* check for lower delay */ 1812 if (delay > dsp_poll && dsp->tx_dejitter) {
1765 if (delay < dsp->tx_delay[0]) 1813 if (dsp_debug & DEBUG_DSP_CLOCK)
1766 dsp->tx_delay[0] = delay; 1814 printk(KERN_DEBUG
1767 if (jittercheck) { 1815 "%s lowest tx_delay of %d bytes for"
1768 /* find the lowest of all rx_delays */ 1816 " dsp %s are now removed.\n",
1769 delay = dsp->rx_delay[0]; 1817 __func__, delay,
1770 i = 1; 1818 dsp->name);
1771 while (i < MAX_SECONDS_JITTER_CHECK) { 1819 r = dsp->tx_R;
1772 if (delay > dsp->rx_delay[i]) 1820 rr = (r + delay - (dsp_poll >> 1))
1773 delay = dsp->rx_delay[i]; 1821 & CMX_BUFF_MASK;
1774 i++; 1822 /* delete tx-data */
1775 } 1823 while (r != rr) {
1776 /* 1824 q[r] = dsp_silence;
1777 * remove rx_delay only if we have delay AND we 1825 r = (r + 1) & CMX_BUFF_MASK;
1778 * have not preset cmx_delay AND
1779 * the delay is greater dsp_poll
1780 */
1781 if (delay > dsp_poll && !dsp->cmx_delay) {
1782 if (dsp_debug & DEBUG_DSP_CLOCK)
1783 printk(KERN_DEBUG
1784 "%s lowest rx_delay of %d bytes for"
1785 " dsp %s are now removed.\n",
1786 __func__, delay,
1787 dsp->name);
1788 r = dsp->rx_R;
1789 rr = (r + delay - (dsp_poll >> 1))
1790 & CMX_BUFF_MASK;
1791 /* delete rx-data */
1792 while (r != rr) {
1793 p[r] = dsp_silence;
1794 r = (r + 1) & CMX_BUFF_MASK;
1795 }
1796 /* increment rx-buffer pointer */
1797 dsp->rx_R = r;
1798 /* write incremented read pointer */
1799 }
1800 /* find the lowest of all tx_delays */
1801 delay = dsp->tx_delay[0];
1802 i = 1;
1803 while (i < MAX_SECONDS_JITTER_CHECK) {
1804 if (delay > dsp->tx_delay[i])
1805 delay = dsp->tx_delay[i];
1806 i++;
1807 }
1808 /*
1809 * remove delay only if we have delay AND we
1810 * have enabled tx_dejitter
1811 */
1812 if (delay > dsp_poll && dsp->tx_dejitter) {
1813 if (dsp_debug & DEBUG_DSP_CLOCK)
1814 printk(KERN_DEBUG
1815 "%s lowest tx_delay of %d bytes for"
1816 " dsp %s are now removed.\n",
1817 __func__, delay,
1818 dsp->name);
1819 r = dsp->tx_R;
1820 rr = (r + delay - (dsp_poll >> 1))
1821 & CMX_BUFF_MASK;
1822 /* delete tx-data */
1823 while (r != rr) {
1824 q[r] = dsp_silence;
1825 r = (r + 1) & CMX_BUFF_MASK;
1826 }
1827 /* increment rx-buffer pointer */
1828 dsp->tx_R = r;
1829 /* write incremented read pointer */
1830 }
1831 /* scroll up delays */
1832 i = MAX_SECONDS_JITTER_CHECK - 1;
1833 while (i) {
1834 dsp->rx_delay[i] = dsp->rx_delay[i - 1];
1835 dsp->tx_delay[i] = dsp->tx_delay[i - 1];
1836 i--;
1837 } 1826 }
1838 dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ 1827 /* increment rx-buffer pointer */
1839 dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ 1828 dsp->tx_R = r;
1829 /* write incremented read pointer */
1840 } 1830 }
1831 /* scroll up delays */
1832 i = MAX_SECONDS_JITTER_CHECK - 1;
1833 while (i) {
1834 dsp->rx_delay[i] = dsp->rx_delay[i - 1];
1835 dsp->tx_delay[i] = dsp->tx_delay[i - 1];
1836 i--;
1837 }
1838 dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1839 dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1841 } 1840 }
1841 }
1842 1842
1843 /* if next event would be in the past ... */ 1843 /* if next event would be in the past ... */
1844 if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0) 1844 if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0)
1845 dsp_spl_jiffies = jiffies + 1; 1845 dsp_spl_jiffies = jiffies + 1;
1846 else 1846 else
1847 dsp_spl_jiffies += dsp_tics; 1847 dsp_spl_jiffies += dsp_tics;
1848 1848
1849 dsp_spl_tl.expires = dsp_spl_jiffies; 1849 dsp_spl_tl.expires = dsp_spl_jiffies;
1850 add_timer(&dsp_spl_tl); 1850 add_timer(&dsp_spl_tl);
1851 1851
1852 /* unlock */ 1852 /* unlock */
1853 spin_unlock_irqrestore(&dsp_lock, flags); 1853 spin_unlock_irqrestore(&dsp_lock, flags);
1854 } 1854}
1855 1855
1856/* 1856/*
1857 * audio data is transmitted from upper layer to the dsp 1857 * audio data is transmitted from upper layer to the dsp
1858 */ 1858 */
1859 void 1859void
1860 dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb) 1860dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb)
1861 { 1861{
1862 u_int w, ww; 1862 u_int w, ww;
1863 u8 *d, *p; 1863 u8 *d, *p;
1864 int space; /* todo: , l = skb->len; */ 1864 int space; /* todo: , l = skb->len; */
1865#ifdef CMX_TX_DEBUG 1865#ifdef CMX_TX_DEBUG
1866 char debugbuf[256] = ""; 1866 char debugbuf[256] = "";
1867#endif 1867#endif
1868 1868
1869 /* check if there is enough space, and then copy */ 1869 /* check if there is enough space, and then copy */
1870 w = dsp->tx_W; 1870 w = dsp->tx_W;
1871 ww = dsp->tx_R; 1871 ww = dsp->tx_R;
1872 p = dsp->tx_buff; 1872 p = dsp->tx_buff;
1873 d = skb->data; 1873 d = skb->data;
1874 space = (ww - w - 1) & CMX_BUFF_MASK; 1874 space = (ww - w - 1) & CMX_BUFF_MASK;
1875 /* write-pointer should not overrun nor reach read pointer */ 1875 /* write-pointer should not overrun nor reach read pointer */
1876 if (space < skb->len) { 1876 if (space < skb->len) {
1877 /* write to the space we have left */ 1877 /* write to the space we have left */
1878 ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */ 1878 ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */
1879 if (dsp_debug & DEBUG_DSP_CLOCK) 1879 if (dsp_debug & DEBUG_DSP_CLOCK)
1880 printk(KERN_DEBUG "%s: TX overflow space=%d skb->len=" 1880 printk(KERN_DEBUG "%s: TX overflow space=%d skb->len="
1881 "%d, w=0x%04x, ww=0x%04x\n", __func__, space, 1881 "%d, w=0x%04x, ww=0x%04x\n", __func__, space,
1882 skb->len, w, ww); 1882 skb->len, w, ww);
1883 } else 1883 } else
1884 /* write until all byte are copied */ 1884 /* write until all byte are copied */
1885 ww = (w + skb->len) & CMX_BUFF_MASK; 1885 ww = (w + skb->len) & CMX_BUFF_MASK;
1886 dsp->tx_W = ww; 1886 dsp->tx_W = ww;
1887
1888 /* show current buffer */ 1887 /* show current buffer */
1889#ifdef CMX_DEBUG 1888#ifdef CMX_DEBUG
1890 printk(KERN_DEBUG 1889 printk(KERN_DEBUG
1891 "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n", 1890 "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
1892 (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name); 1891 (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
1893#endif 1892#endif
1894 1893
1895 /* copy transmit data to tx-buffer */ 1894 /* copy transmit data to tx-buffer */
1896#ifdef CMX_TX_DEBUG 1895#ifdef CMX_TX_DEBUG
1897 sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p); 1896 sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p);
1898#endif 1897#endif
1899 while (w != ww) { 1898 while (w != ww) {
1900#ifdef CMX_TX_DEBUG 1899#ifdef CMX_TX_DEBUG
1901 if (strlen(debugbuf) < 48) 1900 if (strlen(debugbuf) < 48)
1902 sprintf(debugbuf + strlen(debugbuf), " %02x", *d); 1901 sprintf(debugbuf + strlen(debugbuf), " %02x", *d);
1903#endif 1902#endif
1904 p[w] = *d++; 1903 p[w] = *d++;
1905 w = (w + 1) & CMX_BUFF_MASK; 1904 w = (w + 1) & CMX_BUFF_MASK;
1906 } 1905 }
1907#ifdef CMX_TX_DEBUG 1906#ifdef CMX_TX_DEBUG
1908 printk(KERN_DEBUG "%s\n", debugbuf); 1907 printk(KERN_DEBUG "%s\n", debugbuf);
1909#endif 1908#endif
1910 1909
1911 } 1910}
1912 1911
1913/* 1912/*
1914 * hdlc data is received from card and sent to all members. 1913 * hdlc data is received from card and sent to all members.
1915 */ 1914 */
1916 void 1915void
1917 dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb) 1916dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb)
1918 { 1917{
1919 struct sk_buff *nskb = NULL; 1918 struct sk_buff *nskb = NULL;
1920 struct dsp_conf_member *member; 1919 struct dsp_conf_member *member;
1921 struct mISDNhead *hh; 1920 struct mISDNhead *hh;
1922
1923 /* not if not active */
1924 if (!dsp->b_active)
1925 return;
1926 1921
1927 /* check if we have sompen */ 1922 /* not if not active */
1928 if (skb->len < 1) 1923 if (!dsp->b_active)
1929 return; 1924 return;
1930 1925
1931 /* no conf */ 1926 /* check if we have sompen */
1932 if (!dsp->conf) { 1927 if (skb->len < 1)
1933 /* in case of software echo */ 1928 return;
1934 if (dsp->echo.software) { 1929
1935 nskb = skb_clone(skb, GFP_ATOMIC); 1930 /* no conf */
1936 if (nskb) { 1931 if (!dsp->conf) {
1937 hh = mISDN_HEAD_P(nskb); 1932 /* in case of software echo */
1938 hh->prim = PH_DATA_REQ; 1933 if (dsp->echo.software) {
1939 hh->id = 0; 1934 nskb = skb_clone(skb, GFP_ATOMIC);
1940 skb_queue_tail(&dsp->sendq, nskb); 1935 if (nskb) {
1941 schedule_work(&dsp->workq); 1936 hh = mISDN_HEAD_P(nskb);
1942 } 1937 hh->prim = PH_DATA_REQ;
1938 hh->id = 0;
1939 skb_queue_tail(&dsp->sendq, nskb);
1940 schedule_work(&dsp->workq);
1943 } 1941 }
1944 return;
1945 } 1942 }
1946 /* in case of hardware conference */ 1943 return;
1947 if (dsp->conf->hardware) 1944 }
1948 return; 1945 /* in case of hardware conference */
1949 list_for_each_entry(member, &dsp->conf->mlist, list) { 1946 if (dsp->conf->hardware)
1950 if (dsp->echo.software || member->dsp != dsp) { 1947 return;
1951 nskb = skb_clone(skb, GFP_ATOMIC); 1948 list_for_each_entry(member, &dsp->conf->mlist, list) {
1952 if (nskb) { 1949 if (dsp->echo.software || member->dsp != dsp) {
1953 hh = mISDN_HEAD_P(nskb); 1950 nskb = skb_clone(skb, GFP_ATOMIC);
1954 hh->prim = PH_DATA_REQ; 1951 if (nskb) {
1955 hh->id = 0; 1952 hh = mISDN_HEAD_P(nskb);
1956 skb_queue_tail(&member->dsp->sendq, nskb); 1953 hh->prim = PH_DATA_REQ;
1957 schedule_work(&member->dsp->workq); 1954 hh->id = 0;
1958 } 1955 skb_queue_tail(&member->dsp->sendq, nskb);
1956 schedule_work(&member->dsp->workq);
1959 } 1957 }
1960 } 1958 }
1961 } 1959 }
1960}
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index dc44ba7bceca..c6ba37df4b9d 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -384,7 +384,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
384 memcpy(di.channelmap, dev->channelmap, 384 memcpy(di.channelmap, dev->channelmap,
385 sizeof(di.channelmap)); 385 sizeof(di.channelmap));
386 di.nrbchan = dev->nrbchan; 386 di.nrbchan = dev->nrbchan;
387 strcpy(di.name, dev_name(&dev->dev)); 387 strscpy(di.name, dev_name(&dev->dev), sizeof(di.name));
388 if (copy_to_user((void __user *)arg, &di, sizeof(di))) 388 if (copy_to_user((void __user *)arg, &di, sizeof(di)))
389 err = -EFAULT; 389 err = -EFAULT;
390 } else 390 } else
@@ -667,7 +667,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
667 memcpy(di.channelmap, dev->channelmap, 667 memcpy(di.channelmap, dev->channelmap,
668 sizeof(di.channelmap)); 668 sizeof(di.channelmap));
669 di.nrbchan = dev->nrbchan; 669 di.nrbchan = dev->nrbchan;
670 strcpy(di.name, dev_name(&dev->dev)); 670 strscpy(di.name, dev_name(&dev->dev), sizeof(di.name));
671 if (copy_to_user((void __user *)arg, &di, sizeof(di))) 671 if (copy_to_user((void __user *)arg, &di, sizeof(di)))
672 err = -EFAULT; 672 err = -EFAULT;
673 } else 673 } else
@@ -681,6 +681,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
681 err = -EFAULT; 681 err = -EFAULT;
682 break; 682 break;
683 } 683 }
684 dn.name[sizeof(dn.name) - 1] = '\0';
684 dev = get_mdevice(dn.id); 685 dev = get_mdevice(dn.id);
685 if (dev) 686 if (dev)
686 err = device_rename(&dev->dev, dn.name); 687 err = device_rename(&dev->dev, dn.name);
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index e13d77bfc222..9ba3a2ae36e5 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -389,6 +389,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
389 struct smsusb_device_t *dev; 389 struct smsusb_device_t *dev;
390 void *mdev; 390 void *mdev;
391 int i, rc; 391 int i, rc;
392 int align = 0;
392 393
393 /* create device object */ 394 /* create device object */
394 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); 395 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
@@ -400,6 +401,24 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
400 dev->udev = interface_to_usbdev(intf); 401 dev->udev = interface_to_usbdev(intf);
401 dev->state = SMSUSB_DISCONNECTED; 402 dev->state = SMSUSB_DISCONNECTED;
402 403
404 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
405 struct usb_endpoint_descriptor *desc =
406 &intf->cur_altsetting->endpoint[i].desc;
407
408 if (desc->bEndpointAddress & USB_DIR_IN) {
409 dev->in_ep = desc->bEndpointAddress;
410 align = usb_endpoint_maxp(desc) - sizeof(struct sms_msg_hdr);
411 } else {
412 dev->out_ep = desc->bEndpointAddress;
413 }
414 }
415
416 pr_debug("in_ep = %02x, out_ep = %02x\n", dev->in_ep, dev->out_ep);
417 if (!dev->in_ep || !dev->out_ep || align < 0) { /* Missing endpoints? */
418 smsusb_term_device(intf);
419 return -ENODEV;
420 }
421
403 params.device_type = sms_get_board(board_id)->type; 422 params.device_type = sms_get_board(board_id)->type;
404 423
405 switch (params.device_type) { 424 switch (params.device_type) {
@@ -414,24 +433,12 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
414 /* fall-thru */ 433 /* fall-thru */
415 default: 434 default:
416 dev->buffer_size = USB2_BUFFER_SIZE; 435 dev->buffer_size = USB2_BUFFER_SIZE;
417 dev->response_alignment = 436 dev->response_alignment = align;
418 le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) -
419 sizeof(struct sms_msg_hdr);
420 437
421 params.flags |= SMS_DEVICE_FAMILY2; 438 params.flags |= SMS_DEVICE_FAMILY2;
422 break; 439 break;
423 } 440 }
424 441
425 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
426 if (intf->cur_altsetting->endpoint[i].desc. bEndpointAddress & USB_DIR_IN)
427 dev->in_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
428 else
429 dev->out_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
430 }
431
432 pr_debug("in_ep = %02x, out_ep = %02x\n",
433 dev->in_ep, dev->out_ep);
434
435 params.device = &dev->udev->dev; 442 params.device = &dev->udev->dev;
436 params.usb_device = dev->udev; 443 params.usb_device = dev->udev;
437 params.buffer_size = dev->buffer_size; 444 params.buffer_size = dev->buffer_size;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 062fa7e3af4c..407f4095a37a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3122,13 +3122,18 @@ static int bond_slave_netdev_event(unsigned long event,
3122 case NETDEV_CHANGE: 3122 case NETDEV_CHANGE:
3123 /* For 802.3ad mode only: 3123 /* For 802.3ad mode only:
3124 * Getting invalid Speed/Duplex values here will put slave 3124 * Getting invalid Speed/Duplex values here will put slave
3125 * in weird state. So mark it as link-fail for the time 3125 * in weird state. Mark it as link-fail if the link was
3126 * being and let link-monitoring (miimon) set it right when 3126 * previously up or link-down if it hasn't yet come up, and
3127 * correct speeds/duplex are available. 3127 * let link-monitoring (miimon) set it right when correct
3128 * speeds/duplex are available.
3128 */ 3129 */
3129 if (bond_update_speed_duplex(slave) && 3130 if (bond_update_speed_duplex(slave) &&
3130 BOND_MODE(bond) == BOND_MODE_8023AD) 3131 BOND_MODE(bond) == BOND_MODE_8023AD) {
3131 slave->link = BOND_LINK_FAIL; 3132 if (slave->last_link_up)
3133 slave->link = BOND_LINK_FAIL;
3134 else
3135 slave->link = BOND_LINK_DOWN;
3136 }
3132 3137
3133 if (BOND_MODE(bond) == BOND_MODE_8023AD) 3138 if (BOND_MODE(bond) == BOND_MODE_8023AD)
3134 bond_3ad_adapter_speed_duplex_changed(slave); 3139 bond_3ad_adapter_speed_duplex_changed(slave);
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index b4bcbb6461e1..42da3f1bff5b 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -781,7 +781,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip,
781 err = mv88e6xxx_port_read(chip, port, s->reg + 1, &reg); 781 err = mv88e6xxx_port_read(chip, port, s->reg + 1, &reg);
782 if (err) 782 if (err)
783 return U64_MAX; 783 return U64_MAX;
784 high = reg; 784 low |= ((u32)reg) << 16;
785 } 785 }
786 break; 786 break;
787 case STATS_TYPE_BANK1: 787 case STATS_TYPE_BANK1:
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 350e385528fd..941b0beb87ef 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -223,10 +223,10 @@ void aq_ring_queue_stop(struct aq_ring_s *ring)
223bool aq_ring_tx_clean(struct aq_ring_s *self) 223bool aq_ring_tx_clean(struct aq_ring_s *self)
224{ 224{
225 struct device *dev = aq_nic_get_dev(self->aq_nic); 225 struct device *dev = aq_nic_get_dev(self->aq_nic);
226 unsigned int budget = AQ_CFG_TX_CLEAN_BUDGET; 226 unsigned int budget;
227 227
228 for (; self->sw_head != self->hw_head && budget--; 228 for (budget = AQ_CFG_TX_CLEAN_BUDGET;
229 self->sw_head = aq_ring_next_dx(self, self->sw_head)) { 229 budget && self->sw_head != self->hw_head; budget--) {
230 struct aq_ring_buff_s *buff = &self->buff_ring[self->sw_head]; 230 struct aq_ring_buff_s *buff = &self->buff_ring[self->sw_head];
231 231
232 if (likely(buff->is_mapped)) { 232 if (likely(buff->is_mapped)) {
@@ -251,6 +251,7 @@ bool aq_ring_tx_clean(struct aq_ring_s *self)
251 251
252 buff->pa = 0U; 252 buff->pa = 0U;
253 buff->eop_index = 0xffffU; 253 buff->eop_index = 0xffffU;
254 self->sw_head = aq_ring_next_dx(self, self->sw_head);
254 } 255 }
255 256
256 return !!budget; 257 return !!budget;
@@ -298,35 +299,47 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
298 unsigned int i = 0U; 299 unsigned int i = 0U;
299 u16 hdr_len; 300 u16 hdr_len;
300 301
301 if (buff->is_error)
302 continue;
303
304 if (buff->is_cleaned) 302 if (buff->is_cleaned)
305 continue; 303 continue;
306 304
307 if (!buff->is_eop) { 305 if (!buff->is_eop) {
308 for (next_ = buff->next, 306 buff_ = buff;
309 buff_ = &self->buff_ring[next_]; true; 307 do {
310 next_ = buff_->next, 308 next_ = buff_->next,
311 buff_ = &self->buff_ring[next_]) { 309 buff_ = &self->buff_ring[next_];
312 is_rsc_completed = 310 is_rsc_completed =
313 aq_ring_dx_in_range(self->sw_head, 311 aq_ring_dx_in_range(self->sw_head,
314 next_, 312 next_,
315 self->hw_head); 313 self->hw_head);
316 314
317 if (unlikely(!is_rsc_completed)) { 315 if (unlikely(!is_rsc_completed))
318 is_rsc_completed = false;
319 break; 316 break;
320 }
321 317
322 if (buff_->is_eop) 318 buff->is_error |= buff_->is_error;
323 break; 319
324 } 320 } while (!buff_->is_eop);
325 321
326 if (!is_rsc_completed) { 322 if (!is_rsc_completed) {
327 err = 0; 323 err = 0;
328 goto err_exit; 324 goto err_exit;
329 } 325 }
326 if (buff->is_error) {
327 buff_ = buff;
328 do {
329 next_ = buff_->next,
330 buff_ = &self->buff_ring[next_];
331
332 buff_->is_cleaned = true;
333 } while (!buff_->is_eop);
334
335 ++self->stats.rx.errors;
336 continue;
337 }
338 }
339
340 if (buff->is_error) {
341 ++self->stats.rx.errors;
342 continue;
330 } 343 }
331 344
332 dma_sync_single_range_for_cpu(aq_nic_get_dev(self->aq_nic), 345 dma_sync_single_range_for_cpu(aq_nic_get_dev(self->aq_nic),
@@ -389,6 +402,12 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
389 AQ_CFG_RX_FRAME_MAX); 402 AQ_CFG_RX_FRAME_MAX);
390 page_ref_inc(buff_->rxdata.page); 403 page_ref_inc(buff_->rxdata.page);
391 buff_->is_cleaned = 1; 404 buff_->is_cleaned = 1;
405
406 buff->is_ip_cso &= buff_->is_ip_cso;
407 buff->is_udp_cso &= buff_->is_udp_cso;
408 buff->is_tcp_cso &= buff_->is_tcp_cso;
409 buff->is_cso_err |= buff_->is_cso_err;
410
392 } while (!buff_->is_eop); 411 } while (!buff_->is_eop);
393 } 412 }
394 } 413 }
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index bfcda12d73de..5c3065bdfddf 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -266,12 +266,11 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self,
266 */ 266 */
267 hw_atl_rpo_lro_max_coalescing_interval_set(self, 50); 267 hw_atl_rpo_lro_max_coalescing_interval_set(self, 50);
268 268
269
270 hw_atl_rpo_lro_qsessions_lim_set(self, 1U); 269 hw_atl_rpo_lro_qsessions_lim_set(self, 1U);
271 270
272 hw_atl_rpo_lro_total_desc_lim_set(self, 2U); 271 hw_atl_rpo_lro_total_desc_lim_set(self, 2U);
273 272
274 hw_atl_rpo_lro_patch_optimization_en_set(self, 0U); 273 hw_atl_rpo_lro_patch_optimization_en_set(self, 1U);
275 274
276 hw_atl_rpo_lro_min_pay_of_first_pkt_set(self, 10U); 275 hw_atl_rpo_lro_min_pay_of_first_pkt_set(self, 10U);
277 276
@@ -713,38 +712,41 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self,
713 if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) { 712 if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) {
714 /* MAC error or DMA error */ 713 /* MAC error or DMA error */
715 buff->is_error = 1U; 714 buff->is_error = 1U;
716 } else { 715 }
717 if (self->aq_nic_cfg->is_rss) { 716 if (self->aq_nic_cfg->is_rss) {
718 /* last 4 byte */ 717 /* last 4 byte */
719 u16 rss_type = rxd_wb->type & 0xFU; 718 u16 rss_type = rxd_wb->type & 0xFU;
720 719
721 if (rss_type && rss_type < 0x8U) { 720 if (rss_type && rss_type < 0x8U) {
722 buff->is_hash_l4 = (rss_type == 0x4 || 721 buff->is_hash_l4 = (rss_type == 0x4 ||
723 rss_type == 0x5); 722 rss_type == 0x5);
724 buff->rss_hash = rxd_wb->rss_hash; 723 buff->rss_hash = rxd_wb->rss_hash;
725 }
726 } 724 }
725 }
727 726
728 if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) { 727 if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) {
729 buff->len = rxd_wb->pkt_len % 728 buff->len = rxd_wb->pkt_len %
730 AQ_CFG_RX_FRAME_MAX; 729 AQ_CFG_RX_FRAME_MAX;
731 buff->len = buff->len ? 730 buff->len = buff->len ?
732 buff->len : AQ_CFG_RX_FRAME_MAX; 731 buff->len : AQ_CFG_RX_FRAME_MAX;
733 buff->next = 0U; 732 buff->next = 0U;
734 buff->is_eop = 1U; 733 buff->is_eop = 1U;
734 } else {
735 buff->len =
736 rxd_wb->pkt_len > AQ_CFG_RX_FRAME_MAX ?
737 AQ_CFG_RX_FRAME_MAX : rxd_wb->pkt_len;
738
739 if (HW_ATL_B0_RXD_WB_STAT2_RSCCNT &
740 rxd_wb->status) {
741 /* LRO */
742 buff->next = rxd_wb->next_desc_ptr;
743 ++ring->stats.rx.lro_packets;
735 } else { 744 } else {
736 if (HW_ATL_B0_RXD_WB_STAT2_RSCCNT & 745 /* jumbo */
737 rxd_wb->status) { 746 buff->next =
738 /* LRO */ 747 aq_ring_next_dx(ring,
739 buff->next = rxd_wb->next_desc_ptr; 748 ring->hw_head);
740 ++ring->stats.rx.lro_packets; 749 ++ring->stats.rx.jumbo_packets;
741 } else {
742 /* jumbo */
743 buff->next =
744 aq_ring_next_dx(ring,
745 ring->hw_head);
746 ++ring->stats.rx.jumbo_packets;
747 }
748 } 750 }
749 } 751 }
750 } 752 }
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 8314c00d7537..f758b2e0591f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1642,6 +1642,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
1642 skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); 1642 skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
1643 bnxt_reuse_rx_data(rxr, cons, data); 1643 bnxt_reuse_rx_data(rxr, cons, data);
1644 if (!skb) { 1644 if (!skb) {
1645 if (agg_bufs)
1646 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
1645 rc = -ENOMEM; 1647 rc = -ENOMEM;
1646 goto next_rx; 1648 goto next_rx;
1647 } 1649 }
@@ -6377,7 +6379,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp)
6377 if (!ctx || (ctx->flags & BNXT_CTX_FLAG_INITED)) 6379 if (!ctx || (ctx->flags & BNXT_CTX_FLAG_INITED))
6378 return 0; 6380 return 0;
6379 6381
6380 if (bp->flags & BNXT_FLAG_ROCE_CAP) { 6382 if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) {
6381 pg_lvl = 2; 6383 pg_lvl = 2;
6382 extra_qps = 65536; 6384 extra_qps = 65536;
6383 extra_srqs = 8192; 6385 extra_srqs = 8192;
@@ -7616,22 +7618,23 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
7616 bp->flags &= ~BNXT_FLAG_USING_MSIX; 7618 bp->flags &= ~BNXT_FLAG_USING_MSIX;
7617} 7619}
7618 7620
7619int bnxt_reserve_rings(struct bnxt *bp) 7621int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
7620{ 7622{
7621 int tcs = netdev_get_num_tc(bp->dev); 7623 int tcs = netdev_get_num_tc(bp->dev);
7622 bool reinit_irq = false; 7624 bool irq_cleared = false;
7623 int rc; 7625 int rc;
7624 7626
7625 if (!bnxt_need_reserve_rings(bp)) 7627 if (!bnxt_need_reserve_rings(bp))
7626 return 0; 7628 return 0;
7627 7629
7628 if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) { 7630 if (irq_re_init && BNXT_NEW_RM(bp) &&
7631 bnxt_get_num_msix(bp) != bp->total_irqs) {
7629 bnxt_ulp_irq_stop(bp); 7632 bnxt_ulp_irq_stop(bp);
7630 bnxt_clear_int_mode(bp); 7633 bnxt_clear_int_mode(bp);
7631 reinit_irq = true; 7634 irq_cleared = true;
7632 } 7635 }
7633 rc = __bnxt_reserve_rings(bp); 7636 rc = __bnxt_reserve_rings(bp);
7634 if (reinit_irq) { 7637 if (irq_cleared) {
7635 if (!rc) 7638 if (!rc)
7636 rc = bnxt_init_int_mode(bp); 7639 rc = bnxt_init_int_mode(bp);
7637 bnxt_ulp_irq_restart(bp, rc); 7640 bnxt_ulp_irq_restart(bp, rc);
@@ -8530,7 +8533,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
8530 return rc; 8533 return rc;
8531 } 8534 }
8532 } 8535 }
8533 rc = bnxt_reserve_rings(bp); 8536 rc = bnxt_reserve_rings(bp, irq_re_init);
8534 if (rc) 8537 if (rc)
8535 return rc; 8538 return rc;
8536 if ((bp->flags & BNXT_FLAG_RFS) && 8539 if ((bp->flags & BNXT_FLAG_RFS) &&
@@ -10434,7 +10437,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
10434 10437
10435 if (sh) 10438 if (sh)
10436 bp->flags |= BNXT_FLAG_SHARED_RINGS; 10439 bp->flags |= BNXT_FLAG_SHARED_RINGS;
10437 dflt_rings = netif_get_num_default_rss_queues(); 10440 dflt_rings = is_kdump_kernel() ? 1 : netif_get_num_default_rss_queues();
10438 /* Reduce default rings on multi-port cards so that total default 10441 /* Reduce default rings on multi-port cards so that total default
10439 * rings do not exceed CPU count. 10442 * rings do not exceed CPU count.
10440 */ 10443 */
@@ -10722,11 +10725,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
10722 goto init_err_pci_clean; 10725 goto init_err_pci_clean;
10723 } 10726 }
10724 10727
10725 /* Read the adapter's DSN to use as the eswitch switch_id */ 10728 if (BNXT_PF(bp)) {
10726 rc = bnxt_pcie_dsn_get(bp, bp->switch_id); 10729 /* Read the adapter's DSN to use as the eswitch switch_id */
10727 if (rc) 10730 rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
10728 goto init_err_pci_clean; 10731 if (rc)
10729 10732 goto init_err_pci_clean;
10733 }
10730 bnxt_hwrm_func_qcfg(bp); 10734 bnxt_hwrm_func_qcfg(bp);
10731 bnxt_hwrm_vnic_qcaps(bp); 10735 bnxt_hwrm_vnic_qcaps(bp);
10732 bnxt_hwrm_port_led_qcaps(bp); 10736 bnxt_hwrm_port_led_qcaps(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index eca36dd6b751..be438d82f939 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/rhashtable.h> 22#include <linux/rhashtable.h>
23#include <linux/crash_dump.h>
23#include <net/devlink.h> 24#include <net/devlink.h>
24#include <net/dst_metadata.h> 25#include <net/dst_metadata.h>
25#include <net/xdp.h> 26#include <net/xdp.h>
@@ -1369,7 +1370,8 @@ struct bnxt {
1369#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0) 1370#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
1370#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE) 1371#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
1371#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \ 1372#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \
1372 !(bp->flags & BNXT_FLAG_CHIP_P5)) 1373 !(bp->flags & BNXT_FLAG_CHIP_P5) && \
1374 !is_kdump_kernel())
1373 1375
1374/* Chip class phase 5 */ 1376/* Chip class phase 5 */
1375#define BNXT_CHIP_P5(bp) \ 1377#define BNXT_CHIP_P5(bp) \
@@ -1790,7 +1792,7 @@ unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp);
1790unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); 1792unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp);
1791unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp); 1793unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp);
1792int bnxt_get_avail_msix(struct bnxt *bp, int num); 1794int bnxt_get_avail_msix(struct bnxt *bp, int num);
1793int bnxt_reserve_rings(struct bnxt *bp); 1795int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init);
1794void bnxt_tx_disable(struct bnxt *bp); 1796void bnxt_tx_disable(struct bnxt *bp);
1795void bnxt_tx_enable(struct bnxt *bp); 1797void bnxt_tx_enable(struct bnxt *bp);
1796int bnxt_hwrm_set_pause(struct bnxt *); 1798int bnxt_hwrm_set_pause(struct bnxt *);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index b1263821a6e9..a6c7baf38036 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -831,7 +831,7 @@ static int bnxt_set_channels(struct net_device *dev,
831 */ 831 */
832 } 832 }
833 } else { 833 } else {
834 rc = bnxt_reserve_rings(bp); 834 rc = bnxt_reserve_rings(bp, true);
835 } 835 }
836 836
837 return rc; 837 return rc;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index cf475873ce81..bfa342a98d08 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -147,7 +147,7 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,
147 bnxt_close_nic(bp, true, false); 147 bnxt_close_nic(bp, true, false);
148 rc = bnxt_open_nic(bp, true, false); 148 rc = bnxt_open_nic(bp, true, false);
149 } else { 149 } else {
150 rc = bnxt_reserve_rings(bp); 150 rc = bnxt_reserve_rings(bp, true);
151 } 151 }
152 } 152 }
153 if (rc) { 153 if (rc) {
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index acc66a7e7b95..00ee5e8e0ff0 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1080,6 +1080,11 @@ struct macb_ptp_info {
1080 struct ifreq *ifr, int cmd); 1080 struct ifreq *ifr, int cmd);
1081}; 1081};
1082 1082
1083struct macb_pm_data {
1084 u32 scrt2;
1085 u32 usrio;
1086};
1087
1083struct macb_config { 1088struct macb_config {
1084 u32 caps; 1089 u32 caps;
1085 unsigned int dma_burst_length; 1090 unsigned int dma_burst_length;
@@ -1220,6 +1225,8 @@ struct macb {
1220 int tx_bd_rd_prefetch; 1225 int tx_bd_rd_prefetch;
1221 1226
1222 u32 rx_intr_mask; 1227 u32 rx_intr_mask;
1228
1229 struct macb_pm_data pm_data;
1223}; 1230};
1224 1231
1225#ifdef CONFIG_MACB_USE_HWSTAMP 1232#ifdef CONFIG_MACB_USE_HWSTAMP
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index bebd9b1aeb64..f825e3960540 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2849,10 +2849,14 @@ static int macb_get_ts_info(struct net_device *netdev,
2849 2849
2850static void gem_enable_flow_filters(struct macb *bp, bool enable) 2850static void gem_enable_flow_filters(struct macb *bp, bool enable)
2851{ 2851{
2852 struct net_device *netdev = bp->dev;
2852 struct ethtool_rx_fs_item *item; 2853 struct ethtool_rx_fs_item *item;
2853 u32 t2_scr; 2854 u32 t2_scr;
2854 int num_t2_scr; 2855 int num_t2_scr;
2855 2856
2857 if (!(netdev->features & NETIF_F_NTUPLE))
2858 return;
2859
2856 num_t2_scr = GEM_BFEXT(T2SCR, gem_readl(bp, DCFG8)); 2860 num_t2_scr = GEM_BFEXT(T2SCR, gem_readl(bp, DCFG8));
2857 2861
2858 list_for_each_entry(item, &bp->rx_fs_list.list, list) { 2862 list_for_each_entry(item, &bp->rx_fs_list.list, list) {
@@ -3012,8 +3016,7 @@ static int gem_add_flow_filter(struct net_device *netdev,
3012 gem_prog_cmp_regs(bp, fs); 3016 gem_prog_cmp_regs(bp, fs);
3013 bp->rx_fs_list.count++; 3017 bp->rx_fs_list.count++;
3014 /* enable filtering if NTUPLE on */ 3018 /* enable filtering if NTUPLE on */
3015 if (netdev->features & NETIF_F_NTUPLE) 3019 gem_enable_flow_filters(bp, 1);
3016 gem_enable_flow_filters(bp, 1);
3017 3020
3018 spin_unlock_irqrestore(&bp->rx_fs_lock, flags); 3021 spin_unlock_irqrestore(&bp->rx_fs_lock, flags);
3019 return 0; 3022 return 0;
@@ -3201,6 +3204,50 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
3201 } 3204 }
3202} 3205}
3203 3206
3207static inline void macb_set_txcsum_feature(struct macb *bp,
3208 netdev_features_t features)
3209{
3210 u32 val;
3211
3212 if (!macb_is_gem(bp))
3213 return;
3214
3215 val = gem_readl(bp, DMACFG);
3216 if (features & NETIF_F_HW_CSUM)
3217 val |= GEM_BIT(TXCOEN);
3218 else
3219 val &= ~GEM_BIT(TXCOEN);
3220
3221 gem_writel(bp, DMACFG, val);
3222}
3223
3224static inline void macb_set_rxcsum_feature(struct macb *bp,
3225 netdev_features_t features)
3226{
3227 struct net_device *netdev = bp->dev;
3228 u32 val;
3229
3230 if (!macb_is_gem(bp))
3231 return;
3232
3233 val = gem_readl(bp, NCFGR);
3234 if ((features & NETIF_F_RXCSUM) && !(netdev->flags & IFF_PROMISC))
3235 val |= GEM_BIT(RXCOEN);
3236 else
3237 val &= ~GEM_BIT(RXCOEN);
3238
3239 gem_writel(bp, NCFGR, val);
3240}
3241
3242static inline void macb_set_rxflow_feature(struct macb *bp,
3243 netdev_features_t features)
3244{
3245 if (!macb_is_gem(bp))
3246 return;
3247
3248 gem_enable_flow_filters(bp, !!(features & NETIF_F_NTUPLE));
3249}
3250
3204static int macb_set_features(struct net_device *netdev, 3251static int macb_set_features(struct net_device *netdev,
3205 netdev_features_t features) 3252 netdev_features_t features)
3206{ 3253{
@@ -3208,39 +3255,35 @@ static int macb_set_features(struct net_device *netdev,
3208 netdev_features_t changed = features ^ netdev->features; 3255 netdev_features_t changed = features ^ netdev->features;
3209 3256
3210 /* TX checksum offload */ 3257 /* TX checksum offload */
3211 if ((changed & NETIF_F_HW_CSUM) && macb_is_gem(bp)) { 3258 if (changed & NETIF_F_HW_CSUM)
3212 u32 dmacfg; 3259 macb_set_txcsum_feature(bp, features);
3213
3214 dmacfg = gem_readl(bp, DMACFG);
3215 if (features & NETIF_F_HW_CSUM)
3216 dmacfg |= GEM_BIT(TXCOEN);
3217 else
3218 dmacfg &= ~GEM_BIT(TXCOEN);
3219 gem_writel(bp, DMACFG, dmacfg);
3220 }
3221 3260
3222 /* RX checksum offload */ 3261 /* RX checksum offload */
3223 if ((changed & NETIF_F_RXCSUM) && macb_is_gem(bp)) { 3262 if (changed & NETIF_F_RXCSUM)
3224 u32 netcfg; 3263 macb_set_rxcsum_feature(bp, features);
3225
3226 netcfg = gem_readl(bp, NCFGR);
3227 if (features & NETIF_F_RXCSUM &&
3228 !(netdev->flags & IFF_PROMISC))
3229 netcfg |= GEM_BIT(RXCOEN);
3230 else
3231 netcfg &= ~GEM_BIT(RXCOEN);
3232 gem_writel(bp, NCFGR, netcfg);
3233 }
3234 3264
3235 /* RX Flow Filters */ 3265 /* RX Flow Filters */
3236 if ((changed & NETIF_F_NTUPLE) && macb_is_gem(bp)) { 3266 if (changed & NETIF_F_NTUPLE)
3237 bool turn_on = features & NETIF_F_NTUPLE; 3267 macb_set_rxflow_feature(bp, features);
3238 3268
3239 gem_enable_flow_filters(bp, turn_on);
3240 }
3241 return 0; 3269 return 0;
3242} 3270}
3243 3271
3272static void macb_restore_features(struct macb *bp)
3273{
3274 struct net_device *netdev = bp->dev;
3275 netdev_features_t features = netdev->features;
3276
3277 /* TX checksum offload */
3278 macb_set_txcsum_feature(bp, features);
3279
3280 /* RX checksum offload */
3281 macb_set_rxcsum_feature(bp, features);
3282
3283 /* RX Flow Filters */
3284 macb_set_rxflow_feature(bp, features);
3285}
3286
3244static const struct net_device_ops macb_netdev_ops = { 3287static const struct net_device_ops macb_netdev_ops = {
3245 .ndo_open = macb_open, 3288 .ndo_open = macb_open,
3246 .ndo_stop = macb_close, 3289 .ndo_stop = macb_close,
@@ -4273,6 +4316,12 @@ static int __maybe_unused macb_suspend(struct device *dev)
4273 spin_lock_irqsave(&bp->lock, flags); 4316 spin_lock_irqsave(&bp->lock, flags);
4274 macb_reset_hw(bp); 4317 macb_reset_hw(bp);
4275 spin_unlock_irqrestore(&bp->lock, flags); 4318 spin_unlock_irqrestore(&bp->lock, flags);
4319
4320 if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
4321 bp->pm_data.usrio = macb_or_gem_readl(bp, USRIO);
4322
4323 if (netdev->hw_features & NETIF_F_NTUPLE)
4324 bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
4276 } 4325 }
4277 4326
4278 netif_carrier_off(netdev); 4327 netif_carrier_off(netdev);
@@ -4301,6 +4350,13 @@ static int __maybe_unused macb_resume(struct device *dev)
4301 disable_irq_wake(bp->queues[0].irq); 4350 disable_irq_wake(bp->queues[0].irq);
4302 } else { 4351 } else {
4303 macb_writel(bp, NCR, MACB_BIT(MPE)); 4352 macb_writel(bp, NCR, MACB_BIT(MPE));
4353
4354 if (netdev->hw_features & NETIF_F_NTUPLE)
4355 gem_writel_n(bp, ETHT, SCRT2_ETHT, bp->pm_data.scrt2);
4356
4357 if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
4358 macb_or_gem_writel(bp, USRIO, bp->pm_data.usrio);
4359
4304 for (q = 0, queue = bp->queues; q < bp->num_queues; 4360 for (q = 0, queue = bp->queues; q < bp->num_queues;
4305 ++q, ++queue) 4361 ++q, ++queue)
4306 napi_enable(&queue->napi); 4362 napi_enable(&queue->napi);
@@ -4312,6 +4368,7 @@ static int __maybe_unused macb_resume(struct device *dev)
4312 bp->macbgem_ops.mog_init_rings(bp); 4368 bp->macbgem_ops.mog_init_rings(bp);
4313 macb_init_hw(bp); 4369 macb_init_hw(bp);
4314 macb_set_rx_mode(netdev); 4370 macb_set_rx_mode(netdev);
4371 macb_restore_features(bp);
4315 netif_device_attach(netdev); 4372 netif_device_attach(netdev);
4316 if (bp->ptp_info) 4373 if (bp->ptp_info)
4317 bp->ptp_info->ptp_init(netdev); 4374 bp->ptp_info->ptp_init(netdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
index 6e2d80008a79..cfaf8f618d1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
@@ -197,6 +197,9 @@ static void cxgb4_process_flow_match(struct net_device *dev,
197 fs->val.ivlan = vlan_tci; 197 fs->val.ivlan = vlan_tci;
198 fs->mask.ivlan = vlan_tci_mask; 198 fs->mask.ivlan = vlan_tci_mask;
199 199
200 fs->val.ivlan_vld = 1;
201 fs->mask.ivlan_vld = 1;
202
200 /* Chelsio adapters use ivlan_vld bit to match vlan packets 203 /* Chelsio adapters use ivlan_vld bit to match vlan packets
201 * as 802.1Q. Also, when vlan tag is present in packets, 204 * as 802.1Q. Also, when vlan tag is present in packets,
202 * ethtype match is used then to match on ethtype of inner 205 * ethtype match is used then to match on ethtype of inner
@@ -207,8 +210,6 @@ static void cxgb4_process_flow_match(struct net_device *dev,
207 * ethtype value with ethtype of inner header. 210 * ethtype value with ethtype of inner header.
208 */ 211 */
209 if (fs->val.ethtype == ETH_P_8021Q) { 212 if (fs->val.ethtype == ETH_P_8021Q) {
210 fs->val.ivlan_vld = 1;
211 fs->mask.ivlan_vld = 1;
212 fs->val.ethtype = 0; 213 fs->val.ethtype = 0;
213 fs->mask.ethtype = 0; 214 fs->mask.ethtype = 0;
214 } 215 }
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index f9b70be59792..93feb258067b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -7253,10 +7253,21 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
7253 unsigned int cache_line_size) 7253 unsigned int cache_line_size)
7254{ 7254{
7255 unsigned int page_shift = fls(page_size) - 1; 7255 unsigned int page_shift = fls(page_size) - 1;
7256 unsigned int sge_hps = page_shift - 10;
7256 unsigned int stat_len = cache_line_size > 64 ? 128 : 64; 7257 unsigned int stat_len = cache_line_size > 64 ? 128 : 64;
7257 unsigned int fl_align = cache_line_size < 32 ? 32 : cache_line_size; 7258 unsigned int fl_align = cache_line_size < 32 ? 32 : cache_line_size;
7258 unsigned int fl_align_log = fls(fl_align) - 1; 7259 unsigned int fl_align_log = fls(fl_align) - 1;
7259 7260
7261 t4_write_reg(adap, SGE_HOST_PAGE_SIZE_A,
7262 HOSTPAGESIZEPF0_V(sge_hps) |
7263 HOSTPAGESIZEPF1_V(sge_hps) |
7264 HOSTPAGESIZEPF2_V(sge_hps) |
7265 HOSTPAGESIZEPF3_V(sge_hps) |
7266 HOSTPAGESIZEPF4_V(sge_hps) |
7267 HOSTPAGESIZEPF5_V(sge_hps) |
7268 HOSTPAGESIZEPF6_V(sge_hps) |
7269 HOSTPAGESIZEPF7_V(sge_hps));
7270
7260 if (is_t4(adap->params.chip)) { 7271 if (is_t4(adap->params.chip)) {
7261 t4_set_reg_field(adap, SGE_CONTROL_A, 7272 t4_set_reg_field(adap, SGE_CONTROL_A,
7262 INGPADBOUNDARY_V(INGPADBOUNDARY_M) | 7273 INGPADBOUNDARY_V(INGPADBOUNDARY_M) |
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
index 66535d1653f6..f16853c3c851 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -2107,7 +2107,6 @@ static struct eisa_driver de4x5_eisa_driver = {
2107 .remove = de4x5_eisa_remove, 2107 .remove = de4x5_eisa_remove,
2108 } 2108 }
2109}; 2109};
2110MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids);
2111#endif 2110#endif
2112 2111
2113#ifdef CONFIG_PCI 2112#ifdef CONFIG_PCI
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index d3f2408dc9e8..f38c3fa7d705 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -780,7 +780,7 @@ static void dpaa_eth_add_channel(u16 channel)
780 struct qman_portal *portal; 780 struct qman_portal *portal;
781 int cpu; 781 int cpu;
782 782
783 for_each_cpu(cpu, cpus) { 783 for_each_cpu_and(cpu, cpus, cpu_online_mask) {
784 portal = qman_get_affine_portal(cpu); 784 portal = qman_get_affine_portal(cpu);
785 qman_p_static_dequeue_add(portal, pool); 785 qman_p_static_dequeue_add(portal, pool);
786 } 786 }
@@ -896,7 +896,7 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
896 u16 channels[NR_CPUS]; 896 u16 channels[NR_CPUS];
897 struct dpaa_fq *fq; 897 struct dpaa_fq *fq;
898 898
899 for_each_cpu(cpu, affine_cpus) 899 for_each_cpu_and(cpu, affine_cpus, cpu_online_mask)
900 channels[num_portals++] = qman_affine_channel(cpu); 900 channels[num_portals++] = qman_affine_channel(cpu);
901 901
902 if (num_portals == 0) 902 if (num_portals == 0)
@@ -2174,7 +2174,6 @@ static int dpaa_eth_poll(struct napi_struct *napi, int budget)
2174 if (cleaned < budget) { 2174 if (cleaned < budget) {
2175 napi_complete_done(napi, cleaned); 2175 napi_complete_done(napi, cleaned);
2176 qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); 2176 qman_p_irqsource_add(np->p, QM_PIRQ_DQRI);
2177
2178 } else if (np->down) { 2177 } else if (np->down) {
2179 qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); 2178 qman_p_irqsource_add(np->p, QM_PIRQ_DQRI);
2180 } 2179 }
@@ -2448,7 +2447,7 @@ static void dpaa_eth_napi_enable(struct dpaa_priv *priv)
2448 struct dpaa_percpu_priv *percpu_priv; 2447 struct dpaa_percpu_priv *percpu_priv;
2449 int i; 2448 int i;
2450 2449
2451 for_each_possible_cpu(i) { 2450 for_each_online_cpu(i) {
2452 percpu_priv = per_cpu_ptr(priv->percpu_priv, i); 2451 percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2453 2452
2454 percpu_priv->np.down = 0; 2453 percpu_priv->np.down = 0;
@@ -2461,7 +2460,7 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv)
2461 struct dpaa_percpu_priv *percpu_priv; 2460 struct dpaa_percpu_priv *percpu_priv;
2462 int i; 2461 int i;
2463 2462
2464 for_each_possible_cpu(i) { 2463 for_each_online_cpu(i) {
2465 percpu_priv = per_cpu_ptr(priv->percpu_priv, i); 2464 percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2466 2465
2467 percpu_priv->np.down = 1; 2466 percpu_priv->np.down = 1;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index bdee441bc3b7..7ce2e99b594d 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -569,7 +569,7 @@ static int dpaa_set_coalesce(struct net_device *dev,
569 qman_dqrr_get_ithresh(portal, &prev_thresh); 569 qman_dqrr_get_ithresh(portal, &prev_thresh);
570 570
571 /* set new values */ 571 /* set new values */
572 for_each_cpu(cpu, cpus) { 572 for_each_cpu_and(cpu, cpus, cpu_online_mask) {
573 portal = qman_get_affine_portal(cpu); 573 portal = qman_get_affine_portal(cpu);
574 res = qman_portal_set_iperiod(portal, period); 574 res = qman_portal_set_iperiod(portal, period);
575 if (res) 575 if (res)
@@ -586,7 +586,7 @@ static int dpaa_set_coalesce(struct net_device *dev,
586 586
587revert_values: 587revert_values:
588 /* restore previous values */ 588 /* restore previous values */
589 for_each_cpu(cpu, cpus) { 589 for_each_cpu_and(cpu, cpus, cpu_online_mask) {
590 if (!needs_revert[cpu]) 590 if (!needs_revert[cpu])
591 continue; 591 continue;
592 portal = qman_get_affine_portal(cpu); 592 portal = qman_get_affine_portal(cpu);
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 63b1ecc18c26..7d2390e3df77 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -1972,7 +1972,7 @@ alloc_channel(struct dpaa2_eth_priv *priv)
1972 1972
1973 channel->dpcon = setup_dpcon(priv); 1973 channel->dpcon = setup_dpcon(priv);
1974 if (IS_ERR_OR_NULL(channel->dpcon)) { 1974 if (IS_ERR_OR_NULL(channel->dpcon)) {
1975 err = PTR_ERR(channel->dpcon); 1975 err = PTR_ERR_OR_ZERO(channel->dpcon);
1976 goto err_setup; 1976 goto err_setup;
1977 } 1977 }
1978 1978
@@ -2028,7 +2028,7 @@ static int setup_dpio(struct dpaa2_eth_priv *priv)
2028 /* Try to allocate a channel */ 2028 /* Try to allocate a channel */
2029 channel = alloc_channel(priv); 2029 channel = alloc_channel(priv);
2030 if (IS_ERR_OR_NULL(channel)) { 2030 if (IS_ERR_OR_NULL(channel)) {
2031 err = PTR_ERR(channel); 2031 err = PTR_ERR_OR_ZERO(channel);
2032 if (err != -EPROBE_DEFER) 2032 if (err != -EPROBE_DEFER)
2033 dev_info(dev, 2033 dev_info(dev,
2034 "No affine channel for cpu %d and above\n", i); 2034 "No affine channel for cpu %d and above\n", i);
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
index 5fb8f5c0dc9f..e180d5a68c98 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -467,7 +467,7 @@ enum dpaa2_eth_rx_dist {
467#define DPAA2_ETH_DIST_IPPROTO BIT(6) 467#define DPAA2_ETH_DIST_IPPROTO BIT(6)
468#define DPAA2_ETH_DIST_L4SRC BIT(7) 468#define DPAA2_ETH_DIST_L4SRC BIT(7)
469#define DPAA2_ETH_DIST_L4DST BIT(8) 469#define DPAA2_ETH_DIST_L4DST BIT(8)
470#define DPAA2_ETH_DIST_ALL (~0U) 470#define DPAA2_ETH_DIST_ALL (~0ULL)
471 471
472static inline 472static inline
473unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv, 473unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
index 76bd8d2872cc..7b182f4b263c 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/net_tstamp.h> 6#include <linux/net_tstamp.h>
7#include <linux/nospec.h>
7 8
8#include "dpni.h" /* DPNI_LINK_OPT_* */ 9#include "dpni.h" /* DPNI_LINK_OPT_* */
9#include "dpaa2-eth.h" 10#include "dpaa2-eth.h"
@@ -648,6 +649,8 @@ static int dpaa2_eth_get_rxnfc(struct net_device *net_dev,
648 case ETHTOOL_GRXCLSRULE: 649 case ETHTOOL_GRXCLSRULE:
649 if (rxnfc->fs.location >= max_rules) 650 if (rxnfc->fs.location >= max_rules)
650 return -EINVAL; 651 return -EINVAL;
652 rxnfc->fs.location = array_index_nospec(rxnfc->fs.location,
653 max_rules);
651 if (!priv->cls_rules[rxnfc->fs.location].in_use) 654 if (!priv->cls_rules[rxnfc->fs.location].in_use)
652 return -EINVAL; 655 return -EINVAL;
653 rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs; 656 rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index aa7d4e27c5d1..38f10f7dcbc3 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3556,7 +3556,7 @@ failed_init:
3556 if (fep->reg_phy) 3556 if (fep->reg_phy)
3557 regulator_disable(fep->reg_phy); 3557 regulator_disable(fep->reg_phy);
3558failed_reset: 3558failed_reset:
3559 pm_runtime_put(&pdev->dev); 3559 pm_runtime_put_noidle(&pdev->dev);
3560 pm_runtime_disable(&pdev->dev); 3560 pm_runtime_disable(&pdev->dev);
3561failed_regulator: 3561failed_regulator:
3562 clk_disable_unprepare(fep->clk_ahb); 3562 clk_disable_unprepare(fep->clk_ahb);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index e758650b2c26..269bd73be1a0 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4674,7 +4674,7 @@ static int mvneta_probe(struct platform_device *pdev)
4674 err = register_netdev(dev); 4674 err = register_netdev(dev);
4675 if (err < 0) { 4675 if (err < 0) {
4676 dev_err(&pdev->dev, "failed to register\n"); 4676 dev_err(&pdev->dev, "failed to register\n");
4677 goto err_free_stats; 4677 goto err_netdev;
4678 } 4678 }
4679 4679
4680 netdev_info(dev, "Using %s mac address %pM\n", mac_from, 4680 netdev_info(dev, "Using %s mac address %pM\n", mac_from,
@@ -4685,14 +4685,12 @@ static int mvneta_probe(struct platform_device *pdev)
4685 return 0; 4685 return 0;
4686 4686
4687err_netdev: 4687err_netdev:
4688 unregister_netdev(dev);
4689 if (pp->bm_priv) { 4688 if (pp->bm_priv) {
4690 mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id); 4689 mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id);
4691 mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, 4690 mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
4692 1 << pp->id); 4691 1 << pp->id);
4693 mvneta_bm_put(pp->bm_priv); 4692 mvneta_bm_put(pp->bm_priv);
4694 } 4693 }
4695err_free_stats:
4696 free_percpu(pp->stats); 4694 free_percpu(pp->stats);
4697err_free_ports: 4695err_free_ports:
4698 free_percpu(pp->ports); 4696 free_percpu(pp->ports);
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index d046f7a1dcf5..a57d17ab91f0 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -1271,6 +1271,9 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *port,
1271 if (ret) 1271 if (ret)
1272 goto clean_eth_rule; 1272 goto clean_eth_rule;
1273 1273
1274 ethtool_rx_flow_rule_destroy(ethtool_rule);
1275 efs->rule.flow = NULL;
1276
1274 memcpy(&efs->rxnfc, info, sizeof(*info)); 1277 memcpy(&efs->rxnfc, info, sizeof(*info));
1275 port->rfs_rules[efs->rule.loc] = efs; 1278 port->rfs_rules[efs->rule.loc] = efs;
1276 port->n_rfs_rules++; 1279 port->n_rfs_rules++;
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index d38952eb7aa9..7a67e23a2c2b 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1455,7 +1455,7 @@ static inline void mvpp2_xlg_max_rx_size_set(struct mvpp2_port *port)
1455/* Set defaults to the MVPP2 port */ 1455/* Set defaults to the MVPP2 port */
1456static void mvpp2_defaults_set(struct mvpp2_port *port) 1456static void mvpp2_defaults_set(struct mvpp2_port *port)
1457{ 1457{
1458 int tx_port_num, val, queue, ptxq, lrxq; 1458 int tx_port_num, val, queue, lrxq;
1459 1459
1460 if (port->priv->hw_version == MVPP21) { 1460 if (port->priv->hw_version == MVPP21) {
1461 /* Update TX FIFO MIN Threshold */ 1461 /* Update TX FIFO MIN Threshold */
@@ -1476,11 +1476,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port)
1476 mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0); 1476 mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0);
1477 1477
1478 /* Close bandwidth for all queues */ 1478 /* Close bandwidth for all queues */
1479 for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { 1479 for (queue = 0; queue < MVPP2_MAX_TXQ; queue++)
1480 ptxq = mvpp2_txq_phys(port->id, queue);
1481 mvpp2_write(port->priv, 1480 mvpp2_write(port->priv,
1482 MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(ptxq), 0); 1481 MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(queue), 0);
1483 }
1484 1482
1485 /* Set refill period to 1 usec, refill tokens 1483 /* Set refill period to 1 usec, refill tokens
1486 * and bucket size to maximum 1484 * and bucket size to maximum
@@ -2336,7 +2334,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
2336 txq->descs_dma = 0; 2334 txq->descs_dma = 0;
2337 2335
2338 /* Set minimum bandwidth for disabled TXQs */ 2336 /* Set minimum bandwidth for disabled TXQs */
2339 mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0); 2337 mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->log_id), 0);
2340 2338
2341 /* Set Tx descriptors queue starting address and size */ 2339 /* Set Tx descriptors queue starting address and size */
2342 thread = mvpp2_cpu_to_thread(port->priv, get_cpu()); 2340 thread = mvpp2_cpu_to_thread(port->priv, get_cpu());
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 457cc39423f2..c65cefd84eda 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3687,6 +3687,12 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
3687 netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); 3687 netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n");
3688 } 3688 }
3689 3689
3690 if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) {
3691 features &= ~NETIF_F_RXHASH;
3692 if (netdev->features & NETIF_F_RXHASH)
3693 netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n");
3694 }
3695
3690 mutex_unlock(&priv->state_lock); 3696 mutex_unlock(&priv->state_lock);
3691 3697
3692 return features; 3698 return features;
@@ -3812,6 +3818,9 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
3812 memcpy(&priv->tstamp, &config, sizeof(config)); 3818 memcpy(&priv->tstamp, &config, sizeof(config));
3813 mutex_unlock(&priv->state_lock); 3819 mutex_unlock(&priv->state_lock);
3814 3820
3821 /* might need to fix some features */
3822 netdev_update_features(priv->netdev);
3823
3815 return copy_to_user(ifr->ifr_data, &config, 3824 return copy_to_user(ifr->ifr_data, &config,
3816 sizeof(config)) ? -EFAULT : 0; 3825 sizeof(config)) ? -EFAULT : 0;
3817} 3826}
@@ -4680,6 +4689,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
4680 if (!priv->channels.params.scatter_fcs_en) 4689 if (!priv->channels.params.scatter_fcs_en)
4681 netdev->features &= ~NETIF_F_RXFCS; 4690 netdev->features &= ~NETIF_F_RXFCS;
4682 4691
4692 /* prefere CQE compression over rxhash */
4693 if (MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS))
4694 netdev->features &= ~NETIF_F_RXHASH;
4695
4683#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) 4696#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f)
4684 if (FT_CAP(flow_modify_en) && 4697 if (FT_CAP(flow_modify_en) &&
4685 FT_CAP(modify_root) && 4698 FT_CAP(modify_root) &&
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5283e16c69e4..9aea9c5b2ce8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -813,7 +813,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb,
813 struct net_device *netdev = netdev_notifier_info_to_dev(ptr); 813 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
814 814
815 if (!mlx5e_tc_tun_device_to_offload(priv, netdev) && 815 if (!mlx5e_tc_tun_device_to_offload(priv, netdev) &&
816 !is_vlan_dev(netdev)) 816 !(is_vlan_dev(netdev) && vlan_dev_real_dev(netdev) == rpriv->netdev))
817 return NOTIFY_OK; 817 return NOTIFY_OK;
818 818
819 switch (event) { 819 switch (event) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index d7ca7e82a832..fe76c6fd6d80 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -2284,7 +2284,7 @@ static struct mlx5_flow_root_namespace
2284 cmds = mlx5_fs_cmd_get_default_ipsec_fpga_cmds(table_type); 2284 cmds = mlx5_fs_cmd_get_default_ipsec_fpga_cmds(table_type);
2285 2285
2286 /* Create the root namespace */ 2286 /* Create the root namespace */
2287 root_ns = kvzalloc(sizeof(*root_ns), GFP_KERNEL); 2287 root_ns = kzalloc(sizeof(*root_ns), GFP_KERNEL);
2288 if (!root_ns) 2288 if (!root_ns)
2289 return NULL; 2289 return NULL;
2290 2290
@@ -2427,6 +2427,7 @@ static void cleanup_egress_acls_root_ns(struct mlx5_core_dev *dev)
2427 cleanup_root_ns(steering->esw_egress_root_ns[i]); 2427 cleanup_root_ns(steering->esw_egress_root_ns[i]);
2428 2428
2429 kfree(steering->esw_egress_root_ns); 2429 kfree(steering->esw_egress_root_ns);
2430 steering->esw_egress_root_ns = NULL;
2430} 2431}
2431 2432
2432static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) 2433static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev)
@@ -2441,6 +2442,7 @@ static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev)
2441 cleanup_root_ns(steering->esw_ingress_root_ns[i]); 2442 cleanup_root_ns(steering->esw_ingress_root_ns[i]);
2442 2443
2443 kfree(steering->esw_ingress_root_ns); 2444 kfree(steering->esw_ingress_root_ns);
2445 steering->esw_ingress_root_ns = NULL;
2444} 2446}
2445 2447
2446void mlx5_cleanup_fs(struct mlx5_core_dev *dev) 2448void mlx5_cleanup_fs(struct mlx5_core_dev *dev)
@@ -2474,11 +2476,7 @@ static int init_sniffer_tx_root_ns(struct mlx5_flow_steering *steering)
2474 2476
2475 /* Create single prio */ 2477 /* Create single prio */
2476 prio = fs_create_prio(&steering->sniffer_tx_root_ns->ns, 0, 1); 2478 prio = fs_create_prio(&steering->sniffer_tx_root_ns->ns, 0, 1);
2477 if (IS_ERR(prio)) { 2479 return PTR_ERR_OR_ZERO(prio);
2478 cleanup_root_ns(steering->sniffer_tx_root_ns);
2479 return PTR_ERR(prio);
2480 }
2481 return 0;
2482} 2480}
2483 2481
2484static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering) 2482static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering)
@@ -2491,11 +2489,7 @@ static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering)
2491 2489
2492 /* Create single prio */ 2490 /* Create single prio */
2493 prio = fs_create_prio(&steering->sniffer_rx_root_ns->ns, 0, 1); 2491 prio = fs_create_prio(&steering->sniffer_rx_root_ns->ns, 0, 1);
2494 if (IS_ERR(prio)) { 2492 return PTR_ERR_OR_ZERO(prio);
2495 cleanup_root_ns(steering->sniffer_rx_root_ns);
2496 return PTR_ERR(prio);
2497 }
2498 return 0;
2499} 2493}
2500 2494
2501static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering) 2495static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering)
@@ -2511,11 +2505,7 @@ static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering)
2511 2505
2512 /* Create single prio */ 2506 /* Create single prio */
2513 prio = fs_create_prio(&steering->rdma_rx_root_ns->ns, 0, 1); 2507 prio = fs_create_prio(&steering->rdma_rx_root_ns->ns, 0, 1);
2514 if (IS_ERR(prio)) { 2508 return PTR_ERR_OR_ZERO(prio);
2515 cleanup_root_ns(steering->rdma_rx_root_ns);
2516 return PTR_ERR(prio);
2517 }
2518 return 0;
2519} 2509}
2520static int init_fdb_root_ns(struct mlx5_flow_steering *steering) 2510static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
2521{ 2511{
@@ -2637,6 +2627,7 @@ cleanup_root_ns:
2637 for (i--; i >= 0; i--) 2627 for (i--; i >= 0; i--)
2638 cleanup_root_ns(steering->esw_egress_root_ns[i]); 2628 cleanup_root_ns(steering->esw_egress_root_ns[i]);
2639 kfree(steering->esw_egress_root_ns); 2629 kfree(steering->esw_egress_root_ns);
2630 steering->esw_egress_root_ns = NULL;
2640 return err; 2631 return err;
2641} 2632}
2642 2633
@@ -2664,6 +2655,7 @@ cleanup_root_ns:
2664 for (i--; i >= 0; i--) 2655 for (i--; i >= 0; i--)
2665 cleanup_root_ns(steering->esw_ingress_root_ns[i]); 2656 cleanup_root_ns(steering->esw_ingress_root_ns[i]);
2666 kfree(steering->esw_ingress_root_ns); 2657 kfree(steering->esw_ingress_root_ns);
2658 steering->esw_ingress_root_ns = NULL;
2667 return err; 2659 return err;
2668} 2660}
2669 2661
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 61fa1d162d28..23d53163ce15 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1067,7 +1067,7 @@ static int mlx5_load(struct mlx5_core_dev *dev)
1067 err = mlx5_core_set_hca_defaults(dev); 1067 err = mlx5_core_set_hca_defaults(dev);
1068 if (err) { 1068 if (err) {
1069 mlx5_core_err(dev, "Failed to set hca defaults\n"); 1069 mlx5_core_err(dev, "Failed to set hca defaults\n");
1070 goto err_fs; 1070 goto err_sriov;
1071 } 1071 }
1072 1072
1073 err = mlx5_sriov_attach(dev); 1073 err = mlx5_sriov_attach(dev);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index dbb425717f5e..dfe6b44baf63 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3128,6 +3128,10 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev,
3128 ops->reg_ptys_eth_unpack(mlxsw_sp, ptys_pl, &eth_proto_cap, NULL, NULL); 3128 ops->reg_ptys_eth_unpack(mlxsw_sp, ptys_pl, &eth_proto_cap, NULL, NULL);
3129 3129
3130 autoneg = cmd->base.autoneg == AUTONEG_ENABLE; 3130 autoneg = cmd->base.autoneg == AUTONEG_ENABLE;
3131 if (!autoneg && cmd->base.speed == SPEED_56000) {
3132 netdev_err(dev, "56G not supported with autoneg off\n");
3133 return -EINVAL;
3134 }
3131 eth_proto_new = autoneg ? 3135 eth_proto_new = autoneg ?
3132 ops->to_ptys_advert_link(mlxsw_sp, cmd) : 3136 ops->to_ptys_advert_link(mlxsw_sp, cmd) :
3133 ops->to_ptys_speed(mlxsw_sp, cmd->base.speed); 3137 ops->to_ptys_speed(mlxsw_sp, cmd->base.speed);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
index c1a9cc9a3292..4c98950380d5 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
@@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct mlxsw_sp_acl_erp_key *parent_key,
1171 return -EINVAL; 1171 return -EINVAL;
1172 } 1172 }
1173 if (si == -1) { 1173 if (si == -1) {
1174 /* The masks are the same, this cannot happen. 1174 /* The masks are the same, this can happen in case eRPs with
1175 * That means the caller is broken. 1175 * the same mask were created in both A-TCAM and C-TCAM.
1176 * The only possible condition under which this can happen
1177 * is identical rule insertion. Delta is not possible here.
1176 */ 1178 */
1177 WARN_ON(1); 1179 return -EINVAL;
1178 *delta_start = 0;
1179 *delta_mask = 0;
1180 return 0;
1181 } 1180 }
1182 pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)]; 1181 pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)];
1183 mask = (unsigned char) key->mask[__MASK_IDX(si)]; 1182 mask = (unsigned char) key->mask[__MASK_IDX(si)];
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index d715ef4fc92f..02ad11e0b0d8 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -593,45 +593,25 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
593 return NETDEV_TX_OK; 593 return NETDEV_TX_OK;
594} 594}
595 595
596static void ocelot_mact_mc_reset(struct ocelot_port *port) 596static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
597{ 597{
598 struct ocelot *ocelot = port->ocelot; 598 struct ocelot_port *port = netdev_priv(dev);
599 struct netdev_hw_addr *ha, *n;
600 599
601 /* Free and forget all the MAC addresses stored in the port private mc 600 return ocelot_mact_forget(port->ocelot, addr, port->pvid);
602 * list. These are mc addresses that were previously added by calling
603 * ocelot_mact_mc_add().
604 */
605 list_for_each_entry_safe(ha, n, &port->mc, list) {
606 ocelot_mact_forget(ocelot, ha->addr, port->pvid);
607 list_del(&ha->list);
608 kfree(ha);
609 }
610} 601}
611 602
612static int ocelot_mact_mc_add(struct ocelot_port *port, 603static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
613 struct netdev_hw_addr *hw_addr)
614{ 604{
615 struct ocelot *ocelot = port->ocelot; 605 struct ocelot_port *port = netdev_priv(dev);
616 struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC);
617
618 if (!ha)
619 return -ENOMEM;
620
621 memcpy(ha, hw_addr, sizeof(*ha));
622 list_add_tail(&ha->list, &port->mc);
623
624 ocelot_mact_learn(ocelot, PGID_CPU, ha->addr, port->pvid,
625 ENTRYTYPE_LOCKED);
626 606
627 return 0; 607 return ocelot_mact_learn(port->ocelot, PGID_CPU, addr, port->pvid,
608 ENTRYTYPE_LOCKED);
628} 609}
629 610
630static void ocelot_set_rx_mode(struct net_device *dev) 611static void ocelot_set_rx_mode(struct net_device *dev)
631{ 612{
632 struct ocelot_port *port = netdev_priv(dev); 613 struct ocelot_port *port = netdev_priv(dev);
633 struct ocelot *ocelot = port->ocelot; 614 struct ocelot *ocelot = port->ocelot;
634 struct netdev_hw_addr *ha;
635 int i; 615 int i;
636 u32 val; 616 u32 val;
637 617
@@ -643,13 +623,7 @@ static void ocelot_set_rx_mode(struct net_device *dev)
643 for (i = ocelot->num_phys_ports + 1; i < PGID_CPU; i++) 623 for (i = ocelot->num_phys_ports + 1; i < PGID_CPU; i++)
644 ocelot_write_rix(ocelot, val, ANA_PGID_PGID, i); 624 ocelot_write_rix(ocelot, val, ANA_PGID_PGID, i);
645 625
646 /* Handle the device multicast addresses. First remove all the 626 __dev_mc_sync(dev, ocelot_mc_sync, ocelot_mc_unsync);
647 * previously installed addresses and then add the latest ones to the
648 * mac table.
649 */
650 ocelot_mact_mc_reset(port);
651 netdev_for_each_mc_addr(ha, dev)
652 ocelot_mact_mc_add(port, ha);
653} 627}
654 628
655static int ocelot_port_get_phys_port_name(struct net_device *dev, 629static int ocelot_port_get_phys_port_name(struct net_device *dev,
@@ -1657,7 +1631,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
1657 ocelot_port->regs = regs; 1631 ocelot_port->regs = regs;
1658 ocelot_port->chip_port = port; 1632 ocelot_port->chip_port = port;
1659 ocelot_port->phy = phy; 1633 ocelot_port->phy = phy;
1660 INIT_LIST_HEAD(&ocelot_port->mc);
1661 ocelot->ports[port] = ocelot_port; 1634 ocelot->ports[port] = ocelot_port;
1662 1635
1663 dev->netdev_ops = &ocelot_port_netdev_ops; 1636 dev->netdev_ops = &ocelot_port_netdev_ops;
diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h
index ba3b3380b4d0..541fe41e60b0 100644
--- a/drivers/net/ethernet/mscc/ocelot.h
+++ b/drivers/net/ethernet/mscc/ocelot.h
@@ -441,10 +441,6 @@ struct ocelot_port {
441 struct phy_device *phy; 441 struct phy_device *phy;
442 void __iomem *regs; 442 void __iomem *regs;
443 u8 chip_port; 443 u8 chip_port;
444 /* Keep a track of the mc addresses added to the mac table, so that they
445 * can be removed when needed.
446 */
447 struct list_head mc;
448 444
449 /* Ingress default VLAN (pvid) */ 445 /* Ingress default VLAN (pvid) */
450 u16 pvid; 446 u16 pvid;
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 8e404186ef87..d06a61f00e78 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6722,6 +6722,8 @@ static int rtl8169_resume(struct device *device)
6722 struct net_device *dev = dev_get_drvdata(device); 6722 struct net_device *dev = dev_get_drvdata(device);
6723 struct rtl8169_private *tp = netdev_priv(dev); 6723 struct rtl8169_private *tp = netdev_priv(dev);
6724 6724
6725 rtl_rar_set(tp, dev->dev_addr);
6726
6725 clk_prepare_enable(tp->clk); 6727 clk_prepare_enable(tp->clk);
6726 6728
6727 if (netif_running(dev)) 6729 if (netif_running(dev))
@@ -6755,6 +6757,7 @@ static int rtl8169_runtime_resume(struct device *device)
6755{ 6757{
6756 struct net_device *dev = dev_get_drvdata(device); 6758 struct net_device *dev = dev_get_drvdata(device);
6757 struct rtl8169_private *tp = netdev_priv(dev); 6759 struct rtl8169_private *tp = netdev_priv(dev);
6760
6758 rtl_rar_set(tp, dev->dev_addr); 6761 rtl_rar_set(tp, dev->dev_addr);
6759 6762
6760 if (!tp->TxDescArray) 6763 if (!tp->TxDescArray)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 6354f19a31eb..7ba35a0bdb29 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1594,6 +1594,10 @@ static void sh_eth_dev_exit(struct net_device *ndev)
1594 sh_eth_get_stats(ndev); 1594 sh_eth_get_stats(ndev);
1595 mdp->cd->soft_reset(ndev); 1595 mdp->cd->soft_reset(ndev);
1596 1596
1597 /* Set the RMII mode again if required */
1598 if (mdp->cd->rmiimode)
1599 sh_eth_write(ndev, 0x1, RMIIMODE);
1600
1597 /* Set MAC address again */ 1601 /* Set MAC address again */
1598 update_mac_address(ndev); 1602 update_mac_address(ndev);
1599} 1603}
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 3256e5cbad27..5bc224834c77 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -455,7 +455,11 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
455 priv = data->probe(pdev, plat_dat, &stmmac_res); 455 priv = data->probe(pdev, plat_dat, &stmmac_res);
456 if (IS_ERR(priv)) { 456 if (IS_ERR(priv)) {
457 ret = PTR_ERR(priv); 457 ret = PTR_ERR(priv);
458 dev_err(&pdev->dev, "failed to probe subdriver: %d\n", ret); 458
459 if (ret != -EPROBE_DEFER)
460 dev_err(&pdev->dev, "failed to probe subdriver: %d\n",
461 ret);
462
459 goto remove_config; 463 goto remove_config;
460 } 464 }
461 465
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
index bf2562995fc8..126b66bb73a6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
@@ -346,8 +346,6 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)
346 return PTR_ERR(plat_dat); 346 return PTR_ERR(plat_dat);
347 347
348 plat_dat->interface = priv_plat->phy_mode; 348 plat_dat->interface = priv_plat->phy_mode;
349 /* clk_csr_i = 250-300MHz & MDC = clk_csr_i/124 */
350 plat_dat->clk_csr = 5;
351 plat_dat->has_gmac4 = 1; 349 plat_dat->has_gmac4 = 1;
352 plat_dat->has_gmac = 0; 350 plat_dat->has_gmac = 0;
353 plat_dat->pmt = 0; 351 plat_dat->pmt = 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2a1052704885..65e57b9f6887 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3338,6 +3338,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
3338 entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE); 3338 entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
3339 } 3339 }
3340 rx_q->dirty_rx = entry; 3340 rx_q->dirty_rx = entry;
3341 stmmac_set_rx_tail_ptr(priv, priv->ioaddr, rx_q->rx_tail_addr, queue);
3341} 3342}
3342 3343
3343/** 3344/**
@@ -4379,10 +4380,10 @@ int stmmac_dvr_probe(struct device *device,
4379 * set the MDC clock dynamically according to the csr actual 4380 * set the MDC clock dynamically according to the csr actual
4380 * clock input. 4381 * clock input.
4381 */ 4382 */
4382 if (!priv->plat->clk_csr) 4383 if (priv->plat->clk_csr >= 0)
4383 stmmac_clk_csr_set(priv);
4384 else
4385 priv->clk_csr = priv->plat->clk_csr; 4384 priv->clk_csr = priv->plat->clk_csr;
4385 else
4386 stmmac_clk_csr_set(priv);
4386 4387
4387 stmmac_check_pcs_mode(priv); 4388 stmmac_check_pcs_mode(priv);
4388 4389
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index bdd351597b55..093a223fe408 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -267,7 +267,8 @@ int stmmac_mdio_reset(struct mii_bus *bus)
267 of_property_read_u32_array(np, 267 of_property_read_u32_array(np,
268 "snps,reset-delays-us", data->delays, 3); 268 "snps,reset-delays-us", data->delays, 3);
269 269
270 if (gpio_request(data->reset_gpio, "mdio-reset")) 270 if (devm_gpio_request(priv->device, data->reset_gpio,
271 "mdio-reset"))
271 return 0; 272 return 0;
272 } 273 }
273 274
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 3031f2bf15d6..f45bfbef97d0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -408,7 +408,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
408 /* Default to phy auto-detection */ 408 /* Default to phy auto-detection */
409 plat->phy_addr = -1; 409 plat->phy_addr = -1;
410 410
411 /* Get clk_csr from device tree */ 411 /* Default to get clk_csr from stmmac_clk_crs_set(),
412 * or get clk_csr from device tree.
413 */
414 plat->clk_csr = -1;
412 of_property_read_u32(np, "clk_csr", &plat->clk_csr); 415 of_property_read_u32(np, "clk_csr", &plat->clk_csr);
413 416
414 /* "snps,phy-addr" is not a standard property. Mark it as deprecated 417 /* "snps,phy-addr" is not a standard property. Mark it as deprecated
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 72069ec2951e..03ea5a7ed3a4 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1989,6 +1989,12 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb)
1989 struct netvsc_vf_pcpu_stats *pcpu_stats 1989 struct netvsc_vf_pcpu_stats *pcpu_stats
1990 = this_cpu_ptr(ndev_ctx->vf_stats); 1990 = this_cpu_ptr(ndev_ctx->vf_stats);
1991 1991
1992 skb = skb_share_check(skb, GFP_ATOMIC);
1993 if (unlikely(!skb))
1994 return RX_HANDLER_CONSUMED;
1995
1996 *pskb = skb;
1997
1992 skb->dev = ndev; 1998 skb->dev = ndev;
1993 1999
1994 u64_stats_update_begin(&pcpu_stats->syncp); 2000 u64_stats_update_begin(&pcpu_stats->syncp);
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index fd35131a0c39..c71c7d0f53f0 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -26,10 +26,18 @@
26 26
27/* Extended Registers */ 27/* Extended Registers */
28#define DP83867_CFG4 0x0031 28#define DP83867_CFG4 0x0031
29#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6))
30#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5)
31#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5)
32#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5)
33#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5)
34
29#define DP83867_RGMIICTL 0x0032 35#define DP83867_RGMIICTL 0x0032
30#define DP83867_STRAP_STS1 0x006E 36#define DP83867_STRAP_STS1 0x006E
31#define DP83867_RGMIIDCTL 0x0086 37#define DP83867_RGMIIDCTL 0x0086
32#define DP83867_IO_MUX_CFG 0x0170 38#define DP83867_IO_MUX_CFG 0x0170
39#define DP83867_10M_SGMII_CFG 0x016F
40#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7)
33 41
34#define DP83867_SW_RESET BIT(15) 42#define DP83867_SW_RESET BIT(15)
35#define DP83867_SW_RESTART BIT(14) 43#define DP83867_SW_RESTART BIT(14)
@@ -247,10 +255,8 @@ static int dp83867_config_init(struct phy_device *phydev)
247 ret = phy_write(phydev, MII_DP83867_PHYCTRL, val); 255 ret = phy_write(phydev, MII_DP83867_PHYCTRL, val);
248 if (ret) 256 if (ret)
249 return ret; 257 return ret;
250 }
251 258
252 if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) && 259 /* Set up RGMII delays */
253 (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {
254 val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIICTL); 260 val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_RGMIICTL);
255 261
256 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) 262 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
@@ -277,6 +283,33 @@ static int dp83867_config_init(struct phy_device *phydev)
277 DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL); 283 DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL);
278 } 284 }
279 285
286 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
287 /* For support SPEED_10 in SGMII mode
288 * DP83867_10M_SGMII_RATE_ADAPT bit
289 * has to be cleared by software. That
290 * does not affect SPEED_100 and
291 * SPEED_1000.
292 */
293 ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
294 DP83867_10M_SGMII_CFG,
295 DP83867_10M_SGMII_RATE_ADAPT_MASK,
296 0);
297 if (ret)
298 return ret;
299
300 /* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5
301 * are 01). That is not enough to finalize autoneg on some
302 * devices. Increase this timer duration to maximum 16ms.
303 */
304 ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
305 DP83867_CFG4,
306 DP83867_CFG4_SGMII_ANEG_MASK,
307 DP83867_CFG4_SGMII_ANEG_TIMER_16MS);
308
309 if (ret)
310 return ret;
311 }
312
280 /* Enable Interrupt output INT_OE in CFG3 register */ 313 /* Enable Interrupt output INT_OE in CFG3 register */
281 if (phy_interrupt_is_valid(phydev)) { 314 if (phy_interrupt_is_valid(phydev)) {
282 val = phy_read(phydev, DP83867_CFG3); 315 val = phy_read(phydev, DP83867_CFG3);
@@ -307,7 +340,7 @@ static int dp83867_phy_reset(struct phy_device *phydev)
307 340
308 usleep_range(10, 20); 341 usleep_range(10, 20);
309 342
310 return dp83867_config_init(phydev); 343 return 0;
311} 344}
312 345
313static struct phy_driver dp83867_driver[] = { 346static struct phy_driver dp83867_driver[] = {
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 238a20e13d6a..3b99882692e3 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -31,6 +31,9 @@
31#define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) 31#define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa)
32 32
33enum { 33enum {
34 MV_PMA_BOOT = 0xc050,
35 MV_PMA_BOOT_FATAL = BIT(0),
36
34 MV_PCS_BASE_T = 0x0000, 37 MV_PCS_BASE_T = 0x0000,
35 MV_PCS_BASE_R = 0x1000, 38 MV_PCS_BASE_R = 0x1000,
36 MV_PCS_1000BASEX = 0x2000, 39 MV_PCS_1000BASEX = 0x2000,
@@ -213,6 +216,16 @@ static int mv3310_probe(struct phy_device *phydev)
213 (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) 216 (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask)
214 return -ENODEV; 217 return -ENODEV;
215 218
219 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT);
220 if (ret < 0)
221 return ret;
222
223 if (ret & MV_PMA_BOOT_FATAL) {
224 dev_warn(&phydev->mdio.dev,
225 "PHY failed to boot firmware, status=%04x\n", ret);
226 return -ENODEV;
227 }
228
216 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); 229 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
217 if (!priv) 230 if (!priv)
218 return -ENOMEM; 231 return -ENOMEM;
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 74983593834b..9044b95d2afe 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -51,6 +51,10 @@ struct phylink {
51 51
52 /* The link configuration settings */ 52 /* The link configuration settings */
53 struct phylink_link_state link_config; 53 struct phylink_link_state link_config;
54
55 /* The current settings */
56 phy_interface_t cur_interface;
57
54 struct gpio_desc *link_gpio; 58 struct gpio_desc *link_gpio;
55 struct timer_list link_poll; 59 struct timer_list link_poll;
56 void (*get_fixed_state)(struct net_device *dev, 60 void (*get_fixed_state)(struct net_device *dev,
@@ -446,12 +450,12 @@ static void phylink_resolve(struct work_struct *w)
446 if (!link_state.link) { 450 if (!link_state.link) {
447 netif_carrier_off(ndev); 451 netif_carrier_off(ndev);
448 pl->ops->mac_link_down(ndev, pl->link_an_mode, 452 pl->ops->mac_link_down(ndev, pl->link_an_mode,
449 pl->phy_state.interface); 453 pl->cur_interface);
450 netdev_info(ndev, "Link is Down\n"); 454 netdev_info(ndev, "Link is Down\n");
451 } else { 455 } else {
456 pl->cur_interface = link_state.interface;
452 pl->ops->mac_link_up(ndev, pl->link_an_mode, 457 pl->ops->mac_link_up(ndev, pl->link_an_mode,
453 pl->phy_state.interface, 458 pl->cur_interface, pl->phydev);
454 pl->phydev);
455 459
456 netif_carrier_on(ndev); 460 netif_carrier_on(ndev);
457 461
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 0522c2224147..b372419d61f2 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -277,7 +277,7 @@ config PINCTRL_ST
277config PINCTRL_STMFX 277config PINCTRL_STMFX
278 tristate "STMicroelectronics STMFX GPIO expander pinctrl driver" 278 tristate "STMicroelectronics STMFX GPIO expander pinctrl driver"
279 depends on I2C 279 depends on I2C
280 depends on OF || COMPILE_TEST 280 depends on OF_GPIO
281 select GENERIC_PINCONF 281 select GENERIC_PINCONF
282 select GPIOLIB_IRQCHIP 282 select GPIOLIB_IRQCHIP
283 select MFD_STMFX 283 select MFD_STMFX
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index d7acbb79cdf7..a18d6eefe672 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -33,13 +33,13 @@
33 33
34#define PADOWN_BITS 4 34#define PADOWN_BITS 4
35#define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS) 35#define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS)
36#define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p)) 36#define PADOWN_MASK(p) (GENMASK(3, 0) << PADOWN_SHIFT(p))
37#define PADOWN_GPP(p) ((p) / 8) 37#define PADOWN_GPP(p) ((p) / 8)
38 38
39/* Offset from pad_regs */ 39/* Offset from pad_regs */
40#define PADCFG0 0x000 40#define PADCFG0 0x000
41#define PADCFG0_RXEVCFG_SHIFT 25 41#define PADCFG0_RXEVCFG_SHIFT 25
42#define PADCFG0_RXEVCFG_MASK (3 << PADCFG0_RXEVCFG_SHIFT) 42#define PADCFG0_RXEVCFG_MASK GENMASK(26, 25)
43#define PADCFG0_RXEVCFG_LEVEL 0 43#define PADCFG0_RXEVCFG_LEVEL 0
44#define PADCFG0_RXEVCFG_EDGE 1 44#define PADCFG0_RXEVCFG_EDGE 1
45#define PADCFG0_RXEVCFG_DISABLED 2 45#define PADCFG0_RXEVCFG_DISABLED 2
@@ -51,7 +51,7 @@
51#define PADCFG0_GPIROUTSMI BIT(18) 51#define PADCFG0_GPIROUTSMI BIT(18)
52#define PADCFG0_GPIROUTNMI BIT(17) 52#define PADCFG0_GPIROUTNMI BIT(17)
53#define PADCFG0_PMODE_SHIFT 10 53#define PADCFG0_PMODE_SHIFT 10
54#define PADCFG0_PMODE_MASK (0xf << PADCFG0_PMODE_SHIFT) 54#define PADCFG0_PMODE_MASK GENMASK(13, 10)
55#define PADCFG0_GPIORXDIS BIT(9) 55#define PADCFG0_GPIORXDIS BIT(9)
56#define PADCFG0_GPIOTXDIS BIT(8) 56#define PADCFG0_GPIOTXDIS BIT(8)
57#define PADCFG0_GPIORXSTATE BIT(1) 57#define PADCFG0_GPIORXSTATE BIT(1)
@@ -60,7 +60,7 @@
60#define PADCFG1 0x004 60#define PADCFG1 0x004
61#define PADCFG1_TERM_UP BIT(13) 61#define PADCFG1_TERM_UP BIT(13)
62#define PADCFG1_TERM_SHIFT 10 62#define PADCFG1_TERM_SHIFT 10
63#define PADCFG1_TERM_MASK (7 << PADCFG1_TERM_SHIFT) 63#define PADCFG1_TERM_MASK GENMASK(12, 10)
64#define PADCFG1_TERM_20K 4 64#define PADCFG1_TERM_20K 4
65#define PADCFG1_TERM_2K 3 65#define PADCFG1_TERM_2K 3
66#define PADCFG1_TERM_5K 2 66#define PADCFG1_TERM_5K 2
@@ -914,35 +914,6 @@ static void intel_gpio_irq_ack(struct irq_data *d)
914 } 914 }
915} 915}
916 916
917static void intel_gpio_irq_enable(struct irq_data *d)
918{
919 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
920 struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
921 const struct intel_community *community;
922 const struct intel_padgroup *padgrp;
923 int pin;
924
925 pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp);
926 if (pin >= 0) {
927 unsigned int gpp, gpp_offset, is_offset;
928 unsigned long flags;
929 u32 value;
930
931 gpp = padgrp->reg_num;
932 gpp_offset = padgroup_offset(padgrp, pin);
933 is_offset = community->is_offset + gpp * 4;
934
935 raw_spin_lock_irqsave(&pctrl->lock, flags);
936 /* Clear interrupt status first to avoid unexpected interrupt */
937 writel(BIT(gpp_offset), community->regs + is_offset);
938
939 value = readl(community->regs + community->ie_offset + gpp * 4);
940 value |= BIT(gpp_offset);
941 writel(value, community->regs + community->ie_offset + gpp * 4);
942 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
943 }
944}
945
946static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) 917static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
947{ 918{
948 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 919 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -955,15 +926,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
955 if (pin >= 0) { 926 if (pin >= 0) {
956 unsigned int gpp, gpp_offset; 927 unsigned int gpp, gpp_offset;
957 unsigned long flags; 928 unsigned long flags;
958 void __iomem *reg; 929 void __iomem *reg, *is;
959 u32 value; 930 u32 value;
960 931
961 gpp = padgrp->reg_num; 932 gpp = padgrp->reg_num;
962 gpp_offset = padgroup_offset(padgrp, pin); 933 gpp_offset = padgroup_offset(padgrp, pin);
963 934
964 reg = community->regs + community->ie_offset + gpp * 4; 935 reg = community->regs + community->ie_offset + gpp * 4;
936 is = community->regs + community->is_offset + gpp * 4;
965 937
966 raw_spin_lock_irqsave(&pctrl->lock, flags); 938 raw_spin_lock_irqsave(&pctrl->lock, flags);
939
940 /* Clear interrupt status first to avoid unexpected interrupt */
941 writel(BIT(gpp_offset), is);
942
967 value = readl(reg); 943 value = readl(reg);
968 if (mask) 944 if (mask)
969 value &= ~BIT(gpp_offset); 945 value &= ~BIT(gpp_offset);
@@ -1107,7 +1083,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
1107 1083
1108static struct irq_chip intel_gpio_irqchip = { 1084static struct irq_chip intel_gpio_irqchip = {
1109 .name = "intel-gpio", 1085 .name = "intel-gpio",
1110 .irq_enable = intel_gpio_irq_enable,
1111 .irq_ack = intel_gpio_irq_ack, 1086 .irq_ack = intel_gpio_irq_ack,
1112 .irq_mask = intel_gpio_irq_mask, 1087 .irq_mask = intel_gpio_irq_mask,
1113 .irq_unmask = intel_gpio_irq_unmask, 1088 .irq_unmask = intel_gpio_irq_unmask,
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 399847d21146..f580d4ef77a1 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -457,6 +457,7 @@ static int erofs_read_super(struct super_block *sb,
457 */ 457 */
458err_devname: 458err_devname:
459 dput(sb->s_root); 459 dput(sb->s_root);
460 sb->s_root = NULL;
460err_iget: 461err_iget:
461#ifdef EROFS_FS_HAS_MANAGED_CACHE 462#ifdef EROFS_FS_HAS_MANAGED_CACHE
462 iput(sbi->managed_cache); 463 iput(sbi->managed_cache);
diff --git a/drivers/staging/kpc2000/Kconfig b/drivers/staging/kpc2000/Kconfig
index fb5922928f47..3bb2efd511c4 100644
--- a/drivers/staging/kpc2000/Kconfig
+++ b/drivers/staging/kpc2000/Kconfig
@@ -2,7 +2,9 @@
2 2
3config KPC2000 3config KPC2000
4 bool "Daktronics KPC Device support" 4 bool "Daktronics KPC Device support"
5 select MFD_CORE
5 depends on PCI 6 depends on PCI
7 depends on UIO
6 help 8 help
7 Select this if you wish to use the Daktronics KPC PCI devices 9 Select this if you wish to use the Daktronics KPC PCI devices
8 10
diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c
index 5741d2b49a7d..616658709bd9 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -8,7 +8,7 @@
8#include <linux/errno.h> /* error codes */ 8#include <linux/errno.h> /* error codes */
9#include <linux/types.h> /* size_t */ 9#include <linux/types.h> /* size_t */
10#include <linux/cdev.h> 10#include <linux/cdev.h>
11#include <asm/uaccess.h> /* copy_*_user */ 11#include <linux/uaccess.h> /* copy_*_user */
12#include <linux/aio.h> /* aio stuff */ 12#include <linux/aio.h> /* aio stuff */
13#include <linux/highmem.h> 13#include <linux/highmem.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
@@ -116,13 +116,11 @@ int kpc_dma_transfer(struct dev_private_data *priv, struct kiocb *kcb, unsigned
116 if (desc_needed >= ldev->desc_pool_cnt){ 116 if (desc_needed >= ldev->desc_pool_cnt){
117 dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d TOO MANY to ever complete!\n", acd->mapped_entry_count, desc_needed, num_descrs_avail); 117 dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d TOO MANY to ever complete!\n", acd->mapped_entry_count, desc_needed, num_descrs_avail);
118 rv = -EAGAIN; 118 rv = -EAGAIN;
119 unlock_engine(ldev);
120 goto err_descr_too_many; 119 goto err_descr_too_many;
121 } 120 }
122 if (desc_needed > num_descrs_avail){ 121 if (desc_needed > num_descrs_avail){
123 dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d Too many to complete right now.\n", acd->mapped_entry_count, desc_needed, num_descrs_avail); 122 dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d Too many to complete right now.\n", acd->mapped_entry_count, desc_needed, num_descrs_avail);
124 rv = -EMSGSIZE; 123 rv = -EMSGSIZE;
125 unlock_engine(ldev);
126 goto err_descr_too_many; 124 goto err_descr_too_many;
127 } 125 }
128 126
diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index 9841c30450ce..dade79738a29 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -572,7 +572,7 @@ exit:
572 dev->colourfx.enable ? "true" : "false", 572 dev->colourfx.enable ? "true" : "false",
573 dev->colourfx.u, dev->colourfx.v, 573 dev->colourfx.u, dev->colourfx.v,
574 ret, (ret == 0 ? 0 : -EINVAL)); 574 ret, (ret == 0 ? 0 : -EINVAL));
575 return (ret == 0 ? 0 : EINVAL); 575 return (ret == 0 ? 0 : -EINVAL);
576} 576}
577 577
578static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, 578static int ctrl_set_colfx(struct bm2835_mmal_dev *dev,
@@ -596,7 +596,7 @@ static int ctrl_set_colfx(struct bm2835_mmal_dev *dev,
596 "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", 596 "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n",
597 __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, 597 __func__, mmal_ctrl, ctrl->id, ctrl->val, ret,
598 (ret == 0 ? 0 : -EINVAL)); 598 (ret == 0 ? 0 : -EINVAL));
599 return (ret == 0 ? 0 : EINVAL); 599 return (ret == 0 ? 0 : -EINVAL);
600} 600}
601 601
602static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, 602static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index a9a22917ecdb..c557c9953724 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -368,9 +368,18 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
368 int dma_buffers; 368 int dma_buffers;
369 dma_addr_t dma_addr; 369 dma_addr_t dma_addr;
370 370
371 if (count >= INT_MAX - PAGE_SIZE)
372 return NULL;
373
371 offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1)); 374 offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1));
372 num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE); 375 num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
373 376
377 if (num_pages > (SIZE_MAX - sizeof(struct pagelist) -
378 sizeof(struct vchiq_pagelist_info)) /
379 (sizeof(u32) + sizeof(pages[0]) +
380 sizeof(struct scatterlist)))
381 return NULL;
382
374 pagelist_size = sizeof(struct pagelist) + 383 pagelist_size = sizeof(struct pagelist) +
375 (num_pages * sizeof(u32)) + 384 (num_pages * sizeof(u32)) +
376 (num_pages * sizeof(pages[0]) + 385 (num_pages * sizeof(pages[0]) +
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 0a713409ea98..95eaf8fdf4f2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1076,13 +1076,17 @@ void wilc_wlan_cleanup(struct net_device *dev)
1076 acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); 1076 acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);
1077 1077
1078 ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg); 1078 ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
1079 if (!ret) 1079 if (!ret) {
1080 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); 1080 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
1081 return;
1082 }
1081 1083
1082 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0, 1084 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
1083 (reg | ABORT_INT)); 1085 (reg | ABORT_INT));
1084 if (!ret) 1086 if (!ret) {
1085 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); 1087 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
1088 return;
1089 }
1086 1090
1087 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); 1091 release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
1088 wilc->hif_func->hif_deinit(NULL); 1092 wilc->hif_func->hif_deinit(NULL);
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6fde75d4f064..ab734534093b 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3119,7 +3119,9 @@ static void hfa384x_usbin_callback(struct urb *urb)
3119 break; 3119 break;
3120 } 3120 }
3121 3121
3122 /* Save values from the RX URB before reposting overwrites it. */
3122 urb_status = urb->status; 3123 urb_status = urb->status;
3124 usbin = (union hfa384x_usbin *)urb->transfer_buffer;
3123 3125
3124 if (action != ABORT) { 3126 if (action != ABORT) {
3125 /* Repost the RX URB */ 3127 /* Repost the RX URB */
@@ -3136,7 +3138,6 @@ static void hfa384x_usbin_callback(struct urb *urb)
3136 /* Note: the check of the sw_support field, the type field doesn't 3138 /* Note: the check of the sw_support field, the type field doesn't
3137 * have bit 12 set like the docs suggest. 3139 * have bit 12 set like the docs suggest.
3138 */ 3140 */
3139 usbin = (union hfa384x_usbin *)urb->transfer_buffer;
3140 type = le16_to_cpu(usbin->type); 3141 type = le16_to_cpu(usbin->type);
3141 if (HFA384x_USB_ISRXFRM(type)) { 3142 if (HFA384x_USB_ISRXFRM(type)) {
3142 if (action == HANDLE) { 3143 if (action == HANDLE) {
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index dff75dc94731..8b752e895053 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1165,7 +1165,6 @@ static void imx_uart_clear_rx_errors(struct imx_port *sport)
1165 sport->port.icount.buf_overrun++; 1165 sport->port.icount.buf_overrun++;
1166 tty_flip_buffer_push(port); 1166 tty_flip_buffer_push(port);
1167 } else { 1167 } else {
1168 dev_err(sport->port.dev, "DMA transaction error.\n");
1169 if (usr1 & USR1_FRAMERR) { 1168 if (usr1 & USR1_FRAMERR) {
1170 sport->port.icount.frame++; 1169 sport->port.icount.frame++;
1171 imx_uart_writel(sport, USR1_FRAMERR, USR1); 1170 imx_uart_writel(sport, USR1_FRAMERR, USR1);
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 450ba6d7996c..e5aebbf5f302 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -581,7 +581,7 @@ static int max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
581 } 581 }
582 582
583 /* Configure clock source */ 583 /* Configure clock source */
584 clksrc = xtal ? MAX310X_CLKSRC_CRYST_BIT : MAX310X_CLKSRC_EXTCLK_BIT; 584 clksrc = MAX310X_CLKSRC_EXTCLK_BIT | (xtal ? MAX310X_CLKSRC_CRYST_BIT : 0);
585 585
586 /* Configure PLL */ 586 /* Configure PLL */
587 if (pllcfg) { 587 if (pllcfg) {
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 109096033bb1..23833ad952ba 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -860,6 +860,7 @@ static void msm_handle_tx(struct uart_port *port)
860 struct circ_buf *xmit = &msm_port->uart.state->xmit; 860 struct circ_buf *xmit = &msm_port->uart.state->xmit;
861 struct msm_dma *dma = &msm_port->tx_dma; 861 struct msm_dma *dma = &msm_port->tx_dma;
862 unsigned int pio_count, dma_count, dma_min; 862 unsigned int pio_count, dma_count, dma_min;
863 char buf[4] = { 0 };
863 void __iomem *tf; 864 void __iomem *tf;
864 int err = 0; 865 int err = 0;
865 866
@@ -869,10 +870,12 @@ static void msm_handle_tx(struct uart_port *port)
869 else 870 else
870 tf = port->membase + UART_TF; 871 tf = port->membase + UART_TF;
871 872
873 buf[0] = port->x_char;
874
872 if (msm_port->is_uartdm) 875 if (msm_port->is_uartdm)
873 msm_reset_dm_count(port, 1); 876 msm_reset_dm_count(port, 1);
874 877
875 iowrite8_rep(tf, &port->x_char, 1); 878 iowrite32_rep(tf, buf, 1);
876 port->icount.tx++; 879 port->icount.tx++;
877 port->x_char = 0; 880 port->x_char = 0;
878 return; 881 return;
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 3cd139752d3f..abc705716aa0 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1557,6 +1557,13 @@ static void sci_request_dma(struct uart_port *port)
1557 1557
1558 dev_dbg(port->dev, "%s: port %d\n", __func__, port->line); 1558 dev_dbg(port->dev, "%s: port %d\n", __func__, port->line);
1559 1559
1560 /*
1561 * DMA on console may interfere with Kernel log messages which use
1562 * plain putchar(). So, simply don't use it with a console.
1563 */
1564 if (uart_console(port))
1565 return;
1566
1560 if (!port->dev->of_node) 1567 if (!port->dev->of_node)
1561 return; 1568 return;
1562 1569
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index fdd12f8c3deb..5c0ca1c24b6f 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1056,6 +1056,13 @@ static void visual_init(struct vc_data *vc, int num, int init)
1056 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; 1056 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
1057} 1057}
1058 1058
1059
1060static void visual_deinit(struct vc_data *vc)
1061{
1062 vc->vc_sw->con_deinit(vc);
1063 module_put(vc->vc_sw->owner);
1064}
1065
1059int vc_allocate(unsigned int currcons) /* return 0 on success */ 1066int vc_allocate(unsigned int currcons) /* return 0 on success */
1060{ 1067{
1061 struct vt_notifier_param param; 1068 struct vt_notifier_param param;
@@ -1103,6 +1110,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
1103 1110
1104 return 0; 1111 return 0;
1105err_free: 1112err_free:
1113 visual_deinit(vc);
1106 kfree(vc); 1114 kfree(vc);
1107 vc_cons[currcons].d = NULL; 1115 vc_cons[currcons].d = NULL;
1108 return -ENOMEM; 1116 return -ENOMEM;
@@ -1331,9 +1339,8 @@ struct vc_data *vc_deallocate(unsigned int currcons)
1331 param.vc = vc = vc_cons[currcons].d; 1339 param.vc = vc = vc_cons[currcons].d;
1332 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param); 1340 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
1333 vcs_remove_sysfs(currcons); 1341 vcs_remove_sysfs(currcons);
1334 vc->vc_sw->con_deinit(vc); 1342 visual_deinit(vc);
1335 put_pid(vc->vt_pid); 1343 put_pid(vc->vt_pid);
1336 module_put(vc->vc_sw->owner);
1337 vc_uniscr_set(vc, NULL); 1344 vc_uniscr_set(vc, NULL);
1338 kfree(vc->vc_screenbuf); 1345 kfree(vc->vc_screenbuf);
1339 vc_cons[currcons].d = NULL; 1346 vc_cons[currcons].d = NULL;
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 20ff036b4c22..9d6cb709ca7b 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -932,8 +932,8 @@ int usb_get_bos_descriptor(struct usb_device *dev)
932 932
933 /* Get BOS descriptor */ 933 /* Get BOS descriptor */
934 ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE); 934 ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);
935 if (ret < USB_DT_BOS_SIZE) { 935 if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) {
936 dev_err(ddev, "unable to get BOS descriptor\n"); 936 dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n");
937 if (ret >= 0) 937 if (ret >= 0)
938 ret = -ENOMSG; 938 ret = -ENOMSG;
939 kfree(bos); 939 kfree(bos);
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 8bc35d53408b..6082b008969b 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -209,6 +209,9 @@ static const struct usb_device_id usb_quirk_list[] = {
209 /* Microsoft LifeCam-VX700 v2.0 */ 209 /* Microsoft LifeCam-VX700 v2.0 */
210 { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, 210 { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
211 211
212 /* Microsoft Surface Dock Ethernet (RTL8153 GigE) */
213 { USB_DEVICE(0x045e, 0x07c6), .driver_info = USB_QUIRK_NO_LPM },
214
212 /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ 215 /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */
213 { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, 216 { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME },
214 217
diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index cadc01336bf8..7ba6afc7ef23 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -440,6 +440,9 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
440 struct xhci_ep_priv *epriv; 440 struct xhci_ep_priv *epriv;
441 struct xhci_slot_priv *spriv = dev->debugfs_private; 441 struct xhci_slot_priv *spriv = dev->debugfs_private;
442 442
443 if (!spriv)
444 return;
445
443 if (spriv->eps[ep_index]) 446 if (spriv->eps[ep_index])
444 return; 447 return;
445 448
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index fed3385aeac0..feffceb31e8a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -656,6 +656,7 @@ static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci,
656 struct device *dev = xhci_to_hcd(xhci)->self.controller; 656 struct device *dev = xhci_to_hcd(xhci)->self.controller;
657 struct xhci_segment *seg = td->bounce_seg; 657 struct xhci_segment *seg = td->bounce_seg;
658 struct urb *urb = td->urb; 658 struct urb *urb = td->urb;
659 size_t len;
659 660
660 if (!ring || !seg || !urb) 661 if (!ring || !seg || !urb)
661 return; 662 return;
@@ -666,11 +667,14 @@ static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci,
666 return; 667 return;
667 } 668 }
668 669
669 /* for in tranfers we need to copy the data from bounce to sg */
670 sg_pcopy_from_buffer(urb->sg, urb->num_mapped_sgs, seg->bounce_buf,
671 seg->bounce_len, seg->bounce_offs);
672 dma_unmap_single(dev, seg->bounce_dma, ring->bounce_buf_len, 670 dma_unmap_single(dev, seg->bounce_dma, ring->bounce_buf_len,
673 DMA_FROM_DEVICE); 671 DMA_FROM_DEVICE);
672 /* for in tranfers we need to copy the data from bounce to sg */
673 len = sg_pcopy_from_buffer(urb->sg, urb->num_sgs, seg->bounce_buf,
674 seg->bounce_len, seg->bounce_offs);
675 if (len != seg->bounce_len)
676 xhci_warn(xhci, "WARN Wrong bounce buffer read length: %zu != %d\n",
677 len, seg->bounce_len);
674 seg->bounce_len = 0; 678 seg->bounce_len = 0;
675 seg->bounce_offs = 0; 679 seg->bounce_offs = 0;
676} 680}
@@ -3127,6 +3131,7 @@ static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
3127 unsigned int unalign; 3131 unsigned int unalign;
3128 unsigned int max_pkt; 3132 unsigned int max_pkt;
3129 u32 new_buff_len; 3133 u32 new_buff_len;
3134 size_t len;
3130 3135
3131 max_pkt = usb_endpoint_maxp(&urb->ep->desc); 3136 max_pkt = usb_endpoint_maxp(&urb->ep->desc);
3132 unalign = (enqd_len + *trb_buff_len) % max_pkt; 3137 unalign = (enqd_len + *trb_buff_len) % max_pkt;
@@ -3157,8 +3162,12 @@ static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
3157 3162
3158 /* create a max max_pkt sized bounce buffer pointed to by last trb */ 3163 /* create a max max_pkt sized bounce buffer pointed to by last trb */
3159 if (usb_urb_dir_out(urb)) { 3164 if (usb_urb_dir_out(urb)) {
3160 sg_pcopy_to_buffer(urb->sg, urb->num_mapped_sgs, 3165 len = sg_pcopy_to_buffer(urb->sg, urb->num_sgs,
3161 seg->bounce_buf, new_buff_len, enqd_len); 3166 seg->bounce_buf, new_buff_len, enqd_len);
3167 if (len != seg->bounce_len)
3168 xhci_warn(xhci,
3169 "WARN Wrong bounce buffer write length: %zu != %d\n",
3170 len, seg->bounce_len);
3162 seg->bounce_dma = dma_map_single(dev, seg->bounce_buf, 3171 seg->bounce_dma = dma_map_single(dev, seg->bounce_buf,
3163 max_pkt, DMA_TO_DEVICE); 3172 max_pkt, DMA_TO_DEVICE);
3164 } else { 3173 } else {
@@ -3423,11 +3432,14 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
3423 3432
3424 if (urb->transfer_buffer_length > 0) { 3433 if (urb->transfer_buffer_length > 0) {
3425 u32 length_field, remainder; 3434 u32 length_field, remainder;
3435 u64 addr;
3426 3436
3427 if (xhci_urb_suitable_for_idt(urb)) { 3437 if (xhci_urb_suitable_for_idt(urb)) {
3428 memcpy(&urb->transfer_dma, urb->transfer_buffer, 3438 memcpy(&addr, urb->transfer_buffer,
3429 urb->transfer_buffer_length); 3439 urb->transfer_buffer_length);
3430 field |= TRB_IDT; 3440 field |= TRB_IDT;
3441 } else {
3442 addr = (u64) urb->transfer_dma;
3431 } 3443 }
3432 3444
3433 remainder = xhci_td_remainder(xhci, 0, 3445 remainder = xhci_td_remainder(xhci, 0,
@@ -3440,8 +3452,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
3440 if (setup->bRequestType & USB_DIR_IN) 3452 if (setup->bRequestType & USB_DIR_IN)
3441 field |= TRB_DIR_IN; 3453 field |= TRB_DIR_IN;
3442 queue_trb(xhci, ep_ring, true, 3454 queue_trb(xhci, ep_ring, true,
3443 lower_32_bits(urb->transfer_dma), 3455 lower_32_bits(addr),
3444 upper_32_bits(urb->transfer_dma), 3456 upper_32_bits(addr),
3445 length_field, 3457 length_field,
3446 field | ep_ring->cycle_state); 3458 field | ep_ring->cycle_state);
3447 } 3459 }
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a9bb796794e3..20db378a6012 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/iopoll.h>
12#include <linux/irq.h> 13#include <linux/irq.h>
13#include <linux/log2.h> 14#include <linux/log2.h>
14#include <linux/module.h> 15#include <linux/module.h>
@@ -52,7 +53,6 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
52 return false; 53 return false;
53} 54}
54 55
55/* TODO: copied from ehci-hcd.c - can this be refactored? */
56/* 56/*
57 * xhci_handshake - spin reading hc until handshake completes or fails 57 * xhci_handshake - spin reading hc until handshake completes or fails
58 * @ptr: address of hc register to be read 58 * @ptr: address of hc register to be read
@@ -69,18 +69,16 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
69int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) 69int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec)
70{ 70{
71 u32 result; 71 u32 result;
72 int ret;
72 73
73 do { 74 ret = readl_poll_timeout_atomic(ptr, result,
74 result = readl(ptr); 75 (result & mask) == done ||
75 if (result == ~(u32)0) /* card removed */ 76 result == U32_MAX,
76 return -ENODEV; 77 1, usec);
77 result &= mask; 78 if (result == U32_MAX) /* card removed */
78 if (result == done) 79 return -ENODEV;
79 return 0; 80
80 udelay(1); 81 return ret;
81 usec--;
82 } while (usec > 0);
83 return -ETIMEDOUT;
84} 82}
85 83
86/* 84/*
@@ -4320,7 +4318,6 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
4320 pm_addr = ports[port_num]->addr + PORTPMSC; 4318 pm_addr = ports[port_num]->addr + PORTPMSC;
4321 pm_val = readl(pm_addr); 4319 pm_val = readl(pm_addr);
4322 hlpm_addr = ports[port_num]->addr + PORTHLPMC; 4320 hlpm_addr = ports[port_num]->addr + PORTHLPMC;
4323 field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
4324 4321
4325 xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n", 4322 xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
4326 enable ? "enable" : "disable", port_num + 1); 4323 enable ? "enable" : "disable", port_num + 1);
@@ -4332,6 +4329,7 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
4332 * default one which works with mixed HIRD and BESL 4329 * default one which works with mixed HIRD and BESL
4333 * systems. See XHCI_DEFAULT_BESL definition in xhci.h 4330 * systems. See XHCI_DEFAULT_BESL definition in xhci.h
4334 */ 4331 */
4332 field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
4335 if ((field & USB_BESL_SUPPORT) && 4333 if ((field & USB_BESL_SUPPORT) &&
4336 (field & USB_BESL_BASELINE_VALID)) 4334 (field & USB_BESL_BASELINE_VALID))
4337 hird = USB_GET_BESL_BASELINE(field); 4335 hird = USB_GET_BESL_BASELINE(field);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index a450a99e90eb..7f8b950d1a73 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2160,7 +2160,8 @@ static inline bool xhci_urb_suitable_for_idt(struct urb *urb)
2160{ 2160{
2161 if (!usb_endpoint_xfer_isoc(&urb->ep->desc) && usb_urb_dir_out(urb) && 2161 if (!usb_endpoint_xfer_isoc(&urb->ep->desc) && usb_urb_dir_out(urb) &&
2162 usb_endpoint_maxp(&urb->ep->desc) >= TRB_IDT_MAX_SIZE && 2162 usb_endpoint_maxp(&urb->ep->desc) >= TRB_IDT_MAX_SIZE &&
2163 urb->transfer_buffer_length <= TRB_IDT_MAX_SIZE) 2163 urb->transfer_buffer_length <= TRB_IDT_MAX_SIZE &&
2164 !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP))
2164 return true; 2165 return true;
2165 2166
2166 return false; 2167 return false;
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 7b9adeb3e7aa..27e9c78a791e 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -51,7 +51,6 @@ struct rio_usb_data {
51 char *obuf, *ibuf; /* transfer buffers */ 51 char *obuf, *ibuf; /* transfer buffers */
52 char bulk_in_ep, bulk_out_ep; /* Endpoint assignments */ 52 char bulk_in_ep, bulk_out_ep; /* Endpoint assignments */
53 wait_queue_head_t wait_q; /* for timeouts */ 53 wait_queue_head_t wait_q; /* for timeouts */
54 struct mutex lock; /* general race avoidance */
55}; 54};
56 55
57static DEFINE_MUTEX(rio500_mutex); 56static DEFINE_MUTEX(rio500_mutex);
@@ -63,10 +62,8 @@ static int open_rio(struct inode *inode, struct file *file)
63 62
64 /* against disconnect() */ 63 /* against disconnect() */
65 mutex_lock(&rio500_mutex); 64 mutex_lock(&rio500_mutex);
66 mutex_lock(&(rio->lock));
67 65
68 if (rio->isopen || !rio->present) { 66 if (rio->isopen || !rio->present) {
69 mutex_unlock(&(rio->lock));
70 mutex_unlock(&rio500_mutex); 67 mutex_unlock(&rio500_mutex);
71 return -EBUSY; 68 return -EBUSY;
72 } 69 }
@@ -74,7 +71,6 @@ static int open_rio(struct inode *inode, struct file *file)
74 71
75 init_waitqueue_head(&rio->wait_q); 72 init_waitqueue_head(&rio->wait_q);
76 73
77 mutex_unlock(&(rio->lock));
78 74
79 dev_info(&rio->rio_dev->dev, "Rio opened.\n"); 75 dev_info(&rio->rio_dev->dev, "Rio opened.\n");
80 mutex_unlock(&rio500_mutex); 76 mutex_unlock(&rio500_mutex);
@@ -86,9 +82,20 @@ static int close_rio(struct inode *inode, struct file *file)
86{ 82{
87 struct rio_usb_data *rio = &rio_instance; 83 struct rio_usb_data *rio = &rio_instance;
88 84
89 rio->isopen = 0; 85 /* against disconnect() */
86 mutex_lock(&rio500_mutex);
90 87
91 dev_info(&rio->rio_dev->dev, "Rio closed.\n"); 88 rio->isopen = 0;
89 if (!rio->present) {
90 /* cleanup has been delayed */
91 kfree(rio->ibuf);
92 kfree(rio->obuf);
93 rio->ibuf = NULL;
94 rio->obuf = NULL;
95 } else {
96 dev_info(&rio->rio_dev->dev, "Rio closed.\n");
97 }
98 mutex_unlock(&rio500_mutex);
92 return 0; 99 return 0;
93} 100}
94 101
@@ -102,7 +109,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg)
102 int retries; 109 int retries;
103 int retval=0; 110 int retval=0;
104 111
105 mutex_lock(&(rio->lock)); 112 mutex_lock(&rio500_mutex);
106 /* Sanity check to make sure rio is connected, powered, etc */ 113 /* Sanity check to make sure rio is connected, powered, etc */
107 if (rio->present == 0 || rio->rio_dev == NULL) { 114 if (rio->present == 0 || rio->rio_dev == NULL) {
108 retval = -ENODEV; 115 retval = -ENODEV;
@@ -246,7 +253,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg)
246 253
247 254
248err_out: 255err_out:
249 mutex_unlock(&(rio->lock)); 256 mutex_unlock(&rio500_mutex);
250 return retval; 257 return retval;
251} 258}
252 259
@@ -266,12 +273,12 @@ write_rio(struct file *file, const char __user *buffer,
266 int errn = 0; 273 int errn = 0;
267 int intr; 274 int intr;
268 275
269 intr = mutex_lock_interruptible(&(rio->lock)); 276 intr = mutex_lock_interruptible(&rio500_mutex);
270 if (intr) 277 if (intr)
271 return -EINTR; 278 return -EINTR;
272 /* Sanity check to make sure rio is connected, powered, etc */ 279 /* Sanity check to make sure rio is connected, powered, etc */
273 if (rio->present == 0 || rio->rio_dev == NULL) { 280 if (rio->present == 0 || rio->rio_dev == NULL) {
274 mutex_unlock(&(rio->lock)); 281 mutex_unlock(&rio500_mutex);
275 return -ENODEV; 282 return -ENODEV;
276 } 283 }
277 284
@@ -294,7 +301,7 @@ write_rio(struct file *file, const char __user *buffer,
294 goto error; 301 goto error;
295 } 302 }
296 if (signal_pending(current)) { 303 if (signal_pending(current)) {
297 mutex_unlock(&(rio->lock)); 304 mutex_unlock(&rio500_mutex);
298 return bytes_written ? bytes_written : -EINTR; 305 return bytes_written ? bytes_written : -EINTR;
299 } 306 }
300 307
@@ -332,12 +339,12 @@ write_rio(struct file *file, const char __user *buffer,
332 buffer += copy_size; 339 buffer += copy_size;
333 } while (count > 0); 340 } while (count > 0);
334 341
335 mutex_unlock(&(rio->lock)); 342 mutex_unlock(&rio500_mutex);
336 343
337 return bytes_written ? bytes_written : -EIO; 344 return bytes_written ? bytes_written : -EIO;
338 345
339error: 346error:
340 mutex_unlock(&(rio->lock)); 347 mutex_unlock(&rio500_mutex);
341 return errn; 348 return errn;
342} 349}
343 350
@@ -354,12 +361,12 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
354 char *ibuf; 361 char *ibuf;
355 int intr; 362 int intr;
356 363
357 intr = mutex_lock_interruptible(&(rio->lock)); 364 intr = mutex_lock_interruptible(&rio500_mutex);
358 if (intr) 365 if (intr)
359 return -EINTR; 366 return -EINTR;
360 /* Sanity check to make sure rio is connected, powered, etc */ 367 /* Sanity check to make sure rio is connected, powered, etc */
361 if (rio->present == 0 || rio->rio_dev == NULL) { 368 if (rio->present == 0 || rio->rio_dev == NULL) {
362 mutex_unlock(&(rio->lock)); 369 mutex_unlock(&rio500_mutex);
363 return -ENODEV; 370 return -ENODEV;
364 } 371 }
365 372
@@ -370,11 +377,11 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
370 377
371 while (count > 0) { 378 while (count > 0) {
372 if (signal_pending(current)) { 379 if (signal_pending(current)) {
373 mutex_unlock(&(rio->lock)); 380 mutex_unlock(&rio500_mutex);
374 return read_count ? read_count : -EINTR; 381 return read_count ? read_count : -EINTR;
375 } 382 }
376 if (!rio->rio_dev) { 383 if (!rio->rio_dev) {
377 mutex_unlock(&(rio->lock)); 384 mutex_unlock(&rio500_mutex);
378 return -ENODEV; 385 return -ENODEV;
379 } 386 }
380 this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count; 387 this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count;
@@ -392,7 +399,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
392 count = this_read = partial; 399 count = this_read = partial;
393 } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ 400 } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */
394 if (!maxretry--) { 401 if (!maxretry--) {
395 mutex_unlock(&(rio->lock)); 402 mutex_unlock(&rio500_mutex);
396 dev_err(&rio->rio_dev->dev, 403 dev_err(&rio->rio_dev->dev,
397 "read_rio: maxretry timeout\n"); 404 "read_rio: maxretry timeout\n");
398 return -ETIME; 405 return -ETIME;
@@ -402,19 +409,19 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
402 finish_wait(&rio->wait_q, &wait); 409 finish_wait(&rio->wait_q, &wait);
403 continue; 410 continue;
404 } else if (result != -EREMOTEIO) { 411 } else if (result != -EREMOTEIO) {
405 mutex_unlock(&(rio->lock)); 412 mutex_unlock(&rio500_mutex);
406 dev_err(&rio->rio_dev->dev, 413 dev_err(&rio->rio_dev->dev,
407 "Read Whoops - result:%d partial:%u this_read:%u\n", 414 "Read Whoops - result:%d partial:%u this_read:%u\n",
408 result, partial, this_read); 415 result, partial, this_read);
409 return -EIO; 416 return -EIO;
410 } else { 417 } else {
411 mutex_unlock(&(rio->lock)); 418 mutex_unlock(&rio500_mutex);
412 return (0); 419 return (0);
413 } 420 }
414 421
415 if (this_read) { 422 if (this_read) {
416 if (copy_to_user(buffer, ibuf, this_read)) { 423 if (copy_to_user(buffer, ibuf, this_read)) {
417 mutex_unlock(&(rio->lock)); 424 mutex_unlock(&rio500_mutex);
418 return -EFAULT; 425 return -EFAULT;
419 } 426 }
420 count -= this_read; 427 count -= this_read;
@@ -422,7 +429,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
422 buffer += this_read; 429 buffer += this_read;
423 } 430 }
424 } 431 }
425 mutex_unlock(&(rio->lock)); 432 mutex_unlock(&rio500_mutex);
426 return read_count; 433 return read_count;
427} 434}
428 435
@@ -447,15 +454,23 @@ static int probe_rio(struct usb_interface *intf,
447{ 454{
448 struct usb_device *dev = interface_to_usbdev(intf); 455 struct usb_device *dev = interface_to_usbdev(intf);
449 struct rio_usb_data *rio = &rio_instance; 456 struct rio_usb_data *rio = &rio_instance;
450 int retval; 457 int retval = 0;
451 458
452 dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum); 459 mutex_lock(&rio500_mutex);
460 if (rio->present) {
461 dev_info(&intf->dev, "Second USB Rio at address %d refused\n", dev->devnum);
462 retval = -EBUSY;
463 goto bail_out;
464 } else {
465 dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum);
466 }
453 467
454 retval = usb_register_dev(intf, &usb_rio_class); 468 retval = usb_register_dev(intf, &usb_rio_class);
455 if (retval) { 469 if (retval) {
456 dev_err(&dev->dev, 470 dev_err(&dev->dev,
457 "Not able to get a minor for this device.\n"); 471 "Not able to get a minor for this device.\n");
458 return -ENOMEM; 472 retval = -ENOMEM;
473 goto bail_out;
459 } 474 }
460 475
461 rio->rio_dev = dev; 476 rio->rio_dev = dev;
@@ -464,7 +479,8 @@ static int probe_rio(struct usb_interface *intf,
464 dev_err(&dev->dev, 479 dev_err(&dev->dev,
465 "probe_rio: Not enough memory for the output buffer\n"); 480 "probe_rio: Not enough memory for the output buffer\n");
466 usb_deregister_dev(intf, &usb_rio_class); 481 usb_deregister_dev(intf, &usb_rio_class);
467 return -ENOMEM; 482 retval = -ENOMEM;
483 goto bail_out;
468 } 484 }
469 dev_dbg(&intf->dev, "obuf address:%p\n", rio->obuf); 485 dev_dbg(&intf->dev, "obuf address:%p\n", rio->obuf);
470 486
@@ -473,16 +489,17 @@ static int probe_rio(struct usb_interface *intf,
473 "probe_rio: Not enough memory for the input buffer\n"); 489 "probe_rio: Not enough memory for the input buffer\n");
474 usb_deregister_dev(intf, &usb_rio_class); 490 usb_deregister_dev(intf, &usb_rio_class);
475 kfree(rio->obuf); 491 kfree(rio->obuf);
476 return -ENOMEM; 492 retval = -ENOMEM;
493 goto bail_out;
477 } 494 }
478 dev_dbg(&intf->dev, "ibuf address:%p\n", rio->ibuf); 495 dev_dbg(&intf->dev, "ibuf address:%p\n", rio->ibuf);
479 496
480 mutex_init(&(rio->lock));
481
482 usb_set_intfdata (intf, rio); 497 usb_set_intfdata (intf, rio);
483 rio->present = 1; 498 rio->present = 1;
499bail_out:
500 mutex_unlock(&rio500_mutex);
484 501
485 return 0; 502 return retval;
486} 503}
487 504
488static void disconnect_rio(struct usb_interface *intf) 505static void disconnect_rio(struct usb_interface *intf)
@@ -494,12 +511,10 @@ static void disconnect_rio(struct usb_interface *intf)
494 if (rio) { 511 if (rio) {
495 usb_deregister_dev(intf, &usb_rio_class); 512 usb_deregister_dev(intf, &usb_rio_class);
496 513
497 mutex_lock(&(rio->lock));
498 if (rio->isopen) { 514 if (rio->isopen) {
499 rio->isopen = 0; 515 rio->isopen = 0;
500 /* better let it finish - the release will do whats needed */ 516 /* better let it finish - the release will do whats needed */
501 rio->rio_dev = NULL; 517 rio->rio_dev = NULL;
502 mutex_unlock(&(rio->lock));
503 mutex_unlock(&rio500_mutex); 518 mutex_unlock(&rio500_mutex);
504 return; 519 return;
505 } 520 }
@@ -509,7 +524,6 @@ static void disconnect_rio(struct usb_interface *intf)
509 dev_info(&intf->dev, "USB Rio disconnected.\n"); 524 dev_info(&intf->dev, "USB Rio disconnected.\n");
510 525
511 rio->present = 0; 526 rio->present = 0;
512 mutex_unlock(&(rio->lock));
513 } 527 }
514 mutex_unlock(&rio500_mutex); 528 mutex_unlock(&rio500_mutex);
515} 529}
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 9560fde621ee..ea06f1fed6fa 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3029,6 +3029,13 @@ static int sisusb_probe(struct usb_interface *intf,
3029 3029
3030 mutex_init(&(sisusb->lock)); 3030 mutex_init(&(sisusb->lock));
3031 3031
3032 sisusb->sisusb_dev = dev;
3033 sisusb->vrambase = SISUSB_PCI_MEMBASE;
3034 sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
3035 sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
3036 sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
3037 /* Everything else is zero */
3038
3032 /* Register device */ 3039 /* Register device */
3033 retval = usb_register_dev(intf, &usb_sisusb_class); 3040 retval = usb_register_dev(intf, &usb_sisusb_class);
3034 if (retval) { 3041 if (retval) {
@@ -3039,13 +3046,7 @@ static int sisusb_probe(struct usb_interface *intf,
3039 goto error_1; 3046 goto error_1;
3040 } 3047 }
3041 3048
3042 sisusb->sisusb_dev = dev; 3049 sisusb->minor = intf->minor;
3043 sisusb->minor = intf->minor;
3044 sisusb->vrambase = SISUSB_PCI_MEMBASE;
3045 sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
3046 sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
3047 sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
3048 /* Everything else is zero */
3049 3050
3050 /* Allocate buffers */ 3051 /* Allocate buffers */
3051 sisusb->ibufsize = SISUSB_IBUF_SIZE; 3052 sisusb->ibufsize = SISUSB_IBUF_SIZE;
diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
index 62c57ddc554e..b7c86ccd50b4 100644
--- a/drivers/usb/mtu3/mtu3_debugfs.c
+++ b/drivers/usb/mtu3/mtu3_debugfs.c
@@ -528,8 +528,7 @@ void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
528 528
529void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb) 529void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
530{ 530{
531 ssusb->dbgfs_root = 531 ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);
532 debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
533} 532}
534 533
535void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb) 534void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb)
diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index c0d6ff1baa72..7931e6cecc70 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -301,9 +301,17 @@ static int stub_probe(struct usb_device *udev)
301 const char *udev_busid = dev_name(&udev->dev); 301 const char *udev_busid = dev_name(&udev->dev);
302 struct bus_id_priv *busid_priv; 302 struct bus_id_priv *busid_priv;
303 int rc = 0; 303 int rc = 0;
304 char save_status;
304 305
305 dev_dbg(&udev->dev, "Enter probe\n"); 306 dev_dbg(&udev->dev, "Enter probe\n");
306 307
308 /* Not sure if this is our device. Allocate here to avoid
309 * calling alloc while holding busid_table lock.
310 */
311 sdev = stub_device_alloc(udev);
312 if (!sdev)
313 return -ENOMEM;
314
307 /* check we should claim or not by busid_table */ 315 /* check we should claim or not by busid_table */
308 busid_priv = get_busid_priv(udev_busid); 316 busid_priv = get_busid_priv(udev_busid);
309 if (!busid_priv || (busid_priv->status == STUB_BUSID_REMOV) || 317 if (!busid_priv || (busid_priv->status == STUB_BUSID_REMOV) ||
@@ -318,6 +326,9 @@ static int stub_probe(struct usb_device *udev)
318 * See driver_probe_device() in driver/base/dd.c 326 * See driver_probe_device() in driver/base/dd.c
319 */ 327 */
320 rc = -ENODEV; 328 rc = -ENODEV;
329 if (!busid_priv)
330 goto sdev_free;
331
321 goto call_put_busid_priv; 332 goto call_put_busid_priv;
322 } 333 }
323 334
@@ -337,12 +348,6 @@ static int stub_probe(struct usb_device *udev)
337 goto call_put_busid_priv; 348 goto call_put_busid_priv;
338 } 349 }
339 350
340 /* ok, this is my device */
341 sdev = stub_device_alloc(udev);
342 if (!sdev) {
343 rc = -ENOMEM;
344 goto call_put_busid_priv;
345 }
346 351
347 dev_info(&udev->dev, 352 dev_info(&udev->dev,
348 "usbip-host: register new device (bus %u dev %u)\n", 353 "usbip-host: register new device (bus %u dev %u)\n",
@@ -352,9 +357,16 @@ static int stub_probe(struct usb_device *udev)
352 357
353 /* set private data to usb_device */ 358 /* set private data to usb_device */
354 dev_set_drvdata(&udev->dev, sdev); 359 dev_set_drvdata(&udev->dev, sdev);
360
355 busid_priv->sdev = sdev; 361 busid_priv->sdev = sdev;
356 busid_priv->udev = udev; 362 busid_priv->udev = udev;
357 363
364 save_status = busid_priv->status;
365 busid_priv->status = STUB_BUSID_ALLOC;
366
367 /* release the busid_lock */
368 put_busid_priv(busid_priv);
369
358 /* 370 /*
359 * Claim this hub port. 371 * Claim this hub port.
360 * It doesn't matter what value we pass as owner 372 * It doesn't matter what value we pass as owner
@@ -372,10 +384,8 @@ static int stub_probe(struct usb_device *udev)
372 dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid); 384 dev_err(&udev->dev, "stub_add_files for %s\n", udev_busid);
373 goto err_files; 385 goto err_files;
374 } 386 }
375 busid_priv->status = STUB_BUSID_ALLOC;
376 387
377 rc = 0; 388 return 0;
378 goto call_put_busid_priv;
379 389
380err_files: 390err_files:
381 usb_hub_release_port(udev->parent, udev->portnum, 391 usb_hub_release_port(udev->parent, udev->portnum,
@@ -384,23 +394,30 @@ err_port:
384 dev_set_drvdata(&udev->dev, NULL); 394 dev_set_drvdata(&udev->dev, NULL);
385 usb_put_dev(udev); 395 usb_put_dev(udev);
386 396
397 /* we already have busid_priv, just lock busid_lock */
398 spin_lock(&busid_priv->busid_lock);
387 busid_priv->sdev = NULL; 399 busid_priv->sdev = NULL;
388 stub_device_free(sdev); 400 busid_priv->status = save_status;
401 spin_unlock(&busid_priv->busid_lock);
402 /* lock is released - go to free */
403 goto sdev_free;
389 404
390call_put_busid_priv: 405call_put_busid_priv:
406 /* release the busid_lock */
391 put_busid_priv(busid_priv); 407 put_busid_priv(busid_priv);
408
409sdev_free:
410 stub_device_free(sdev);
411
392 return rc; 412 return rc;
393} 413}
394 414
395static void shutdown_busid(struct bus_id_priv *busid_priv) 415static void shutdown_busid(struct bus_id_priv *busid_priv)
396{ 416{
397 if (busid_priv->sdev && !busid_priv->shutdown_busid) { 417 usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED);
398 busid_priv->shutdown_busid = 1;
399 usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED);
400 418
401 /* wait for the stop of the event handler */ 419 /* wait for the stop of the event handler */
402 usbip_stop_eh(&busid_priv->sdev->ud); 420 usbip_stop_eh(&busid_priv->sdev->ud);
403 }
404} 421}
405 422
406/* 423/*
@@ -427,11 +444,16 @@ static void stub_disconnect(struct usb_device *udev)
427 /* get stub_device */ 444 /* get stub_device */
428 if (!sdev) { 445 if (!sdev) {
429 dev_err(&udev->dev, "could not get device"); 446 dev_err(&udev->dev, "could not get device");
430 goto call_put_busid_priv; 447 /* release busid_lock */
448 put_busid_priv(busid_priv);
449 return;
431 } 450 }
432 451
433 dev_set_drvdata(&udev->dev, NULL); 452 dev_set_drvdata(&udev->dev, NULL);
434 453
454 /* release busid_lock before call to remove device files */
455 put_busid_priv(busid_priv);
456
435 /* 457 /*
436 * NOTE: rx/tx threads are invoked for each usb_device. 458 * NOTE: rx/tx threads are invoked for each usb_device.
437 */ 459 */
@@ -442,27 +464,36 @@ static void stub_disconnect(struct usb_device *udev)
442 (struct usb_dev_state *) udev); 464 (struct usb_dev_state *) udev);
443 if (rc) { 465 if (rc) {
444 dev_dbg(&udev->dev, "unable to release port\n"); 466 dev_dbg(&udev->dev, "unable to release port\n");
445 goto call_put_busid_priv; 467 return;
446 } 468 }
447 469
448 /* If usb reset is called from event handler */ 470 /* If usb reset is called from event handler */
449 if (usbip_in_eh(current)) 471 if (usbip_in_eh(current))
450 goto call_put_busid_priv; 472 return;
473
474 /* we already have busid_priv, just lock busid_lock */
475 spin_lock(&busid_priv->busid_lock);
476 if (!busid_priv->shutdown_busid)
477 busid_priv->shutdown_busid = 1;
478 /* release busid_lock */
479 spin_unlock(&busid_priv->busid_lock);
451 480
452 /* shutdown the current connection */ 481 /* shutdown the current connection */
453 shutdown_busid(busid_priv); 482 shutdown_busid(busid_priv);
454 483
455 usb_put_dev(sdev->udev); 484 usb_put_dev(sdev->udev);
456 485
486 /* we already have busid_priv, just lock busid_lock */
487 spin_lock(&busid_priv->busid_lock);
457 /* free sdev */ 488 /* free sdev */
458 busid_priv->sdev = NULL; 489 busid_priv->sdev = NULL;
459 stub_device_free(sdev); 490 stub_device_free(sdev);
460 491
461 if (busid_priv->status == STUB_BUSID_ALLOC) 492 if (busid_priv->status == STUB_BUSID_ALLOC)
462 busid_priv->status = STUB_BUSID_ADDED; 493 busid_priv->status = STUB_BUSID_ADDED;
463 494 /* release busid_lock */
464call_put_busid_priv: 495 spin_unlock(&busid_priv->busid_lock);
465 put_busid_priv(busid_priv); 496 return;
466} 497}
467 498
468#ifdef CONFIG_PM 499#ifdef CONFIG_PM
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 786f9aab55df..a9c69ae30878 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1248,7 +1248,7 @@ finished:
1248 if (free_font) 1248 if (free_font)
1249 vc->vc_font.data = NULL; 1249 vc->vc_font.data = NULL;
1250 1250
1251 if (vc->vc_hi_font_mask) 1251 if (vc->vc_hi_font_mask && vc->vc_screenbuf)
1252 set_vc_hi_font(vc, false); 1252 set_vc_hi_font(vc, false);
1253 1253
1254 if (!con_is_bound(&fb_con)) 1254 if (!con_is_bound(&fb_con))
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 55c15f31d00d..ee0989c7e3a9 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -603,17 +603,33 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
603 } 603 }
604 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); 604 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
605 605
606 trans = btrfs_start_transaction(root, 0); 606 /*
607 if (IS_ERR(trans)) { 607 * We have to use this loop approach because at this point src_device
608 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); 608 * has to be available for transaction commit to complete, yet new
609 return PTR_ERR(trans); 609 * chunks shouldn't be allocated on the device.
610 */
611 while (1) {
612 trans = btrfs_start_transaction(root, 0);
613 if (IS_ERR(trans)) {
614 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
615 return PTR_ERR(trans);
616 }
617 ret = btrfs_commit_transaction(trans);
618 WARN_ON(ret);
619
620 /* Prevent write_all_supers() during the finishing procedure */
621 mutex_lock(&fs_info->fs_devices->device_list_mutex);
622 /* Prevent new chunks being allocated on the source device */
623 mutex_lock(&fs_info->chunk_mutex);
624
625 if (!list_empty(&src_device->post_commit_list)) {
626 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
627 mutex_unlock(&fs_info->chunk_mutex);
628 } else {
629 break;
630 }
610 } 631 }
611 ret = btrfs_commit_transaction(trans);
612 WARN_ON(ret);
613 632
614 /* keep away write_all_supers() during the finishing procedure */
615 mutex_lock(&fs_info->fs_devices->device_list_mutex);
616 mutex_lock(&fs_info->chunk_mutex);
617 down_write(&dev_replace->rwsem); 633 down_write(&dev_replace->rwsem);
618 dev_replace->replace_state = 634 dev_replace->replace_state =
619 scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 635 scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED
@@ -662,7 +678,6 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
662 btrfs_device_set_disk_total_bytes(tgt_device, 678 btrfs_device_set_disk_total_bytes(tgt_device,
663 src_device->disk_total_bytes); 679 src_device->disk_total_bytes);
664 btrfs_device_set_bytes_used(tgt_device, src_device->bytes_used); 680 btrfs_device_set_bytes_used(tgt_device, src_device->bytes_used);
665 ASSERT(list_empty(&src_device->post_commit_list));
666 tgt_device->commit_total_bytes = src_device->commit_total_bytes; 681 tgt_device->commit_total_bytes = src_device->commit_total_bytes;
667 tgt_device->commit_bytes_used = src_device->bytes_used; 682 tgt_device->commit_bytes_used = src_device->bytes_used;
668 683
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9aba9660efe5..a2aabdb85226 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6433,8 +6433,18 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
6433 btrfs_i_size_write(parent_inode, parent_inode->vfs_inode.i_size + 6433 btrfs_i_size_write(parent_inode, parent_inode->vfs_inode.i_size +
6434 name_len * 2); 6434 name_len * 2);
6435 inode_inc_iversion(&parent_inode->vfs_inode); 6435 inode_inc_iversion(&parent_inode->vfs_inode);
6436 parent_inode->vfs_inode.i_mtime = parent_inode->vfs_inode.i_ctime = 6436 /*
6437 current_time(&parent_inode->vfs_inode); 6437 * If we are replaying a log tree, we do not want to update the mtime
6438 * and ctime of the parent directory with the current time, since the
6439 * log replay procedure is responsible for setting them to their correct
6440 * values (the ones it had when the fsync was done).
6441 */
6442 if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) {
6443 struct timespec64 now = current_time(&parent_inode->vfs_inode);
6444
6445 parent_inode->vfs_inode.i_mtime = now;
6446 parent_inode->vfs_inode.i_ctime = now;
6447 }
6438 ret = btrfs_update_inode(trans, root, &parent_inode->vfs_inode); 6448 ret = btrfs_update_inode(trans, root, &parent_inode->vfs_inode);
6439 if (ret) 6449 if (ret)
6440 btrfs_abort_transaction(trans, ret); 6450 btrfs_abort_transaction(trans, ret);
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 2f708f2c4e67..3e6ffbbd8b0a 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -3830,7 +3830,13 @@ int btrfs_qgroup_add_swapped_blocks(struct btrfs_trans_handle *trans,
3830 subvol_slot); 3830 subvol_slot);
3831 block->last_snapshot = last_snapshot; 3831 block->last_snapshot = last_snapshot;
3832 block->level = level; 3832 block->level = level;
3833 if (bg->flags & BTRFS_BLOCK_GROUP_DATA) 3833
3834 /*
3835 * If we have bg == NULL, we're called from btrfs_recover_relocation(),
3836 * no one else can modify tree blocks thus we qgroup will not change
3837 * no matter the value of trace_leaf.
3838 */
3839 if (bg && bg->flags & BTRFS_BLOCK_GROUP_DATA)
3834 block->trace_leaf = true; 3840 block->trace_leaf = true;
3835 else 3841 else
3836 block->trace_leaf = false; 3842 block->trace_leaf = false;
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index a459ecddcce4..22a3c69864fa 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2177,22 +2177,30 @@ static int clean_dirty_subvols(struct reloc_control *rc)
2177 struct btrfs_root *root; 2177 struct btrfs_root *root;
2178 struct btrfs_root *next; 2178 struct btrfs_root *next;
2179 int ret = 0; 2179 int ret = 0;
2180 int ret2;
2180 2181
2181 list_for_each_entry_safe(root, next, &rc->dirty_subvol_roots, 2182 list_for_each_entry_safe(root, next, &rc->dirty_subvol_roots,
2182 reloc_dirty_list) { 2183 reloc_dirty_list) {
2183 struct btrfs_root *reloc_root = root->reloc_root; 2184 if (root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID) {
2185 /* Merged subvolume, cleanup its reloc root */
2186 struct btrfs_root *reloc_root = root->reloc_root;
2184 2187
2185 clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state); 2188 clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
2186 list_del_init(&root->reloc_dirty_list); 2189 list_del_init(&root->reloc_dirty_list);
2187 root->reloc_root = NULL; 2190 root->reloc_root = NULL;
2188 if (reloc_root) { 2191 if (reloc_root) {
2189 int ret2;
2190 2192
2191 ret2 = btrfs_drop_snapshot(reloc_root, NULL, 0, 1); 2193 ret2 = btrfs_drop_snapshot(reloc_root, NULL, 0, 1);
2194 if (ret2 < 0 && !ret)
2195 ret = ret2;
2196 }
2197 btrfs_put_fs_root(root);
2198 } else {
2199 /* Orphan reloc tree, just clean it up */
2200 ret2 = btrfs_drop_snapshot(root, NULL, 0, 1);
2192 if (ret2 < 0 && !ret) 2201 if (ret2 < 0 && !ret)
2193 ret = ret2; 2202 ret = ret2;
2194 } 2203 }
2195 btrfs_put_fs_root(root);
2196 } 2204 }
2197 return ret; 2205 return ret;
2198} 2206}
@@ -2480,6 +2488,9 @@ again:
2480 } 2488 }
2481 } else { 2489 } else {
2482 list_del_init(&reloc_root->root_list); 2490 list_del_init(&reloc_root->root_list);
2491 /* Don't forget to queue this reloc root for cleanup */
2492 list_add_tail(&reloc_root->reloc_dirty_list,
2493 &rc->dirty_subvol_roots);
2483 } 2494 }
2484 } 2495 }
2485 2496
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index dd38dfe174df..f7fe4770f0e5 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -4999,6 +4999,12 @@ static int send_hole(struct send_ctx *sctx, u64 end)
4999 if (offset >= sctx->cur_inode_size) 4999 if (offset >= sctx->cur_inode_size)
5000 return 0; 5000 return 0;
5001 5001
5002 /*
5003 * Don't go beyond the inode's i_size due to prealloc extents that start
5004 * after the i_size.
5005 */
5006 end = min_t(u64, end, sctx->cur_inode_size);
5007
5002 if (sctx->flags & BTRFS_SEND_FLAG_NO_FILE_DATA) 5008 if (sctx->flags & BTRFS_SEND_FLAG_NO_FILE_DATA)
5003 return send_update_extent(sctx, offset, end - offset); 5009 return send_update_extent(sctx, offset, end - offset);
5004 5010
@@ -5218,10 +5224,50 @@ static int clone_range(struct send_ctx *sctx,
5218 clone_len = min_t(u64, ext_len, len); 5224 clone_len = min_t(u64, ext_len, len);
5219 5225
5220 if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte && 5226 if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte &&
5221 clone_data_offset == data_offset) 5227 clone_data_offset == data_offset) {
5222 ret = send_clone(sctx, offset, clone_len, clone_root); 5228 const u64 src_end = clone_root->offset + clone_len;
5223 else 5229 const u64 sectorsize = SZ_64K;
5230
5231 /*
5232 * We can't clone the last block, when its size is not
5233 * sector size aligned, into the middle of a file. If we
5234 * do so, the receiver will get a failure (-EINVAL) when
5235 * trying to clone or will silently corrupt the data in
5236 * the destination file if it's on a kernel without the
5237 * fix introduced by commit ac765f83f1397646
5238 * ("Btrfs: fix data corruption due to cloning of eof
5239 * block).
5240 *
5241 * So issue a clone of the aligned down range plus a
5242 * regular write for the eof block, if we hit that case.
5243 *
5244 * Also, we use the maximum possible sector size, 64K,
5245 * because we don't know what's the sector size of the
5246 * filesystem that receives the stream, so we have to
5247 * assume the largest possible sector size.
5248 */
5249 if (src_end == clone_src_i_size &&
5250 !IS_ALIGNED(src_end, sectorsize) &&
5251 offset + clone_len < sctx->cur_inode_size) {
5252 u64 slen;
5253
5254 slen = ALIGN_DOWN(src_end - clone_root->offset,
5255 sectorsize);
5256 if (slen > 0) {
5257 ret = send_clone(sctx, offset, slen,
5258 clone_root);
5259 if (ret < 0)
5260 goto out;
5261 }
5262 ret = send_extent_data(sctx, offset + slen,
5263 clone_len - slen);
5264 } else {
5265 ret = send_clone(sctx, offset, clone_len,
5266 clone_root);
5267 }
5268 } else {
5224 ret = send_extent_data(sctx, offset, clone_len); 5269 ret = send_extent_data(sctx, offset, clone_len);
5270 }
5225 5271
5226 if (ret < 0) 5272 if (ret < 0)
5227 goto out; 5273 goto out;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 6c47f6ed3e94..3fc8d854d7fb 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3110,6 +3110,12 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
3110 log->log_transid = root->log_transid; 3110 log->log_transid = root->log_transid;
3111 root->log_start_pid = 0; 3111 root->log_start_pid = 0;
3112 /* 3112 /*
3113 * Update or create log root item under the root's log_mutex to prevent
3114 * races with concurrent log syncs that can lead to failure to update
3115 * log root item because it was not created yet.
3116 */
3117 ret = update_log_root(trans, log);
3118 /*
3113 * IO has been started, blocks of the log tree have WRITTEN flag set 3119 * IO has been started, blocks of the log tree have WRITTEN flag set
3114 * in their headers. new modifications of the log will be written to 3120 * in their headers. new modifications of the log will be written to
3115 * new positions. so it's safe to allow log writers to go in. 3121 * new positions. so it's safe to allow log writers to go in.
@@ -3128,8 +3134,6 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
3128 3134
3129 mutex_unlock(&log_root_tree->log_mutex); 3135 mutex_unlock(&log_root_tree->log_mutex);
3130 3136
3131 ret = update_log_root(trans, log);
3132
3133 mutex_lock(&log_root_tree->log_mutex); 3137 mutex_lock(&log_root_tree->log_mutex);
3134 if (atomic_dec_and_test(&log_root_tree->log_writers)) { 3138 if (atomic_dec_and_test(&log_root_tree->log_writers)) {
3135 /* atomic_dec_and_test implies a barrier */ 3139 /* atomic_dec_and_test implies a barrier */
@@ -5478,7 +5482,6 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
5478{ 5482{
5479 int ret = 0; 5483 int ret = 0;
5480 struct dentry *old_parent = NULL; 5484 struct dentry *old_parent = NULL;
5481 struct btrfs_inode *orig_inode = inode;
5482 5485
5483 /* 5486 /*
5484 * for regular files, if its inode is already on disk, we don't 5487 * for regular files, if its inode is already on disk, we don't
@@ -5498,16 +5501,6 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
5498 } 5501 }
5499 5502
5500 while (1) { 5503 while (1) {
5501 /*
5502 * If we are logging a directory then we start with our inode,
5503 * not our parent's inode, so we need to skip setting the
5504 * logged_trans so that further down in the log code we don't
5505 * think this inode has already been logged.
5506 */
5507 if (inode != orig_inode)
5508 inode->logged_trans = trans->transid;
5509 smp_mb();
5510
5511 if (btrfs_must_commit_transaction(trans, inode)) { 5504 if (btrfs_must_commit_transaction(trans, inode)) {
5512 ret = 1; 5505 ret = 1;
5513 break; 5506 break;
@@ -6384,7 +6377,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
6384 * if this directory was already logged any new 6377 * if this directory was already logged any new
6385 * names for this file/dir will get recorded 6378 * names for this file/dir will get recorded
6386 */ 6379 */
6387 smp_mb();
6388 if (dir->logged_trans == trans->transid) 6380 if (dir->logged_trans == trans->transid)
6389 return; 6381 return;
6390 6382
diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
index a6ff07cf11d5..3837ca180d52 100644
--- a/fs/btrfs/zstd.c
+++ b/fs/btrfs/zstd.c
@@ -105,10 +105,10 @@ static void zstd_reclaim_timer_fn(struct timer_list *timer)
105 unsigned long reclaim_threshold = jiffies - ZSTD_BTRFS_RECLAIM_JIFFIES; 105 unsigned long reclaim_threshold = jiffies - ZSTD_BTRFS_RECLAIM_JIFFIES;
106 struct list_head *pos, *next; 106 struct list_head *pos, *next;
107 107
108 spin_lock(&wsm.lock); 108 spin_lock_bh(&wsm.lock);
109 109
110 if (list_empty(&wsm.lru_list)) { 110 if (list_empty(&wsm.lru_list)) {
111 spin_unlock(&wsm.lock); 111 spin_unlock_bh(&wsm.lock);
112 return; 112 return;
113 } 113 }
114 114
@@ -137,7 +137,7 @@ static void zstd_reclaim_timer_fn(struct timer_list *timer)
137 if (!list_empty(&wsm.lru_list)) 137 if (!list_empty(&wsm.lru_list))
138 mod_timer(&wsm.timer, jiffies + ZSTD_BTRFS_RECLAIM_JIFFIES); 138 mod_timer(&wsm.timer, jiffies + ZSTD_BTRFS_RECLAIM_JIFFIES);
139 139
140 spin_unlock(&wsm.lock); 140 spin_unlock_bh(&wsm.lock);
141} 141}
142 142
143/* 143/*
@@ -198,7 +198,7 @@ static void zstd_cleanup_workspace_manager(void)
198 struct workspace *workspace; 198 struct workspace *workspace;
199 int i; 199 int i;
200 200
201 spin_lock(&wsm.lock); 201 spin_lock_bh(&wsm.lock);
202 for (i = 0; i < ZSTD_BTRFS_MAX_LEVEL; i++) { 202 for (i = 0; i < ZSTD_BTRFS_MAX_LEVEL; i++) {
203 while (!list_empty(&wsm.idle_ws[i])) { 203 while (!list_empty(&wsm.idle_ws[i])) {
204 workspace = container_of(wsm.idle_ws[i].next, 204 workspace = container_of(wsm.idle_ws[i].next,
@@ -208,7 +208,7 @@ static void zstd_cleanup_workspace_manager(void)
208 zstd_free_workspace(&workspace->list); 208 zstd_free_workspace(&workspace->list);
209 } 209 }
210 } 210 }
211 spin_unlock(&wsm.lock); 211 spin_unlock_bh(&wsm.lock);
212 212
213 del_timer_sync(&wsm.timer); 213 del_timer_sync(&wsm.timer);
214} 214}
@@ -230,7 +230,7 @@ static struct list_head *zstd_find_workspace(unsigned int level)
230 struct workspace *workspace; 230 struct workspace *workspace;
231 int i = level - 1; 231 int i = level - 1;
232 232
233 spin_lock(&wsm.lock); 233 spin_lock_bh(&wsm.lock);
234 for_each_set_bit_from(i, &wsm.active_map, ZSTD_BTRFS_MAX_LEVEL) { 234 for_each_set_bit_from(i, &wsm.active_map, ZSTD_BTRFS_MAX_LEVEL) {
235 if (!list_empty(&wsm.idle_ws[i])) { 235 if (!list_empty(&wsm.idle_ws[i])) {
236 ws = wsm.idle_ws[i].next; 236 ws = wsm.idle_ws[i].next;
@@ -242,11 +242,11 @@ static struct list_head *zstd_find_workspace(unsigned int level)
242 list_del(&workspace->lru_list); 242 list_del(&workspace->lru_list);
243 if (list_empty(&wsm.idle_ws[i])) 243 if (list_empty(&wsm.idle_ws[i]))
244 clear_bit(i, &wsm.active_map); 244 clear_bit(i, &wsm.active_map);
245 spin_unlock(&wsm.lock); 245 spin_unlock_bh(&wsm.lock);
246 return ws; 246 return ws;
247 } 247 }
248 } 248 }
249 spin_unlock(&wsm.lock); 249 spin_unlock_bh(&wsm.lock);
250 250
251 return NULL; 251 return NULL;
252} 252}
@@ -305,7 +305,7 @@ static void zstd_put_workspace(struct list_head *ws)
305{ 305{
306 struct workspace *workspace = list_to_workspace(ws); 306 struct workspace *workspace = list_to_workspace(ws);
307 307
308 spin_lock(&wsm.lock); 308 spin_lock_bh(&wsm.lock);
309 309
310 /* A node is only taken off the lru if we are the corresponding level */ 310 /* A node is only taken off the lru if we are the corresponding level */
311 if (workspace->req_level == workspace->level) { 311 if (workspace->req_level == workspace->level) {
@@ -325,7 +325,7 @@ static void zstd_put_workspace(struct list_head *ws)
325 list_add(&workspace->list, &wsm.idle_ws[workspace->level - 1]); 325 list_add(&workspace->list, &wsm.idle_ws[workspace->level - 1]);
326 workspace->req_level = 0; 326 workspace->req_level = 0;
327 327
328 spin_unlock(&wsm.lock); 328 spin_unlock_bh(&wsm.lock);
329 329
330 if (workspace->level == ZSTD_BTRFS_MAX_LEVEL) 330 if (workspace->level == ZSTD_BTRFS_MAX_LEVEL)
331 cond_wake_up(&wsm.wait); 331 cond_wake_up(&wsm.wait);
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 7731c459cfc3..d2ca5287762d 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -44,15 +44,13 @@ static void configfs_d_iput(struct dentry * dentry,
44 if (sd) { 44 if (sd) {
45 /* Coordinate with configfs_readdir */ 45 /* Coordinate with configfs_readdir */
46 spin_lock(&configfs_dirent_lock); 46 spin_lock(&configfs_dirent_lock);
47 /* Coordinate with configfs_attach_attr where will increase 47 /*
48 * sd->s_count and update sd->s_dentry to new allocated one. 48 * Set sd->s_dentry to null only when this dentry is the one
49 * Only set sd->dentry to null when this dentry is the only 49 * that is going to be killed. Otherwise configfs_d_iput may
50 * sd owner. 50 * run just after configfs_attach_attr and set sd->s_dentry to
51 * If not do so, configfs_d_iput may run just after 51 * NULL even it's still in use.
52 * configfs_attach_attr and set sd->s_dentry to null
53 * even it's still in use.
54 */ 52 */
55 if (atomic_read(&sd->s_count) <= 2) 53 if (sd->s_dentry == dentry)
56 sd->s_dentry = NULL; 54 sd->s_dentry = NULL;
57 55
58 spin_unlock(&configfs_dirent_lock); 56 spin_unlock(&configfs_dirent_lock);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e6ebc9761822..95991e4300bf 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -260,6 +260,15 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
260 * will remain unchanged. 260 * will remain unchanged.
261 * Returns a negative error code or zero. An error code must be returned 261 * Returns a negative error code or zero. An error code must be returned
262 * if at least one unsupported change was requested. 262 * if at least one unsupported change was requested.
263 * @get_rxfh_context: Get the contents of the RX flow hash indirection table,
264 * hash key, and/or hash function assiciated to the given rss context.
265 * Returns a negative error code or zero.
266 * @set_rxfh_context: Create, remove and configure RSS contexts. Allows setting
267 * the contents of the RX flow hash indirection table, hash key, and/or
268 * hash function associated to the given context. Arguments which are set
269 * to %NULL or zero will remain unchanged.
270 * Returns a negative error code or zero. An error code must be returned
271 * if at least one unsupported change was requested.
263 * @get_channels: Get number of channels. 272 * @get_channels: Get number of channels.
264 * @set_channels: Set number of channels. Returns a negative error code or 273 * @set_channels: Set number of channels. Returns a negative error code or
265 * zero. 274 * zero.
diff --git a/include/net/netfilter/nft_fib.h b/include/net/netfilter/nft_fib.h
index a88f92737308..e4c4d8eaca8c 100644
--- a/include/net/netfilter/nft_fib.h
+++ b/include/net/netfilter/nft_fib.h
@@ -34,5 +34,5 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
34 const struct nft_pktinfo *pkt); 34 const struct nft_pktinfo *pkt);
35 35
36void nft_fib_store_result(void *reg, const struct nft_fib *priv, 36void nft_fib_store_result(void *reg, const struct nft_fib *priv,
37 const struct nft_pktinfo *pkt, int index); 37 const struct net_device *dev);
38#endif 38#endif
diff --git a/include/net/udp.h b/include/net/udp.h
index 9272be5700ce..79d141d2103b 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -467,12 +467,19 @@ void udpv6_encap_enable(void);
467static inline struct sk_buff *udp_rcv_segment(struct sock *sk, 467static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
468 struct sk_buff *skb, bool ipv4) 468 struct sk_buff *skb, bool ipv4)
469{ 469{
470 netdev_features_t features = NETIF_F_SG;
470 struct sk_buff *segs; 471 struct sk_buff *segs;
471 472
473 /* Avoid csum recalculation by skb_segment unless userspace explicitly
474 * asks for the final checksum values
475 */
476 if (!inet_get_convert_csum(sk))
477 features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
478
472 /* the GSO CB lays after the UDP one, no need to save and restore any 479 /* the GSO CB lays after the UDP one, no need to save and restore any
473 * CB fragment 480 * CB fragment
474 */ 481 */
475 segs = __skb_gso_segment(skb, NETIF_F_SG, false); 482 segs = __skb_gso_segment(skb, features, false);
476 if (unlikely(IS_ERR_OR_NULL(segs))) { 483 if (unlikely(IS_ERR_OR_NULL(segs))) {
477 int segs_nr = skb_shinfo(skb)->gso_segs; 484 int segs_nr = skb_shinfo(skb)->gso_segs;
478 485
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index d3e59312ef40..5079d1db3754 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -428,7 +428,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
428 op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL); 428 op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL);
429 if (!op_stack) 429 if (!op_stack)
430 return ERR_PTR(-ENOMEM); 430 return ERR_PTR(-ENOMEM);
431 prog_stack = kmalloc_array(nr_preds, sizeof(*prog_stack), GFP_KERNEL); 431 prog_stack = kcalloc(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
432 if (!prog_stack) { 432 if (!prog_stack) {
433 parse_error(pe, -ENOMEM, 0); 433 parse_error(pe, -ENOMEM, 0);
434 goto out_free; 434 goto out_free;
@@ -579,7 +579,11 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
579out_free: 579out_free:
580 kfree(op_stack); 580 kfree(op_stack);
581 kfree(inverts); 581 kfree(inverts);
582 kfree(prog_stack); 582 if (prog_stack) {
583 for (i = 0; prog_stack[i].pred; i++)
584 kfree(prog_stack[i].pred);
585 kfree(prog_stack);
586 }
583 return ERR_PTR(ret); 587 return ERR_PTR(ret);
584} 588}
585 589
diff --git a/lib/list_sort.c b/lib/list_sort.c
index 06e900c5587b..712ed1f4eb64 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -120,7 +120,8 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
120 * The latter offers a chance to save a few cycles in the comparison 120 * The latter offers a chance to save a few cycles in the comparison
121 * (which is used by e.g. plug_ctx_cmp() in block/blk-mq.c). 121 * (which is used by e.g. plug_ctx_cmp() in block/blk-mq.c).
122 * 122 *
123 * A good way to write a multi-word comparison is 123 * A good way to write a multi-word comparison is::
124 *
124 * if (a->high != b->high) 125 * if (a->high != b->high)
125 * return a->high > b->high; 126 * return a->high > b->high;
126 * if (a->middle != b->middle) 127 * if (a->middle != b->middle)
diff --git a/net/core/dev.c b/net/core/dev.c
index 9c8b3e193e85..140858d4a048 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4498,23 +4498,6 @@ static int netif_rx_internal(struct sk_buff *skb)
4498 4498
4499 trace_netif_rx(skb); 4499 trace_netif_rx(skb);
4500 4500
4501 if (static_branch_unlikely(&generic_xdp_needed_key)) {
4502 int ret;
4503
4504 preempt_disable();
4505 rcu_read_lock();
4506 ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
4507 rcu_read_unlock();
4508 preempt_enable();
4509
4510 /* Consider XDP consuming the packet a success from
4511 * the netdev point of view we do not want to count
4512 * this as an error.
4513 */
4514 if (ret != XDP_PASS)
4515 return NET_RX_SUCCESS;
4516 }
4517
4518#ifdef CONFIG_RPS 4501#ifdef CONFIG_RPS
4519 if (static_branch_unlikely(&rps_needed)) { 4502 if (static_branch_unlikely(&rps_needed)) {
4520 struct rps_dev_flow voidflow, *rflow = &voidflow; 4503 struct rps_dev_flow voidflow, *rflow = &voidflow;
@@ -4854,6 +4837,18 @@ another_round:
4854 4837
4855 __this_cpu_inc(softnet_data.processed); 4838 __this_cpu_inc(softnet_data.processed);
4856 4839
4840 if (static_branch_unlikely(&generic_xdp_needed_key)) {
4841 int ret2;
4842
4843 preempt_disable();
4844 ret2 = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
4845 preempt_enable();
4846
4847 if (ret2 != XDP_PASS)
4848 return NET_RX_DROP;
4849 skb_reset_mac_len(skb);
4850 }
4851
4857 if (skb->protocol == cpu_to_be16(ETH_P_8021Q) || 4852 if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
4858 skb->protocol == cpu_to_be16(ETH_P_8021AD)) { 4853 skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
4859 skb = skb_vlan_untag(skb); 4854 skb = skb_vlan_untag(skb);
@@ -5174,19 +5169,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
5174 if (skb_defer_rx_timestamp(skb)) 5169 if (skb_defer_rx_timestamp(skb))
5175 return NET_RX_SUCCESS; 5170 return NET_RX_SUCCESS;
5176 5171
5177 if (static_branch_unlikely(&generic_xdp_needed_key)) {
5178 int ret;
5179
5180 preempt_disable();
5181 rcu_read_lock();
5182 ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
5183 rcu_read_unlock();
5184 preempt_enable();
5185
5186 if (ret != XDP_PASS)
5187 return NET_RX_DROP;
5188 }
5189
5190 rcu_read_lock(); 5172 rcu_read_lock();
5191#ifdef CONFIG_RPS 5173#ifdef CONFIG_RPS
5192 if (static_branch_unlikely(&rps_needed)) { 5174 if (static_branch_unlikely(&rps_needed)) {
@@ -5207,7 +5189,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
5207 5189
5208static void netif_receive_skb_list_internal(struct list_head *head) 5190static void netif_receive_skb_list_internal(struct list_head *head)
5209{ 5191{
5210 struct bpf_prog *xdp_prog = NULL;
5211 struct sk_buff *skb, *next; 5192 struct sk_buff *skb, *next;
5212 struct list_head sublist; 5193 struct list_head sublist;
5213 5194
@@ -5220,21 +5201,6 @@ static void netif_receive_skb_list_internal(struct list_head *head)
5220 } 5201 }
5221 list_splice_init(&sublist, head); 5202 list_splice_init(&sublist, head);
5222 5203
5223 if (static_branch_unlikely(&generic_xdp_needed_key)) {
5224 preempt_disable();
5225 rcu_read_lock();
5226 list_for_each_entry_safe(skb, next, head, list) {
5227 xdp_prog = rcu_dereference(skb->dev->xdp_prog);
5228 skb_list_del_init(skb);
5229 if (do_xdp_generic(xdp_prog, skb) == XDP_PASS)
5230 list_add_tail(&skb->list, &sublist);
5231 }
5232 rcu_read_unlock();
5233 preempt_enable();
5234 /* Put passed packets back on main list */
5235 list_splice_init(&sublist, head);
5236 }
5237
5238 rcu_read_lock(); 5204 rcu_read_lock();
5239#ifdef CONFIG_RPS 5205#ifdef CONFIG_RPS
5240 if (static_branch_unlikely(&rps_needed)) { 5206 if (static_branch_unlikely(&rps_needed)) {
@@ -5805,7 +5771,6 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
5805 skb_reset_mac_header(skb); 5771 skb_reset_mac_header(skb);
5806 skb_gro_reset_offset(skb); 5772 skb_gro_reset_offset(skb);
5807 5773
5808 eth = skb_gro_header_fast(skb, 0);
5809 if (unlikely(skb_gro_header_hard(skb, hlen))) { 5774 if (unlikely(skb_gro_header_hard(skb, hlen))) {
5810 eth = skb_gro_header_slow(skb, hlen, 0); 5775 eth = skb_gro_header_slow(skb, hlen, 0);
5811 if (unlikely(!eth)) { 5776 if (unlikely(!eth)) {
@@ -5815,6 +5780,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
5815 return NULL; 5780 return NULL;
5816 } 5781 }
5817 } else { 5782 } else {
5783 eth = (const struct ethhdr *)skb->data;
5818 gro_pull_from_frag0(skb, hlen); 5784 gro_pull_from_frag0(skb, hlen);
5819 NAPI_GRO_CB(skb)->frag0 += hlen; 5785 NAPI_GRO_CB(skb)->frag0 += hlen;
5820 NAPI_GRO_CB(skb)->frag0_len -= hlen; 5786 NAPI_GRO_CB(skb)->frag0_len -= hlen;
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d97f7320dfdc..6dadeff8d39a 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -3006,11 +3006,12 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
3006 const struct ethtool_flow_ext *ext_h_spec = &fs->h_ext; 3006 const struct ethtool_flow_ext *ext_h_spec = &fs->h_ext;
3007 const struct ethtool_flow_ext *ext_m_spec = &fs->m_ext; 3007 const struct ethtool_flow_ext *ext_m_spec = &fs->m_ext;
3008 3008
3009 if (ext_m_spec->vlan_etype && 3009 if (ext_m_spec->vlan_etype) {
3010 ext_m_spec->vlan_tci) {
3011 match->key.vlan.vlan_tpid = ext_h_spec->vlan_etype; 3010 match->key.vlan.vlan_tpid = ext_h_spec->vlan_etype;
3012 match->mask.vlan.vlan_tpid = ext_m_spec->vlan_etype; 3011 match->mask.vlan.vlan_tpid = ext_m_spec->vlan_etype;
3012 }
3013 3013
3014 if (ext_m_spec->vlan_tci) {
3014 match->key.vlan.vlan_id = 3015 match->key.vlan.vlan_id =
3015 ntohs(ext_h_spec->vlan_tci) & 0x0fff; 3016 ntohs(ext_h_spec->vlan_tci) & 0x0fff;
3016 match->mask.vlan.vlan_id = 3017 match->mask.vlan.vlan_id =
@@ -3020,7 +3021,10 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
3020 (ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13; 3021 (ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13;
3021 match->mask.vlan.vlan_priority = 3022 match->mask.vlan.vlan_priority =
3022 (ntohs(ext_m_spec->vlan_tci) & 0xe000) >> 13; 3023 (ntohs(ext_m_spec->vlan_tci) & 0xe000) >> 13;
3024 }
3023 3025
3026 if (ext_m_spec->vlan_etype ||
3027 ext_m_spec->vlan_tci) {
3024 match->dissector.used_keys |= 3028 match->dissector.used_keys |=
3025 BIT(FLOW_DISSECTOR_KEY_VLAN); 3029 BIT(FLOW_DISSECTOR_KEY_VLAN);
3026 match->dissector.offset[FLOW_DISSECTOR_KEY_VLAN] = 3030 match->dissector.offset[FLOW_DISSECTOR_KEY_VLAN] =
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7f8657080570..47c1aa9ee045 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1032,7 +1032,11 @@ struct ubuf_info *sock_zerocopy_realloc(struct sock *sk, size_t size,
1032 uarg->len++; 1032 uarg->len++;
1033 uarg->bytelen = bytelen; 1033 uarg->bytelen = bytelen;
1034 atomic_set(&sk->sk_zckey, ++next); 1034 atomic_set(&sk->sk_zckey, ++next);
1035 sock_zerocopy_get(uarg); 1035
1036 /* no extra ref when appending to datagram (MSG_MORE) */
1037 if (sk->sk_type == SOCK_STREAM)
1038 sock_zerocopy_get(uarg);
1039
1036 return uarg; 1040 return uarg;
1037 } 1041 }
1038 } 1042 }
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 8ae48c7e1e76..65a35e976d7b 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -11,20 +11,59 @@
11 11
12#include "dsa_priv.h" 12#include "dsa_priv.h"
13 13
14/* Allocating two VLAN tags per port - one for the RX VID and 14/* Binary structure of the fake 12-bit VID field (when the TPID is
15 * the other for the TX VID - see below 15 * ETH_P_DSA_8021Q):
16 *
17 * | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
18 * +-----------+-----+-----------------+-----------+-----------------------+
19 * | DIR | RSV | SWITCH_ID | RSV | PORT |
20 * +-----------+-----+-----------------+-----------+-----------------------+
21 *
22 * DIR - VID[11:10]:
23 * Direction flags.
24 * * 1 (0b01) for RX VLAN,
25 * * 2 (0b10) for TX VLAN.
26 * These values make the special VIDs of 0, 1 and 4095 to be left
27 * unused by this coding scheme.
28 *
29 * RSV - VID[9]:
30 * To be used for further expansion of SWITCH_ID or for other purposes.
31 *
32 * SWITCH_ID - VID[8:6]:
33 * Index of switch within DSA tree. Must be between 0 and
34 * DSA_MAX_SWITCHES - 1.
35 *
36 * RSV - VID[5:4]:
37 * To be used for further expansion of PORT or for other purposes.
38 *
39 * PORT - VID[3:0]:
40 * Index of switch port. Must be between 0 and DSA_MAX_PORTS - 1.
16 */ 41 */
17#define DSA_8021Q_VID_RANGE (DSA_MAX_SWITCHES * DSA_MAX_PORTS) 42
18#define DSA_8021Q_VID_BASE (VLAN_N_VID - 2 * DSA_8021Q_VID_RANGE - 1) 43#define DSA_8021Q_DIR_SHIFT 10
19#define DSA_8021Q_RX_VID_BASE (DSA_8021Q_VID_BASE) 44#define DSA_8021Q_DIR_MASK GENMASK(11, 10)
20#define DSA_8021Q_TX_VID_BASE (DSA_8021Q_VID_BASE + DSA_8021Q_VID_RANGE) 45#define DSA_8021Q_DIR(x) (((x) << DSA_8021Q_DIR_SHIFT) & \
46 DSA_8021Q_DIR_MASK)
47#define DSA_8021Q_DIR_RX DSA_8021Q_DIR(1)
48#define DSA_8021Q_DIR_TX DSA_8021Q_DIR(2)
49
50#define DSA_8021Q_SWITCH_ID_SHIFT 6
51#define DSA_8021Q_SWITCH_ID_MASK GENMASK(8, 6)
52#define DSA_8021Q_SWITCH_ID(x) (((x) << DSA_8021Q_SWITCH_ID_SHIFT) & \
53 DSA_8021Q_SWITCH_ID_MASK)
54
55#define DSA_8021Q_PORT_SHIFT 0
56#define DSA_8021Q_PORT_MASK GENMASK(3, 0)
57#define DSA_8021Q_PORT(x) (((x) << DSA_8021Q_PORT_SHIFT) & \
58 DSA_8021Q_PORT_MASK)
21 59
22/* Returns the VID to be inserted into the frame from xmit for switch steering 60/* Returns the VID to be inserted into the frame from xmit for switch steering
23 * instructions on egress. Encodes switch ID and port ID. 61 * instructions on egress. Encodes switch ID and port ID.
24 */ 62 */
25u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) 63u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
26{ 64{
27 return DSA_8021Q_TX_VID_BASE + (DSA_MAX_PORTS * ds->index) + port; 65 return DSA_8021Q_DIR_TX | DSA_8021Q_SWITCH_ID(ds->index) |
66 DSA_8021Q_PORT(port);
28} 67}
29EXPORT_SYMBOL_GPL(dsa_8021q_tx_vid); 68EXPORT_SYMBOL_GPL(dsa_8021q_tx_vid);
30 69
@@ -33,21 +72,22 @@ EXPORT_SYMBOL_GPL(dsa_8021q_tx_vid);
33 */ 72 */
34u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port) 73u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port)
35{ 74{
36 return DSA_8021Q_RX_VID_BASE + (DSA_MAX_PORTS * ds->index) + port; 75 return DSA_8021Q_DIR_RX | DSA_8021Q_SWITCH_ID(ds->index) |
76 DSA_8021Q_PORT(port);
37} 77}
38EXPORT_SYMBOL_GPL(dsa_8021q_rx_vid); 78EXPORT_SYMBOL_GPL(dsa_8021q_rx_vid);
39 79
40/* Returns the decoded switch ID from the RX VID. */ 80/* Returns the decoded switch ID from the RX VID. */
41int dsa_8021q_rx_switch_id(u16 vid) 81int dsa_8021q_rx_switch_id(u16 vid)
42{ 82{
43 return ((vid - DSA_8021Q_RX_VID_BASE) / DSA_MAX_PORTS); 83 return (vid & DSA_8021Q_SWITCH_ID_MASK) >> DSA_8021Q_SWITCH_ID_SHIFT;
44} 84}
45EXPORT_SYMBOL_GPL(dsa_8021q_rx_switch_id); 85EXPORT_SYMBOL_GPL(dsa_8021q_rx_switch_id);
46 86
47/* Returns the decoded port ID from the RX VID. */ 87/* Returns the decoded port ID from the RX VID. */
48int dsa_8021q_rx_source_port(u16 vid) 88int dsa_8021q_rx_source_port(u16 vid)
49{ 89{
50 return ((vid - DSA_8021Q_RX_VID_BASE) % DSA_MAX_PORTS); 90 return (vid & DSA_8021Q_PORT_MASK) >> DSA_8021Q_PORT_SHIFT;
51} 91}
52EXPORT_SYMBOL_GPL(dsa_8021q_rx_source_port); 92EXPORT_SYMBOL_GPL(dsa_8021q_rx_source_port);
53 93
@@ -128,10 +168,7 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int port, bool enabled)
128 u16 flags; 168 u16 flags;
129 169
130 if (i == upstream) 170 if (i == upstream)
131 /* CPU port needs to see this port's RX VID 171 continue;
132 * as tagged egress.
133 */
134 flags = 0;
135 else if (i == port) 172 else if (i == port)
136 /* The RX VID is pvid on this port */ 173 /* The RX VID is pvid on this port */
137 flags = BRIDGE_VLAN_INFO_UNTAGGED | 174 flags = BRIDGE_VLAN_INFO_UNTAGGED |
@@ -150,6 +187,20 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int port, bool enabled)
150 return err; 187 return err;
151 } 188 }
152 } 189 }
190
191 /* CPU port needs to see this port's RX VID
192 * as tagged egress.
193 */
194 if (enabled)
195 err = dsa_port_vid_add(upstream_dp, rx_vid, 0);
196 else
197 err = dsa_port_vid_del(upstream_dp, rx_vid);
198 if (err) {
199 dev_err(ds->dev, "Failed to apply RX VID %d to port %d: %d\n",
200 rx_vid, port, err);
201 return err;
202 }
203
153 /* Finally apply the TX VID on this port and on the CPU port */ 204 /* Finally apply the TX VID on this port and on the CPU port */
154 if (enabled) 205 if (enabled)
155 err = dsa_port_vid_add(dp, tx_vid, BRIDGE_VLAN_INFO_UNTAGGED); 206 err = dsa_port_vid_add(dp, tx_vid, BRIDGE_VLAN_INFO_UNTAGGED);
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index 9fa9abd83018..2d7a19750436 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -365,6 +365,14 @@ void hsr_prune_nodes(struct timer_list *t)
365 365
366 rcu_read_lock(); 366 rcu_read_lock();
367 list_for_each_entry_rcu(node, &hsr->node_db, mac_list) { 367 list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
368 /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A]
369 * nor time_in[HSR_PT_SLAVE_B], will ever be updated for
370 * the master port. Thus the master node will be repeatedly
371 * pruned leading to packet loss.
372 */
373 if (hsr_addr_is_self(hsr, node->macaddress_A))
374 continue;
375
368 /* Shorthand */ 376 /* Shorthand */
369 time_a = node->time_in[HSR_PT_SLAVE_A]; 377 time_a = node->time_in[HSR_PT_SLAVE_A];
370 time_b = node->time_in[HSR_PT_SLAVE_B]; 378 time_b = node->time_in[HSR_PT_SLAVE_B];
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index fb0c3d9869da..52bdb881a506 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -424,8 +424,8 @@ int inet_release(struct socket *sock)
424 if (sock_flag(sk, SOCK_LINGER) && 424 if (sock_flag(sk, SOCK_LINGER) &&
425 !(current->flags & PF_EXITING)) 425 !(current->flags & PF_EXITING))
426 timeout = sk->sk_lingertime; 426 timeout = sk->sk_lingertime;
427 sock->sk = NULL;
428 sk->sk_prot->close(sk, timeout); 427 sk->sk_prot->close(sk, timeout);
428 sock->sk = NULL;
429 } 429 }
430 return 0; 430 return 0;
431} 431}
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index c0cc3171badc..a57f0d69eadb 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -184,6 +184,17 @@ static void ip_ma_put(struct ip_mc_list *im)
184 pmc != NULL; \ 184 pmc != NULL; \
185 pmc = rtnl_dereference(pmc->next_rcu)) 185 pmc = rtnl_dereference(pmc->next_rcu))
186 186
187static void ip_sf_list_clear_all(struct ip_sf_list *psf)
188{
189 struct ip_sf_list *next;
190
191 while (psf) {
192 next = psf->sf_next;
193 kfree(psf);
194 psf = next;
195 }
196}
197
187#ifdef CONFIG_IP_MULTICAST 198#ifdef CONFIG_IP_MULTICAST
188 199
189/* 200/*
@@ -629,6 +640,13 @@ static void igmpv3_clear_zeros(struct ip_sf_list **ppsf)
629 } 640 }
630} 641}
631 642
643static void kfree_pmc(struct ip_mc_list *pmc)
644{
645 ip_sf_list_clear_all(pmc->sources);
646 ip_sf_list_clear_all(pmc->tomb);
647 kfree(pmc);
648}
649
632static void igmpv3_send_cr(struct in_device *in_dev) 650static void igmpv3_send_cr(struct in_device *in_dev)
633{ 651{
634 struct ip_mc_list *pmc, *pmc_prev, *pmc_next; 652 struct ip_mc_list *pmc, *pmc_prev, *pmc_next;
@@ -665,7 +683,7 @@ static void igmpv3_send_cr(struct in_device *in_dev)
665 else 683 else
666 in_dev->mc_tomb = pmc_next; 684 in_dev->mc_tomb = pmc_next;
667 in_dev_put(pmc->interface); 685 in_dev_put(pmc->interface);
668 kfree(pmc); 686 kfree_pmc(pmc);
669 } else 687 } else
670 pmc_prev = pmc; 688 pmc_prev = pmc;
671 } 689 }
@@ -1211,14 +1229,18 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im)
1211 im->interface = pmc->interface; 1229 im->interface = pmc->interface;
1212 if (im->sfmode == MCAST_INCLUDE) { 1230 if (im->sfmode == MCAST_INCLUDE) {
1213 im->tomb = pmc->tomb; 1231 im->tomb = pmc->tomb;
1232 pmc->tomb = NULL;
1233
1214 im->sources = pmc->sources; 1234 im->sources = pmc->sources;
1235 pmc->sources = NULL;
1236
1215 for (psf = im->sources; psf; psf = psf->sf_next) 1237 for (psf = im->sources; psf; psf = psf->sf_next)
1216 psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; 1238 psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
1217 } else { 1239 } else {
1218 im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; 1240 im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
1219 } 1241 }
1220 in_dev_put(pmc->interface); 1242 in_dev_put(pmc->interface);
1221 kfree(pmc); 1243 kfree_pmc(pmc);
1222 } 1244 }
1223 spin_unlock_bh(&im->lock); 1245 spin_unlock_bh(&im->lock);
1224} 1246}
@@ -1239,21 +1261,18 @@ static void igmpv3_clear_delrec(struct in_device *in_dev)
1239 nextpmc = pmc->next; 1261 nextpmc = pmc->next;
1240 ip_mc_clear_src(pmc); 1262 ip_mc_clear_src(pmc);
1241 in_dev_put(pmc->interface); 1263 in_dev_put(pmc->interface);
1242 kfree(pmc); 1264 kfree_pmc(pmc);
1243 } 1265 }
1244 /* clear dead sources, too */ 1266 /* clear dead sources, too */
1245 rcu_read_lock(); 1267 rcu_read_lock();
1246 for_each_pmc_rcu(in_dev, pmc) { 1268 for_each_pmc_rcu(in_dev, pmc) {
1247 struct ip_sf_list *psf, *psf_next; 1269 struct ip_sf_list *psf;
1248 1270
1249 spin_lock_bh(&pmc->lock); 1271 spin_lock_bh(&pmc->lock);
1250 psf = pmc->tomb; 1272 psf = pmc->tomb;
1251 pmc->tomb = NULL; 1273 pmc->tomb = NULL;
1252 spin_unlock_bh(&pmc->lock); 1274 spin_unlock_bh(&pmc->lock);
1253 for (; psf; psf = psf_next) { 1275 ip_sf_list_clear_all(psf);
1254 psf_next = psf->sf_next;
1255 kfree(psf);
1256 }
1257 } 1276 }
1258 rcu_read_unlock(); 1277 rcu_read_unlock();
1259} 1278}
@@ -2119,7 +2138,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
2119 2138
2120static void ip_mc_clear_src(struct ip_mc_list *pmc) 2139static void ip_mc_clear_src(struct ip_mc_list *pmc)
2121{ 2140{
2122 struct ip_sf_list *psf, *nextpsf, *tomb, *sources; 2141 struct ip_sf_list *tomb, *sources;
2123 2142
2124 spin_lock_bh(&pmc->lock); 2143 spin_lock_bh(&pmc->lock);
2125 tomb = pmc->tomb; 2144 tomb = pmc->tomb;
@@ -2131,14 +2150,8 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc)
2131 pmc->sfcount[MCAST_EXCLUDE] = 1; 2150 pmc->sfcount[MCAST_EXCLUDE] = 1;
2132 spin_unlock_bh(&pmc->lock); 2151 spin_unlock_bh(&pmc->lock);
2133 2152
2134 for (psf = tomb; psf; psf = nextpsf) { 2153 ip_sf_list_clear_all(tomb);
2135 nextpsf = psf->sf_next; 2154 ip_sf_list_clear_all(sources);
2136 kfree(psf);
2137 }
2138 for (psf = sources; psf; psf = nextpsf) {
2139 nextpsf = psf->sf_next;
2140 kfree(psf);
2141 }
2142} 2155}
2143 2156
2144/* Join a multicast group 2157/* Join a multicast group
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index bfd0ca554977..8c9189a41b13 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -878,7 +878,7 @@ static int __ip_append_data(struct sock *sk,
878 int csummode = CHECKSUM_NONE; 878 int csummode = CHECKSUM_NONE;
879 struct rtable *rt = (struct rtable *)cork->dst; 879 struct rtable *rt = (struct rtable *)cork->dst;
880 unsigned int wmem_alloc_delta = 0; 880 unsigned int wmem_alloc_delta = 0;
881 bool paged, extra_uref; 881 bool paged, extra_uref = false;
882 u32 tskey = 0; 882 u32 tskey = 0;
883 883
884 skb = skb_peek_tail(queue); 884 skb = skb_peek_tail(queue);
@@ -918,7 +918,7 @@ static int __ip_append_data(struct sock *sk,
918 uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb)); 918 uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb));
919 if (!uarg) 919 if (!uarg)
920 return -ENOBUFS; 920 return -ENOBUFS;
921 extra_uref = true; 921 extra_uref = !skb; /* only extra ref if !MSG_MORE */
922 if (rt->dst.dev->features & NETIF_F_SG && 922 if (rt->dst.dev->features & NETIF_F_SG &&
923 csummode == CHECKSUM_PARTIAL) { 923 csummode == CHECKSUM_PARTIAL) {
924 paged = true; 924 paged = true;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 82f341e84fae..aa3fd61818c4 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -343,6 +343,8 @@ int ip_ra_control(struct sock *sk, unsigned char on,
343 return -EINVAL; 343 return -EINVAL;
344 344
345 new_ra = on ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; 345 new_ra = on ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
346 if (on && !new_ra)
347 return -ENOMEM;
346 348
347 mutex_lock(&net->ipv4.ra_mutex); 349 mutex_lock(&net->ipv4.ra_mutex);
348 for (rap = &net->ipv4.ra_chain; 350 for (rap = &net->ipv4.ra_chain;
diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
index 94eb25bc8d7e..c8888e52591f 100644
--- a/net/ipv4/netfilter/nft_fib_ipv4.c
+++ b/net/ipv4/netfilter/nft_fib_ipv4.c
@@ -58,11 +58,6 @@ void nft_fib4_eval_type(const struct nft_expr *expr, struct nft_regs *regs,
58} 58}
59EXPORT_SYMBOL_GPL(nft_fib4_eval_type); 59EXPORT_SYMBOL_GPL(nft_fib4_eval_type);
60 60
61static int get_ifindex(const struct net_device *dev)
62{
63 return dev ? dev->ifindex : 0;
64}
65
66void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, 61void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
67 const struct nft_pktinfo *pkt) 62 const struct nft_pktinfo *pkt)
68{ 63{
@@ -94,8 +89,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
94 89
95 if (nft_hook(pkt) == NF_INET_PRE_ROUTING && 90 if (nft_hook(pkt) == NF_INET_PRE_ROUTING &&
96 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { 91 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) {
97 nft_fib_store_result(dest, priv, pkt, 92 nft_fib_store_result(dest, priv, nft_in(pkt));
98 nft_in(pkt)->ifindex);
99 return; 93 return;
100 } 94 }
101 95
@@ -108,8 +102,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
108 if (ipv4_is_zeronet(iph->saddr)) { 102 if (ipv4_is_zeronet(iph->saddr)) {
109 if (ipv4_is_lbcast(iph->daddr) || 103 if (ipv4_is_lbcast(iph->daddr) ||
110 ipv4_is_local_multicast(iph->daddr)) { 104 ipv4_is_local_multicast(iph->daddr)) {
111 nft_fib_store_result(dest, priv, pkt, 105 nft_fib_store_result(dest, priv, pkt->skb->dev);
112 get_ifindex(pkt->skb->dev));
113 return; 106 return;
114 } 107 }
115 } 108 }
@@ -150,17 +143,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
150 found = oif; 143 found = oif;
151 } 144 }
152 145
153 switch (priv->result) { 146 nft_fib_store_result(dest, priv, found);
154 case NFT_FIB_RESULT_OIF:
155 *dest = found->ifindex;
156 break;
157 case NFT_FIB_RESULT_OIFNAME:
158 strncpy((char *)dest, found->name, IFNAMSIZ);
159 break;
160 default:
161 WARN_ON_ONCE(1);
162 break;
163 }
164} 147}
165EXPORT_SYMBOL_GPL(nft_fib4_eval); 148EXPORT_SYMBOL_GPL(nft_fib4_eval);
166 149
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index c61edd023b35..08a477e74cf3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3791,6 +3791,8 @@ void tcp_parse_options(const struct net *net,
3791 length--; 3791 length--;
3792 continue; 3792 continue;
3793 default: 3793 default:
3794 if (length < 2)
3795 return;
3794 opsize = *ptr++; 3796 opsize = *ptr++;
3795 if (opsize < 2) /* "silly options" */ 3797 if (opsize < 2) /* "silly options" */
3796 return; 3798 return;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e2d9fa0c98cb..081bb517e40d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5657,18 +5657,6 @@ static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = {
5657 [IFLA_INET6_TOKEN] = { .len = sizeof(struct in6_addr) }, 5657 [IFLA_INET6_TOKEN] = { .len = sizeof(struct in6_addr) },
5658}; 5658};
5659 5659
5660static int inet6_validate_link_af(const struct net_device *dev,
5661 const struct nlattr *nla)
5662{
5663 struct nlattr *tb[IFLA_INET6_MAX + 1];
5664
5665 if (dev && !__in6_dev_get(dev))
5666 return -EAFNOSUPPORT;
5667
5668 return nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla,
5669 inet6_af_policy, NULL);
5670}
5671
5672static int check_addr_gen_mode(int mode) 5660static int check_addr_gen_mode(int mode)
5673{ 5661{
5674 if (mode != IN6_ADDR_GEN_MODE_EUI64 && 5662 if (mode != IN6_ADDR_GEN_MODE_EUI64 &&
@@ -5689,14 +5677,44 @@ static int check_stable_privacy(struct inet6_dev *idev, struct net *net,
5689 return 1; 5677 return 1;
5690} 5678}
5691 5679
5680static int inet6_validate_link_af(const struct net_device *dev,
5681 const struct nlattr *nla)
5682{
5683 struct nlattr *tb[IFLA_INET6_MAX + 1];
5684 struct inet6_dev *idev = NULL;
5685 int err;
5686
5687 if (dev) {
5688 idev = __in6_dev_get(dev);
5689 if (!idev)
5690 return -EAFNOSUPPORT;
5691 }
5692
5693 err = nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla,
5694 inet6_af_policy, NULL);
5695 if (err)
5696 return err;
5697
5698 if (!tb[IFLA_INET6_TOKEN] && !tb[IFLA_INET6_ADDR_GEN_MODE])
5699 return -EINVAL;
5700
5701 if (tb[IFLA_INET6_ADDR_GEN_MODE]) {
5702 u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]);
5703
5704 if (check_addr_gen_mode(mode) < 0)
5705 return -EINVAL;
5706 if (dev && check_stable_privacy(idev, dev_net(dev), mode) < 0)
5707 return -EINVAL;
5708 }
5709
5710 return 0;
5711}
5712
5692static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) 5713static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
5693{ 5714{
5694 int err = -EINVAL;
5695 struct inet6_dev *idev = __in6_dev_get(dev); 5715 struct inet6_dev *idev = __in6_dev_get(dev);
5696 struct nlattr *tb[IFLA_INET6_MAX + 1]; 5716 struct nlattr *tb[IFLA_INET6_MAX + 1];
5697 5717 int err;
5698 if (!idev)
5699 return -EAFNOSUPPORT;
5700 5718
5701 if (nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0) 5719 if (nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0)
5702 BUG(); 5720 BUG();
@@ -5710,15 +5728,10 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
5710 if (tb[IFLA_INET6_ADDR_GEN_MODE]) { 5728 if (tb[IFLA_INET6_ADDR_GEN_MODE]) {
5711 u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]); 5729 u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]);
5712 5730
5713 if (check_addr_gen_mode(mode) < 0 ||
5714 check_stable_privacy(idev, dev_net(dev), mode) < 0)
5715 return -EINVAL;
5716
5717 idev->cnf.addr_gen_mode = mode; 5731 idev->cnf.addr_gen_mode = mode;
5718 err = 0;
5719 } 5732 }
5720 5733
5721 return err; 5734 return 0;
5722} 5735}
5723 5736
5724static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, 5737static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index d79779ad712b..934c88f128ab 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1271,7 +1271,7 @@ static int __ip6_append_data(struct sock *sk,
1271 int csummode = CHECKSUM_NONE; 1271 int csummode = CHECKSUM_NONE;
1272 unsigned int maxnonfragsize, headersize; 1272 unsigned int maxnonfragsize, headersize;
1273 unsigned int wmem_alloc_delta = 0; 1273 unsigned int wmem_alloc_delta = 0;
1274 bool paged, extra_uref; 1274 bool paged, extra_uref = false;
1275 1275
1276 skb = skb_peek_tail(queue); 1276 skb = skb_peek_tail(queue);
1277 if (!skb) { 1277 if (!skb) {
@@ -1340,7 +1340,7 @@ emsgsize:
1340 uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb)); 1340 uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb));
1341 if (!uarg) 1341 if (!uarg)
1342 return -ENOBUFS; 1342 return -ENOBUFS;
1343 extra_uref = true; 1343 extra_uref = !skb; /* only extra ref if !MSG_MORE */
1344 if (rt->dst.dev->features & NETIF_F_SG && 1344 if (rt->dst.dev->features & NETIF_F_SG &&
1345 csummode == CHECKSUM_PARTIAL) { 1345 csummode == CHECKSUM_PARTIAL) {
1346 paged = true; 1346 paged = true;
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index a3b5b3144de3..264c292e7dcc 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -64,6 +64,8 @@ int ip6_ra_control(struct sock *sk, int sel)
64 return -ENOPROTOOPT; 64 return -ENOPROTOOPT;
65 65
66 new_ra = (sel >= 0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; 66 new_ra = (sel >= 0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
67 if (sel >= 0 && !new_ra)
68 return -ENOMEM;
67 69
68 write_lock_bh(&ip6_ra_lock); 70 write_lock_bh(&ip6_ra_lock);
69 for (rap = &ip6_ra_chain; (ra = *rap) != NULL; rap = &ra->next) { 71 for (rap = &ip6_ra_chain; (ra = *rap) != NULL; rap = &ra->next) {
diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c
index 73cdc0bc63f7..ec068b0cffca 100644
--- a/net/ipv6/netfilter/nft_fib_ipv6.c
+++ b/net/ipv6/netfilter/nft_fib_ipv6.c
@@ -169,8 +169,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
169 169
170 if (nft_hook(pkt) == NF_INET_PRE_ROUTING && 170 if (nft_hook(pkt) == NF_INET_PRE_ROUTING &&
171 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { 171 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) {
172 nft_fib_store_result(dest, priv, pkt, 172 nft_fib_store_result(dest, priv, nft_in(pkt));
173 nft_in(pkt)->ifindex);
174 return; 173 return;
175 } 174 }
176 175
@@ -187,18 +186,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
187 if (oif && oif != rt->rt6i_idev->dev) 186 if (oif && oif != rt->rt6i_idev->dev)
188 goto put_rt_err; 187 goto put_rt_err;
189 188
190 switch (priv->result) { 189 nft_fib_store_result(dest, priv, rt->rt6i_idev->dev);
191 case NFT_FIB_RESULT_OIF:
192 *dest = rt->rt6i_idev->dev->ifindex;
193 break;
194 case NFT_FIB_RESULT_OIFNAME:
195 strncpy((char *)dest, rt->rt6i_idev->dev->name, IFNAMSIZ);
196 break;
197 default:
198 WARN_ON_ONCE(1);
199 break;
200 }
201
202 put_rt_err: 190 put_rt_err:
203 ip6_rt_put(rt); 191 ip6_rt_put(rt);
204} 192}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b76b8d8fff56..0f60eb3a2873 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2508,6 +2508,12 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
2508 struct fib6_info *rt; 2508 struct fib6_info *rt;
2509 struct fib6_node *fn; 2509 struct fib6_node *fn;
2510 2510
2511 /* l3mdev_update_flow overrides oif if the device is enslaved; in
2512 * this case we must match on the real ingress device, so reset it
2513 */
2514 if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF)
2515 fl6->flowi6_oif = skb->dev->ifindex;
2516
2511 /* Get the "current" route for this destination and 2517 /* Get the "current" route for this destination and
2512 * check if the redirect has come from appropriate router. 2518 * check if the redirect has come from appropriate router.
2513 * 2519 *
diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c
index 94425e421213..9e4b6bcf6920 100644
--- a/net/llc/llc_output.c
+++ b/net/llc/llc_output.c
@@ -72,6 +72,8 @@ int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
72 rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac); 72 rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac);
73 if (likely(!rc)) 73 if (likely(!rc))
74 rc = dev_queue_xmit(skb); 74 rc = dev_queue_xmit(skb);
75 else
76 kfree_skb(skb);
75 return rc; 77 return rc;
76} 78}
77 79
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 92036aeb0df4..7138556b206b 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -2307,7 +2307,6 @@ static void __net_exit __ip_vs_cleanup(struct net *net)
2307{ 2307{
2308 struct netns_ipvs *ipvs = net_ipvs(net); 2308 struct netns_ipvs *ipvs = net_ipvs(net);
2309 2309
2310 nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
2311 ip_vs_service_net_cleanup(ipvs); /* ip_vs_flush() with locks */ 2310 ip_vs_service_net_cleanup(ipvs); /* ip_vs_flush() with locks */
2312 ip_vs_conn_net_cleanup(ipvs); 2311 ip_vs_conn_net_cleanup(ipvs);
2313 ip_vs_app_net_cleanup(ipvs); 2312 ip_vs_app_net_cleanup(ipvs);
@@ -2322,6 +2321,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net)
2322{ 2321{
2323 struct netns_ipvs *ipvs = net_ipvs(net); 2322 struct netns_ipvs *ipvs = net_ipvs(net);
2324 EnterFunction(2); 2323 EnterFunction(2);
2324 nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
2325 ipvs->enable = 0; /* Disable packet reception */ 2325 ipvs->enable = 0; /* Disable packet reception */
2326 smp_wmb(); 2326 smp_wmb();
2327 ip_vs_sync_net_cleanup(ipvs); 2327 ip_vs_sync_net_cleanup(ipvs);
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 96825e20368f..241317473114 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -244,8 +244,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
244 rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; 244 rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache;
245 outdev = rt->dst.dev; 245 outdev = rt->dst.dev;
246 246
247 if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) && 247 if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
248 (ip_hdr(skb)->frag_off & htons(IP_DF)) != 0)
249 return NF_ACCEPT; 248 return NF_ACCEPT;
250 249
251 if (skb_try_make_writable(skb, sizeof(*iph))) 250 if (skb_try_make_writable(skb, sizeof(*iph)))
diff --git a/net/netfilter/nf_nat_helper.c b/net/netfilter/nf_nat_helper.c
index ccc06f7539d7..53aeb12b70fb 100644
--- a/net/netfilter/nf_nat_helper.c
+++ b/net/netfilter/nf_nat_helper.c
@@ -170,7 +170,7 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
170 if (!udph->check && skb->ip_summed != CHECKSUM_PARTIAL) 170 if (!udph->check && skb->ip_summed != CHECKSUM_PARTIAL)
171 return true; 171 return true;
172 172
173 nf_nat_csum_recalc(skb, nf_ct_l3num(ct), IPPROTO_TCP, 173 nf_nat_csum_recalc(skb, nf_ct_l3num(ct), IPPROTO_UDP,
174 udph, &udph->check, datalen, oldlen); 174 udph, &udph->check, datalen, oldlen);
175 175
176 return true; 176 return true;
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 9dc1d6e04946..b5b2be55ca82 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -255,6 +255,7 @@ static unsigned int nf_iterate(struct sk_buff *skb,
255repeat: 255repeat:
256 verdict = nf_hook_entry_hookfn(hook, skb, state); 256 verdict = nf_hook_entry_hookfn(hook, skb, state);
257 if (verdict != NF_ACCEPT) { 257 if (verdict != NF_ACCEPT) {
258 *index = i;
258 if (verdict != NF_REPEAT) 259 if (verdict != NF_REPEAT)
259 return verdict; 260 return verdict;
260 goto repeat; 261 goto repeat;
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 28241e82fd15..4b5159936034 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2270,13 +2270,13 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
2270 u32 flags, int family, 2270 u32 flags, int family,
2271 const struct nft_table *table, 2271 const struct nft_table *table,
2272 const struct nft_chain *chain, 2272 const struct nft_chain *chain,
2273 const struct nft_rule *rule) 2273 const struct nft_rule *rule,
2274 const struct nft_rule *prule)
2274{ 2275{
2275 struct nlmsghdr *nlh; 2276 struct nlmsghdr *nlh;
2276 struct nfgenmsg *nfmsg; 2277 struct nfgenmsg *nfmsg;
2277 const struct nft_expr *expr, *next; 2278 const struct nft_expr *expr, *next;
2278 struct nlattr *list; 2279 struct nlattr *list;
2279 const struct nft_rule *prule;
2280 u16 type = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event); 2280 u16 type = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
2281 2281
2282 nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg), flags); 2282 nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg), flags);
@@ -2296,8 +2296,7 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
2296 NFTA_RULE_PAD)) 2296 NFTA_RULE_PAD))
2297 goto nla_put_failure; 2297 goto nla_put_failure;
2298 2298
2299 if ((event != NFT_MSG_DELRULE) && (rule->list.prev != &chain->rules)) { 2299 if (event != NFT_MSG_DELRULE && prule) {
2300 prule = list_prev_entry(rule, list);
2301 if (nla_put_be64(skb, NFTA_RULE_POSITION, 2300 if (nla_put_be64(skb, NFTA_RULE_POSITION,
2302 cpu_to_be64(prule->handle), 2301 cpu_to_be64(prule->handle),
2303 NFTA_RULE_PAD)) 2302 NFTA_RULE_PAD))
@@ -2344,7 +2343,7 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx,
2344 2343
2345 err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq, 2344 err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq,
2346 event, 0, ctx->family, ctx->table, 2345 event, 0, ctx->family, ctx->table,
2347 ctx->chain, rule); 2346 ctx->chain, rule, NULL);
2348 if (err < 0) { 2347 if (err < 0) {
2349 kfree_skb(skb); 2348 kfree_skb(skb);
2350 goto err; 2349 goto err;
@@ -2369,12 +2368,13 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
2369 const struct nft_chain *chain) 2368 const struct nft_chain *chain)
2370{ 2369{
2371 struct net *net = sock_net(skb->sk); 2370 struct net *net = sock_net(skb->sk);
2371 const struct nft_rule *rule, *prule;
2372 unsigned int s_idx = cb->args[0]; 2372 unsigned int s_idx = cb->args[0];
2373 const struct nft_rule *rule;
2374 2373
2374 prule = NULL;
2375 list_for_each_entry_rcu(rule, &chain->rules, list) { 2375 list_for_each_entry_rcu(rule, &chain->rules, list) {
2376 if (!nft_is_active(net, rule)) 2376 if (!nft_is_active(net, rule))
2377 goto cont; 2377 goto cont_skip;
2378 if (*idx < s_idx) 2378 if (*idx < s_idx)
2379 goto cont; 2379 goto cont;
2380 if (*idx > s_idx) { 2380 if (*idx > s_idx) {
@@ -2386,11 +2386,13 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
2386 NFT_MSG_NEWRULE, 2386 NFT_MSG_NEWRULE,
2387 NLM_F_MULTI | NLM_F_APPEND, 2387 NLM_F_MULTI | NLM_F_APPEND,
2388 table->family, 2388 table->family,
2389 table, chain, rule) < 0) 2389 table, chain, rule, prule) < 0)
2390 return 1; 2390 return 1;
2391 2391
2392 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 2392 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
2393cont: 2393cont:
2394 prule = rule;
2395cont_skip:
2394 (*idx)++; 2396 (*idx)++;
2395 } 2397 }
2396 return 0; 2398 return 0;
@@ -2546,7 +2548,7 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk,
2546 2548
2547 err = nf_tables_fill_rule_info(skb2, net, NETLINK_CB(skb).portid, 2549 err = nf_tables_fill_rule_info(skb2, net, NETLINK_CB(skb).portid,
2548 nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0, 2550 nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0,
2549 family, table, chain, rule); 2551 family, table, chain, rule, NULL);
2550 if (err < 0) 2552 if (err < 0)
2551 goto err; 2553 goto err;
2552 2554
diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c
index 21df8cccea65..77f00a99dfab 100644
--- a/net/netfilter/nft_fib.c
+++ b/net/netfilter/nft_fib.c
@@ -135,17 +135,17 @@ int nft_fib_dump(struct sk_buff *skb, const struct nft_expr *expr)
135EXPORT_SYMBOL_GPL(nft_fib_dump); 135EXPORT_SYMBOL_GPL(nft_fib_dump);
136 136
137void nft_fib_store_result(void *reg, const struct nft_fib *priv, 137void nft_fib_store_result(void *reg, const struct nft_fib *priv,
138 const struct nft_pktinfo *pkt, int index) 138 const struct net_device *dev)
139{ 139{
140 struct net_device *dev;
141 u32 *dreg = reg; 140 u32 *dreg = reg;
141 int index;
142 142
143 switch (priv->result) { 143 switch (priv->result) {
144 case NFT_FIB_RESULT_OIF: 144 case NFT_FIB_RESULT_OIF:
145 index = dev ? dev->ifindex : 0;
145 *dreg = (priv->flags & NFTA_FIB_F_PRESENT) ? !!index : index; 146 *dreg = (priv->flags & NFTA_FIB_F_PRESENT) ? !!index : index;
146 break; 147 break;
147 case NFT_FIB_RESULT_OIFNAME: 148 case NFT_FIB_RESULT_OIFNAME:
148 dev = dev_get_by_index_rcu(nft_net(pkt), index);
149 if (priv->flags & NFTA_FIB_F_PRESENT) 149 if (priv->flags & NFTA_FIB_F_PRESENT)
150 *dreg = !!dev; 150 *dreg = !!dev;
151 else 151 else
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index ffb25d5e8dbe..aa5f571d4361 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -13,7 +13,6 @@
13#include <net/netfilter/nf_conntrack_core.h> 13#include <net/netfilter/nf_conntrack_core.h>
14#include <linux/netfilter/nf_conntrack_common.h> 14#include <linux/netfilter/nf_conntrack_common.h>
15#include <net/netfilter/nf_flow_table.h> 15#include <net/netfilter/nf_flow_table.h>
16#include <net/netfilter/nf_conntrack_helper.h>
17 16
18struct nft_flow_offload { 17struct nft_flow_offload {
19 struct nft_flowtable *flowtable; 18 struct nft_flowtable *flowtable;
@@ -50,15 +49,20 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
50 return 0; 49 return 0;
51} 50}
52 51
53static bool nft_flow_offload_skip(struct sk_buff *skb) 52static bool nft_flow_offload_skip(struct sk_buff *skb, int family)
54{ 53{
55 struct ip_options *opt = &(IPCB(skb)->opt);
56
57 if (unlikely(opt->optlen))
58 return true;
59 if (skb_sec_path(skb)) 54 if (skb_sec_path(skb))
60 return true; 55 return true;
61 56
57 if (family == NFPROTO_IPV4) {
58 const struct ip_options *opt;
59
60 opt = &(IPCB(skb)->opt);
61
62 if (unlikely(opt->optlen))
63 return true;
64 }
65
62 return false; 66 return false;
63} 67}
64 68
@@ -68,15 +72,15 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
68{ 72{
69 struct nft_flow_offload *priv = nft_expr_priv(expr); 73 struct nft_flow_offload *priv = nft_expr_priv(expr);
70 struct nf_flowtable *flowtable = &priv->flowtable->data; 74 struct nf_flowtable *flowtable = &priv->flowtable->data;
71 const struct nf_conn_help *help;
72 enum ip_conntrack_info ctinfo; 75 enum ip_conntrack_info ctinfo;
73 struct nf_flow_route route; 76 struct nf_flow_route route;
74 struct flow_offload *flow; 77 struct flow_offload *flow;
75 enum ip_conntrack_dir dir; 78 enum ip_conntrack_dir dir;
79 bool is_tcp = false;
76 struct nf_conn *ct; 80 struct nf_conn *ct;
77 int ret; 81 int ret;
78 82
79 if (nft_flow_offload_skip(pkt->skb)) 83 if (nft_flow_offload_skip(pkt->skb, nft_pf(pkt)))
80 goto out; 84 goto out;
81 85
82 ct = nf_ct_get(pkt->skb, &ctinfo); 86 ct = nf_ct_get(pkt->skb, &ctinfo);
@@ -85,14 +89,16 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
85 89
86 switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) { 90 switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
87 case IPPROTO_TCP: 91 case IPPROTO_TCP:
92 is_tcp = true;
93 break;
88 case IPPROTO_UDP: 94 case IPPROTO_UDP:
89 break; 95 break;
90 default: 96 default:
91 goto out; 97 goto out;
92 } 98 }
93 99
94 help = nfct_help(ct); 100 if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
95 if (help) 101 ct->status & IPS_SEQ_ADJUST)
96 goto out; 102 goto out;
97 103
98 if (!nf_ct_is_confirmed(ct)) 104 if (!nf_ct_is_confirmed(ct))
@@ -109,6 +115,11 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
109 if (!flow) 115 if (!flow)
110 goto err_flow_alloc; 116 goto err_flow_alloc;
111 117
118 if (is_tcp) {
119 ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
120 ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
121 }
122
112 ret = flow_offload_add(flowtable, flow); 123 ret = flow_offload_add(flowtable, flow);
113 if (ret < 0) 124 if (ret < 0)
114 goto err_flow_add; 125 goto err_flow_add;
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ebd306f0d2fc..4e5d2e9ace5d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -794,7 +794,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
794 794
795 for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { 795 for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
796 a = actions[i]; 796 a = actions[i];
797 nest = nla_nest_start_noflag(skb, a->order); 797 nest = nla_nest_start_noflag(skb, i + 1);
798 if (nest == NULL) 798 if (nest == NULL)
799 goto nla_put_failure; 799 goto nla_put_failure;
800 err = tcf_action_dump_1(skb, a, bind, ref); 800 err = tcf_action_dump_1(skb, a, bind, ref);
@@ -1297,7 +1297,6 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
1297 ret = PTR_ERR(act); 1297 ret = PTR_ERR(act);
1298 goto err; 1298 goto err;
1299 } 1299 }
1300 act->order = i;
1301 attr_size += tcf_action_fill_size(act); 1300 attr_size += tcf_action_fill_size(act);
1302 actions[i - 1] = act; 1301 actions[i - 1] = act;
1303 } 1302 }
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index ca54a7c7ec81..b95c408fd771 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -553,8 +553,8 @@ void tls_device_write_space(struct sock *sk, struct tls_context *ctx)
553void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn) 553void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
554{ 554{
555 struct tls_context *tls_ctx = tls_get_ctx(sk); 555 struct tls_context *tls_ctx = tls_get_ctx(sk);
556 struct net_device *netdev = tls_ctx->netdev;
557 struct tls_offload_context_rx *rx_ctx; 556 struct tls_offload_context_rx *rx_ctx;
557 struct net_device *netdev;
558 u32 is_req_pending; 558 u32 is_req_pending;
559 s64 resync_req; 559 s64 resync_req;
560 u32 req_seq; 560 u32 req_seq;
@@ -568,10 +568,15 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
568 is_req_pending = resync_req; 568 is_req_pending = resync_req;
569 569
570 if (unlikely(is_req_pending) && req_seq == seq && 570 if (unlikely(is_req_pending) && req_seq == seq &&
571 atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) 571 atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) {
572 netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, 572 seq += TLS_HEADER_SIZE - 1;
573 seq + TLS_HEADER_SIZE - 1, 573 down_read(&device_offload_lock);
574 rcd_sn); 574 netdev = tls_ctx->netdev;
575 if (netdev)
576 netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, seq,
577 rcd_sn);
578 up_read(&device_offload_lock);
579 }
575} 580}
576 581
577static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb) 582static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb)
@@ -934,12 +939,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk)
934 if (!netdev) 939 if (!netdev)
935 goto out; 940 goto out;
936 941
937 if (!(netdev->features & NETIF_F_HW_TLS_RX)) {
938 pr_err_ratelimited("%s: device is missing NETIF_F_HW_TLS_RX cap\n",
939 __func__);
940 goto out;
941 }
942
943 netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx, 942 netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx,
944 TLS_OFFLOAD_CTX_DIR_RX); 943 TLS_OFFLOAD_CTX_DIR_RX);
945 944
@@ -998,7 +997,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event,
998{ 997{
999 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 998 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1000 999
1001 if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX))) 1000 if (!dev->tlsdev_ops &&
1001 !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
1002 return NOTIFY_DONE; 1002 return NOTIFY_DONE;
1003 1003
1004 switch (event) { 1004 switch (event) {
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index d93f83f77864..960494f437ac 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1712,15 +1712,14 @@ int tls_sw_recvmsg(struct sock *sk,
1712 copied = err; 1712 copied = err;
1713 } 1713 }
1714 1714
1715 len = len - copied; 1715 if (len <= copied)
1716 if (len) {
1717 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
1718 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
1719 } else {
1720 goto recv_end; 1716 goto recv_end;
1721 }
1722 1717
1723 do { 1718 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
1719 len = len - copied;
1720 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
1721
1722 while (len && (decrypted + copied < target || ctx->recv_pkt)) {
1724 bool retain_skb = false; 1723 bool retain_skb = false;
1725 bool zc = false; 1724 bool zc = false;
1726 int to_decrypt; 1725 int to_decrypt;
@@ -1851,11 +1850,7 @@ pick_next_record:
1851 } else { 1850 } else {
1852 break; 1851 break;
1853 } 1852 }
1854 1853 }
1855 /* If we have a new message from strparser, continue now. */
1856 if (decrypted >= target && !ctx->recv_pkt)
1857 break;
1858 } while (len);
1859 1854
1860recv_end: 1855recv_end:
1861 if (num_async) { 1856 if (num_async) {
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index c8133b636a41..9be208db88d3 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -5,7 +5,7 @@ use strict;
5# Copyright (c) 2017 Mauro Carvalho Chehab <mchehab@kernel.org> 5# Copyright (c) 2017 Mauro Carvalho Chehab <mchehab@kernel.org>
6# 6#
7 7
8my $virtenv_dir = "sphinx_1.4"; 8my $conf = "Documentation/conf.py";
9my $requirement_file = "Documentation/sphinx/requirements.txt"; 9my $requirement_file = "Documentation/sphinx/requirements.txt";
10 10
11# 11#
@@ -18,7 +18,9 @@ my $need = 0;
18my $optional = 0; 18my $optional = 0;
19my $need_symlink = 0; 19my $need_symlink = 0;
20my $need_sphinx = 0; 20my $need_sphinx = 0;
21my $rec_sphinx_upgrade = 0;
21my $install = ""; 22my $install = "";
23my $virtenv_dir = "sphinx_";
22 24
23# 25#
24# Command line arguments 26# Command line arguments
@@ -193,13 +195,15 @@ sub check_missing_tex($)
193 } 195 }
194} 196}
195 197
196sub check_sphinx() 198sub get_sphinx_fname()
197{ 199{
198 return if findprog("sphinx-build"); 200 my $fname = "sphinx-build";
201 return $fname if findprog($fname);
199 202
200 if (findprog("sphinx-build-3")) { 203 $fname = "sphinx-build-3";
204 if (findprog($fname)) {
201 $need_symlink = 1; 205 $need_symlink = 1;
202 return; 206 return $fname;
203 } 207 }
204 208
205 if ($virtualenv) { 209 if ($virtualenv) {
@@ -211,6 +215,73 @@ sub check_sphinx()
211 } else { 215 } else {
212 add_package("python-sphinx", 0); 216 add_package("python-sphinx", 0);
213 } 217 }
218
219 return "";
220}
221
222sub check_sphinx()
223{
224 my $min_version;
225 my $rec_version;
226 my $cur_version;
227
228 open IN, $conf or die "Can't open $conf";
229 while (<IN>) {
230 if (m/^\s*needs_sphinx\s*=\s*[\'\"]([\d\.]+)[\'\"]/) {
231 $min_version=$1;
232 last;
233 }
234 }
235 close IN;
236
237 die "Can't get needs_sphinx version from $conf" if (!$min_version);
238
239 open IN, $requirement_file or die "Can't open $requirement_file";
240 while (<IN>) {
241 if (m/^\s*Sphinx\s*==\s*([\d\.]+)$/) {
242 $rec_version=$1;
243 last;
244 }
245 }
246 close IN;
247
248 die "Can't get recommended sphinx version from $requirement_file" if (!$min_version);
249
250 $virtenv_dir .= $rec_version;
251
252 my $sphinx = get_sphinx_fname();
253 return if ($sphinx eq "");
254
255 open IN, "$sphinx --version 2>&1 |" or die "$sphinx returned an error";
256 while (<IN>) {
257 if (m/^\s*sphinx-build\s+([\d\.]+)$/) {
258 $cur_version=$1;
259 last;
260 }
261 # Sphinx 1.2.x uses a different format
262 if (m/^\s*Sphinx.*\s+([\d\.]+)$/) {
263 $cur_version=$1;
264 last;
265 }
266 }
267 close IN;
268
269 die "$sphinx didn't return its version" if (!$cur_version);
270
271 printf "Sphinx version %s (minimal: %s, recommended >= %s)\n",
272 $cur_version, $min_version, $rec_version;
273
274 if ($cur_version lt $min_version) {
275 print "Warning: Sphinx version should be >= $min_version\n\n";
276 $need_sphinx = 1;
277 return;
278 }
279
280 if ($cur_version lt $rec_version) {
281 print "Warning: It is recommended at least Sphinx version $rec_version.\n";
282 print " To upgrade, use:\n\n";
283 $rec_sphinx_upgrade = 1;
284 }
214} 285}
215 286
216# 287#
@@ -532,7 +603,7 @@ sub check_needs()
532 printf "\tsudo ln -sf %s /usr/bin/sphinx-build\n\n", 603 printf "\tsudo ln -sf %s /usr/bin/sphinx-build\n\n",
533 which("sphinx-build-3"); 604 which("sphinx-build-3");
534 } 605 }
535 if ($need_sphinx) { 606 if ($need_sphinx || $rec_sphinx_upgrade) {
536 my $activate = "$virtenv_dir/bin/activate"; 607 my $activate = "$virtenv_dir/bin/activate";
537 if (-e "$ENV{'PWD'}/$activate") { 608 if (-e "$ENV{'PWD'}/$activate") {
538 printf "\nNeed to activate virtualenv with:\n"; 609 printf "\nNeed to activate virtualenv with:\n";
@@ -546,7 +617,8 @@ sub check_needs()
546 printf "\t$virtualenv $virtenv_dir\n"; 617 printf "\t$virtualenv $virtenv_dir\n";
547 printf "\t. $activate\n"; 618 printf "\t. $activate\n";
548 printf "\tpip install -r $requirement_file\n"; 619 printf "\tpip install -r $requirement_file\n";
549 $need++; 620
621 $need++ if (!$rec_sphinx_upgrade);
550 } 622 }
551 } 623 }
552 printf "\n"; 624 printf "\n";
diff --git a/sound/firewire/fireface/ff-protocol-latter.c b/sound/firewire/fireface/ff-protocol-latter.c
index c8236ff89b7f..b30d02d359b1 100644
--- a/sound/firewire/fireface/ff-protocol-latter.c
+++ b/sound/firewire/fireface/ff-protocol-latter.c
@@ -9,11 +9,11 @@
9 9
10#include "ff.h" 10#include "ff.h"
11 11
12#define LATTER_STF 0xffff00000004 12#define LATTER_STF 0xffff00000004ULL
13#define LATTER_ISOC_CHANNELS 0xffff00000008 13#define LATTER_ISOC_CHANNELS 0xffff00000008ULL
14#define LATTER_ISOC_START 0xffff0000000c 14#define LATTER_ISOC_START 0xffff0000000cULL
15#define LATTER_FETCH_MODE 0xffff00000010 15#define LATTER_FETCH_MODE 0xffff00000010ULL
16#define LATTER_SYNC_STATUS 0x0000801c0000 16#define LATTER_SYNC_STATUS 0x0000801c0000ULL
17 17
18static int parse_clock_bits(u32 data, unsigned int *rate, 18static int parse_clock_bits(u32 data, unsigned int *rate,
19 enum snd_ff_clock_src *src) 19 enum snd_ff_clock_src *src)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 4f24fa80e1ed..50f86f458918 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -361,6 +361,7 @@ enum {
361 361
362#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) 362#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
363#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) 363#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
364#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
364 365
365static char *driver_short_names[] = { 366static char *driver_short_names[] = {
366 [AZX_DRIVER_ICH] = "HDA Intel", 367 [AZX_DRIVER_ICH] = "HDA Intel",
@@ -1686,8 +1687,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
1686 else 1687 else
1687 chip->bdl_pos_adj = bdl_pos_adj[dev]; 1688 chip->bdl_pos_adj = bdl_pos_adj[dev];
1688 1689
1689 /* Workaround for a communication error on CFL (bko#199007) */ 1690 /* Workaround for a communication error on CFL (bko#199007) and CNL */
1690 if (IS_CFL(pci)) 1691 if (IS_CFL(pci) || IS_CNL(pci))
1691 chip->polling_mode = 1; 1692 chip->polling_mode = 1;
1692 1693
1693 err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); 1694 err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2c1942dc6147..974244978509 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -821,6 +821,8 @@ static void alc_pre_init(struct hda_codec *codec)
821 alc_fill_eapd_coef(codec); 821 alc_fill_eapd_coef(codec);
822} 822}
823 823
824#define is_s3_resume(codec) \
825 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
824#define is_s4_resume(codec) \ 826#define is_s4_resume(codec) \
825 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE) 827 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
826 828
@@ -4888,6 +4890,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
4888 switch (new_headset_mode) { 4890 switch (new_headset_mode) {
4889 case ALC_HEADSET_MODE_UNPLUGGED: 4891 case ALC_HEADSET_MODE_UNPLUGGED:
4890 alc_headset_mode_unplugged(codec); 4892 alc_headset_mode_unplugged(codec);
4893 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
4894 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4891 spec->gen.hp_jack_present = false; 4895 spec->gen.hp_jack_present = false;
4892 break; 4896 break;
4893 case ALC_HEADSET_MODE_HEADSET: 4897 case ALC_HEADSET_MODE_HEADSET:
@@ -4930,8 +4934,6 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
4930static void alc_update_headset_jack_cb(struct hda_codec *codec, 4934static void alc_update_headset_jack_cb(struct hda_codec *codec,
4931 struct hda_jack_callback *jack) 4935 struct hda_jack_callback *jack)
4932{ 4936{
4933 struct alc_spec *spec = codec->spec;
4934 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4935 snd_hda_gen_hp_automute(codec, jack); 4937 snd_hda_gen_hp_automute(codec, jack);
4936} 4938}
4937 4939
@@ -4968,7 +4970,10 @@ static void alc_fixup_headset_mode(struct hda_codec *codec,
4968 alc_probe_headset_mode(codec); 4970 alc_probe_headset_mode(codec);
4969 break; 4971 break;
4970 case HDA_FIXUP_ACT_INIT: 4972 case HDA_FIXUP_ACT_INIT:
4971 spec->current_headset_mode = 0; 4973 if (is_s3_resume(codec) || is_s4_resume(codec)) {
4974 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
4975 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4976 }
4972 alc_update_headset_mode(codec); 4977 alc_update_headset_mode(codec);
4973 break; 4978 break;
4974 } 4979 }
@@ -5734,7 +5739,7 @@ enum {
5734 ALC298_FIXUP_TPT470_DOCK, 5739 ALC298_FIXUP_TPT470_DOCK,
5735 ALC255_FIXUP_DUMMY_LINEOUT_VERB, 5740 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5736 ALC255_FIXUP_DELL_HEADSET_MIC, 5741 ALC255_FIXUP_DELL_HEADSET_MIC,
5737 ALC256_FIXUP_HUAWEI_MBXP_PINS, 5742 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
5738 ALC295_FIXUP_HP_X360, 5743 ALC295_FIXUP_HP_X360,
5739 ALC221_FIXUP_HP_HEADSET_MIC, 5744 ALC221_FIXUP_HP_HEADSET_MIC,
5740 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE, 5745 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
@@ -6025,7 +6030,7 @@ static const struct hda_fixup alc269_fixups[] = {
6025 .chained = true, 6030 .chained = true,
6026 .chain_id = ALC269_FIXUP_HEADSET_MIC 6031 .chain_id = ALC269_FIXUP_HEADSET_MIC
6027 }, 6032 },
6028 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = { 6033 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
6029 .type = HDA_FIXUP_PINS, 6034 .type = HDA_FIXUP_PINS,
6030 .v.pins = (const struct hda_pintbl[]) { 6035 .v.pins = (const struct hda_pintbl[]) {
6031 {0x12, 0x90a60130}, 6036 {0x12, 0x90a60130},
@@ -6205,13 +6210,15 @@ static const struct hda_fixup alc269_fixups[] = {
6205 .chain_id = ALC269_FIXUP_THINKPAD_ACPI, 6210 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6206 }, 6211 },
6207 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = { 6212 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6208 .type = HDA_FIXUP_PINS, 6213 .type = HDA_FIXUP_VERBS,
6209 .v.pins = (const struct hda_pintbl[]) { 6214 .v.verbs = (const struct hda_verb[]) {
6210 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ 6215 /* Enable the Mic */
6211 { } 6216 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6217 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6218 {}
6212 }, 6219 },
6213 .chained = true, 6220 .chained = true,
6214 .chain_id = ALC255_FIXUP_HEADSET_MODE 6221 .chain_id = ALC269_FIXUP_LIFEBOOK_EXTMIC
6215 }, 6222 },
6216 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = { 6223 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6217 .type = HDA_FIXUP_PINS, 6224 .type = HDA_FIXUP_PINS,
@@ -7050,9 +7057,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7050 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), 7057 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7051 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), 7058 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7052 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 7059 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
7053 SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED), 7060 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
7054 SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
7055 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
7056 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ 7061 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
7057 7062
7058#if 0 7063#if 0
@@ -7111,6 +7116,7 @@ static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7111 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), 7116 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7112 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 7117 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7113 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), 7118 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7119 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
7114 {} 7120 {}
7115}; 7121};
7116 7122
@@ -7257,6 +7263,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7257 {0x19, 0x0181303F}, 7263 {0x19, 0x0181303F},
7258 {0x21, 0x0221102f}), 7264 {0x21, 0x0221102f}),
7259 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE, 7265 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7266 {0x12, 0x90a60140},
7267 {0x14, 0x90170120},
7268 {0x21, 0x02211030}),
7269 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7260 {0x12, 0x90a601c0}, 7270 {0x12, 0x90a601c0},
7261 {0x14, 0x90171120}, 7271 {0x14, 0x90171120},
7262 {0x21, 0x02211030}), 7272 {0x21, 0x02211030}),
@@ -7693,7 +7703,7 @@ static int patch_alc269(struct hda_codec *codec)
7693 7703
7694 spec = codec->spec; 7704 spec = codec->spec;
7695 spec->gen.shared_mic_vref_pin = 0x18; 7705 spec->gen.shared_mic_vref_pin = 0x18;
7696 codec->power_save_node = 1; 7706 codec->power_save_node = 0;
7697 7707
7698#ifdef CONFIG_PM 7708#ifdef CONFIG_PM
7699 codec->patch_ops.suspend = alc269_suspend; 7709 codec->patch_ops.suspend = alc269_suspend;
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index b61f65bed4e4..2b57854335b3 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -720,6 +720,15 @@ static int line6_init_cap_control(struct usb_line6 *line6)
720 return 0; 720 return 0;
721} 721}
722 722
723static void line6_startup_work(struct work_struct *work)
724{
725 struct usb_line6 *line6 =
726 container_of(work, struct usb_line6, startup_work.work);
727
728 if (line6->startup)
729 line6->startup(line6);
730}
731
723/* 732/*
724 Probe USB device. 733 Probe USB device.
725*/ 734*/
@@ -755,6 +764,7 @@ int line6_probe(struct usb_interface *interface,
755 line6->properties = properties; 764 line6->properties = properties;
756 line6->usbdev = usbdev; 765 line6->usbdev = usbdev;
757 line6->ifcdev = &interface->dev; 766 line6->ifcdev = &interface->dev;
767 INIT_DELAYED_WORK(&line6->startup_work, line6_startup_work);
758 768
759 strcpy(card->id, properties->id); 769 strcpy(card->id, properties->id);
760 strcpy(card->driver, driver_name); 770 strcpy(card->driver, driver_name);
@@ -825,6 +835,8 @@ void line6_disconnect(struct usb_interface *interface)
825 if (WARN_ON(usbdev != line6->usbdev)) 835 if (WARN_ON(usbdev != line6->usbdev))
826 return; 836 return;
827 837
838 cancel_delayed_work(&line6->startup_work);
839
828 if (line6->urb_listen != NULL) 840 if (line6->urb_listen != NULL)
829 line6_stop_listen(line6); 841 line6_stop_listen(line6);
830 842
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index 61425597eb61..650d909c9c4f 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -178,11 +178,15 @@ struct usb_line6 {
178 fifo; 178 fifo;
179 } messages; 179 } messages;
180 180
181 /* Work for delayed PCM startup */
182 struct delayed_work startup_work;
183
181 /* If MIDI is supported, buffer_message contains the pre-processed data; 184 /* If MIDI is supported, buffer_message contains the pre-processed data;
182 * otherwise the data is only in urb_listen (buffer_incoming). 185 * otherwise the data is only in urb_listen (buffer_incoming).
183 */ 186 */
184 void (*process_message)(struct usb_line6 *); 187 void (*process_message)(struct usb_line6 *);
185 void (*disconnect)(struct usb_line6 *line6); 188 void (*disconnect)(struct usb_line6 *line6);
189 void (*startup)(struct usb_line6 *line6);
186}; 190};
187 191
188extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, 192extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index e28368d8eba2..55865f7e437d 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -54,9 +54,6 @@ struct usb_line6_toneport {
54 /* Firmware version (x 100) */ 54 /* Firmware version (x 100) */
55 u8 firmware_version; 55 u8 firmware_version;
56 56
57 /* Work for delayed PCM startup */
58 struct delayed_work pcm_work;
59
60 /* Device type */ 57 /* Device type */
61 enum line6_device_type type; 58 enum line6_device_type type;
62 59
@@ -241,12 +238,8 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol,
241 return 1; 238 return 1;
242} 239}
243 240
244static void toneport_start_pcm(struct work_struct *work) 241static void toneport_startup(struct usb_line6 *line6)
245{ 242{
246 struct usb_line6_toneport *toneport =
247 container_of(work, struct usb_line6_toneport, pcm_work.work);
248 struct usb_line6 *line6 = &toneport->line6;
249
250 line6_pcm_acquire(line6->line6pcm, LINE6_STREAM_MONITOR, true); 243 line6_pcm_acquire(line6->line6pcm, LINE6_STREAM_MONITOR, true);
251} 244}
252 245
@@ -394,7 +387,7 @@ static int toneport_setup(struct usb_line6_toneport *toneport)
394 if (toneport_has_led(toneport)) 387 if (toneport_has_led(toneport))
395 toneport_update_led(toneport); 388 toneport_update_led(toneport);
396 389
397 schedule_delayed_work(&toneport->pcm_work, 390 schedule_delayed_work(&toneport->line6.startup_work,
398 msecs_to_jiffies(TONEPORT_PCM_DELAY * 1000)); 391 msecs_to_jiffies(TONEPORT_PCM_DELAY * 1000));
399 return 0; 392 return 0;
400} 393}
@@ -407,8 +400,6 @@ static void line6_toneport_disconnect(struct usb_line6 *line6)
407 struct usb_line6_toneport *toneport = 400 struct usb_line6_toneport *toneport =
408 (struct usb_line6_toneport *)line6; 401 (struct usb_line6_toneport *)line6;
409 402
410 cancel_delayed_work_sync(&toneport->pcm_work);
411
412 if (toneport_has_led(toneport)) 403 if (toneport_has_led(toneport))
413 toneport_remove_leds(toneport); 404 toneport_remove_leds(toneport);
414} 405}
@@ -424,9 +415,9 @@ static int toneport_init(struct usb_line6 *line6,
424 struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; 415 struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6;
425 416
426 toneport->type = id->driver_info; 417 toneport->type = id->driver_info;
427 INIT_DELAYED_WORK(&toneport->pcm_work, toneport_start_pcm);
428 418
429 line6->disconnect = line6_toneport_disconnect; 419 line6->disconnect = line6_toneport_disconnect;
420 line6->startup = toneport_startup;
430 421
431 /* initialize PCM subsystem: */ 422 /* initialize PCM subsystem: */
432 err = line6_init_pcm(line6, &toneport_pcm_properties); 423 err = line6_init_pcm(line6, &toneport_pcm_properties);
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 136387422b00..7da5e31fa0ed 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -318,6 +318,7 @@ run_test() { # testfile
318 local testlog=/proc/self/fd/1 318 local testlog=/proc/self/fd/1
319 fi 319 fi
320 export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX` 320 export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
321 export FTRACETEST_ROOT=$TOP_DIR
321 echo "execute$INSTANCE: "$1 > $testlog 322 echo "execute$INSTANCE: "$1 > $testlog
322 SIG_RESULT=0 323 SIG_RESULT=0
323 if [ $VERBOSE -eq -1 ]; then 324 if [ $VERBOSE -eq -1 ]; then
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
index 492426e95e09..7650a82db3f5 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
@@ -3,7 +3,7 @@
3# description: Kprobe dynamic event with function tracer 3# description: Kprobe dynamic event with function tracer
4 4
5[ -f kprobe_events ] || exit_unsupported # this is configurable 5[ -f kprobe_events ] || exit_unsupported # this is configurable
6grep function available_tracers || exit_unsupported # this is configurable 6grep "function" available_tracers || exit_unsupported # this is configurable
7 7
8# prepare 8# prepare
9echo nop > current_tracer 9echo nop > current_tracer
diff --git a/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
new file mode 100644
index 000000000000..1b081e910e14
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
@@ -0,0 +1,21 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Meta-selftest: Checkbashisms
4
5if [ ! -f $FTRACETEST_ROOT/ftracetest ]; then
6 echo "Hmm, we can not find ftracetest"
7 exit_unresolved
8fi
9
10if ! which checkbashisms > /dev/null 2>&1 ; then
11 echo "No checkbashisms found. skipped."
12 exit_unresolved
13fi
14
15checkbashisms $FTRACETEST_ROOT/ftracetest
16checkbashisms $FTRACETEST_ROOT/test.d/functions
17for t in $(find $FTRACETEST_ROOT/test.d -name \*.tc); do
18 checkbashisms $t
19done
20
21exit 0
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 941d9391377f..2067c6b0e8a1 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -62,6 +62,7 @@
62#include <sys/wait.h> 62#include <sys/wait.h>
63#include <unistd.h> 63#include <unistd.h>
64 64
65#define TEST_TIMEOUT_DEFAULT 30
65 66
66/* Utilities exposed to the test definitions */ 67/* Utilities exposed to the test definitions */
67#ifndef TH_LOG_STREAM 68#ifndef TH_LOG_STREAM
@@ -169,7 +170,8 @@
169 static void test_name(struct __test_metadata *_metadata); \ 170 static void test_name(struct __test_metadata *_metadata); \
170 static struct __test_metadata _##test_name##_object = \ 171 static struct __test_metadata _##test_name##_object = \
171 { .name = "global." #test_name, \ 172 { .name = "global." #test_name, \
172 .fn = &test_name, .termsig = _signal }; \ 173 .fn = &test_name, .termsig = _signal, \
174 .timeout = TEST_TIMEOUT_DEFAULT, }; \
173 static void __attribute__((constructor)) _register_##test_name(void) \ 175 static void __attribute__((constructor)) _register_##test_name(void) \
174 { \ 176 { \
175 __register_test(&_##test_name##_object); \ 177 __register_test(&_##test_name##_object); \
@@ -280,12 +282,15 @@
280 */ 282 */
281/* TODO(wad) register fixtures on dedicated test lists. */ 283/* TODO(wad) register fixtures on dedicated test lists. */
282#define TEST_F(fixture_name, test_name) \ 284#define TEST_F(fixture_name, test_name) \
283 __TEST_F_IMPL(fixture_name, test_name, -1) 285 __TEST_F_IMPL(fixture_name, test_name, -1, TEST_TIMEOUT_DEFAULT)
284 286
285#define TEST_F_SIGNAL(fixture_name, test_name, signal) \ 287#define TEST_F_SIGNAL(fixture_name, test_name, signal) \
286 __TEST_F_IMPL(fixture_name, test_name, signal) 288 __TEST_F_IMPL(fixture_name, test_name, signal, TEST_TIMEOUT_DEFAULT)
287 289
288#define __TEST_F_IMPL(fixture_name, test_name, signal) \ 290#define TEST_F_TIMEOUT(fixture_name, test_name, timeout) \
291 __TEST_F_IMPL(fixture_name, test_name, -1, timeout)
292
293#define __TEST_F_IMPL(fixture_name, test_name, signal, tmout) \
289 static void fixture_name##_##test_name( \ 294 static void fixture_name##_##test_name( \
290 struct __test_metadata *_metadata, \ 295 struct __test_metadata *_metadata, \
291 FIXTURE_DATA(fixture_name) *self); \ 296 FIXTURE_DATA(fixture_name) *self); \
@@ -307,6 +312,7 @@
307 .name = #fixture_name "." #test_name, \ 312 .name = #fixture_name "." #test_name, \
308 .fn = &wrapper_##fixture_name##_##test_name, \ 313 .fn = &wrapper_##fixture_name##_##test_name, \
309 .termsig = signal, \ 314 .termsig = signal, \
315 .timeout = tmout, \
310 }; \ 316 }; \
311 static void __attribute__((constructor)) \ 317 static void __attribute__((constructor)) \
312 _register_##fixture_name##_##test_name(void) \ 318 _register_##fixture_name##_##test_name(void) \
@@ -632,6 +638,7 @@ struct __test_metadata {
632 int termsig; 638 int termsig;
633 int passed; 639 int passed;
634 int trigger; /* extra handler after the evaluation */ 640 int trigger; /* extra handler after the evaluation */
641 int timeout;
635 __u8 step; 642 __u8 step;
636 bool no_print; /* manual trigger when TH_LOG_STREAM is not available */ 643 bool no_print; /* manual trigger when TH_LOG_STREAM is not available */
637 struct __test_metadata *prev, *next; 644 struct __test_metadata *prev, *next;
@@ -696,7 +703,7 @@ void __run_test(struct __test_metadata *t)
696 t->passed = 1; 703 t->passed = 1;
697 t->trigger = 0; 704 t->trigger = 0;
698 printf("[ RUN ] %s\n", t->name); 705 printf("[ RUN ] %s\n", t->name);
699 alarm(30); 706 alarm(t->timeout);
700 child_pid = fork(); 707 child_pid = fork();
701 if (child_pid < 0) { 708 if (child_pid < 0) {
702 printf("ERROR SPAWNING TEST CHILD\n"); 709 printf("ERROR SPAWNING TEST CHILD\n");
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index b9171a7b3aaa..317dafcd605d 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -208,8 +208,8 @@ tunnel6_a_addr="fd00:2::a"
208tunnel6_b_addr="fd00:2::b" 208tunnel6_b_addr="fd00:2::b"
209tunnel6_mask="64" 209tunnel6_mask="64"
210 210
211dummy6_0_addr="fc00:1000::0" 211dummy6_0_prefix="fc00:1000::"
212dummy6_1_addr="fc00:1001::0" 212dummy6_1_prefix="fc00:1001::"
213dummy6_mask="64" 213dummy6_mask="64"
214 214
215cleanup_done=1 215cleanup_done=1
@@ -1005,13 +1005,13 @@ test_pmtu_vti6_link_change_mtu() {
1005 run_cmd ${ns_a} ip link set dummy0 up 1005 run_cmd ${ns_a} ip link set dummy0 up
1006 run_cmd ${ns_a} ip link set dummy1 up 1006 run_cmd ${ns_a} ip link set dummy1 up
1007 1007
1008 run_cmd ${ns_a} ip addr add ${dummy6_0_addr}/${dummy6_mask} dev dummy0 1008 run_cmd ${ns_a} ip addr add ${dummy6_0_prefix}1/${dummy6_mask} dev dummy0
1009 run_cmd ${ns_a} ip addr add ${dummy6_1_addr}/${dummy6_mask} dev dummy1 1009 run_cmd ${ns_a} ip addr add ${dummy6_1_prefix}1/${dummy6_mask} dev dummy1
1010 1010
1011 fail=0 1011 fail=0
1012 1012
1013 # Create vti6 interface bound to device, passing MTU, check it 1013 # Create vti6 interface bound to device, passing MTU, check it
1014 run_cmd ${ns_a} ip link add vti6_a mtu 1300 type vti6 remote ${dummy6_0_addr} local ${dummy6_0_addr} 1014 run_cmd ${ns_a} ip link add vti6_a mtu 1300 type vti6 remote ${dummy6_0_prefix}2 local ${dummy6_0_prefix}1
1015 mtu="$(link_get_mtu "${ns_a}" vti6_a)" 1015 mtu="$(link_get_mtu "${ns_a}" vti6_a)"
1016 if [ ${mtu} -ne 1300 ]; then 1016 if [ ${mtu} -ne 1300 ]; then
1017 err " vti6 MTU ${mtu} doesn't match configured value 1300" 1017 err " vti6 MTU ${mtu} doesn't match configured value 1300"
@@ -1020,7 +1020,7 @@ test_pmtu_vti6_link_change_mtu() {
1020 1020
1021 # Move to another device with different MTU, without passing MTU, check 1021 # Move to another device with different MTU, without passing MTU, check
1022 # MTU is adjusted 1022 # MTU is adjusted
1023 run_cmd ${ns_a} ip link set vti6_a type vti6 remote ${dummy6_1_addr} local ${dummy6_1_addr} 1023 run_cmd ${ns_a} ip link set vti6_a type vti6 remote ${dummy6_1_prefix}2 local ${dummy6_1_prefix}1
1024 mtu="$(link_get_mtu "${ns_a}" vti6_a)" 1024 mtu="$(link_get_mtu "${ns_a}" vti6_a)"
1025 if [ ${mtu} -ne $((3000 - 40)) ]; then 1025 if [ ${mtu} -ne $((3000 - 40)) ]; then
1026 err " vti MTU ${mtu} is not dummy MTU 3000 minus IPv6 header length" 1026 err " vti MTU ${mtu} is not dummy MTU 3000 minus IPv6 header length"
@@ -1028,7 +1028,7 @@ test_pmtu_vti6_link_change_mtu() {
1028 fi 1028 fi
1029 1029
1030 # Move it back, passing MTU, check MTU is not overridden 1030 # Move it back, passing MTU, check MTU is not overridden
1031 run_cmd ${ns_a} ip link set vti6_a mtu 1280 type vti6 remote ${dummy6_0_addr} local ${dummy6_0_addr} 1031 run_cmd ${ns_a} ip link set vti6_a mtu 1280 type vti6 remote ${dummy6_0_prefix}2 local ${dummy6_0_prefix}1
1032 mtu="$(link_get_mtu "${ns_a}" vti6_a)" 1032 mtu="$(link_get_mtu "${ns_a}" vti6_a)"
1033 if [ ${mtu} -ne 1280 ]; then 1033 if [ ${mtu} -ne 1280 ]; then
1034 err " vti6 MTU ${mtu} doesn't match configured value 1280" 1034 err " vti6 MTU ${mtu} doesn't match configured value 1280"
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 47ddfc154036..278c86134556 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -442,6 +442,21 @@ TEST_F(tls, multiple_send_single_recv)
442 EXPECT_EQ(memcmp(send_mem, recv_mem + send_len, send_len), 0); 442 EXPECT_EQ(memcmp(send_mem, recv_mem + send_len, send_len), 0);
443} 443}
444 444
445TEST_F(tls, single_send_multiple_recv_non_align)
446{
447 const unsigned int total_len = 15;
448 const unsigned int recv_len = 10;
449 char recv_mem[recv_len * 2];
450 char send_mem[total_len];
451
452 EXPECT_GE(send(self->fd, send_mem, total_len, 0), 0);
453 memset(recv_mem, 0, total_len);
454
455 EXPECT_EQ(recv(self->cfd, recv_mem, recv_len, 0), recv_len);
456 EXPECT_EQ(recv(self->cfd, recv_mem + recv_len, recv_len, 0), 5);
457 EXPECT_EQ(memcmp(send_mem, recv_mem, total_len), 0);
458}
459
445TEST_F(tls, recv_partial) 460TEST_F(tls, recv_partial)
446{ 461{
447 char const *test_str = "test_read_partial"; 462 char const *test_str = "test_read_partial";
@@ -575,6 +590,25 @@ TEST_F(tls, recv_peek_large_buf_mult_recs)
575 EXPECT_EQ(memcmp(test_str, buf, len), 0); 590 EXPECT_EQ(memcmp(test_str, buf, len), 0);
576} 591}
577 592
593TEST_F(tls, recv_lowat)
594{
595 char send_mem[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
596 char recv_mem[20];
597 int lowat = 8;
598
599 EXPECT_EQ(send(self->fd, send_mem, 10, 0), 10);
600 EXPECT_EQ(send(self->fd, send_mem, 5, 0), 5);
601
602 memset(recv_mem, 0, 20);
603 EXPECT_EQ(setsockopt(self->cfd, SOL_SOCKET, SO_RCVLOWAT,
604 &lowat, sizeof(lowat)), 0);
605 EXPECT_EQ(recv(self->cfd, recv_mem, 1, MSG_WAITALL), 1);
606 EXPECT_EQ(recv(self->cfd, recv_mem + 1, 6, MSG_WAITALL), 6);
607 EXPECT_EQ(recv(self->cfd, recv_mem + 7, 10, 0), 8);
608
609 EXPECT_EQ(memcmp(send_mem, recv_mem, 10), 0);
610 EXPECT_EQ(memcmp(send_mem, recv_mem + 10, 5), 0);
611}
578 612
579TEST_F(tls, pollin) 613TEST_F(tls, pollin)
580{ 614{
diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile
index 3e6d1bcc2894..4144984ebee5 100644
--- a/tools/testing/selftests/netfilter/Makefile
+++ b/tools/testing/selftests/netfilter/Makefile
@@ -2,6 +2,6 @@
2# Makefile for netfilter selftests 2# Makefile for netfilter selftests
3 3
4TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \ 4TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \
5 conntrack_icmp_related.sh 5 conntrack_icmp_related.sh nft_flowtable.sh
6 6
7include ../lib.mk 7include ../lib.mk
diff --git a/tools/testing/selftests/netfilter/nft_flowtable.sh b/tools/testing/selftests/netfilter/nft_flowtable.sh
new file mode 100755
index 000000000000..fe52488a6f72
--- /dev/null
+++ b/tools/testing/selftests/netfilter/nft_flowtable.sh
@@ -0,0 +1,324 @@
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# This tests basic flowtable functionality.
5# Creates following topology:
6#
7# Originator (MTU 9000) <-Router1-> MTU 1500 <-Router2-> Responder (MTU 2000)
8# Router1 is the one doing flow offloading, Router2 has no special
9# purpose other than having a link that is smaller than either Originator
10# and responder, i.e. TCPMSS announced values are too large and will still
11# result in fragmentation and/or PMTU discovery.
12
13# Kselftest framework requirement - SKIP code is 4.
14ksft_skip=4
15ret=0
16
17ns1in=""
18ns2in=""
19ns1out=""
20ns2out=""
21
22log_netns=$(sysctl -n net.netfilter.nf_log_all_netns)
23
24nft --version > /dev/null 2>&1
25if [ $? -ne 0 ];then
26 echo "SKIP: Could not run test without nft tool"
27 exit $ksft_skip
28fi
29
30ip -Version > /dev/null 2>&1
31if [ $? -ne 0 ];then
32 echo "SKIP: Could not run test without ip tool"
33 exit $ksft_skip
34fi
35
36which nc > /dev/null 2>&1
37if [ $? -ne 0 ];then
38 echo "SKIP: Could not run test without nc (netcat)"
39 exit $ksft_skip
40fi
41
42ip netns add nsr1
43if [ $? -ne 0 ];then
44 echo "SKIP: Could not create net namespace"
45 exit $ksft_skip
46fi
47
48ip netns add ns1
49ip netns add ns2
50
51ip netns add nsr2
52
53cleanup() {
54 for i in 1 2; do
55 ip netns del ns$i
56 ip netns del nsr$i
57 done
58
59 rm -f "$ns1in" "$ns1out"
60 rm -f "$ns2in" "$ns2out"
61
62 [ $log_netns -eq 0 ] && sysctl -q net.netfilter.nf_log_all_netns=$log_netns
63}
64
65trap cleanup EXIT
66
67sysctl -q net.netfilter.nf_log_all_netns=1
68
69ip link add veth0 netns nsr1 type veth peer name eth0 netns ns1
70ip link add veth1 netns nsr1 type veth peer name veth0 netns nsr2
71
72ip link add veth1 netns nsr2 type veth peer name eth0 netns ns2
73
74for dev in lo veth0 veth1; do
75 for i in 1 2; do
76 ip -net nsr$i link set $dev up
77 done
78done
79
80ip -net nsr1 addr add 10.0.1.1/24 dev veth0
81ip -net nsr1 addr add dead:1::1/64 dev veth0
82
83ip -net nsr2 addr add 10.0.2.1/24 dev veth1
84ip -net nsr2 addr add dead:2::1/64 dev veth1
85
86# set different MTUs so we need to push packets coming from ns1 (large MTU)
87# to ns2 (smaller MTU) to stack either to perform fragmentation (ip_no_pmtu_disc=1),
88# or to do PTMU discovery (send ICMP error back to originator).
89# ns2 is going via nsr2 with a smaller mtu, so that TCPMSS announced by both peers
90# is NOT the lowest link mtu.
91
92ip -net nsr1 link set veth0 mtu 9000
93ip -net ns1 link set eth0 mtu 9000
94
95ip -net nsr2 link set veth1 mtu 2000
96ip -net ns2 link set eth0 mtu 2000
97
98# transfer-net between nsr1 and nsr2.
99# these addresses are not used for connections.
100ip -net nsr1 addr add 192.168.10.1/24 dev veth1
101ip -net nsr1 addr add fee1:2::1/64 dev veth1
102
103ip -net nsr2 addr add 192.168.10.2/24 dev veth0
104ip -net nsr2 addr add fee1:2::2/64 dev veth0
105
106for i in 1 2; do
107 ip netns exec nsr$i sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
108 ip netns exec nsr$i sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
109
110 ip -net ns$i link set lo up
111 ip -net ns$i link set eth0 up
112 ip -net ns$i addr add 10.0.$i.99/24 dev eth0
113 ip -net ns$i route add default via 10.0.$i.1
114 ip -net ns$i addr add dead:$i::99/64 dev eth0
115 ip -net ns$i route add default via dead:$i::1
116 ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null
117
118 # don't set ip DF bit for first two tests
119 ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null
120done
121
122ip -net nsr1 route add default via 192.168.10.2
123ip -net nsr2 route add default via 192.168.10.1
124
125ip netns exec nsr1 nft -f - <<EOF
126table inet filter {
127 flowtable f1 {
128 hook ingress priority 0
129 devices = { veth0, veth1 }
130 }
131
132 chain forward {
133 type filter hook forward priority 0; policy drop;
134
135 # flow offloaded? Tag ct with mark 1, so we can detect when it fails.
136 meta oif "veth1" tcp dport 12345 flow offload @f1 counter
137
138 # use packet size to trigger 'should be offloaded by now'.
139 # otherwise, if 'flow offload' expression never offloads, the
140 # test will pass.
141 tcp dport 12345 meta length gt 200 ct mark set 1 counter
142
143 # this turns off flow offloading internally, so expect packets again
144 tcp flags fin,rst ct mark set 0 accept
145
146 # this allows large packets from responder, we need this as long
147 # as PMTUd is off.
148 # This rule is deleted for the last test, when we expect PMTUd
149 # to kick in and ensure all packets meet mtu requirements.
150 meta length gt 1500 accept comment something-to-grep-for
151
152 # next line blocks connection w.o. working offload.
153 # we only do this for reverse dir, because we expect packets to
154 # enter slow path due to MTU mismatch of veth0 and veth1.
155 tcp sport 12345 ct mark 1 counter log prefix "mark failure " drop
156
157 ct state established,related accept
158
159 # for packets that we can't offload yet, i.e. SYN (any ct that is not confirmed)
160 meta length lt 200 oif "veth1" tcp dport 12345 counter accept
161
162 meta nfproto ipv4 meta l4proto icmp accept
163 meta nfproto ipv6 meta l4proto icmpv6 accept
164 }
165}
166EOF
167
168if [ $? -ne 0 ]; then
169 echo "SKIP: Could not load nft ruleset"
170 exit $ksft_skip
171fi
172
173# test basic connectivity
174ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null
175if [ $? -ne 0 ];then
176 echo "ERROR: ns1 cannot reach ns2" 1>&2
177 bash
178 exit 1
179fi
180
181ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null
182if [ $? -ne 0 ];then
183 echo "ERROR: ns2 cannot reach ns1" 1>&2
184 exit 1
185fi
186
187if [ $ret -eq 0 ];then
188 echo "PASS: netns routing/connectivity: ns1 can reach ns2"
189fi
190
191ns1in=$(mktemp)
192ns1out=$(mktemp)
193ns2in=$(mktemp)
194ns2out=$(mktemp)
195
196make_file()
197{
198 name=$1
199 who=$2
200
201 SIZE=$((RANDOM % (1024 * 8)))
202 TSIZE=$((SIZE * 1024))
203
204 dd if=/dev/urandom of="$name" bs=1024 count=$SIZE 2> /dev/null
205
206 SIZE=$((RANDOM % 1024))
207 SIZE=$((SIZE + 128))
208 TSIZE=$((TSIZE + SIZE))
209 dd if=/dev/urandom conf=notrunc of="$name" bs=1 count=$SIZE 2> /dev/null
210}
211
212check_transfer()
213{
214 in=$1
215 out=$2
216 what=$3
217
218 cmp "$in" "$out" > /dev/null 2>&1
219 if [ $? -ne 0 ] ;then
220 echo "FAIL: file mismatch for $what" 1>&2
221 ls -l "$in"
222 ls -l "$out"
223 return 1
224 fi
225
226 return 0
227}
228
229test_tcp_forwarding()
230{
231 local nsa=$1
232 local nsb=$2
233 local lret=0
234
235 ip netns exec $nsb nc -w 5 -l -p 12345 < "$ns2in" > "$ns2out" &
236 lpid=$!
237
238 sleep 1
239 ip netns exec $nsa nc -w 4 10.0.2.99 12345 < "$ns1in" > "$ns1out" &
240 cpid=$!
241
242 sleep 3
243
244 kill $lpid
245 kill $cpid
246 wait
247
248 check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"
249 if [ $? -ne 0 ];then
250 lret=1
251 fi
252
253 check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"
254 if [ $? -ne 0 ];then
255 lret=1
256 fi
257
258 return $lret
259}
260
261make_file "$ns1in" "ns1"
262make_file "$ns2in" "ns2"
263
264# First test:
265# No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed.
266test_tcp_forwarding ns1 ns2
267if [ $? -eq 0 ] ;then
268 echo "PASS: flow offloaded for ns1/ns2"
269else
270 echo "FAIL: flow offload for ns1/ns2:" 1>&2
271 ip netns exec nsr1 nft list ruleset
272 ret=1
273fi
274
275# delete default route, i.e. ns2 won't be able to reach ns1 and
276# will depend on ns1 being masqueraded in nsr1.
277# expect ns1 has nsr1 address.
278ip -net ns2 route del default via 10.0.2.1
279ip -net ns2 route del default via dead:2::1
280ip -net ns2 route add 192.168.10.1 via 10.0.2.1
281
282# Second test:
283# Same, but with NAT enabled.
284ip netns exec nsr1 nft -f - <<EOF
285table ip nat {
286 chain postrouting {
287 type nat hook postrouting priority 0; policy accept;
288 meta oifname "veth1" masquerade
289 }
290}
291EOF
292
293test_tcp_forwarding ns1 ns2
294
295if [ $? -eq 0 ] ;then
296 echo "PASS: flow offloaded for ns1/ns2 with NAT"
297else
298 echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2
299 ip netns exec nsr1 nft list ruleset
300 ret=1
301fi
302
303# Third test:
304# Same as second test, but with PMTU discovery enabled.
305handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2)
306
307ip netns exec nsr1 nft delete rule inet filter forward $handle
308if [ $? -ne 0 ] ;then
309 echo "FAIL: Could not delete large-packet accept rule"
310 exit 1
311fi
312
313ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
314ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
315
316test_tcp_forwarding ns1 ns2
317if [ $? -eq 0 ] ;then
318 echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery"
319else
320 echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2
321 ip netns exec nsr1 nft list ruleset
322fi
323
324exit $ret
diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh
index 14fcf3104c77..1be55e705780 100755
--- a/tools/testing/selftests/netfilter/nft_nat.sh
+++ b/tools/testing/selftests/netfilter/nft_nat.sh
@@ -36,7 +36,11 @@ trap cleanup EXIT
36ip netns add ns1 36ip netns add ns1
37ip netns add ns2 37ip netns add ns2
38 38
39ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 39ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1
40if [ $? -ne 0 ];then
41 echo "SKIP: No virtual ethernet pair device support in kernel"
42 exit $ksft_skip
43fi
40ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 44ip link add veth1 netns ns0 type veth peer name eth0 netns ns2
41 45
42ip -net ns0 link set lo up 46ip -net ns0 link set lo up
diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c
index b2065536d407..66af608fb4c6 100644
--- a/tools/testing/selftests/rtc/rtctest.c
+++ b/tools/testing/selftests/rtc/rtctest.c
@@ -49,7 +49,7 @@ TEST_F(rtc, date_read) {
49 rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); 49 rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
50} 50}
51 51
52TEST_F(rtc, uie_read) { 52TEST_F_TIMEOUT(rtc, uie_read, NUM_UIE + 2) {
53 int i, rc, irq = 0; 53 int i, rc, irq = 0;
54 unsigned long data; 54 unsigned long data;
55 55
@@ -211,7 +211,7 @@ TEST_F(rtc, alarm_wkalm_set) {
211 ASSERT_EQ(new, secs); 211 ASSERT_EQ(new, secs);
212} 212}
213 213
214TEST_F(rtc, alarm_alm_set_minute) { 214TEST_F_TIMEOUT(rtc, alarm_alm_set_minute, 65) {
215 struct timeval tv = { .tv_sec = 62 }; 215 struct timeval tv = { .tv_sec = 62 };
216 unsigned long data; 216 unsigned long data;
217 struct rtc_time tm; 217 struct rtc_time tm;
@@ -264,7 +264,7 @@ TEST_F(rtc, alarm_alm_set_minute) {
264 ASSERT_EQ(new, secs); 264 ASSERT_EQ(new, secs);
265} 265}
266 266
267TEST_F(rtc, alarm_wkalm_set_minute) { 267TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
268 struct timeval tv = { .tv_sec = 62 }; 268 struct timeval tv = { .tv_sec = 62 };
269 struct rtc_wkalrm alarm = { 0 }; 269 struct rtc_wkalrm alarm = { 0 };
270 struct rtc_time tm; 270 struct rtc_time tm;