Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from David Miller:

1) Fix free/alloc races in batmanadv, from Sven Eckelmann.

2) Several leaks and other fixes in kTLS support of mlx5 driver, from
Tariq Toukan.

3) BPF devmap_hash cost calculation can overflow on 32-bit, from Toke
Høiland-Jørgensen.

4) Add an r8152 device ID, from Kazutoshi Noguchi.

5) Missing include in ipv6's addrconf.c, from Ben Dooks.

6) Use siphash in flow dissector, from Eric Dumazet. Attackers can
easily infer the 32-bit secret otherwise etc.

7) Several netdevice nesting depth fixes from Taehee Yoo.

8) Fix several KCSAN reported errors, from Eric Dumazet. For example,
when doing lockless skb_queue_empty() checks, and accessing
sk_napi_id/sk_incoming_cpu lockless as well.

9) Fix jumbo packet handling in RXRPC, from David Howells.

10) Bump SOMAXCONN and tcp_max_syn_backlog values, from Eric Dumazet.

11) Fix DMA synchronization in gve driver, from Yangchun Fu.

12) Several bpf offload fixes, from Jakub Kicinski.

13) Fix sk_page_frag() recursion during memory reclaim, from Tejun Heo.

14) Fix ping latency during high traffic rates in hisilicon driver, from
Jiangfent Xiao.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (146 commits)
net: fix installing orphaned programs
net: cls_bpf: fix NULL deref on offload filter removal
selftests: bpf: Skip write only files in debugfs
selftests: net: reuseport_dualstack: fix uninitalized parameter
r8169: fix wrong PHY ID issue with RTL8168dp
net: dsa: bcm_sf2: Fix IMP setup for port different than 8
net: phylink: Fix phylink_dbg() macro
gve: Fixes DMA synchronization.
inet: stop leaking jiffies on the wire
ixgbe: Remove duplicate clear_bit() call
Documentation: networking: device drivers: Remove stray asterisks
e1000: fix memory leaks
i40e: Fix receive buffer starvation for AF_XDP
igb: Fix constant media auto sense switching when no cable is connected
net: ethernet: arc: add the missed clk_disable_unprepare
igb: Enable media autosense for the i350.
igb/igc: Don't warn on fatal read failures when the device is removed
tcp: increase tcp_max_syn_backlog max value
net: increase SOMAXCONN to 4096
netdevsim: Fix use-after-free during device dismantle
...

+2136 -1292
+7 -7
Documentation/networking/device_drivers/intel/e100.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ============================================================== 4 - Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters 5 - ============================================================== 3 + ============================================================= 4 + Linux Base Driver for the Intel(R) PRO/100 Family of Adapters 5 + ============================================================= 6 6 7 7 June 1, 2018 8 8 ··· 21 21 In This Release 22 22 =============== 23 23 24 - This file describes the Linux* Base Driver for the Intel(R) PRO/100 Family of 24 + This file describes the Linux Base Driver for the Intel(R) PRO/100 Family of 25 25 Adapters. This driver includes support for Itanium(R)2-based systems. 26 26 27 27 For questions related to hardware requirements, refer to the documentation ··· 138 138 The latest release of ethtool can be found from 139 139 https://www.kernel.org/pub/software/network/ethtool/ 140 140 141 - Enabling Wake on LAN* (WoL) 142 - --------------------------- 143 - WoL is provided through the ethtool* utility. For instructions on 141 + Enabling Wake on LAN (WoL) 142 + -------------------------- 143 + WoL is provided through the ethtool utility. For instructions on 144 144 enabling WoL with ethtool, refer to the ethtool man page. WoL will be 145 145 enabled on the system during the next shut down or reboot. For this 146 146 driver version, in order to enable WoL, the e100 driver must be loaded
+6 -6
Documentation/networking/device_drivers/intel/e1000.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - =========================================================== 4 - Linux* Base Driver for Intel(R) Ethernet Network Connection 5 - =========================================================== 3 + ========================================================== 4 + Linux Base Driver for Intel(R) Ethernet Network Connection 5 + ========================================================== 6 6 7 7 Intel Gigabit Linux driver. 8 8 Copyright(c) 1999 - 2013 Intel Corporation. ··· 438 438 The latest release of ethtool can be found from 439 439 https://www.kernel.org/pub/software/network/ethtool/ 440 440 441 - Enabling Wake on LAN* (WoL) 442 - --------------------------- 441 + Enabling Wake on LAN (WoL) 442 + -------------------------- 443 443 444 - WoL is configured through the ethtool* utility. 444 + WoL is configured through the ethtool utility. 445 445 446 446 WoL will be enabled on the system during the next shut down or reboot. 447 447 For this driver version, in order to enable WoL, the e1000 driver must be
+7 -7
Documentation/networking/device_drivers/intel/e1000e.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ====================================================== 4 - Linux* Driver for Intel(R) Ethernet Network Connection 5 - ====================================================== 3 + ===================================================== 4 + Linux Driver for Intel(R) Ethernet Network Connection 5 + ===================================================== 6 6 7 7 Intel Gigabit Linux driver. 8 8 Copyright(c) 2008-2018 Intel Corporation. ··· 338 338 manually set devices for 1 Gbps and higher. 339 339 340 340 Speed, duplex, and autonegotiation advertising are configured through the 341 - ethtool* utility. 341 + ethtool utility. 342 342 343 343 Caution: Only experienced network administrators should force speed and duplex 344 344 or change autonegotiation advertising manually. The settings at the switch must ··· 351 351 operate only in full duplex and only at their native speed. 352 352 353 353 354 - Enabling Wake on LAN* (WoL) 355 - --------------------------- 356 - WoL is configured through the ethtool* utility. 354 + Enabling Wake on LAN (WoL) 355 + -------------------------- 356 + WoL is configured through the ethtool utility. 357 357 358 358 WoL will be enabled on the system during the next shut down or reboot. For 359 359 this driver version, in order to enable WoL, the e1000e driver must be loaded
+5 -5
Documentation/networking/device_drivers/intel/fm10k.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ============================================================== 4 - Linux* Base Driver for Intel(R) Ethernet Multi-host Controller 5 - ============================================================== 3 + ============================================================= 4 + Linux Base Driver for Intel(R) Ethernet Multi-host Controller 5 + ============================================================= 6 6 7 7 August 20, 2018 8 8 Copyright(c) 2015-2018 Intel Corporation. ··· 120 120 Known Issues/Troubleshooting 121 121 ============================ 122 122 123 - Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS under Linux KVM 124 - --------------------------------------------------------------------------------------- 123 + Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS under Linux KVM 124 + ------------------------------------------------------------------------------------- 125 125 KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM. This 126 126 includes traditional PCIe devices, as well as SR-IOV-capable devices based on 127 127 the Intel Ethernet Controller XL710.
+4 -4
Documentation/networking/device_drivers/intel/i40e.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ================================================================== 4 - Linux* Base Driver for the Intel(R) Ethernet Controller 700 Series 5 - ================================================================== 3 + ================================================================= 4 + Linux Base Driver for the Intel(R) Ethernet Controller 700 Series 5 + ================================================================= 6 6 7 7 Intel 40 Gigabit Linux driver. 8 8 Copyright(c) 1999-2018 Intel Corporation. ··· 384 384 Network Adapter XXV710 based devices. 385 385 386 386 Speed, duplex, and autonegotiation advertising are configured through the 387 - ethtool* utility. 387 + ethtool utility. 388 388 389 389 Caution: Only experienced network administrators should force speed and duplex 390 390 or change autonegotiation advertising manually. The settings at the switch must
+4 -4
Documentation/networking/device_drivers/intel/iavf.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ================================================================== 4 - Linux* Base Driver for Intel(R) Ethernet Adaptive Virtual Function 5 - ================================================================== 3 + ================================================================= 4 + Linux Base Driver for Intel(R) Ethernet Adaptive Virtual Function 5 + ================================================================= 6 6 7 7 Intel Ethernet Adaptive Virtual Function Linux driver. 8 8 Copyright(c) 2013-2018 Intel Corporation. ··· 19 19 Overview 20 20 ======== 21 21 22 - This file describes the iavf Linux* Base Driver. This driver was formerly 22 + This file describes the iavf Linux Base Driver. This driver was formerly 23 23 called i40evf. 24 24 25 25 The iavf driver supports the below mentioned virtual function devices and
+3 -3
Documentation/networking/device_drivers/intel/ice.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - =================================================================== 4 - Linux* Base Driver for the Intel(R) Ethernet Connection E800 Series 5 - =================================================================== 3 + ================================================================== 4 + Linux Base Driver for the Intel(R) Ethernet Connection E800 Series 5 + ================================================================== 6 6 7 7 Intel ice Linux driver. 8 8 Copyright(c) 2018 Intel Corporation.
+6 -6
Documentation/networking/device_drivers/intel/igb.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - =========================================================== 4 - Linux* Base Driver for Intel(R) Ethernet Network Connection 5 - =========================================================== 3 + ========================================================== 4 + Linux Base Driver for Intel(R) Ethernet Network Connection 5 + ========================================================== 6 6 7 7 Intel Gigabit Linux driver. 8 8 Copyright(c) 1999-2018 Intel Corporation. ··· 129 129 https://www.kernel.org/pub/software/network/ethtool/ 130 130 131 131 132 - Enabling Wake on LAN* (WoL) 133 - --------------------------- 134 - WoL is configured through the ethtool* utility. 132 + Enabling Wake on LAN (WoL) 133 + -------------------------- 134 + WoL is configured through the ethtool utility. 135 135 136 136 WoL will be enabled on the system during the next shut down or reboot. For 137 137 this driver version, in order to enable WoL, the igb driver must be loaded
+3 -3
Documentation/networking/device_drivers/intel/igbvf.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ============================================================ 4 - Linux* Base Virtual Function Driver for Intel(R) 1G Ethernet 5 - ============================================================ 3 + =========================================================== 4 + Linux Base Virtual Function Driver for Intel(R) 1G Ethernet 5 + =========================================================== 6 6 7 7 Intel Gigabit Virtual Function Linux driver. 8 8 Copyright(c) 1999-2018 Intel Corporation.
+5 -5
Documentation/networking/device_drivers/intel/ixgbe.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ============================================================================= 4 - Linux* Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters 5 - ============================================================================= 3 + =========================================================================== 4 + Linux Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters 5 + =========================================================================== 6 6 7 7 Intel 10 Gigabit Linux driver. 8 8 Copyright(c) 1999-2018 Intel Corporation. ··· 519 519 Known Issues/Troubleshooting 520 520 ============================ 521 521 522 - Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS 523 - ----------------------------------------------------------------------- 522 + Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS 523 + --------------------------------------------------------------------- 524 524 Linux KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM. 525 525 This includes traditional PCIe devices, as well as SR-IOV-capable devices based 526 526 on the Intel Ethernet Controller XL710.
+3 -3
Documentation/networking/device_drivers/intel/ixgbevf.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ============================================================= 4 - Linux* Base Virtual Function Driver for Intel(R) 10G Ethernet 5 - ============================================================= 3 + ============================================================ 4 + Linux Base Virtual Function Driver for Intel(R) 10G Ethernet 5 + ============================================================ 6 6 7 7 Intel 10 Gigabit Virtual Function Linux driver. 8 8 Copyright(c) 1999-2018 Intel Corporation.
+3 -3
Documentation/networking/device_drivers/pensando/ionic.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 2 3 - ========================================================== 4 - Linux* Driver for the Pensando(R) Ethernet adapter family 5 - ========================================================== 3 + ======================================================== 4 + Linux Driver for the Pensando(R) Ethernet adapter family 5 + ======================================================== 6 6 7 7 Pensando Linux Ethernet driver. 8 8 Copyright(c) 2019 Pensando Systems, Inc
+7 -4
Documentation/networking/ip-sysctl.txt
··· 207 207 208 208 somaxconn - INTEGER 209 209 Limit of socket listen() backlog, known in userspace as SOMAXCONN. 210 - Defaults to 128. See also tcp_max_syn_backlog for additional tuning 211 - for TCP sockets. 210 + Defaults to 4096. (Was 128 before linux-5.4) 211 + See also tcp_max_syn_backlog for additional tuning for TCP sockets. 212 212 213 213 tcp_abort_on_overflow - BOOLEAN 214 214 If listening service is too slow to accept new connections, ··· 408 408 up to ~64K of unswappable memory. 409 409 410 410 tcp_max_syn_backlog - INTEGER 411 - Maximal number of remembered connection requests, which have not 412 - received an acknowledgment from connecting client. 411 + Maximal number of remembered connection requests (SYN_RECV), 412 + which have not received an acknowledgment from connecting client. 413 + This is a per-listener limit. 413 414 The minimal value is 128 for low memory machines, and it will 414 415 increase in proportion to the memory of machine. 415 416 If server suffers from overload, try increasing this number. 417 + Remember to also check /proc/sys/net/core/somaxconn 418 + A SYN_RECV request socket consumes about 304 bytes of memory. 416 419 417 420 tcp_max_tw_buckets - INTEGER 418 421 Maximal number of timewait sockets held by system simultaneously.
-1
MAINTAINERS
··· 11408 11408 NETWORKING [TLS] 11409 11409 M: Boris Pismenny <borisp@mellanox.com> 11410 11410 M: Aviad Yehezkel <aviadye@mellanox.com> 11411 - M: Dave Watson <davejwatson@fb.com> 11412 11411 M: John Fastabend <john.fastabend@gmail.com> 11413 11412 M: Daniel Borkmann <daniel@iogearbox.net> 11414 11413 M: Jakub Kicinski <jakub.kicinski@netronome.com>
+1 -1
drivers/crypto/chelsio/chtls/chtls_cm.c
··· 1297 1297 tp->write_seq = snd_isn; 1298 1298 tp->snd_nxt = snd_isn; 1299 1299 tp->snd_una = snd_isn; 1300 - inet_sk(sk)->inet_id = tp->write_seq ^ jiffies; 1300 + inet_sk(sk)->inet_id = prandom_u32(); 1301 1301 assign_rxopt(sk, opt); 1302 1302 1303 1303 if (tp->rcv_wnd > (RCV_BUFSIZ_M << 10))
+1 -1
drivers/crypto/chelsio/chtls/chtls_io.c
··· 1702 1702 return peekmsg(sk, msg, len, nonblock, flags); 1703 1703 1704 1704 if (sk_can_busy_loop(sk) && 1705 - skb_queue_empty(&sk->sk_receive_queue) && 1705 + skb_queue_empty_lockless(&sk->sk_receive_queue) && 1706 1706 sk->sk_state == TCP_ESTABLISHED) 1707 1707 sk_busy_loop(sk, nonblock); 1708 1708
+1 -1
drivers/isdn/capi/capi.c
··· 744 744 745 745 poll_wait(file, &(cdev->recvwait), wait); 746 746 mask = EPOLLOUT | EPOLLWRNORM; 747 - if (!skb_queue_empty(&cdev->recvqueue)) 747 + if (!skb_queue_empty_lockless(&cdev->recvqueue)) 748 748 mask |= EPOLLIN | EPOLLRDNORM; 749 749 return mask; 750 750 }
+1 -1
drivers/net/bonding/bond_alb.c
··· 952 952 struct bond_vlan_tag *tags; 953 953 954 954 if (is_vlan_dev(upper) && 955 - bond->nest_level == vlan_get_encap_level(upper) - 1) { 955 + bond->dev->lower_level == upper->lower_level - 1) { 956 956 if (upper->addr_assign_type == NET_ADDR_STOLEN) { 957 957 alb_send_lp_vid(slave, mac_addr, 958 958 vlan_dev_vlan_proto(upper),
+9 -19
drivers/net/bonding/bond_main.c
··· 1733 1733 goto err_upper_unlink; 1734 1734 } 1735 1735 1736 - bond->nest_level = dev_get_nest_level(bond_dev) + 1; 1737 - 1738 1736 /* If the mode uses primary, then the following is handled by 1739 1737 * bond_change_active_slave(). 1740 1738 */ ··· 1814 1816 slave_disable_netpoll(new_slave); 1815 1817 1816 1818 err_close: 1817 - slave_dev->priv_flags &= ~IFF_BONDING; 1819 + if (!netif_is_bond_master(slave_dev)) 1820 + slave_dev->priv_flags &= ~IFF_BONDING; 1818 1821 dev_close(slave_dev); 1819 1822 1820 1823 err_restore_mac: ··· 1955 1956 if (!bond_has_slaves(bond)) { 1956 1957 bond_set_carrier(bond); 1957 1958 eth_hw_addr_random(bond_dev); 1958 - bond->nest_level = SINGLE_DEPTH_NESTING; 1959 - } else { 1960 - bond->nest_level = dev_get_nest_level(bond_dev) + 1; 1961 1959 } 1962 1960 1963 1961 unblock_netpoll_tx(); ··· 2013 2017 else 2014 2018 dev_set_mtu(slave_dev, slave->original_mtu); 2015 2019 2016 - slave_dev->priv_flags &= ~IFF_BONDING; 2020 + if (!netif_is_bond_master(slave_dev)) 2021 + slave_dev->priv_flags &= ~IFF_BONDING; 2017 2022 2018 2023 bond_free_slave(slave); 2019 2024 ··· 3439 3442 } 3440 3443 } 3441 3444 3442 - static int bond_get_nest_level(struct net_device *bond_dev) 3443 - { 3444 - struct bonding *bond = netdev_priv(bond_dev); 3445 - 3446 - return bond->nest_level; 3447 - } 3448 - 3449 3445 static void bond_get_stats(struct net_device *bond_dev, 3450 3446 struct rtnl_link_stats64 *stats) 3451 3447 { ··· 3447 3457 struct list_head *iter; 3448 3458 struct slave *slave; 3449 3459 3450 - spin_lock_nested(&bond->stats_lock, bond_get_nest_level(bond_dev)); 3460 + spin_lock(&bond->stats_lock); 3451 3461 memcpy(stats, &bond->bond_stats, sizeof(*stats)); 3452 3462 3453 3463 rcu_read_lock(); ··· 4258 4268 .ndo_neigh_setup = bond_neigh_setup, 4259 4269 .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid, 4260 4270 .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid, 4261 - .ndo_get_lock_subclass = bond_get_nest_level, 4262 4271 #ifdef CONFIG_NET_POLL_CONTROLLER 4263 4272 .ndo_netpoll_setup = bond_netpoll_setup, 4264 4273 .ndo_netpoll_cleanup = bond_netpoll_cleanup, ··· 4285 4296 struct bonding *bond = netdev_priv(bond_dev); 4286 4297 4287 4298 spin_lock_init(&bond->mode_lock); 4288 - spin_lock_init(&bond->stats_lock); 4289 4299 bond->params = bonding_defaults; 4290 4300 4291 4301 /* Initialize pointers */ ··· 4353 4365 4354 4366 list_del(&bond->bond_list); 4355 4367 4368 + lockdep_unregister_key(&bond->stats_lock_key); 4356 4369 bond_debug_unregister(bond); 4357 4370 } 4358 4371 ··· 4757 4768 if (!bond->wq) 4758 4769 return -ENOMEM; 4759 4770 4760 - bond->nest_level = SINGLE_DEPTH_NESTING; 4761 - netdev_lockdep_set_classes(bond_dev); 4771 + spin_lock_init(&bond->stats_lock); 4772 + lockdep_register_key(&bond->stats_lock_key); 4773 + lockdep_set_class(&bond->stats_lock, &bond->stats_lock_key); 4762 4774 4763 4775 list_add_tail(&bond->bond_list, &bn->dev_list); 4764 4776
+21 -15
drivers/net/dsa/bcm_sf2.c
··· 37 37 unsigned int i; 38 38 u32 reg, offset; 39 39 40 - if (priv->type == BCM7445_DEVICE_ID) 41 - offset = CORE_STS_OVERRIDE_IMP; 42 - else 43 - offset = CORE_STS_OVERRIDE_IMP2; 44 - 45 40 /* Enable the port memories */ 46 41 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL); 47 42 reg &= ~P_TXQ_PSM_VDD(port); 48 43 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); 49 - 50 - /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ 51 - reg = core_readl(priv, CORE_IMP_CTL); 52 - reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN); 53 - reg &= ~(RX_DIS | TX_DIS); 54 - core_writel(priv, reg, CORE_IMP_CTL); 55 44 56 45 /* Enable forwarding */ 57 46 core_writel(priv, SW_FWDG_EN, CORE_SWMODE); ··· 60 71 61 72 b53_brcm_hdr_setup(ds, port); 62 73 63 - /* Force link status for IMP port */ 64 - reg = core_readl(priv, offset); 65 - reg |= (MII_SW_OR | LINK_STS); 66 - core_writel(priv, reg, offset); 74 + if (port == 8) { 75 + if (priv->type == BCM7445_DEVICE_ID) 76 + offset = CORE_STS_OVERRIDE_IMP; 77 + else 78 + offset = CORE_STS_OVERRIDE_IMP2; 79 + 80 + /* Force link status for IMP port */ 81 + reg = core_readl(priv, offset); 82 + reg |= (MII_SW_OR | LINK_STS); 83 + core_writel(priv, reg, offset); 84 + 85 + /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ 86 + reg = core_readl(priv, CORE_IMP_CTL); 87 + reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN); 88 + reg &= ~(RX_DIS | TX_DIS); 89 + core_writel(priv, reg, CORE_IMP_CTL); 90 + } else { 91 + reg = core_readl(priv, CORE_G_PCTL_PORT(port)); 92 + reg &= ~(RX_DIS | TX_DIS); 93 + core_writel(priv, reg, CORE_G_PCTL_PORT(port)); 94 + } 67 95 } 68 96 69 97 static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)
+2 -2
drivers/net/dsa/sja1105/Kconfig
··· 26 26 27 27 config NET_DSA_SJA1105_TAS 28 28 bool "Support for the Time-Aware Scheduler on NXP SJA1105" 29 - depends on NET_DSA_SJA1105 30 - depends on NET_SCH_TAPRIO 29 + depends on NET_DSA_SJA1105 && NET_SCH_TAPRIO 30 + depends on NET_SCH_TAPRIO=y || NET_DSA_SJA1105=m 31 31 help 32 32 This enables support for the TTEthernet-based egress scheduling 33 33 engine in the SJA1105 DSA driver, which is controlled using a
+3
drivers/net/ethernet/arc/emac_rockchip.c
··· 256 256 if (priv->regulator) 257 257 regulator_disable(priv->regulator); 258 258 259 + if (priv->soc_data->need_div_macclk) 260 + clk_disable_unprepare(priv->macclk); 261 + 259 262 free_netdev(ndev); 260 263 return err; 261 264 }
+4 -6
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 10382 10382 { 10383 10383 bnxt_unmap_bars(bp, bp->pdev); 10384 10384 pci_release_regions(bp->pdev); 10385 - pci_disable_device(bp->pdev); 10385 + if (pci_is_enabled(bp->pdev)) 10386 + pci_disable_device(bp->pdev); 10386 10387 } 10387 10388 10388 10389 static void bnxt_init_dflt_coal(struct bnxt *bp) ··· 10670 10669 bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW; 10671 10670 } 10672 10671 /* fall through */ 10673 - case BNXT_FW_RESET_STATE_RESET_FW: { 10674 - u32 wait_dsecs = bp->fw_health->post_reset_wait_dsecs; 10675 - 10672 + case BNXT_FW_RESET_STATE_RESET_FW: 10676 10673 bnxt_reset_all(bp); 10677 10674 bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV; 10678 - bnxt_queue_fw_reset_work(bp, wait_dsecs * HZ / 10); 10675 + bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10); 10679 10676 return; 10680 - } 10681 10677 case BNXT_FW_RESET_STATE_ENABLE_DEV: 10682 10678 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) && 10683 10679 bp->fw_health) {
+67 -45
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
··· 29 29 val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG); 30 30 health_status = val & 0xffff; 31 31 32 - if (health_status == BNXT_FW_STATUS_HEALTHY) { 33 - rc = devlink_fmsg_string_pair_put(fmsg, "FW status", 34 - "Healthy;"); 35 - if (rc) 36 - return rc; 37 - } else if (health_status < BNXT_FW_STATUS_HEALTHY) { 38 - rc = devlink_fmsg_string_pair_put(fmsg, "FW status", 39 - "Not yet completed initialization;"); 32 + if (health_status < BNXT_FW_STATUS_HEALTHY) { 33 + rc = devlink_fmsg_string_pair_put(fmsg, "Description", 34 + "Not yet completed initialization"); 40 35 if (rc) 41 36 return rc; 42 37 } else if (health_status > BNXT_FW_STATUS_HEALTHY) { 43 - rc = devlink_fmsg_string_pair_put(fmsg, "FW status", 44 - "Encountered fatal error and cannot recover;"); 38 + rc = devlink_fmsg_string_pair_put(fmsg, "Description", 39 + "Encountered fatal error and cannot recover"); 45 40 if (rc) 46 41 return rc; 47 42 } 48 43 49 44 if (val >> 16) { 50 - rc = devlink_fmsg_u32_pair_put(fmsg, "Error", val >> 16); 45 + rc = devlink_fmsg_u32_pair_put(fmsg, "Error code", val >> 16); 51 46 if (rc) 52 47 return rc; 53 48 } ··· 210 215 211 216 static const struct bnxt_dl_nvm_param nvm_params[] = { 212 217 {DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV, 213 - BNXT_NVM_SHARED_CFG, 1}, 218 + BNXT_NVM_SHARED_CFG, 1, 1}, 214 219 {DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, NVM_OFF_IGNORE_ARI, 215 - BNXT_NVM_SHARED_CFG, 1}, 220 + BNXT_NVM_SHARED_CFG, 1, 1}, 216 221 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX, 217 - NVM_OFF_MSIX_VEC_PER_PF_MAX, BNXT_NVM_SHARED_CFG, 10}, 222 + NVM_OFF_MSIX_VEC_PER_PF_MAX, BNXT_NVM_SHARED_CFG, 10, 4}, 218 223 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN, 219 - NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7}, 224 + NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7, 4}, 220 225 {BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK, 221 - BNXT_NVM_SHARED_CFG, 1}, 226 + BNXT_NVM_SHARED_CFG, 1, 1}, 222 227 }; 228 + 229 + union bnxt_nvm_data { 230 + u8 val8; 231 + __le32 val32; 232 + }; 233 + 234 + static void bnxt_copy_to_nvm_data(union bnxt_nvm_data *dst, 235 + union devlink_param_value *src, 236 + int nvm_num_bits, int dl_num_bytes) 237 + { 238 + u32 val32 = 0; 239 + 240 + if (nvm_num_bits == 1) { 241 + dst->val8 = src->vbool; 242 + return; 243 + } 244 + if (dl_num_bytes == 4) 245 + val32 = src->vu32; 246 + else if (dl_num_bytes == 2) 247 + val32 = (u32)src->vu16; 248 + else if (dl_num_bytes == 1) 249 + val32 = (u32)src->vu8; 250 + dst->val32 = cpu_to_le32(val32); 251 + } 252 + 253 + static void bnxt_copy_from_nvm_data(union devlink_param_value *dst, 254 + union bnxt_nvm_data *src, 255 + int nvm_num_bits, int dl_num_bytes) 256 + { 257 + u32 val32; 258 + 259 + if (nvm_num_bits == 1) { 260 + dst->vbool = src->val8; 261 + return; 262 + } 263 + val32 = le32_to_cpu(src->val32); 264 + if (dl_num_bytes == 4) 265 + dst->vu32 = val32; 266 + else if (dl_num_bytes == 2) 267 + dst->vu16 = (u16)val32; 268 + else if (dl_num_bytes == 1) 269 + dst->vu8 = (u8)val32; 270 + } 223 271 224 272 static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, 225 273 int msg_len, union devlink_param_value *val) 226 274 { 227 275 struct hwrm_nvm_get_variable_input *req = msg; 228 - void *data_addr = NULL, *buf = NULL; 229 276 struct bnxt_dl_nvm_param nvm_param; 230 - int bytesize, idx = 0, rc, i; 277 + union bnxt_nvm_data *data; 231 278 dma_addr_t data_dma_addr; 279 + int idx = 0, rc, i; 232 280 233 281 /* Get/Set NVM CFG parameter is supported only on PFs */ 234 282 if (BNXT_VF(bp)) ··· 292 254 else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG) 293 255 idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID; 294 256 295 - bytesize = roundup(nvm_param.num_bits, BITS_PER_BYTE) / BITS_PER_BYTE; 296 - switch (bytesize) { 297 - case 1: 298 - if (nvm_param.num_bits == 1) 299 - buf = &val->vbool; 300 - else 301 - buf = &val->vu8; 302 - break; 303 - case 2: 304 - buf = &val->vu16; 305 - break; 306 - case 4: 307 - buf = &val->vu32; 308 - break; 309 - default: 310 - return -EFAULT; 311 - } 312 - 313 - data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize, 314 - &data_dma_addr, GFP_KERNEL); 315 - if (!data_addr) 257 + data = dma_alloc_coherent(&bp->pdev->dev, sizeof(*data), 258 + &data_dma_addr, GFP_KERNEL); 259 + if (!data) 316 260 return -ENOMEM; 317 261 318 262 req->dest_data_addr = cpu_to_le64(data_dma_addr); 319 - req->data_len = cpu_to_le16(nvm_param.num_bits); 263 + req->data_len = cpu_to_le16(nvm_param.nvm_num_bits); 320 264 req->option_num = cpu_to_le16(nvm_param.offset); 321 265 req->index_0 = cpu_to_le16(idx); 322 266 if (idx) 323 267 req->dimensions = cpu_to_le16(1); 324 268 325 269 if (req->req_type == cpu_to_le16(HWRM_NVM_SET_VARIABLE)) { 326 - memcpy(data_addr, buf, bytesize); 270 + bnxt_copy_to_nvm_data(data, val, nvm_param.nvm_num_bits, 271 + nvm_param.dl_num_bytes); 327 272 rc = hwrm_send_message(bp, msg, msg_len, HWRM_CMD_TIMEOUT); 328 273 } else { 329 274 rc = hwrm_send_message_silent(bp, msg, msg_len, 330 275 HWRM_CMD_TIMEOUT); 276 + if (!rc) 277 + bnxt_copy_from_nvm_data(val, data, 278 + nvm_param.nvm_num_bits, 279 + nvm_param.dl_num_bytes); 331 280 } 332 - if (!rc && req->req_type == cpu_to_le16(HWRM_NVM_GET_VARIABLE)) 333 - memcpy(buf, data_addr, bytesize); 334 - 335 - dma_free_coherent(&bp->pdev->dev, bytesize, data_addr, data_dma_addr); 281 + dma_free_coherent(&bp->pdev->dev, sizeof(*data), data, data_dma_addr); 336 282 if (rc == -EACCES) 337 283 netdev_err(bp->dev, "PF does not have admin privileges to modify NVM config\n"); 338 284 return rc;
+2 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
··· 52 52 u16 id; 53 53 u16 offset; 54 54 u16 dir_type; 55 - u16 num_bits; 55 + u16 nvm_num_bits; 56 + u8 dl_num_bytes; 56 57 }; 57 58 58 59 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
+16 -12
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
··· 695 695 lld->write_cmpl_support = adap->params.write_cmpl_support; 696 696 } 697 697 698 - static void uld_attach(struct adapter *adap, unsigned int uld) 698 + static int uld_attach(struct adapter *adap, unsigned int uld) 699 699 { 700 - void *handle; 701 700 struct cxgb4_lld_info lli; 701 + void *handle; 702 702 703 703 uld_init(adap, &lli); 704 704 uld_queue_init(adap, uld, &lli); ··· 708 708 dev_warn(adap->pdev_dev, 709 709 "could not attach to the %s driver, error %ld\n", 710 710 adap->uld[uld].name, PTR_ERR(handle)); 711 - return; 711 + return PTR_ERR(handle); 712 712 } 713 713 714 714 adap->uld[uld].handle = handle; ··· 716 716 717 717 if (adap->flags & CXGB4_FULL_INIT_DONE) 718 718 adap->uld[uld].state_change(handle, CXGB4_STATE_UP); 719 + 720 + return 0; 719 721 } 720 722 721 - /** 722 - * cxgb4_register_uld - register an upper-layer driver 723 - * @type: the ULD type 724 - * @p: the ULD methods 723 + /* cxgb4_register_uld - register an upper-layer driver 724 + * @type: the ULD type 725 + * @p: the ULD methods 725 726 * 726 - * Registers an upper-layer driver with this driver and notifies the ULD 727 - * about any presently available devices that support its type. Returns 728 - * %-EBUSY if a ULD of the same type is already registered. 727 + * Registers an upper-layer driver with this driver and notifies the ULD 728 + * about any presently available devices that support its type. 729 729 */ 730 730 void cxgb4_register_uld(enum cxgb4_uld type, 731 731 const struct cxgb4_uld_info *p) 732 732 { 733 - int ret = 0; 734 733 struct adapter *adap; 734 + int ret = 0; 735 735 736 736 if (type >= CXGB4_ULD_MAX) 737 737 return; ··· 763 763 if (ret) 764 764 goto free_irq; 765 765 adap->uld[type] = *p; 766 - uld_attach(adap, type); 766 + ret = uld_attach(adap, type); 767 + if (ret) 768 + goto free_txq; 767 769 continue; 770 + free_txq: 771 + release_sge_txq_uld(adap, type); 768 772 free_irq: 769 773 if (adap->flags & CXGB4_FULL_INIT_DONE) 770 774 quiesce_rx_uld(adap, type);
+2 -6
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 3791 3791 * write the CIDX Updates into the Status Page at the end of the 3792 3792 * TX Queue. 3793 3793 */ 3794 - c.autoequiqe_to_viid = htonl((dbqt 3795 - ? FW_EQ_ETH_CMD_AUTOEQUIQE_F 3796 - : FW_EQ_ETH_CMD_AUTOEQUEQE_F) | 3794 + c.autoequiqe_to_viid = htonl(FW_EQ_ETH_CMD_AUTOEQUEQE_F | 3797 3795 FW_EQ_ETH_CMD_VIID_V(pi->viid)); 3798 3796 3799 3797 c.fetchszm_to_iqid = 3800 - htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(dbqt 3801 - ? HOSTFCMODE_INGRESS_QUEUE_X 3802 - : HOSTFCMODE_STATUS_PAGE_X) | 3798 + htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(HOSTFCMODE_STATUS_PAGE_X) | 3803 3799 FW_EQ_ETH_CMD_PCIECHN_V(pi->tx_chan) | 3804 3800 FW_EQ_ETH_CMD_FETCHRO_F | FW_EQ_ETH_CMD_IQID_V(iqid)); 3805 3801
+1 -1
drivers/net/ethernet/cortina/gemini.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Register definitions for Gemini GMAC Ethernet device driver 3 3 * 4 4 * Copyright (C) 2006 Storlink, Corp.
+12 -13
drivers/net/ethernet/faraday/ftgmac100.c
··· 727 727 */ 728 728 nfrags = skb_shinfo(skb)->nr_frags; 729 729 730 + /* Setup HW checksumming */ 731 + csum_vlan = 0; 732 + if (skb->ip_summed == CHECKSUM_PARTIAL && 733 + !ftgmac100_prep_tx_csum(skb, &csum_vlan)) 734 + goto drop; 735 + 736 + /* Add VLAN tag */ 737 + if (skb_vlan_tag_present(skb)) { 738 + csum_vlan |= FTGMAC100_TXDES1_INS_VLANTAG; 739 + csum_vlan |= skb_vlan_tag_get(skb) & 0xffff; 740 + } 741 + 730 742 /* Get header len */ 731 743 len = skb_headlen(skb); 732 744 ··· 765 753 if (nfrags == 0) 766 754 f_ctl_stat |= FTGMAC100_TXDES0_LTS; 767 755 txdes->txdes3 = cpu_to_le32(map); 768 - 769 - /* Setup HW checksumming */ 770 - csum_vlan = 0; 771 - if (skb->ip_summed == CHECKSUM_PARTIAL && 772 - !ftgmac100_prep_tx_csum(skb, &csum_vlan)) 773 - goto drop; 774 - 775 - /* Add VLAN tag */ 776 - if (skb_vlan_tag_present(skb)) { 777 - csum_vlan |= FTGMAC100_TXDES1_INS_VLANTAG; 778 - csum_vlan |= skb_vlan_tag_get(skb) & 0xffff; 779 - } 780 - 781 756 txdes->txdes1 = cpu_to_le32(csum_vlan); 782 757 783 758 /* Next descriptor */
+1 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* 3 3 * Copyright 2018 NXP 4 4 */
+1 -1
drivers/net/ethernet/freescale/dpaa2/dprtc-cmd.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* 3 3 * Copyright 2013-2016 Freescale Semiconductor Inc. 4 4 * Copyright 2016-2018 NXP
+1 -1
drivers/net/ethernet/freescale/dpaa2/dprtc.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* 3 3 * Copyright 2013-2016 Freescale Semiconductor Inc. 4 4 * Copyright 2016-2018 NXP
+1 -1
drivers/net/ethernet/freescale/fec_main.c
··· 3558 3558 3559 3559 for (i = 0; i < irq_cnt; i++) { 3560 3560 snprintf(irq_name, sizeof(irq_name), "int%d", i); 3561 - irq = platform_get_irq_byname(pdev, irq_name); 3561 + irq = platform_get_irq_byname_optional(pdev, irq_name); 3562 3562 if (irq < 0) 3563 3563 irq = platform_get_irq(pdev, i); 3564 3564 if (irq < 0) {
+2 -2
drivers/net/ethernet/freescale/fec_ptp.c
··· 600 600 601 601 INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep); 602 602 603 - irq = platform_get_irq_byname(pdev, "pps"); 603 + irq = platform_get_irq_byname_optional(pdev, "pps"); 604 604 if (irq < 0) 605 - irq = platform_get_irq(pdev, irq_idx); 605 + irq = platform_get_irq_optional(pdev, irq_idx); 606 606 /* Failure to get an irq is not fatal, 607 607 * only the PTP_CLOCK_PPS clock events should stop 608 608 */
+2
drivers/net/ethernet/google/gve/gve_rx.c
··· 289 289 290 290 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD; 291 291 page_info = &rx->data.page_info[idx]; 292 + dma_sync_single_for_cpu(&priv->pdev->dev, rx->data.qpl->page_buses[idx], 293 + PAGE_SIZE, DMA_FROM_DEVICE); 292 294 293 295 /* gvnic can only receive into registered segments. If the buffer 294 296 * can't be recycled, our only choice is to copy the data out of
+22 -2
drivers/net/ethernet/google/gve/gve_tx.c
··· 390 390 seg_desc->seg.seg_addr = cpu_to_be64(addr); 391 391 } 392 392 393 - static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb) 393 + static void gve_dma_sync_for_device(struct device *dev, dma_addr_t *page_buses, 394 + u64 iov_offset, u64 iov_len) 395 + { 396 + dma_addr_t dma; 397 + u64 addr; 398 + 399 + for (addr = iov_offset; addr < iov_offset + iov_len; 400 + addr += PAGE_SIZE) { 401 + dma = page_buses[addr / PAGE_SIZE]; 402 + dma_sync_single_for_device(dev, dma, PAGE_SIZE, DMA_TO_DEVICE); 403 + } 404 + } 405 + 406 + static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb, 407 + struct device *dev) 394 408 { 395 409 int pad_bytes, hlen, hdr_nfrags, payload_nfrags, l4_hdr_offset; 396 410 union gve_tx_desc *pkt_desc, *seg_desc; ··· 446 432 skb_copy_bits(skb, 0, 447 433 tx->tx_fifo.base + info->iov[hdr_nfrags - 1].iov_offset, 448 434 hlen); 435 + gve_dma_sync_for_device(dev, tx->tx_fifo.qpl->page_buses, 436 + info->iov[hdr_nfrags - 1].iov_offset, 437 + info->iov[hdr_nfrags - 1].iov_len); 449 438 copy_offset = hlen; 450 439 451 440 for (i = payload_iov; i < payload_nfrags + payload_iov; i++) { ··· 462 445 skb_copy_bits(skb, copy_offset, 463 446 tx->tx_fifo.base + info->iov[i].iov_offset, 464 447 info->iov[i].iov_len); 448 + gve_dma_sync_for_device(dev, tx->tx_fifo.qpl->page_buses, 449 + info->iov[i].iov_offset, 450 + info->iov[i].iov_len); 465 451 copy_offset += info->iov[i].iov_len; 466 452 } 467 453 ··· 493 473 gve_tx_put_doorbell(priv, tx->q_resources, tx->req); 494 474 return NETDEV_TX_BUSY; 495 475 } 496 - nsegs = gve_tx_add_skb(tx, skb); 476 + nsegs = gve_tx_add_skb(tx, skb, &priv->pdev->dev); 497 477 498 478 netdev_tx_sent_queue(tx->netdev_txq, skb->len); 499 479 skb_tx_timestamp(skb);
+9 -7
drivers/net/ethernet/hisilicon/hip04_eth.c
··· 237 237 dma_addr_t rx_phys[RX_DESC_NUM]; 238 238 unsigned int rx_head; 239 239 unsigned int rx_buf_size; 240 + unsigned int rx_cnt_remaining; 240 241 241 242 struct device_node *phy_node; 242 243 struct phy_device *phy; ··· 576 575 struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi); 577 576 struct net_device *ndev = priv->ndev; 578 577 struct net_device_stats *stats = &ndev->stats; 579 - unsigned int cnt = hip04_recv_cnt(priv); 580 578 struct rx_desc *desc; 581 579 struct sk_buff *skb; 582 580 unsigned char *buf; ··· 588 588 589 589 /* clean up tx descriptors */ 590 590 tx_remaining = hip04_tx_reclaim(ndev, false); 591 - 592 - while (cnt && !last) { 591 + priv->rx_cnt_remaining += hip04_recv_cnt(priv); 592 + while (priv->rx_cnt_remaining && !last) { 593 593 buf = priv->rx_buf[priv->rx_head]; 594 594 skb = build_skb(buf, priv->rx_buf_size); 595 595 if (unlikely(!skb)) { ··· 635 635 hip04_set_recv_desc(priv, phys); 636 636 637 637 priv->rx_head = RX_NEXT(priv->rx_head); 638 - if (rx >= budget) 638 + if (rx >= budget) { 639 + --priv->rx_cnt_remaining; 639 640 goto done; 641 + } 640 642 641 - if (--cnt == 0) 642 - cnt = hip04_recv_cnt(priv); 643 + if (--priv->rx_cnt_remaining == 0) 644 + priv->rx_cnt_remaining += hip04_recv_cnt(priv); 643 645 } 644 646 645 647 if (!(priv->reg_inten & RCV_INT)) { ··· 726 724 int i; 727 725 728 726 priv->rx_head = 0; 727 + priv->rx_cnt_remaining = 0; 729 728 priv->tx_head = 0; 730 729 priv->tx_tail = 0; 731 730 hip04_reset_ppe(priv); ··· 1041 1038 1042 1039 hip04_free_ring(ndev, d); 1043 1040 unregister_netdev(ndev); 1044 - free_irq(ndev->irq, ndev); 1045 1041 of_node_put(priv->phy_node); 1046 1042 cancel_work_sync(&priv->tx_timeout_task); 1047 1043 free_netdev(ndev);
+3 -4
drivers/net/ethernet/intel/e1000/e1000_ethtool.c
··· 607 607 for (i = 0; i < adapter->num_rx_queues; i++) 608 608 rxdr[i].count = rxdr->count; 609 609 610 + err = 0; 610 611 if (netif_running(adapter->netdev)) { 611 612 /* Try to get new resources before deleting old */ 612 613 err = e1000_setup_all_rx_resources(adapter); ··· 628 627 adapter->rx_ring = rxdr; 629 628 adapter->tx_ring = txdr; 630 629 err = e1000_up(adapter); 631 - if (err) 632 - goto err_setup; 633 630 } 634 631 kfree(tx_old); 635 632 kfree(rx_old); 636 633 637 634 clear_bit(__E1000_RESETTING, &adapter->flags); 638 - return 0; 635 + return err; 636 + 639 637 err_setup_tx: 640 638 e1000_free_all_rx_resources(adapter); 641 639 err_setup_rx: ··· 646 646 err_alloc_tx: 647 647 if (netif_running(adapter->netdev)) 648 648 e1000_up(adapter); 649 - err_setup: 650 649 clear_bit(__E1000_RESETTING, &adapter->flags); 651 650 return err; 652 651 }
-5
drivers/net/ethernet/intel/i40e/i40e_xsk.c
··· 157 157 err = i40e_queue_pair_enable(vsi, qid); 158 158 if (err) 159 159 return err; 160 - 161 - /* Kick start the NAPI context so that receiving will start */ 162 - err = i40e_xsk_wakeup(vsi->netdev, qid, XDP_WAKEUP_RX); 163 - if (err) 164 - return err; 165 160 } 166 161 167 162 return 0;
+1 -1
drivers/net/ethernet/intel/igb/e1000_82575.c
··· 466 466 ? igb_setup_copper_link_82575 467 467 : igb_setup_serdes_link_82575; 468 468 469 - if (mac->type == e1000_82580) { 469 + if (mac->type == e1000_82580 || mac->type == e1000_i350) { 470 470 switch (hw->device_id) { 471 471 /* feature not supported on these id's */ 472 472 case E1000_DEV_ID_DH89XXCC_SGMII:
+5 -3
drivers/net/ethernet/intel/igb/igb_main.c
··· 753 753 struct net_device *netdev = igb->netdev; 754 754 hw->hw_addr = NULL; 755 755 netdev_err(netdev, "PCIe link lost\n"); 756 - WARN(1, "igb: Failed to read reg 0x%x!\n", reg); 756 + WARN(pci_device_is_present(igb->pdev), 757 + "igb: Failed to read reg 0x%x!\n", reg); 757 758 } 758 759 759 760 return value; ··· 2065 2064 if ((hw->phy.media_type == e1000_media_type_copper) && 2066 2065 (!(connsw & E1000_CONNSW_AUTOSENSE_EN))) { 2067 2066 swap_now = true; 2068 - } else if (!(connsw & E1000_CONNSW_SERDESD)) { 2067 + } else if ((hw->phy.media_type != e1000_media_type_copper) && 2068 + !(connsw & E1000_CONNSW_SERDESD)) { 2069 2069 /* copper signal takes time to appear */ 2070 2070 if (adapter->copper_tries < 4) { 2071 2071 adapter->copper_tries++; ··· 2372 2370 adapter->ei.get_invariants(hw); 2373 2371 adapter->flags &= ~IGB_FLAG_MEDIA_RESET; 2374 2372 } 2375 - if ((mac->type == e1000_82575) && 2373 + if ((mac->type == e1000_82575 || mac->type == e1000_i350) && 2376 2374 (adapter->flags & IGB_FLAG_MAS_ENABLE)) { 2377 2375 igb_enable_mas(adapter); 2378 2376 }
+2 -1
drivers/net/ethernet/intel/igc/igc_main.c
··· 4047 4047 hw->hw_addr = NULL; 4048 4048 netif_device_detach(netdev); 4049 4049 netdev_err(netdev, "PCIe link lost, device now detached\n"); 4050 - WARN(1, "igc: Failed to read reg 0x%x!\n", reg); 4050 + WARN(pci_device_is_present(igc->pdev), 4051 + "igc: Failed to read reg 0x%x!\n", reg); 4051 4052 } 4052 4053 4053 4054 return value;
-1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 4310 4310 if (test_bit(__IXGBE_RX_FCOE, &rx_ring->state)) 4311 4311 set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state); 4312 4312 4313 - clear_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &rx_ring->state); 4314 4313 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) 4315 4314 continue; 4316 4315
+20 -12
drivers/net/ethernet/marvell/mvneta_bm.h
··· 160 160 (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS)); 161 161 } 162 162 #else 163 - void mvneta_bm_pool_destroy(struct mvneta_bm *priv, 164 - struct mvneta_bm_pool *bm_pool, u8 port_map) {} 165 - void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool, 166 - u8 port_map) {} 167 - int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; } 168 - int mvneta_bm_pool_refill(struct mvneta_bm *priv, 169 - struct mvneta_bm_pool *bm_pool) {return 0; } 170 - struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id, 171 - enum mvneta_bm_type type, u8 port_id, 172 - int pkt_size) { return NULL; } 163 + static inline void mvneta_bm_pool_destroy(struct mvneta_bm *priv, 164 + struct mvneta_bm_pool *bm_pool, 165 + u8 port_map) {} 166 + static inline void mvneta_bm_bufs_free(struct mvneta_bm *priv, 167 + struct mvneta_bm_pool *bm_pool, 168 + u8 port_map) {} 169 + static inline int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) 170 + { return 0; } 171 + static inline int mvneta_bm_pool_refill(struct mvneta_bm *priv, 172 + struct mvneta_bm_pool *bm_pool) 173 + { return 0; } 174 + static inline struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, 175 + u8 pool_id, 176 + enum mvneta_bm_type type, 177 + u8 port_id, 178 + int pkt_size) 179 + { return NULL; } 173 180 174 181 static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv, 175 182 struct mvneta_bm_pool *bm_pool, ··· 185 178 static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv, 186 179 struct mvneta_bm_pool *bm_pool) 187 180 { return 0; } 188 - struct mvneta_bm *mvneta_bm_get(struct device_node *node) { return NULL; } 189 - void mvneta_bm_put(struct mvneta_bm *priv) {} 181 + static inline struct mvneta_bm *mvneta_bm_get(struct device_node *node) 182 + { return NULL; } 183 + static inline void mvneta_bm_put(struct mvneta_bm *priv) {} 190 184 #endif /* CONFIG_MVNETA_BM */ 191 185 #endif
+26 -16
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
··· 471 471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf]; 472 472 } 473 473 474 - static int get_max_gauranteed_vfs_counter(struct mlx4_dev *dev) 474 + static int 475 + mlx4_calc_res_counter_guaranteed(struct mlx4_dev *dev, 476 + struct resource_allocator *res_alloc, 477 + int vf) 475 478 { 476 - /* reduce the sink counter */ 477 - return (dev->caps.max_counters - 1 - 478 - (MLX4_PF_COUNTERS_PER_PORT * MLX4_MAX_PORTS)) 479 - / MLX4_MAX_PORTS; 479 + struct mlx4_active_ports actv_ports; 480 + int ports, counters_guaranteed; 481 + 482 + /* For master, only allocate according to the number of phys ports */ 483 + if (vf == mlx4_master_func_num(dev)) 484 + return MLX4_PF_COUNTERS_PER_PORT * dev->caps.num_ports; 485 + 486 + /* calculate real number of ports for the VF */ 487 + actv_ports = mlx4_get_active_ports(dev, vf); 488 + ports = bitmap_weight(actv_ports.ports, dev->caps.num_ports); 489 + counters_guaranteed = ports * MLX4_VF_COUNTERS_PER_PORT; 490 + 491 + /* If we do not have enough counters for this VF, do not 492 + * allocate any for it. '-1' to reduce the sink counter. 493 + */ 494 + if ((res_alloc->res_reserved + counters_guaranteed) > 495 + (dev->caps.max_counters - 1)) 496 + return 0; 497 + 498 + return counters_guaranteed; 480 499 } 481 500 482 501 int mlx4_init_resource_tracker(struct mlx4_dev *dev) ··· 503 484 struct mlx4_priv *priv = mlx4_priv(dev); 504 485 int i, j; 505 486 int t; 506 - int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev); 507 487 508 488 priv->mfunc.master.res_tracker.slave_list = 509 489 kcalloc(dev->num_slaves, sizeof(struct slave_list), ··· 621 603 break; 622 604 case RES_COUNTER: 623 605 res_alloc->quota[t] = dev->caps.max_counters; 624 - if (t == mlx4_master_func_num(dev)) 625 - res_alloc->guaranteed[t] = 626 - MLX4_PF_COUNTERS_PER_PORT * 627 - MLX4_MAX_PORTS; 628 - else if (t <= max_vfs_guarantee_counter) 629 - res_alloc->guaranteed[t] = 630 - MLX4_VF_COUNTERS_PER_PORT * 631 - MLX4_MAX_PORTS; 632 - else 633 - res_alloc->guaranteed[t] = 0; 606 + res_alloc->guaranteed[t] = 607 + mlx4_calc_res_counter_guaranteed(dev, res_alloc, t); 634 608 break; 635 609 default: 636 610 break;
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 345 345 u8 num_wqebbs; 346 346 u8 num_dma; 347 347 #ifdef CONFIG_MLX5_EN_TLS 348 - skb_frag_t *resync_dump_frag; 348 + struct page *resync_dump_frag_page; 349 349 #endif 350 350 }; 351 351 ··· 410 410 struct device *pdev; 411 411 __be32 mkey_be; 412 412 unsigned long state; 413 + unsigned int hw_mtu; 413 414 struct hwtstamp_config *tstamp; 414 415 struct mlx5_clock *clock; 415 416
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en/hv_vhca_stats.c
··· 141 141 "Failed to create hv vhca stats agent, err = %ld\n", 142 142 PTR_ERR(agent)); 143 143 144 - kfree(priv->stats_agent.buf); 144 + kvfree(priv->stats_agent.buf); 145 145 return IS_ERR_OR_NULL(agent); 146 146 } 147 147 ··· 157 157 return; 158 158 159 159 mlx5_hv_vhca_agent_destroy(priv->stats_agent.agent); 160 - kfree(priv->stats_agent.buf); 160 + kvfree(priv->stats_agent.buf); 161 161 }
+9 -3
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
··· 97 97 if (ret) 98 98 return ret; 99 99 100 - if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) 100 + if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) { 101 + ip_rt_put(rt); 101 102 return -ENETUNREACH; 103 + } 102 104 #else 103 105 return -EOPNOTSUPP; 104 106 #endif 105 107 106 108 ret = get_route_and_out_devs(priv, rt->dst.dev, route_dev, out_dev); 107 - if (ret < 0) 109 + if (ret < 0) { 110 + ip_rt_put(rt); 108 111 return ret; 112 + } 109 113 110 114 if (!(*out_ttl)) 111 115 *out_ttl = ip4_dst_hoplimit(&rt->dst); ··· 153 149 *out_ttl = ip6_dst_hoplimit(dst); 154 150 155 151 ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev); 156 - if (ret < 0) 152 + if (ret < 0) { 153 + dst_release(dst); 157 154 return ret; 155 + } 158 156 #else 159 157 return -EOPNOTSUPP; 160 158 #endif
+6 -7
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
··· 15 15 #else 16 16 /* TLS offload requires additional stop_room for: 17 17 * - a resync SKB. 18 - * kTLS offload requires additional stop_room for: 19 - * - static params WQE, 20 - * - progress params WQE, and 21 - * - resync DUMP per frag. 18 + * kTLS offload requires fixed additional stop_room for: 19 + * - a static params WQE, and a progress params WQE. 20 + * The additional MTU-depending room for the resync DUMP WQEs 21 + * will be calculated and added in runtime. 22 22 */ 23 23 #define MLX5E_SQ_TLS_ROOM \ 24 24 (MLX5_SEND_WQE_MAX_WQEBBS + \ 25 - MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS + \ 26 - MAX_SKB_FRAGS * MLX5E_KTLS_MAX_DUMP_WQEBBS) 25 + MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS) 27 26 #endif 28 27 29 28 #define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg *)NULL)->inline_hdr.start)) ··· 91 92 92 93 /* fill sq frag edge with nops to avoid wqe wrapping two pages */ 93 94 for (; wi < edge_wi; wi++) { 94 - wi->skb = NULL; 95 + memset(wi, 0, sizeof(*wi)); 95 96 wi->num_wqebbs = 1; 96 97 mlx5e_post_nop(wq, sq->sqn, &sq->pc); 97 98 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
··· 38 38 return -ENOMEM; 39 39 40 40 tx_priv->expected_seq = start_offload_tcp_sn; 41 - tx_priv->crypto_info = crypto_info; 41 + tx_priv->crypto_info = *(struct tls12_crypto_info_aes_gcm_128 *)crypto_info; 42 42 mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv); 43 43 44 44 /* tc and underlay_qpn values are not in use for tls tis */
+25 -4
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
··· 21 21 MLX5_ST_SZ_BYTES(tls_progress_params)) 22 22 #define MLX5E_KTLS_PROGRESS_WQEBBS \ 23 23 (DIV_ROUND_UP(MLX5E_KTLS_PROGRESS_WQE_SZ, MLX5_SEND_WQE_BB)) 24 - #define MLX5E_KTLS_MAX_DUMP_WQEBBS 2 24 + 25 + struct mlx5e_dump_wqe { 26 + struct mlx5_wqe_ctrl_seg ctrl; 27 + struct mlx5_wqe_data_seg data; 28 + }; 29 + 30 + #define MLX5E_KTLS_DUMP_WQEBBS \ 31 + (DIV_ROUND_UP(sizeof(struct mlx5e_dump_wqe), MLX5_SEND_WQE_BB)) 25 32 26 33 enum { 27 34 MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD = 0, ··· 44 37 45 38 struct mlx5e_ktls_offload_context_tx { 46 39 struct tls_offload_context_tx *tx_ctx; 47 - struct tls_crypto_info *crypto_info; 40 + struct tls12_crypto_info_aes_gcm_128 crypto_info; 48 41 u32 expected_seq; 49 42 u32 tisn; 50 43 u32 key_id; ··· 93 86 struct mlx5e_tx_wqe **wqe, u16 *pi); 94 87 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, 95 88 struct mlx5e_tx_wqe_info *wi, 96 - struct mlx5e_sq_dma *dma); 97 - 89 + u32 *dma_fifo_cc); 90 + static inline u8 91 + mlx5e_ktls_dumps_num_wqebbs(struct mlx5e_txqsq *sq, unsigned int nfrags, 92 + unsigned int sync_len) 93 + { 94 + /* Given the MTU and sync_len, calculates an upper bound for the 95 + * number of WQEBBs needed for the TX resync DUMP WQEs of a record. 96 + */ 97 + return MLX5E_KTLS_DUMP_WQEBBS * 98 + (nfrags + DIV_ROUND_UP(sync_len, sq->hw_mtu)); 99 + } 98 100 #else 99 101 100 102 static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv) 101 103 { 102 104 } 105 + 106 + static inline void 107 + mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, 108 + struct mlx5e_tx_wqe_info *wi, 109 + u32 *dma_fifo_cc) {} 103 110 104 111 #endif 105 112
+113 -75
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
··· 24 24 static void 25 25 fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx) 26 26 { 27 - struct tls_crypto_info *crypto_info = priv_tx->crypto_info; 28 - struct tls12_crypto_info_aes_gcm_128 *info; 27 + struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info; 29 28 char *initial_rn, *gcm_iv; 30 29 u16 salt_sz, rec_seq_sz; 31 30 char *salt, *rec_seq; 32 31 u8 tls_version; 33 32 34 - if (WARN_ON(crypto_info->cipher_type != TLS_CIPHER_AES_GCM_128)) 35 - return; 36 - 37 - info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info; 38 33 EXTRACT_INFO_FIELDS; 39 34 40 35 gcm_iv = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv); ··· 103 108 } 104 109 105 110 static void tx_fill_wi(struct mlx5e_txqsq *sq, 106 - u16 pi, u8 num_wqebbs, 107 - skb_frag_t *resync_dump_frag, 108 - u32 num_bytes) 111 + u16 pi, u8 num_wqebbs, u32 num_bytes, 112 + struct page *page) 109 113 { 110 114 struct mlx5e_tx_wqe_info *wi = &sq->db.wqe_info[pi]; 111 115 112 - wi->skb = NULL; 113 - wi->num_wqebbs = num_wqebbs; 114 - wi->resync_dump_frag = resync_dump_frag; 115 - wi->num_bytes = num_bytes; 116 + memset(wi, 0, sizeof(*wi)); 117 + wi->num_wqebbs = num_wqebbs; 118 + wi->num_bytes = num_bytes; 119 + wi->resync_dump_frag_page = page; 116 120 } 117 121 118 122 void mlx5e_ktls_tx_offload_set_pending(struct mlx5e_ktls_offload_context_tx *priv_tx) ··· 139 145 140 146 umr_wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_STATIC_UMR_WQE_SZ, &pi); 141 147 build_static_params(umr_wqe, sq->pc, sq->sqn, priv_tx, fence); 142 - tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, NULL, 0); 148 + tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, 0, NULL); 143 149 sq->pc += MLX5E_KTLS_STATIC_WQEBBS; 144 150 } 145 151 ··· 153 159 154 160 wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_PROGRESS_WQE_SZ, &pi); 155 161 build_progress_params(wqe, sq->pc, sq->sqn, priv_tx, fence); 156 - tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, NULL, 0); 162 + tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, 0, NULL); 157 163 sq->pc += MLX5E_KTLS_PROGRESS_WQEBBS; 158 164 } 159 165 ··· 163 169 bool skip_static_post, bool fence_first_post) 164 170 { 165 171 bool progress_fence = skip_static_post || !fence_first_post; 172 + struct mlx5_wq_cyc *wq = &sq->wq; 173 + u16 contig_wqebbs_room, pi; 174 + 175 + pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc); 176 + contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); 177 + if (unlikely(contig_wqebbs_room < 178 + MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS)) 179 + mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); 166 180 167 181 if (!skip_static_post) 168 182 post_static_params(sq, priv_tx, fence_first_post); ··· 182 180 u64 rcd_sn; 183 181 s32 sync_len; 184 182 int nr_frags; 185 - skb_frag_t *frags[MAX_SKB_FRAGS]; 183 + skb_frag_t frags[MAX_SKB_FRAGS]; 186 184 }; 187 185 188 - static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, 189 - u32 tcp_seq, struct tx_sync_info *info) 186 + enum mlx5e_ktls_sync_retval { 187 + MLX5E_KTLS_SYNC_DONE, 188 + MLX5E_KTLS_SYNC_FAIL, 189 + MLX5E_KTLS_SYNC_SKIP_NO_DATA, 190 + }; 191 + 192 + static enum mlx5e_ktls_sync_retval 193 + tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, 194 + u32 tcp_seq, struct tx_sync_info *info) 190 195 { 191 196 struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx; 197 + enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE; 192 198 struct tls_record_info *record; 193 199 int remaining, i = 0; 194 200 unsigned long flags; 195 - bool ret = true; 196 201 197 202 spin_lock_irqsave(&tx_ctx->lock, flags); 198 203 record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn); 199 204 200 205 if (unlikely(!record)) { 201 - ret = false; 206 + ret = MLX5E_KTLS_SYNC_FAIL; 202 207 goto out; 203 208 } 204 209 205 210 if (unlikely(tcp_seq < tls_record_start_seq(record))) { 206 - if (!tls_record_is_start_marker(record)) 207 - ret = false; 211 + ret = tls_record_is_start_marker(record) ? 212 + MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL; 208 213 goto out; 209 214 } 210 215 ··· 220 211 while (remaining > 0) { 221 212 skb_frag_t *frag = &record->frags[i]; 222 213 223 - __skb_frag_ref(frag); 214 + get_page(skb_frag_page(frag)); 224 215 remaining -= skb_frag_size(frag); 225 - info->frags[i++] = frag; 216 + info->frags[i++] = *frag; 226 217 } 227 218 /* reduce the part which will be sent with the original SKB */ 228 219 if (remaining < 0) 229 - skb_frag_size_add(info->frags[i - 1], remaining); 220 + skb_frag_size_add(&info->frags[i - 1], remaining); 230 221 info->nr_frags = i; 231 222 out: 232 223 spin_unlock_irqrestore(&tx_ctx->lock, flags); ··· 238 229 struct mlx5e_ktls_offload_context_tx *priv_tx, 239 230 u64 rcd_sn) 240 231 { 241 - struct tls_crypto_info *crypto_info = priv_tx->crypto_info; 242 - struct tls12_crypto_info_aes_gcm_128 *info; 232 + struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info; 243 233 __be64 rn_be = cpu_to_be64(rcd_sn); 244 234 bool skip_static_post; 245 235 u16 rec_seq_sz; 246 236 char *rec_seq; 247 237 248 - if (WARN_ON(crypto_info->cipher_type != TLS_CIPHER_AES_GCM_128)) 249 - return; 250 - 251 - info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info; 252 238 rec_seq = info->rec_seq; 253 239 rec_seq_sz = sizeof(info->rec_seq); 254 240 ··· 254 250 mlx5e_ktls_tx_post_param_wqes(sq, priv_tx, skip_static_post, true); 255 251 } 256 252 257 - struct mlx5e_dump_wqe { 258 - struct mlx5_wqe_ctrl_seg ctrl; 259 - struct mlx5_wqe_data_seg data; 260 - }; 261 - 262 253 static int 263 254 tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool first) 264 255 { ··· 261 262 struct mlx5_wqe_data_seg *dseg; 262 263 struct mlx5e_dump_wqe *wqe; 263 264 dma_addr_t dma_addr = 0; 264 - u8 num_wqebbs; 265 265 u16 ds_cnt; 266 266 int fsz; 267 267 u16 pi; ··· 268 270 wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi); 269 271 270 272 ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS; 271 - num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); 272 273 273 274 cseg = &wqe->ctrl; 274 275 dseg = &wqe->data; ··· 288 291 dseg->byte_count = cpu_to_be32(fsz); 289 292 mlx5e_dma_push(sq, dma_addr, fsz, MLX5E_DMA_MAP_PAGE); 290 293 291 - tx_fill_wi(sq, pi, num_wqebbs, frag, fsz); 292 - sq->pc += num_wqebbs; 293 - 294 - WARN(num_wqebbs > MLX5E_KTLS_MAX_DUMP_WQEBBS, 295 - "unexpected DUMP num_wqebbs, %d > %d", 296 - num_wqebbs, MLX5E_KTLS_MAX_DUMP_WQEBBS); 294 + tx_fill_wi(sq, pi, MLX5E_KTLS_DUMP_WQEBBS, fsz, skb_frag_page(frag)); 295 + sq->pc += MLX5E_KTLS_DUMP_WQEBBS; 297 296 298 297 return 0; 299 298 } 300 299 301 300 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, 302 301 struct mlx5e_tx_wqe_info *wi, 303 - struct mlx5e_sq_dma *dma) 302 + u32 *dma_fifo_cc) 304 303 { 305 - struct mlx5e_sq_stats *stats = sq->stats; 304 + struct mlx5e_sq_stats *stats; 305 + struct mlx5e_sq_dma *dma; 306 + 307 + if (!wi->resync_dump_frag_page) 308 + return; 309 + 310 + dma = mlx5e_dma_get(sq, (*dma_fifo_cc)++); 311 + stats = sq->stats; 306 312 307 313 mlx5e_tx_dma_unmap(sq->pdev, dma); 308 - __skb_frag_unref(wi->resync_dump_frag); 314 + put_page(wi->resync_dump_frag_page); 309 315 stats->tls_dump_packets++; 310 316 stats->tls_dump_bytes += wi->num_bytes; 311 317 } ··· 318 318 struct mlx5_wq_cyc *wq = &sq->wq; 319 319 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc); 320 320 321 - tx_fill_wi(sq, pi, 1, NULL, 0); 321 + tx_fill_wi(sq, pi, 1, 0, NULL); 322 322 323 323 mlx5e_post_nop_fence(wq, sq->sqn, &sq->pc); 324 324 } 325 325 326 - static struct sk_buff * 326 + static enum mlx5e_ktls_sync_retval 327 327 mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, 328 328 struct mlx5e_txqsq *sq, 329 - struct sk_buff *skb, 329 + int datalen, 330 330 u32 seq) 331 331 { 332 332 struct mlx5e_sq_stats *stats = sq->stats; 333 333 struct mlx5_wq_cyc *wq = &sq->wq; 334 + enum mlx5e_ktls_sync_retval ret; 334 335 struct tx_sync_info info = {}; 335 336 u16 contig_wqebbs_room, pi; 336 337 u8 num_wqebbs; 337 - int i; 338 + int i = 0; 338 339 339 - if (!tx_sync_info_get(priv_tx, seq, &info)) { 340 + ret = tx_sync_info_get(priv_tx, seq, &info); 341 + if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) { 342 + if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) { 343 + stats->tls_skip_no_sync_data++; 344 + return MLX5E_KTLS_SYNC_SKIP_NO_DATA; 345 + } 340 346 /* We might get here if a retransmission reaches the driver 341 347 * after the relevant record is acked. 342 348 * It should be safe to drop the packet in this case ··· 352 346 } 353 347 354 348 if (unlikely(info.sync_len < 0)) { 355 - u32 payload; 356 - int headln; 357 - 358 - headln = skb_transport_offset(skb) + tcp_hdrlen(skb); 359 - payload = skb->len - headln; 360 - if (likely(payload <= -info.sync_len)) 361 - return skb; 349 + if (likely(datalen <= -info.sync_len)) 350 + return MLX5E_KTLS_SYNC_DONE; 362 351 363 352 stats->tls_drop_bypass_req++; 364 353 goto err_out; ··· 361 360 362 361 stats->tls_ooo++; 363 362 364 - num_wqebbs = MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS + 365 - (info.nr_frags ? info.nr_frags * MLX5E_KTLS_MAX_DUMP_WQEBBS : 1); 363 + tx_post_resync_params(sq, priv_tx, info.rcd_sn); 364 + 365 + /* If no dump WQE was sent, we need to have a fence NOP WQE before the 366 + * actual data xmit. 367 + */ 368 + if (!info.nr_frags) { 369 + tx_post_fence_nop(sq); 370 + return MLX5E_KTLS_SYNC_DONE; 371 + } 372 + 373 + num_wqebbs = mlx5e_ktls_dumps_num_wqebbs(sq, info.nr_frags, info.sync_len); 366 374 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc); 367 375 contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); 376 + 368 377 if (unlikely(contig_wqebbs_room < num_wqebbs)) 369 378 mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); 370 379 371 380 tx_post_resync_params(sq, priv_tx, info.rcd_sn); 372 381 373 - for (i = 0; i < info.nr_frags; i++) 374 - if (tx_post_resync_dump(sq, info.frags[i], priv_tx->tisn, !i)) 375 - goto err_out; 382 + for (; i < info.nr_frags; i++) { 383 + unsigned int orig_fsz, frag_offset = 0, n = 0; 384 + skb_frag_t *f = &info.frags[i]; 376 385 377 - /* If no dump WQE was sent, we need to have a fence NOP WQE before the 378 - * actual data xmit. 379 - */ 380 - if (!info.nr_frags) 381 - tx_post_fence_nop(sq); 386 + orig_fsz = skb_frag_size(f); 382 387 383 - return skb; 388 + do { 389 + bool fence = !(i || frag_offset); 390 + unsigned int fsz; 391 + 392 + n++; 393 + fsz = min_t(unsigned int, sq->hw_mtu, orig_fsz - frag_offset); 394 + skb_frag_size_set(f, fsz); 395 + if (tx_post_resync_dump(sq, f, priv_tx->tisn, fence)) { 396 + page_ref_add(skb_frag_page(f), n - 1); 397 + goto err_out; 398 + } 399 + 400 + skb_frag_off_add(f, fsz); 401 + frag_offset += fsz; 402 + } while (frag_offset < orig_fsz); 403 + 404 + page_ref_add(skb_frag_page(f), n - 1); 405 + } 406 + 407 + return MLX5E_KTLS_SYNC_DONE; 384 408 385 409 err_out: 386 - dev_kfree_skb_any(skb); 387 - return NULL; 410 + for (; i < info.nr_frags; i++) 411 + /* The put_page() here undoes the page ref obtained in tx_sync_info_get(). 412 + * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be 413 + * released only upon their completions (or in mlx5e_free_txqsq_descs, 414 + * if channel closes). 415 + */ 416 + put_page(skb_frag_page(&info.frags[i])); 417 + 418 + return MLX5E_KTLS_SYNC_FAIL; 388 419 } 389 420 390 421 struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, ··· 452 419 453 420 seq = ntohl(tcp_hdr(skb)->seq); 454 421 if (unlikely(priv_tx->expected_seq != seq)) { 455 - skb = mlx5e_ktls_tx_handle_ooo(priv_tx, sq, skb, seq); 456 - if (unlikely(!skb)) 422 + enum mlx5e_ktls_sync_retval ret = 423 + mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq); 424 + 425 + if (likely(ret == MLX5E_KTLS_SYNC_DONE)) 426 + *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi); 427 + else if (ret == MLX5E_KTLS_SYNC_FAIL) 428 + goto err_out; 429 + else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */ 457 430 goto out; 458 - *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi); 459 431 } 460 432 461 433 priv_tx->expected_seq = seq + datalen;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 1021 1021 { 1022 1022 #define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT 1023 1023 int size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT; 1024 - __ETHTOOL_DECLARE_LINK_MODE_MASK(modes); 1024 + __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = {0,}; 1025 1025 1026 1026 bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size); 1027 1027 return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);
+11 -2
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 1128 1128 sq->txq_ix = txq_ix; 1129 1129 sq->uar_map = mdev->mlx5e_res.bfreg.map; 1130 1130 sq->min_inline_mode = params->tx_min_inline_mode; 1131 + sq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu); 1131 1132 sq->stats = &c->priv->channel_stats[c->ix].sq[tc]; 1132 1133 sq->stop_room = MLX5E_SQ_STOP_ROOM; 1133 1134 INIT_WORK(&sq->recover_work, mlx5e_tx_err_cqe_work); ··· 1136 1135 set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state); 1137 1136 if (MLX5_IPSEC_DEV(c->priv->mdev)) 1138 1137 set_bit(MLX5E_SQ_STATE_IPSEC, &sq->state); 1138 + #ifdef CONFIG_MLX5_EN_TLS 1139 1139 if (mlx5_accel_is_tls_device(c->priv->mdev)) { 1140 1140 set_bit(MLX5E_SQ_STATE_TLS, &sq->state); 1141 - sq->stop_room += MLX5E_SQ_TLS_ROOM; 1141 + sq->stop_room += MLX5E_SQ_TLS_ROOM + 1142 + mlx5e_ktls_dumps_num_wqebbs(sq, MAX_SKB_FRAGS, 1143 + TLS_MAX_PAYLOAD_SIZE); 1142 1144 } 1145 + #endif 1143 1146 1144 1147 param->wq.db_numa_node = cpu_to_node(c->cpu); 1145 1148 err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl); ··· 1354 1349 /* last doorbell out, godspeed .. */ 1355 1350 if (mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, 1)) { 1356 1351 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc); 1352 + struct mlx5e_tx_wqe_info *wi; 1357 1353 struct mlx5e_tx_wqe *nop; 1358 1354 1359 - sq->db.wqe_info[pi].skb = NULL; 1355 + wi = &sq->db.wqe_info[pi]; 1356 + 1357 + memset(wi, 0, sizeof(*wi)); 1358 + wi->num_wqebbs = 1; 1360 1359 nop = mlx5e_post_nop(wq, sq->sqn, &sq->pc); 1361 1360 mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nop->ctrl); 1362 1361 }
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 611 611 612 612 mutex_lock(&esw->offloads.encap_tbl_lock); 613 613 encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID); 614 - if (e->compl_result || (encap_connected == neigh_connected && 615 - ether_addr_equal(e->h_dest, ha))) 614 + if (e->compl_result < 0 || (encap_connected == neigh_connected && 615 + ether_addr_equal(e->h_dest, ha))) 616 616 goto unlock; 617 617 618 618 mlx5e_take_all_encap_flows(e, &flow_list);
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 1386 1386 if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state))) 1387 1387 return 0; 1388 1388 1389 - if (rq->cqd.left) 1389 + if (rq->cqd.left) { 1390 1390 work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget); 1391 + if (rq->cqd.left || work_done >= budget) 1392 + goto out; 1393 + } 1391 1394 1392 1395 cqe = mlx5_cqwq_get_cqe(cqwq); 1393 1396 if (!cqe) {
+3 -12
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
··· 35 35 #include <linux/udp.h> 36 36 #include <net/udp.h> 37 37 #include "en.h" 38 + #include "en/port.h" 38 39 39 40 enum { 40 41 MLX5E_ST_LINK_STATE, ··· 81 80 82 81 static int mlx5e_test_link_speed(struct mlx5e_priv *priv) 83 82 { 84 - u32 out[MLX5_ST_SZ_DW(ptys_reg)]; 85 - u32 eth_proto_oper; 86 - int i; 83 + u32 speed; 87 84 88 85 if (!netif_carrier_ok(priv->netdev)) 89 86 return 1; 90 87 91 - if (mlx5_query_port_ptys(priv->mdev, out, sizeof(out), MLX5_PTYS_EN, 1)) 92 - return 1; 93 - 94 - eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); 95 - for (i = 0; i < MLX5E_LINK_MODES_NUMBER; i++) { 96 - if (eth_proto_oper & MLX5E_PROT_MASK(i)) 97 - return 0; 98 - } 99 - return 1; 88 + return mlx5e_port_linkspeed(priv->mdev, &speed); 100 89 } 101 90 102 91 struct mlx5ehdr {
+12 -8
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 52 52 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_bytes) }, 53 53 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ctx) }, 54 54 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ooo) }, 55 - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_resync_bytes) }, 56 - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) }, 57 - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_bypass_req) }, 58 55 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_packets) }, 59 56 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_bytes) }, 57 + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_resync_bytes) }, 58 + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_skip_no_sync_data) }, 59 + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) }, 60 + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_bypass_req) }, 60 61 #endif 61 62 62 63 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) }, ··· 289 288 s->tx_tls_encrypted_bytes += sq_stats->tls_encrypted_bytes; 290 289 s->tx_tls_ctx += sq_stats->tls_ctx; 291 290 s->tx_tls_ooo += sq_stats->tls_ooo; 292 - s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes; 293 - s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data; 294 - s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req; 295 291 s->tx_tls_dump_bytes += sq_stats->tls_dump_bytes; 296 292 s->tx_tls_dump_packets += sq_stats->tls_dump_packets; 293 + s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes; 294 + s->tx_tls_skip_no_sync_data += sq_stats->tls_skip_no_sync_data; 295 + s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data; 296 + s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req; 297 297 #endif 298 298 s->tx_cqes += sq_stats->cqes; 299 299 } ··· 1474 1472 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_bytes) }, 1475 1473 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ctx) }, 1476 1474 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ooo) }, 1477 - { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_no_sync_data) }, 1478 - { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_bypass_req) }, 1479 1475 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_packets) }, 1480 1476 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_bytes) }, 1477 + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_resync_bytes) }, 1478 + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_skip_no_sync_data) }, 1479 + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_no_sync_data) }, 1480 + { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_bypass_req) }, 1481 1481 #endif 1482 1482 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) }, 1483 1483 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
+8 -6
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
··· 129 129 u64 tx_tls_encrypted_bytes; 130 130 u64 tx_tls_ctx; 131 131 u64 tx_tls_ooo; 132 - u64 tx_tls_resync_bytes; 133 - u64 tx_tls_drop_no_sync_data; 134 - u64 tx_tls_drop_bypass_req; 135 132 u64 tx_tls_dump_packets; 136 133 u64 tx_tls_dump_bytes; 134 + u64 tx_tls_resync_bytes; 135 + u64 tx_tls_skip_no_sync_data; 136 + u64 tx_tls_drop_no_sync_data; 137 + u64 tx_tls_drop_bypass_req; 137 138 #endif 138 139 139 140 u64 rx_xsk_packets; ··· 274 273 u64 tls_encrypted_bytes; 275 274 u64 tls_ctx; 276 275 u64 tls_ooo; 277 - u64 tls_resync_bytes; 278 - u64 tls_drop_no_sync_data; 279 - u64 tls_drop_bypass_req; 280 276 u64 tls_dump_packets; 281 277 u64 tls_dump_bytes; 278 + u64 tls_resync_bytes; 279 + u64 tls_skip_no_sync_data; 280 + u64 tls_drop_no_sync_data; 281 + u64 tls_drop_bypass_req; 282 282 #endif 283 283 /* less likely accessed in data path */ 284 284 u64 csum_none;
+28 -8
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1278 1278 mlx5_eswitch_del_vlan_action(esw, attr); 1279 1279 1280 1280 for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++) 1281 - if (attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP) 1281 + if (attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP) { 1282 1282 mlx5e_detach_encap(priv, flow, out_index); 1283 + kfree(attr->parse_attr->tun_info[out_index]); 1284 + } 1283 1285 kvfree(attr->parse_attr); 1284 1286 1285 1287 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) ··· 1561 1559 mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat); 1562 1560 } 1563 1561 1562 + kfree(e->tun_info); 1564 1563 kfree(e->encap_header); 1565 1564 kfree_rcu(e, rcu); 1566 1565 } ··· 2975 2972 return NULL; 2976 2973 } 2977 2974 2975 + static struct ip_tunnel_info *dup_tun_info(const struct ip_tunnel_info *tun_info) 2976 + { 2977 + size_t tun_size = sizeof(*tun_info) + tun_info->options_len; 2978 + 2979 + return kmemdup(tun_info, tun_size, GFP_KERNEL); 2980 + } 2981 + 2978 2982 static int mlx5e_attach_encap(struct mlx5e_priv *priv, 2979 2983 struct mlx5e_tc_flow *flow, 2980 2984 struct net_device *mirred_dev, ··· 3038 3028 refcount_set(&e->refcnt, 1); 3039 3029 init_completion(&e->res_ready); 3040 3030 3031 + tun_info = dup_tun_info(tun_info); 3032 + if (!tun_info) { 3033 + err = -ENOMEM; 3034 + goto out_err_init; 3035 + } 3041 3036 e->tun_info = tun_info; 3042 3037 err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack); 3043 - if (err) { 3044 - kfree(e); 3045 - e = NULL; 3046 - goto out_err; 3047 - } 3038 + if (err) 3039 + goto out_err_init; 3048 3040 3049 3041 INIT_LIST_HEAD(&e->flows); 3050 3042 hash_add_rcu(esw->offloads.encap_tbl, &e->encap_hlist, hash_key); ··· 3086 3074 mutex_unlock(&esw->offloads.encap_tbl_lock); 3087 3075 if (e) 3088 3076 mlx5e_encap_put(priv, e); 3077 + return err; 3078 + 3079 + out_err_init: 3080 + mutex_unlock(&esw->offloads.encap_tbl_lock); 3081 + kfree(tun_info); 3082 + kfree(e); 3089 3083 return err; 3090 3084 } 3091 3085 ··· 3178 3160 struct mlx5_esw_flow_attr *attr, 3179 3161 u32 *action) 3180 3162 { 3181 - int nest_level = vlan_get_encap_level(attr->parse_attr->filter_dev); 3163 + int nest_level = attr->parse_attr->filter_dev->lower_level; 3182 3164 struct flow_action_entry vlan_act = { 3183 3165 .id = FLOW_ACTION_VLAN_POP, 3184 3166 }; ··· 3313 3295 } else if (encap) { 3314 3296 parse_attr->mirred_ifindex[attr->out_count] = 3315 3297 out_dev->ifindex; 3316 - parse_attr->tun_info[attr->out_count] = info; 3298 + parse_attr->tun_info[attr->out_count] = dup_tun_info(info); 3299 + if (!parse_attr->tun_info[attr->out_count]) 3300 + return -ENOMEM; 3317 3301 encap = false; 3318 3302 attr->dests[attr->out_count].flags |= 3319 3303 MLX5_ESW_DEST_ENCAP;
+20 -15
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 403 403 static void mlx5e_dump_error_cqe(struct mlx5e_txqsq *sq, 404 404 struct mlx5_err_cqe *err_cqe) 405 405 { 406 - u32 ci = mlx5_cqwq_get_ci(&sq->cq.wq); 406 + struct mlx5_cqwq *wq = &sq->cq.wq; 407 + u32 ci; 408 + 409 + ci = mlx5_cqwq_ctr2ix(wq, wq->cc - 1); 407 410 408 411 netdev_err(sq->channel->netdev, 409 412 "Error cqe on cqn 0x%x, ci 0x%x, sqn 0x%x, opcode 0x%x, syndrome 0x%x, vendor syndrome 0x%x\n", ··· 482 479 skb = wi->skb; 483 480 484 481 if (unlikely(!skb)) { 485 - #ifdef CONFIG_MLX5_EN_TLS 486 - if (wi->resync_dump_frag) { 487 - struct mlx5e_sq_dma *dma = 488 - mlx5e_dma_get(sq, dma_fifo_cc++); 489 - 490 - mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, dma); 491 - } 492 - #endif 482 + mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc); 493 483 sqcc += wi->num_wqebbs; 494 484 continue; 495 485 } ··· 538 542 { 539 543 struct mlx5e_tx_wqe_info *wi; 540 544 struct sk_buff *skb; 545 + u32 dma_fifo_cc; 546 + u16 sqcc; 541 547 u16 ci; 542 548 int i; 543 549 544 - while (sq->cc != sq->pc) { 545 - ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sq->cc); 550 + sqcc = sq->cc; 551 + dma_fifo_cc = sq->dma_fifo_cc; 552 + 553 + while (sqcc != sq->pc) { 554 + ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc); 546 555 wi = &sq->db.wqe_info[ci]; 547 556 skb = wi->skb; 548 557 549 - if (!skb) { /* nop */ 550 - sq->cc++; 558 + if (!skb) { 559 + mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc); 560 + sqcc += wi->num_wqebbs; 551 561 continue; 552 562 } 553 563 554 564 for (i = 0; i < wi->num_dma; i++) { 555 565 struct mlx5e_sq_dma *dma = 556 - mlx5e_dma_get(sq, sq->dma_fifo_cc++); 566 + mlx5e_dma_get(sq, dma_fifo_cc++); 557 567 558 568 mlx5e_tx_dma_unmap(sq->pdev, dma); 559 569 } 560 570 561 571 dev_kfree_skb_any(skb); 562 - sq->cc += wi->num_wqebbs; 572 + sqcc += wi->num_wqebbs; 563 573 } 574 + 575 + sq->dma_fifo_cc = dma_fifo_cc; 576 + sq->cc = sqcc; 564 577 } 565 578 566 579 #ifdef CONFIG_MLX5_CORE_IPOIB
-1
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 285 285 286 286 mlx5_eswitch_set_rule_source_port(esw, spec, attr); 287 287 288 - spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 289 288 if (attr->outer_match_level != MLX5_MATCH_NONE) 290 289 spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS; 291 290
+16 -6
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
··· 177 177 memset(&src->vlan[1], 0, sizeof(src->vlan[1])); 178 178 } 179 179 180 + static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw, 181 + const struct mlx5_flow_spec *spec) 182 + { 183 + u32 port_mask, port_value; 184 + 185 + if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source)) 186 + return spec->flow_context.flow_source == MLX5_VPORT_UPLINK; 187 + 188 + port_mask = MLX5_GET(fte_match_param, spec->match_criteria, 189 + misc_parameters.source_port); 190 + port_value = MLX5_GET(fte_match_param, spec->match_value, 191 + misc_parameters.source_port); 192 + return (port_mask & port_value & 0xffff) == MLX5_VPORT_UPLINK; 193 + } 194 + 180 195 bool 181 196 mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, 182 197 struct mlx5_flow_act *flow_act, 183 198 struct mlx5_flow_spec *spec) 184 199 { 185 - u32 port_mask = MLX5_GET(fte_match_param, spec->match_criteria, 186 - misc_parameters.source_port); 187 - u32 port_value = MLX5_GET(fte_match_param, spec->match_value, 188 - misc_parameters.source_port); 189 - 190 200 if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table)) 191 201 return false; 192 202 193 203 /* push vlan on RX */ 194 204 return (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) && 195 - ((port_mask & port_value) == MLX5_VPORT_UPLINK); 205 + mlx5_eswitch_offload_is_uplink_port(esw, spec); 196 206 } 197 207 198 208 struct mlx5_flow_handle *
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c
··· 464 464 } 465 465 466 466 err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn); 467 - if (err) 467 + if (err) { 468 + kvfree(in); 468 469 goto err_cqwq; 470 + } 469 471 470 472 cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context); 471 473 MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size));
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 507 507 MLX5_SET(dest_format_struct, in_dests, 508 508 destination_eswitch_owner_vhca_id, 509 509 dst->dest_attr.vport.vhca_id); 510 - if (extended_dest) { 510 + if (extended_dest && 511 + dst->dest_attr.vport.pkt_reformat) { 511 512 MLX5_SET(dest_format_struct, in_dests, 512 513 packet_reformat, 513 514 !!(dst->dest_attr.vport.flags &
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 572 572 return -ENOMEM; 573 573 err = mlx5_crdump_collect(dev, cr_data); 574 574 if (err) 575 - return err; 575 + goto free_data; 576 576 577 577 if (priv_ctx) { 578 578 struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;
+2 -2
drivers/net/ethernet/mellanox/mlxsw/core.c
··· 1186 1186 if (err) 1187 1187 goto err_thermal_init; 1188 1188 1189 - if (mlxsw_driver->params_register && !reload) 1189 + if (mlxsw_driver->params_register) 1190 1190 devlink_params_publish(devlink); 1191 1191 1192 1192 return 0; ··· 1259 1259 return; 1260 1260 } 1261 1261 1262 - if (mlxsw_core->driver->params_unregister && !reload) 1262 + if (mlxsw_core->driver->params_unregister) 1263 1263 devlink_params_unpublish(devlink); 1264 1264 mlxsw_thermal_fini(mlxsw_core->thermal); 1265 1265 mlxsw_hwmon_fini(mlxsw_core->hwmon);
+9 -2
drivers/net/ethernet/mscc/ocelot.c
··· 261 261 port->pvid = vid; 262 262 263 263 /* Untagged egress vlan clasification */ 264 - if (untagged) 264 + if (untagged && port->vid != vid) { 265 + if (port->vid) { 266 + dev_err(ocelot->dev, 267 + "Port already has a native VLAN: %d\n", 268 + port->vid); 269 + return -EBUSY; 270 + } 265 271 port->vid = vid; 272 + } 266 273 267 274 ocelot_vlan_port_apply(ocelot, port); 268 275 ··· 941 934 static int ocelot_vlan_rx_add_vid(struct net_device *dev, __be16 proto, 942 935 u16 vid) 943 936 { 944 - return ocelot_vlan_vid_add(dev, vid, false, true); 937 + return ocelot_vlan_vid_add(dev, vid, false, false); 945 938 } 946 939 947 940 static int ocelot_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
-18
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
··· 299 299 nfp_port_free(repr->port); 300 300 } 301 301 302 - static struct lock_class_key nfp_repr_netdev_xmit_lock_key; 303 - static struct lock_class_key nfp_repr_netdev_addr_lock_key; 304 - 305 - static void nfp_repr_set_lockdep_class_one(struct net_device *dev, 306 - struct netdev_queue *txq, 307 - void *_unused) 308 - { 309 - lockdep_set_class(&txq->_xmit_lock, &nfp_repr_netdev_xmit_lock_key); 310 - } 311 - 312 - static void nfp_repr_set_lockdep_class(struct net_device *dev) 313 - { 314 - lockdep_set_class(&dev->addr_list_lock, &nfp_repr_netdev_addr_lock_key); 315 - netdev_for_each_tx_queue(dev, nfp_repr_set_lockdep_class_one, NULL); 316 - } 317 - 318 302 int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, 319 303 u32 cmsg_port_id, struct nfp_port *port, 320 304 struct net_device *pf_netdev) ··· 307 323 struct nfp_net *nn = netdev_priv(pf_netdev); 308 324 u32 repr_cap = nn->tlv_caps.repr_cap; 309 325 int err; 310 - 311 - nfp_repr_set_lockdep_class(netdev); 312 326 313 327 repr->port = port; 314 328 repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, GFP_KERNEL);
+2
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ 3 3 4 + #include <linux/printk.h> 5 + #include <linux/dynamic_debug.h> 4 6 #include <linux/netdevice.h> 5 7 #include <linux/etherdevice.h> 6 8 #include <linux/rtnetlink.h>
+2
drivers/net/ethernet/pensando/ionic/ionic_main.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ 3 3 4 + #include <linux/printk.h> 5 + #include <linux/dynamic_debug.h> 4 6 #include <linux/module.h> 5 7 #include <linux/netdevice.h> 6 8 #include <linux/utsname.h>
+21 -6
drivers/net/ethernet/qlogic/qed/qed_main.c
··· 67 67 #define QED_ROCE_QPS (8192) 68 68 #define QED_ROCE_DPIS (8) 69 69 #define QED_RDMA_SRQS QED_ROCE_QPS 70 - #define QED_NVM_CFG_SET_FLAGS 0xE 71 - #define QED_NVM_CFG_SET_PF_FLAGS 0x1E 72 70 #define QED_NVM_CFG_GET_FLAGS 0xA 73 71 #define QED_NVM_CFG_GET_PF_FLAGS 0x1A 72 + #define QED_NVM_CFG_MAX_ATTRS 50 74 73 75 74 static char version[] = 76 75 "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n"; ··· 2254 2255 { 2255 2256 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev); 2256 2257 u8 entity_id, len, buf[32]; 2258 + bool need_nvm_init = true; 2257 2259 struct qed_ptt *ptt; 2258 2260 u16 cfg_id, count; 2259 2261 int rc = 0, i; ··· 2271 2271 2272 2272 DP_VERBOSE(cdev, NETIF_MSG_DRV, 2273 2273 "Read config ids: num_attrs = %0d\n", count); 2274 - /* NVM CFG ID attributes */ 2275 - for (i = 0; i < count; i++) { 2274 + /* NVM CFG ID attributes. Start loop index from 1 to avoid additional 2275 + * arithmetic operations in the implementation. 2276 + */ 2277 + for (i = 1; i <= count; i++) { 2276 2278 cfg_id = *((u16 *)*data); 2277 2279 *data += 2; 2278 2280 entity_id = **data; ··· 2284 2282 memcpy(buf, *data, len); 2285 2283 *data += len; 2286 2284 2287 - flags = entity_id ? QED_NVM_CFG_SET_PF_FLAGS : 2288 - QED_NVM_CFG_SET_FLAGS; 2285 + flags = 0; 2286 + if (need_nvm_init) { 2287 + flags |= QED_NVM_CFG_OPTION_INIT; 2288 + need_nvm_init = false; 2289 + } 2290 + 2291 + /* Commit to flash and free the resources */ 2292 + if (!(i % QED_NVM_CFG_MAX_ATTRS) || i == count) { 2293 + flags |= QED_NVM_CFG_OPTION_COMMIT | 2294 + QED_NVM_CFG_OPTION_FREE; 2295 + need_nvm_init = true; 2296 + } 2297 + 2298 + if (entity_id) 2299 + flags |= QED_NVM_CFG_OPTION_ENTITY_SEL; 2289 2300 2290 2301 DP_VERBOSE(cdev, NETIF_MSG_DRV, 2291 2302 "cfg_id = %d entity = %d len = %d\n", cfg_id,
+1 -1
drivers/net/ethernet/qlogic/qed/qed_sriov.c
··· 2005 2005 (qed_iov_validate_active_txq(p_hwfn, vf))) { 2006 2006 vf->b_malicious = true; 2007 2007 DP_NOTICE(p_hwfn, 2008 - "VF [%02x] - considered malicious; Unable to stop RX/TX queuess\n", 2008 + "VF [%02x] - considered malicious; Unable to stop RX/TX queues\n", 2009 2009 vf->abs_vf_id); 2010 2010 status = PFVF_STATUS_MALICIOUS; 2011 2011 goto out;
+4
drivers/net/ethernet/realtek/r8169_main.c
··· 1029 1029 { 1030 1030 int value; 1031 1031 1032 + /* Work around issue with chip reporting wrong PHY ID */ 1033 + if (reg == MII_PHYSID2) 1034 + return 0xc912; 1035 + 1032 1036 r8168dp_2_mdio_start(tp); 1033 1037 1034 1038 value = r8169_mdio_read(tp, reg);
+1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2995 2995 } else { 2996 2996 stmmac_set_desc_addr(priv, first, des); 2997 2997 tmp_pay_len = pay_len; 2998 + des += proto_hdr_len; 2998 2999 } 2999 3000 3000 3001 stmmac_tso_allocator(priv, des, tmp_pay_len, (nfrags == 0), queue);
+14 -1
drivers/net/fjes/fjes_main.c
··· 1237 1237 adapter->open_guard = false; 1238 1238 1239 1239 adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0); 1240 + if (unlikely(!adapter->txrx_wq)) { 1241 + err = -ENOMEM; 1242 + goto err_free_netdev; 1243 + } 1244 + 1240 1245 adapter->control_wq = alloc_workqueue(DRV_NAME "/control", 1241 1246 WQ_MEM_RECLAIM, 0); 1247 + if (unlikely(!adapter->control_wq)) { 1248 + err = -ENOMEM; 1249 + goto err_free_txrx_wq; 1250 + } 1242 1251 1243 1252 INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task); 1244 1253 INIT_WORK(&adapter->raise_intr_rxdata_task, ··· 1264 1255 hw->hw_res.irq = platform_get_irq(plat_dev, 0); 1265 1256 err = fjes_hw_init(&adapter->hw); 1266 1257 if (err) 1267 - goto err_free_netdev; 1258 + goto err_free_control_wq; 1268 1259 1269 1260 /* setup MAC address (02:00:00:00:00:[epid])*/ 1270 1261 netdev->dev_addr[0] = 2; ··· 1286 1277 1287 1278 err_hw_exit: 1288 1279 fjes_hw_exit(&adapter->hw); 1280 + err_free_control_wq: 1281 + destroy_workqueue(adapter->control_wq); 1282 + err_free_txrx_wq: 1283 + destroy_workqueue(adapter->txrx_wq); 1289 1284 err_free_netdev: 1290 1285 free_netdev(netdev); 1291 1286 err_out:
-22
drivers/net/hamradio/bpqether.c
··· 107 107 108 108 static LIST_HEAD(bpq_devices); 109 109 110 - /* 111 - * bpqether network devices are paired with ethernet devices below them, so 112 - * form a special "super class" of normal ethernet devices; split their locks 113 - * off into a separate class since they always nest. 114 - */ 115 - static struct lock_class_key bpq_netdev_xmit_lock_key; 116 - static struct lock_class_key bpq_netdev_addr_lock_key; 117 - 118 - static void bpq_set_lockdep_class_one(struct net_device *dev, 119 - struct netdev_queue *txq, 120 - void *_unused) 121 - { 122 - lockdep_set_class(&txq->_xmit_lock, &bpq_netdev_xmit_lock_key); 123 - } 124 - 125 - static void bpq_set_lockdep_class(struct net_device *dev) 126 - { 127 - lockdep_set_class(&dev->addr_list_lock, &bpq_netdev_addr_lock_key); 128 - netdev_for_each_tx_queue(dev, bpq_set_lockdep_class_one, NULL); 129 - } 130 - 131 110 /* ------------------------------------------------------------------------ */ 132 111 133 112 ··· 477 498 err = register_netdevice(ndev); 478 499 if (err) 479 500 goto error; 480 - bpq_set_lockdep_class(ndev); 481 501 482 502 /* List protected by RTNL */ 483 503 list_add_rcu(&bpq->bpq_list, &bpq_devices);
+11 -4
drivers/net/hyperv/netvsc_drv.c
··· 982 982 if (netif_running(ndev)) { 983 983 ret = rndis_filter_open(nvdev); 984 984 if (ret) 985 - return ret; 985 + goto err; 986 986 987 987 rdev = nvdev->extension; 988 988 if (!rdev->link_state) ··· 990 990 } 991 991 992 992 return 0; 993 + 994 + err: 995 + netif_device_detach(ndev); 996 + 997 + rndis_filter_device_remove(hdev, nvdev); 998 + 999 + return ret; 993 1000 } 994 1001 995 1002 static int netvsc_set_channels(struct net_device *net, ··· 1814 1807 1815 1808 ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads); 1816 1809 1817 - if (ret) 1810 + if (ret) { 1818 1811 features ^= NETIF_F_LRO; 1812 + ndev->features = features; 1813 + } 1819 1814 1820 1815 syncvf: 1821 1816 if (!vf_netdev) ··· 2343 2334 NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | 2344 2335 NETIF_F_HW_VLAN_CTAG_RX; 2345 2336 net->vlan_features = net->features; 2346 - 2347 - netdev_lockdep_set_classes(net); 2348 2337 2349 2338 /* MTU range: 68 - 1500 or 65521 */ 2350 2339 net->min_mtu = NETVSC_MTU_MIN;
-2
drivers/net/ipvlan/ipvlan_main.c
··· 131 131 dev->gso_max_segs = phy_dev->gso_max_segs; 132 132 dev->hard_header_len = phy_dev->hard_header_len; 133 133 134 - netdev_lockdep_set_classes(dev); 135 - 136 134 ipvlan->pcpu_stats = netdev_alloc_pcpu_stats(struct ipvl_pcpu_stats); 137 135 if (!ipvlan->pcpu_stats) 138 136 return -ENOMEM;
-18
drivers/net/macsec.c
··· 267 267 struct pcpu_secy_stats __percpu *stats; 268 268 struct list_head secys; 269 269 struct gro_cells gro_cells; 270 - unsigned int nest_level; 271 270 }; 272 271 273 272 /** ··· 2749 2750 2750 2751 #define MACSEC_FEATURES \ 2751 2752 (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST) 2752 - static struct lock_class_key macsec_netdev_addr_lock_key; 2753 2753 2754 2754 static int macsec_dev_init(struct net_device *dev) 2755 2755 { ··· 2956 2958 return macsec_priv(dev)->real_dev->ifindex; 2957 2959 } 2958 2960 2959 - static int macsec_get_nest_level(struct net_device *dev) 2960 - { 2961 - return macsec_priv(dev)->nest_level; 2962 - } 2963 - 2964 2961 static const struct net_device_ops macsec_netdev_ops = { 2965 2962 .ndo_init = macsec_dev_init, 2966 2963 .ndo_uninit = macsec_dev_uninit, ··· 2969 2976 .ndo_start_xmit = macsec_start_xmit, 2970 2977 .ndo_get_stats64 = macsec_get_stats64, 2971 2978 .ndo_get_iflink = macsec_get_iflink, 2972 - .ndo_get_lock_subclass = macsec_get_nest_level, 2973 2979 }; 2974 2980 2975 2981 static const struct device_type macsec_type = { ··· 2993 3001 static void macsec_free_netdev(struct net_device *dev) 2994 3002 { 2995 3003 struct macsec_dev *macsec = macsec_priv(dev); 2996 - struct net_device *real_dev = macsec->real_dev; 2997 3004 2998 3005 free_percpu(macsec->stats); 2999 3006 free_percpu(macsec->secy.tx_sc.stats); 3000 3007 3001 - dev_put(real_dev); 3002 3008 } 3003 3009 3004 3010 static void macsec_setup(struct net_device *dev) ··· 3250 3260 err = register_netdevice(dev); 3251 3261 if (err < 0) 3252 3262 return err; 3253 - 3254 - dev_hold(real_dev); 3255 - 3256 - macsec->nest_level = dev_get_nest_level(real_dev) + 1; 3257 - netdev_lockdep_set_classes(dev); 3258 - lockdep_set_class_and_subclass(&dev->addr_list_lock, 3259 - &macsec_netdev_addr_lock_key, 3260 - macsec_get_nest_level(dev)); 3261 3263 3262 3264 err = netdev_upper_dev_link(real_dev, dev, extack); 3263 3265 if (err < 0)
-19
drivers/net/macvlan.c
··· 852 852 * "super class" of normal network devices; split their locks off into a 853 853 * separate class since they always nest. 854 854 */ 855 - static struct lock_class_key macvlan_netdev_addr_lock_key; 856 - 857 855 #define ALWAYS_ON_OFFLOADS \ 858 856 (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \ 859 857 NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL) ··· 866 868 867 869 #define MACVLAN_STATE_MASK \ 868 870 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) 869 - 870 - static int macvlan_get_nest_level(struct net_device *dev) 871 - { 872 - return ((struct macvlan_dev *)netdev_priv(dev))->nest_level; 873 - } 874 - 875 - static void macvlan_set_lockdep_class(struct net_device *dev) 876 - { 877 - netdev_lockdep_set_classes(dev); 878 - lockdep_set_class_and_subclass(&dev->addr_list_lock, 879 - &macvlan_netdev_addr_lock_key, 880 - macvlan_get_nest_level(dev)); 881 - } 882 871 883 872 static int macvlan_init(struct net_device *dev) 884 873 { ··· 884 899 dev->gso_max_size = lowerdev->gso_max_size; 885 900 dev->gso_max_segs = lowerdev->gso_max_segs; 886 901 dev->hard_header_len = lowerdev->hard_header_len; 887 - 888 - macvlan_set_lockdep_class(dev); 889 902 890 903 vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats); 891 904 if (!vlan->pcpu_stats) ··· 1144 1161 .ndo_fdb_add = macvlan_fdb_add, 1145 1162 .ndo_fdb_del = macvlan_fdb_del, 1146 1163 .ndo_fdb_dump = ndo_dflt_fdb_dump, 1147 - .ndo_get_lock_subclass = macvlan_get_nest_level, 1148 1164 #ifdef CONFIG_NET_POLL_CONTROLLER 1149 1165 .ndo_poll_controller = macvlan_dev_poll_controller, 1150 1166 .ndo_netpoll_setup = macvlan_dev_netpoll_setup, ··· 1427 1445 vlan->dev = dev; 1428 1446 vlan->port = port; 1429 1447 vlan->set_features = MACVLAN_FEATURES; 1430 - vlan->nest_level = dev_get_nest_level(lowerdev) + 1; 1431 1448 1432 1449 vlan->mode = MACVLAN_MODE_VEPA; 1433 1450 if (data && data[IFLA_MACVLAN_MODE])
+5
drivers/net/netdevsim/dev.c
··· 806 806 { 807 807 struct nsim_dev_port *nsim_dev_port, *tmp; 808 808 809 + mutex_lock(&nsim_dev->port_list_lock); 809 810 list_for_each_entry_safe(nsim_dev_port, tmp, 810 811 &nsim_dev->port_list, list) 811 812 __nsim_dev_port_del(nsim_dev_port); 813 + mutex_unlock(&nsim_dev->port_list_lock); 812 814 } 813 815 814 816 int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) ··· 824 822 return PTR_ERR(nsim_dev); 825 823 dev_set_drvdata(&nsim_bus_dev->dev, nsim_dev); 826 824 825 + mutex_lock(&nsim_dev->port_list_lock); 827 826 for (i = 0; i < nsim_bus_dev->port_count; i++) { 828 827 err = __nsim_dev_port_add(nsim_dev, i); 829 828 if (err) 830 829 goto err_port_del_all; 831 830 } 831 + mutex_unlock(&nsim_dev->port_list_lock); 832 832 return 0; 833 833 834 834 err_port_del_all: 835 + mutex_unlock(&nsim_dev->port_list_lock); 835 836 nsim_dev_port_del_all(nsim_dev); 836 837 nsim_dev_destroy(nsim_dev); 837 838 return err;
+16
drivers/net/phy/phylink.c
··· 87 87 phylink_printk(KERN_WARNING, pl, fmt, ##__VA_ARGS__) 88 88 #define phylink_info(pl, fmt, ...) \ 89 89 phylink_printk(KERN_INFO, pl, fmt, ##__VA_ARGS__) 90 + #if defined(CONFIG_DYNAMIC_DEBUG) 90 91 #define phylink_dbg(pl, fmt, ...) \ 92 + do { \ 93 + if ((pl)->config->type == PHYLINK_NETDEV) \ 94 + netdev_dbg((pl)->netdev, fmt, ##__VA_ARGS__); \ 95 + else if ((pl)->config->type == PHYLINK_DEV) \ 96 + dev_dbg((pl)->dev, fmt, ##__VA_ARGS__); \ 97 + } while (0) 98 + #elif defined(DEBUG) 99 + #define phylink_dbg(pl, fmt, ...) \ 91 100 phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__) 101 + #else 102 + #define phylink_dbg(pl, fmt, ...) \ 103 + ({ \ 104 + if (0) \ 105 + phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__); \ 106 + }) 107 + #endif 92 108 93 109 /** 94 110 * phylink_set_port_modes() - set the port type modes in the ethtool mask
+1
drivers/net/phy/smsc.c
··· 327 327 .name = "SMSC LAN8740", 328 328 329 329 /* PHY_BASIC_FEATURES */ 330 + .flags = PHY_RST_AFTER_CLK_EN, 330 331 331 332 .probe = smsc_phy_probe, 332 333
-2
drivers/net/ppp/ppp_generic.c
··· 1324 1324 { 1325 1325 struct ppp *ppp; 1326 1326 1327 - netdev_lockdep_set_classes(dev); 1328 - 1329 1327 ppp = netdev_priv(dev); 1330 1328 /* Let the netdevice take a reference on the ppp file. This ensures 1331 1329 * that ppp_destroy_interface() won't run before the device gets
+12 -4
drivers/net/team/team.c
··· 1615 1615 int err; 1616 1616 1617 1617 team->dev = dev; 1618 - mutex_init(&team->lock); 1619 1618 team_set_no_mode(team); 1620 1619 1621 1620 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats); ··· 1641 1642 goto err_options_register; 1642 1643 netif_carrier_off(dev); 1643 1644 1644 - netdev_lockdep_set_classes(dev); 1645 + lockdep_register_key(&team->team_lock_key); 1646 + __mutex_init(&team->lock, "team->team_lock_key", &team->team_lock_key); 1645 1647 1646 1648 return 0; 1647 1649 ··· 1673 1673 team_queue_override_fini(team); 1674 1674 mutex_unlock(&team->lock); 1675 1675 netdev_change_features(dev); 1676 + lockdep_unregister_key(&team->team_lock_key); 1676 1677 } 1677 1678 1678 1679 static void team_destructor(struct net_device *dev) ··· 1977 1976 err = team_port_del(team, port_dev); 1978 1977 mutex_unlock(&team->lock); 1979 1978 1980 - if (!err) 1981 - netdev_change_features(dev); 1979 + if (err) 1980 + return err; 1981 + 1982 + if (netif_is_team_master(port_dev)) { 1983 + lockdep_unregister_key(&team->team_lock_key); 1984 + lockdep_register_key(&team->team_lock_key); 1985 + lockdep_set_class(&team->lock, &team->team_lock_key); 1986 + } 1987 + netdev_change_features(dev); 1982 1988 1983 1989 return err; 1984 1990 }
+7
drivers/net/usb/cdc_ether.c
··· 787 787 .driver_info = 0, 788 788 }, 789 789 790 + /* ThinkPad USB-C Dock Gen 2 (based on Realtek RTL8153) */ 791 + { 792 + USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0xa387, USB_CLASS_COMM, 793 + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 794 + .driver_info = 0, 795 + }, 796 + 790 797 /* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */ 791 798 { 792 799 USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM,
+4 -1
drivers/net/usb/lan78xx.c
··· 1264 1264 netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata); 1265 1265 lan78xx_defer_kevent(dev, EVENT_LINK_RESET); 1266 1266 1267 - if (dev->domain_data.phyirq > 0) 1267 + if (dev->domain_data.phyirq > 0) { 1268 + local_irq_disable(); 1268 1269 generic_handle_irq(dev->domain_data.phyirq); 1270 + local_irq_enable(); 1271 + } 1269 1272 } else 1270 1273 netdev_warn(dev->net, 1271 1274 "unexpected interrupt: 0x%08x\n", intdata);
+1
drivers/net/usb/r8152.c
··· 5755 5755 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, 5756 5756 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)}, 5757 5757 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, 5758 + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)}, 5758 5759 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, 5759 5760 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, 5760 5761 {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},
-1
drivers/net/vrf.c
··· 865 865 866 866 /* similarly, oper state is irrelevant; set to up to avoid confusion */ 867 867 dev->operstate = IF_OPER_UP; 868 - netdev_lockdep_set_classes(dev); 869 868 return 0; 870 869 871 870 out_rth:
+50 -12
drivers/net/vxlan.c
··· 2487 2487 vni = tunnel_id_to_key32(info->key.tun_id); 2488 2488 ifindex = 0; 2489 2489 dst_cache = &info->dst_cache; 2490 - if (info->options_len && 2491 - info->key.tun_flags & TUNNEL_VXLAN_OPT) 2490 + if (info->key.tun_flags & TUNNEL_VXLAN_OPT) { 2491 + if (info->options_len < sizeof(*md)) 2492 + goto drop; 2492 2493 md = ip_tunnel_info_opts(info); 2494 + } 2493 2495 ttl = info->key.ttl; 2494 2496 tos = info->key.tos; 2495 2497 label = info->key.label; ··· 3568 3566 { 3569 3567 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 3570 3568 struct vxlan_dev *vxlan = netdev_priv(dev); 3569 + struct net_device *remote_dev = NULL; 3571 3570 struct vxlan_fdb *f = NULL; 3572 3571 bool unregister = false; 3572 + struct vxlan_rdst *dst; 3573 3573 int err; 3574 3574 3575 + dst = &vxlan->default_dst; 3575 3576 err = vxlan_dev_configure(net, dev, conf, false, extack); 3576 3577 if (err) 3577 3578 return err; ··· 3582 3577 dev->ethtool_ops = &vxlan_ethtool_ops; 3583 3578 3584 3579 /* create an fdb entry for a valid default destination */ 3585 - if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) { 3580 + if (!vxlan_addr_any(&dst->remote_ip)) { 3586 3581 err = vxlan_fdb_create(vxlan, all_zeros_mac, 3587 - &vxlan->default_dst.remote_ip, 3582 + &dst->remote_ip, 3588 3583 NUD_REACHABLE | NUD_PERMANENT, 3589 3584 vxlan->cfg.dst_port, 3590 - vxlan->default_dst.remote_vni, 3591 - vxlan->default_dst.remote_vni, 3592 - vxlan->default_dst.remote_ifindex, 3585 + dst->remote_vni, 3586 + dst->remote_vni, 3587 + dst->remote_ifindex, 3593 3588 NTF_SELF, &f); 3594 3589 if (err) 3595 3590 return err; ··· 3600 3595 goto errout; 3601 3596 unregister = true; 3602 3597 3598 + if (dst->remote_ifindex) { 3599 + remote_dev = __dev_get_by_index(net, dst->remote_ifindex); 3600 + if (!remote_dev) 3601 + goto errout; 3602 + 3603 + err = netdev_upper_dev_link(remote_dev, dev, extack); 3604 + if (err) 3605 + goto errout; 3606 + } 3607 + 3603 3608 err = rtnl_configure_link(dev, NULL); 3604 3609 if (err) 3605 - goto errout; 3610 + goto unlink; 3606 3611 3607 3612 if (f) { 3608 - vxlan_fdb_insert(vxlan, all_zeros_mac, 3609 - vxlan->default_dst.remote_vni, f); 3613 + vxlan_fdb_insert(vxlan, all_zeros_mac, dst->remote_vni, f); 3610 3614 3611 3615 /* notify default fdb entry */ 3612 3616 err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), 3613 3617 RTM_NEWNEIGH, true, extack); 3614 3618 if (err) { 3615 3619 vxlan_fdb_destroy(vxlan, f, false, false); 3620 + if (remote_dev) 3621 + netdev_upper_dev_unlink(remote_dev, dev); 3616 3622 goto unregister; 3617 3623 } 3618 3624 } 3619 3625 3620 3626 list_add(&vxlan->next, &vn->vxlan_list); 3627 + if (remote_dev) 3628 + dst->remote_dev = remote_dev; 3621 3629 return 0; 3622 - 3630 + unlink: 3631 + if (remote_dev) 3632 + netdev_upper_dev_unlink(remote_dev, dev); 3623 3633 errout: 3624 3634 /* unregister_netdevice() destroys the default FDB entry with deletion 3625 3635 * notification. But the addition notification was not sent yet, so ··· 3952 3932 struct netlink_ext_ack *extack) 3953 3933 { 3954 3934 struct vxlan_dev *vxlan = netdev_priv(dev); 3955 - struct vxlan_rdst *dst = &vxlan->default_dst; 3956 3935 struct net_device *lowerdev; 3957 3936 struct vxlan_config conf; 3937 + struct vxlan_rdst *dst; 3958 3938 int err; 3959 3939 3940 + dst = &vxlan->default_dst; 3960 3941 err = vxlan_nl2conf(tb, data, dev, &conf, true, extack); 3961 3942 if (err) 3962 3943 return err; 3963 3944 3964 3945 err = vxlan_config_validate(vxlan->net, &conf, &lowerdev, 3965 3946 vxlan, extack); 3947 + if (err) 3948 + return err; 3949 + 3950 + if (dst->remote_dev == lowerdev) 3951 + lowerdev = NULL; 3952 + 3953 + err = netdev_adjacent_change_prepare(dst->remote_dev, lowerdev, dev, 3954 + extack); 3966 3955 if (err) 3967 3956 return err; 3968 3957 ··· 3991 3962 NTF_SELF, true, extack); 3992 3963 if (err) { 3993 3964 spin_unlock_bh(&vxlan->hash_lock[hash_index]); 3965 + netdev_adjacent_change_abort(dst->remote_dev, 3966 + lowerdev, dev); 3994 3967 return err; 3995 3968 } 3996 3969 } ··· 4010 3979 if (conf.age_interval != vxlan->cfg.age_interval) 4011 3980 mod_timer(&vxlan->age_timer, jiffies); 4012 3981 3982 + netdev_adjacent_change_commit(dst->remote_dev, lowerdev, dev); 3983 + if (lowerdev && lowerdev != dst->remote_dev) { 3984 + dst->remote_dev = lowerdev; 3985 + netdev_update_lockdep_key(lowerdev); 3986 + } 4013 3987 vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true); 4014 3988 return 0; 4015 3989 } ··· 4027 3991 4028 3992 list_del(&vxlan->next); 4029 3993 unregister_netdevice_queue(dev, head); 3994 + if (vxlan->default_dst.remote_dev) 3995 + netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev); 4030 3996 } 4031 3997 4032 3998 static size_t vxlan_get_size(const struct net_device *dev)
+1 -1
drivers/net/wimax/i2400m/op-rfkill.c
··· 127 127 "%d\n", result); 128 128 result = 0; 129 129 error_cmd: 130 - kfree(cmd); 131 130 kfree_skb(ack_skb); 132 131 error_msg_to_dev: 133 132 error_alloc: 134 133 d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n", 135 134 wimax_dev, state, result); 135 + kfree(cmd); 136 136 return result; 137 137 } 138 138
+20 -2
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
··· 520 520 } __packed; 521 521 522 522 /** 523 - * struct iwl_scan_config 523 + * struct iwl_scan_config_v1 524 524 * @flags: enum scan_config_flags 525 525 * @tx_chains: valid_tx antenna - ANT_* definitions 526 526 * @rx_chains: valid_rx antenna - ANT_* definitions ··· 552 552 #define SCAN_LB_LMAC_IDX 0 553 553 #define SCAN_HB_LMAC_IDX 1 554 554 555 - struct iwl_scan_config { 555 + struct iwl_scan_config_v2 { 556 556 __le32 flags; 557 557 __le32 tx_chains; 558 558 __le32 rx_chains; ··· 564 564 u8 bcast_sta_id; 565 565 u8 channel_flags; 566 566 u8 channel_array[]; 567 + } __packed; /* SCAN_CONFIG_DB_CMD_API_S_2 */ 568 + 569 + /** 570 + * struct iwl_scan_config 571 + * @enable_cam_mode: whether to enable CAM mode. 572 + * @enable_promiscouos_mode: whether to enable promiscouos mode 573 + * @bcast_sta_id: the index of the station in the fw 574 + * @reserved: reserved 575 + * @tx_chains: valid_tx antenna - ANT_* definitions 576 + * @rx_chains: valid_rx antenna - ANT_* definitions 577 + */ 578 + struct iwl_scan_config { 579 + u8 enable_cam_mode; 580 + u8 enable_promiscouos_mode; 581 + u8 bcast_sta_id; 582 + u8 reserved; 583 + __le32 tx_chains; 584 + __le32 rx_chains; 567 585 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */ 568 586 569 587 /**
+3
drivers/net/wireless/intel/iwlwifi/fw/file.h
··· 288 288 * STA_CONTEXT_DOT11AX_API_S 289 289 * @IWL_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar 290 290 * version tables. 291 + * @IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG: This ucode supports v3 of 292 + * SCAN_CONFIG_DB_CMD_API_S. 291 293 * 292 294 * @NUM_IWL_UCODE_TLV_API: number of bits used 293 295 */ ··· 323 321 IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = (__force iwl_ucode_tlv_api_t)53, 324 322 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY = (__force iwl_ucode_tlv_api_t)54, 325 323 IWL_UCODE_TLV_API_SAR_TABLE_VER = (__force iwl_ucode_tlv_api_t)55, 324 + IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG = (__force iwl_ucode_tlv_api_t)56, 326 325 IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = (__force iwl_ucode_tlv_api_t)57, 327 326 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER = (__force iwl_ucode_tlv_api_t)58, 328 327
+1
drivers/net/wireless/intel/iwlwifi/iwl-csr.h
··· 279 279 * Indicates MAC is entering a power-saving sleep power-down. 280 280 * Not a good time to access device-internal resources. 281 281 */ 282 + #define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) 282 283 #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) 283 284 #define CSR_GP_CNTRL_REG_FLAG_XTAL_ON (0x00000400) 284 285
+5
drivers/net/wireless/intel/iwlwifi/iwl-prph.h
··· 449 449 #define PERSISTENCE_BIT BIT(12) 450 450 #define PREG_WFPM_ACCESS BIT(12) 451 451 452 + #define HPM_HIPM_GEN_CFG 0xA03458 453 + #define HPM_HIPM_GEN_CFG_CR_PG_EN BIT(0) 454 + #define HPM_HIPM_GEN_CFG_CR_SLP_EN BIT(1) 455 + #define HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE BIT(10) 456 + 452 457 #define UREG_DOORBELL_TO_ISR6 0xA05C04 453 458 #define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0) 454 459 #define UREG_DOORBELL_TO_ISR6_SUSPEND BIT(18)
+6
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1405 1405 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER); 1406 1406 } 1407 1407 1408 + static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm) 1409 + { 1410 + return fw_has_api(&mvm->fw->ucode_capa, 1411 + IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG); 1412 + } 1413 + 1408 1414 static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm) 1409 1415 { 1410 1416 return fw_has_api(&mvm->fw->ucode_capa,
+32 -8
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1137 1137 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); 1138 1138 } 1139 1139 1140 - static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config, 1141 - u32 flags, u8 channel_flags, 1142 - u32 max_channels) 1140 + static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config, 1141 + u32 flags, u8 channel_flags, 1142 + u32 max_channels) 1143 1143 { 1144 - struct iwl_scan_config *cfg = config; 1144 + struct iwl_scan_config_v2 *cfg = config; 1145 1145 1146 1146 cfg->flags = cpu_to_le32(flags); 1147 1147 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); ··· 1185 1185 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); 1186 1186 } 1187 1187 1188 - int iwl_mvm_config_scan(struct iwl_mvm *mvm) 1188 + static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm) 1189 1189 { 1190 1190 void *cfg; 1191 1191 int ret, cmd_size; ··· 1217 1217 } 1218 1218 1219 1219 if (iwl_mvm_cdb_scan_api(mvm)) 1220 - cmd_size = sizeof(struct iwl_scan_config); 1220 + cmd_size = sizeof(struct iwl_scan_config_v2); 1221 1221 else 1222 1222 cmd_size = sizeof(struct iwl_scan_config_v1); 1223 1223 cmd_size += num_channels; ··· 1254 1254 flags |= (iwl_mvm_is_scan_fragmented(hb_type)) ? 1255 1255 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED : 1256 1256 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED; 1257 - iwl_mvm_fill_scan_config(mvm, cfg, flags, channel_flags, 1258 - num_channels); 1257 + iwl_mvm_fill_scan_config_v2(mvm, cfg, flags, channel_flags, 1258 + num_channels); 1259 1259 } else { 1260 1260 iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags, 1261 1261 num_channels); ··· 1275 1275 1276 1276 kfree(cfg); 1277 1277 return ret; 1278 + } 1279 + 1280 + int iwl_mvm_config_scan(struct iwl_mvm *mvm) 1281 + { 1282 + struct iwl_scan_config cfg; 1283 + struct iwl_host_cmd cmd = { 1284 + .id = iwl_cmd_id(SCAN_CFG_CMD, IWL_ALWAYS_LONG_GROUP, 0), 1285 + .len[0] = sizeof(cfg), 1286 + .data[0] = &cfg, 1287 + .dataflags[0] = IWL_HCMD_DFL_NOCOPY, 1288 + }; 1289 + 1290 + if (!iwl_mvm_is_reduced_config_scan_supported(mvm)) 1291 + return iwl_mvm_legacy_config_scan(mvm); 1292 + 1293 + memset(&cfg, 0, sizeof(cfg)); 1294 + 1295 + cfg.bcast_sta_id = mvm->aux_sta.sta_id; 1296 + cfg.tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); 1297 + cfg.rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); 1298 + 1299 + IWL_DEBUG_SCAN(mvm, "Sending UMAC scan config\n"); 1300 + 1301 + return iwl_mvm_send_cmd(mvm, &cmd); 1278 1302 } 1279 1303 1280 1304 static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status)
+84 -58
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1482 1482 mvm_sta->sta_id, i); 1483 1483 txq_id = iwl_mvm_tvqm_enable_txq(mvm, mvm_sta->sta_id, 1484 1484 i, wdg); 1485 + /* 1486 + * on failures, just set it to IWL_MVM_INVALID_QUEUE 1487 + * to try again later, we have no other good way of 1488 + * failing here 1489 + */ 1490 + if (txq_id < 0) 1491 + txq_id = IWL_MVM_INVALID_QUEUE; 1485 1492 tid_data->txq_id = txq_id; 1486 1493 1487 1494 /* ··· 1957 1950 sta->sta_id = IWL_MVM_INVALID_STA; 1958 1951 } 1959 1952 1960 - static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 *queue, 1953 + static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 queue, 1961 1954 u8 sta_id, u8 fifo) 1962 1955 { 1963 1956 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ? 1964 1957 mvm->trans->trans_cfg->base_params->wd_timeout : 1965 1958 IWL_WATCHDOG_DISABLED; 1959 + struct iwl_trans_txq_scd_cfg cfg = { 1960 + .fifo = fifo, 1961 + .sta_id = sta_id, 1962 + .tid = IWL_MAX_TID_COUNT, 1963 + .aggregate = false, 1964 + .frame_limit = IWL_FRAME_LIMIT, 1965 + }; 1966 1966 1967 - if (iwl_mvm_has_new_tx_api(mvm)) { 1968 - int tvqm_queue = 1969 - iwl_mvm_tvqm_enable_txq(mvm, sta_id, 1970 - IWL_MAX_TID_COUNT, 1971 - wdg_timeout); 1972 - *queue = tvqm_queue; 1973 - } else { 1974 - struct iwl_trans_txq_scd_cfg cfg = { 1975 - .fifo = fifo, 1976 - .sta_id = sta_id, 1977 - .tid = IWL_MAX_TID_COUNT, 1978 - .aggregate = false, 1979 - .frame_limit = IWL_FRAME_LIMIT, 1980 - }; 1967 + WARN_ON(iwl_mvm_has_new_tx_api(mvm)); 1981 1968 1982 - iwl_mvm_enable_txq(mvm, NULL, *queue, 0, &cfg, wdg_timeout); 1969 + iwl_mvm_enable_txq(mvm, NULL, queue, 0, &cfg, wdg_timeout); 1970 + } 1971 + 1972 + static int iwl_mvm_enable_aux_snif_queue_tvqm(struct iwl_mvm *mvm, u8 sta_id) 1973 + { 1974 + unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ? 1975 + mvm->trans->trans_cfg->base_params->wd_timeout : 1976 + IWL_WATCHDOG_DISABLED; 1977 + 1978 + WARN_ON(!iwl_mvm_has_new_tx_api(mvm)); 1979 + 1980 + return iwl_mvm_tvqm_enable_txq(mvm, sta_id, IWL_MAX_TID_COUNT, 1981 + wdg_timeout); 1982 + } 1983 + 1984 + static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx, 1985 + int maccolor, 1986 + struct iwl_mvm_int_sta *sta, 1987 + u16 *queue, int fifo) 1988 + { 1989 + int ret; 1990 + 1991 + /* Map queue to fifo - needs to happen before adding station */ 1992 + if (!iwl_mvm_has_new_tx_api(mvm)) 1993 + iwl_mvm_enable_aux_snif_queue(mvm, *queue, sta->sta_id, fifo); 1994 + 1995 + ret = iwl_mvm_add_int_sta_common(mvm, sta, NULL, macidx, maccolor); 1996 + if (ret) { 1997 + if (!iwl_mvm_has_new_tx_api(mvm)) 1998 + iwl_mvm_disable_txq(mvm, NULL, *queue, 1999 + IWL_MAX_TID_COUNT, 0); 2000 + return ret; 1983 2001 } 2002 + 2003 + /* 2004 + * For 22000 firmware and on we cannot add queue to a station unknown 2005 + * to firmware so enable queue here - after the station was added 2006 + */ 2007 + if (iwl_mvm_has_new_tx_api(mvm)) { 2008 + int txq; 2009 + 2010 + txq = iwl_mvm_enable_aux_snif_queue_tvqm(mvm, sta->sta_id); 2011 + if (txq < 0) { 2012 + iwl_mvm_rm_sta_common(mvm, sta->sta_id); 2013 + return txq; 2014 + } 2015 + 2016 + *queue = txq; 2017 + } 2018 + 2019 + return 0; 1984 2020 } 1985 2021 1986 2022 int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) ··· 2039 1989 if (ret) 2040 1990 return ret; 2041 1991 2042 - /* Map Aux queue to fifo - needs to happen before adding Aux station */ 2043 - if (!iwl_mvm_has_new_tx_api(mvm)) 2044 - iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue, 2045 - mvm->aux_sta.sta_id, 2046 - IWL_MVM_TX_FIFO_MCAST); 2047 - 2048 - ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, 2049 - MAC_INDEX_AUX, 0); 1992 + ret = iwl_mvm_add_int_sta_with_queue(mvm, MAC_INDEX_AUX, 0, 1993 + &mvm->aux_sta, &mvm->aux_queue, 1994 + IWL_MVM_TX_FIFO_MCAST); 2050 1995 if (ret) { 2051 1996 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); 2052 1997 return ret; 2053 1998 } 2054 - 2055 - /* 2056 - * For 22000 firmware and on we cannot add queue to a station unknown 2057 - * to firmware so enable queue here - after the station was added 2058 - */ 2059 - if (iwl_mvm_has_new_tx_api(mvm)) 2060 - iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue, 2061 - mvm->aux_sta.sta_id, 2062 - IWL_MVM_TX_FIFO_MCAST); 2063 1999 2064 2000 return 0; 2065 2001 } ··· 2053 2017 int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 2054 2018 { 2055 2019 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 2056 - int ret; 2057 2020 2058 2021 lockdep_assert_held(&mvm->mutex); 2059 2022 2060 - /* Map snif queue to fifo - must happen before adding snif station */ 2061 - if (!iwl_mvm_has_new_tx_api(mvm)) 2062 - iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue, 2063 - mvm->snif_sta.sta_id, 2023 + return iwl_mvm_add_int_sta_with_queue(mvm, mvmvif->id, mvmvif->color, 2024 + &mvm->snif_sta, &mvm->snif_queue, 2064 2025 IWL_MVM_TX_FIFO_BE); 2065 - 2066 - ret = iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr, 2067 - mvmvif->id, 0); 2068 - if (ret) 2069 - return ret; 2070 - 2071 - /* 2072 - * For 22000 firmware and on we cannot add queue to a station unknown 2073 - * to firmware so enable queue here - after the station was added 2074 - */ 2075 - if (iwl_mvm_has_new_tx_api(mvm)) 2076 - iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue, 2077 - mvm->snif_sta.sta_id, 2078 - IWL_MVM_TX_FIFO_BE); 2079 - 2080 - return 0; 2081 2026 } 2082 2027 2083 2028 int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) ··· 2150 2133 queue = iwl_mvm_tvqm_enable_txq(mvm, bsta->sta_id, 2151 2134 IWL_MAX_TID_COUNT, 2152 2135 wdg_timeout); 2136 + if (queue < 0) { 2137 + iwl_mvm_rm_sta_common(mvm, bsta->sta_id); 2138 + return queue; 2139 + } 2153 2140 2154 2141 if (vif->type == NL80211_IFTYPE_AP || 2155 2142 vif->type == NL80211_IFTYPE_ADHOC) ··· 2328 2307 } 2329 2308 ret = iwl_mvm_add_int_sta_common(mvm, msta, maddr, 2330 2309 mvmvif->id, mvmvif->color); 2331 - if (ret) { 2332 - iwl_mvm_dealloc_int_sta(mvm, msta); 2333 - return ret; 2334 - } 2310 + if (ret) 2311 + goto err; 2335 2312 2336 2313 /* 2337 2314 * Enable cab queue after the ADD_STA command is sent. ··· 2342 2323 int queue = iwl_mvm_tvqm_enable_txq(mvm, msta->sta_id, 2343 2324 0, 2344 2325 timeout); 2326 + if (queue < 0) { 2327 + ret = queue; 2328 + goto err; 2329 + } 2345 2330 mvmvif->cab_queue = queue; 2346 2331 } else if (!fw_has_api(&mvm->fw->ucode_capa, 2347 2332 IWL_UCODE_TLV_API_STA_TYPE)) ··· 2353 2330 timeout); 2354 2331 2355 2332 return 0; 2333 + err: 2334 + iwl_mvm_dealloc_int_sta(mvm, msta); 2335 + return ret; 2356 2336 } 2357 2337 2358 2338 static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id,
+63 -66
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 573 573 {IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)}, 574 574 {IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_160_cfg)}, 575 575 {IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_160_cfg)}, 576 - {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9460_2ac_cfg)}, 577 - {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9460_2ac_cfg)}, 578 - {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9460_2ac_cfg)}, 579 - {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9460_2ac_cfg)}, 576 + {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9461_2ac_cfg_soc)}, 577 + {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9461_2ac_cfg_soc)}, 578 + {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9462_2ac_cfg_soc)}, 579 + {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9462_2ac_cfg_soc)}, 580 580 {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9260_2ac_cfg)}, 581 581 {IWL_PCI_DEVICE(0x2526, 0x0214, iwl9260_2ac_cfg)}, 582 582 {IWL_PCI_DEVICE(0x2526, 0x0230, iwl9560_2ac_cfg)}, 583 583 {IWL_PCI_DEVICE(0x2526, 0x0234, iwl9560_2ac_cfg)}, 584 584 {IWL_PCI_DEVICE(0x2526, 0x0238, iwl9560_2ac_cfg)}, 585 585 {IWL_PCI_DEVICE(0x2526, 0x023C, iwl9560_2ac_cfg)}, 586 - {IWL_PCI_DEVICE(0x2526, 0x0260, iwl9460_2ac_cfg)}, 586 + {IWL_PCI_DEVICE(0x2526, 0x0260, iwl9461_2ac_cfg_soc)}, 587 587 {IWL_PCI_DEVICE(0x2526, 0x0264, iwl9461_2ac_cfg_soc)}, 588 - {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9460_2ac_cfg)}, 589 - {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9460_2ac_cfg)}, 588 + {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9462_2ac_cfg_soc)}, 589 + {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9462_2ac_cfg_soc)}, 590 590 {IWL_PCI_DEVICE(0x2526, 0x1010, iwl9260_2ac_cfg)}, 591 591 {IWL_PCI_DEVICE(0x2526, 0x1030, iwl9560_2ac_cfg)}, 592 592 {IWL_PCI_DEVICE(0x2526, 0x1210, iwl9260_2ac_cfg)}, ··· 603 603 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)}, 604 604 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)}, 605 605 {IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)}, 606 - {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9460_2ac_cfg)}, 606 + {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9462_2ac_cfg_soc)}, 607 607 {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)}, 608 608 {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)}, 609 609 {IWL_PCI_DEVICE(0x2526, 0x6010, iwl9260_2ac_160_cfg)}, ··· 618 618 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)}, 619 619 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)}, 620 620 {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)}, 621 - {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_160_cfg)}, 622 - {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg)}, 623 - {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg)}, 624 - {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_soc)}, 625 - {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_soc)}, 626 - {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_soc)}, 627 - {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_soc)}, 628 - {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg)}, 629 - {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg)}, 630 - {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg)}, 631 - {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg)}, 632 - {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_soc)}, 633 - {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_soc)}, 634 - {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_soc)}, 635 - {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_soc)}, 636 - {IWL_PCI_DEVICE(0x2720, 0x1010, iwl9260_2ac_cfg)}, 637 - {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_soc)}, 638 - {IWL_PCI_DEVICE(0x2720, 0x1210, iwl9260_2ac_cfg)}, 639 - {IWL_PCI_DEVICE(0x2720, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 640 - {IWL_PCI_DEVICE(0x2720, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 641 - {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_soc)}, 642 - {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_soc)}, 643 - {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg)}, 644 - {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_soc)}, 645 - {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)}, 646 - {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)}, 647 - {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)}, 648 621 649 - {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 650 - {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 651 - {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 652 - {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 653 - {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 654 - {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 655 - {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 656 - {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 657 - {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 658 - {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 659 - {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 660 - {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 661 - {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 662 - {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 663 - {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 664 - {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 665 - {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 666 - {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 667 - {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 668 - {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 669 - {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 670 - {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 671 - {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 672 - {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 673 - {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 674 - {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 622 + {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 623 + {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 624 + {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 625 + {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 626 + {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 627 + {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 628 + {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 629 + {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 630 + {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 631 + {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 632 + {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 633 + {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 634 + {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 635 + {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 636 + {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 637 + {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 638 + {IWL_PCI_DEVICE(0x2720, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 639 + {IWL_PCI_DEVICE(0x2720, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 640 + {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 641 + {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 642 + {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 643 + {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 644 + {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 645 + {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 646 + {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 647 + 648 + {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)}, 649 + {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)}, 650 + {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)}, 651 + {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)}, 652 + {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)}, 653 + {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)}, 654 + {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)}, 655 + {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)}, 656 + {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)}, 657 + {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)}, 658 + {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)}, 659 + {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)}, 660 + {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)}, 661 + {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)}, 662 + {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 663 + {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 664 + {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)}, 665 + {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)}, 666 + {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)}, 667 + {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 668 + {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 669 + {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)}, 670 + {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)}, 671 + {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)}, 672 + {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)}, 673 + {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)}, 674 + {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)}, 675 + {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)}, 675 676 676 677 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)}, 677 678 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)}, ··· 1068 1067 } 1069 1068 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(iwl_trans->hw_rf_id) == 1070 1069 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && 1071 - ((cfg != &iwl_ax200_cfg_cc && 1072 - cfg != &killer1650x_2ax_cfg && 1073 - cfg != &killer1650w_2ax_cfg && 1074 - cfg != &iwl_ax201_cfg_quz_hr) || 1075 - iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) { 1070 + iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) { 1076 1071 u32 hw_status; 1077 1072 1078 1073 hw_status = iwl_read_prph(iwl_trans, UMAG_GEN_HW_STATUS);
+25
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
··· 57 57 #include "internal.h" 58 58 #include "fw/dbg.h" 59 59 60 + static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) 61 + { 62 + iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 63 + HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 64 + udelay(20); 65 + iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, 66 + HPM_HIPM_GEN_CFG_CR_PG_EN | 67 + HPM_HIPM_GEN_CFG_CR_SLP_EN); 68 + udelay(20); 69 + iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG, 70 + HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); 71 + 72 + iwl_trans_sw_reset(trans); 73 + iwl_clear_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 74 + 75 + return 0; 76 + } 77 + 60 78 /* 61 79 * Start up NIC's basic functionality after it has been reset 62 80 * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop()) ··· 109 91 CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); 110 92 111 93 iwl_pcie_apm_config(trans); 94 + 95 + if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && 96 + trans->cfg->integrated) { 97 + ret = iwl_pcie_gen2_force_power_gating(trans); 98 + if (ret) 99 + return ret; 100 + } 112 101 113 102 ret = iwl_finish_nic_init(trans, trans->trans_cfg); 114 103 if (ret)
-25
drivers/net/wireless/intersil/hostap/hostap_hw.c
··· 3041 3041 } 3042 3042 } 3043 3043 3044 - 3045 - /* 3046 - * HostAP uses two layers of net devices, where the inner 3047 - * layer gets called all the time from the outer layer. 3048 - * This is a natural nesting, which needs a split lock type. 3049 - */ 3050 - static struct lock_class_key hostap_netdev_xmit_lock_key; 3051 - static struct lock_class_key hostap_netdev_addr_lock_key; 3052 - 3053 - static void prism2_set_lockdep_class_one(struct net_device *dev, 3054 - struct netdev_queue *txq, 3055 - void *_unused) 3056 - { 3057 - lockdep_set_class(&txq->_xmit_lock, 3058 - &hostap_netdev_xmit_lock_key); 3059 - } 3060 - 3061 - static void prism2_set_lockdep_class(struct net_device *dev) 3062 - { 3063 - lockdep_set_class(&dev->addr_list_lock, 3064 - &hostap_netdev_addr_lock_key); 3065 - netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL); 3066 - } 3067 - 3068 3044 static struct net_device * 3069 3045 prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, 3070 3046 struct device *sdev) ··· 3199 3223 if (ret >= 0) 3200 3224 ret = register_netdevice(dev); 3201 3225 3202 - prism2_set_lockdep_class(dev); 3203 3226 rtnl_unlock(); 3204 3227 if (ret < 0) { 3205 3228 printk(KERN_WARNING "%s: register netdevice failed!\n",
+2
drivers/net/wireless/mediatek/mt76/Makefile
··· 8 8 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \ 9 9 tx.o agg-rx.o mcu.o 10 10 11 + mt76-$(CONFIG_PCI) += pci.o 12 + 11 13 mt76-usb-y := usb.o usb_trace.o 12 14 13 15 CFLAGS_trace.o := -I$(src)
+4 -2
drivers/net/wireless/mediatek/mt76/dma.c
··· 53 53 u32 ctrl; 54 54 int i, idx = -1; 55 55 56 - if (txwi) 56 + if (txwi) { 57 57 q->entry[q->head].txwi = DMA_DUMMY_DATA; 58 + q->entry[q->head].skip_buf0 = true; 59 + } 58 60 59 61 for (i = 0; i < nbufs; i += 2, buf += 2) { 60 62 u32 buf0 = buf[0].addr, buf1 = 0; ··· 99 97 __le32 __ctrl = READ_ONCE(q->desc[idx].ctrl); 100 98 u32 ctrl = le32_to_cpu(__ctrl); 101 99 102 - if (!e->txwi || !e->skb) { 100 + if (!e->skip_buf0) { 103 101 __le32 addr = READ_ONCE(q->desc[idx].buf0); 104 102 u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctrl); 105 103
+4 -2
drivers/net/wireless/mediatek/mt76/mt76.h
··· 93 93 struct urb *urb; 94 94 }; 95 95 enum mt76_txq_id qid; 96 - bool schedule; 97 - bool done; 96 + bool skip_buf0:1; 97 + bool schedule:1; 98 + bool done:1; 98 99 }; 99 100 100 101 struct mt76_queue_regs { ··· 579 578 #define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA_ARGS__) 580 579 581 580 void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs); 581 + void mt76_pci_disable_aspm(struct pci_dev *pdev); 582 582 583 583 static inline u16 mt76_chip(struct mt76_dev *dev) 584 584 {
+2
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
··· 81 81 /* RG_SSUSB_CDR_BR_PE1D = 0x3 */ 82 82 mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3); 83 83 84 + mt76_pci_disable_aspm(pdev); 85 + 84 86 return 0; 85 87 86 88 error:
+46
drivers/net/wireless/mediatek/mt76/pci.c
··· 1 + // SPDX-License-Identifier: ISC 2 + /* 3 + * Copyright (C) 2019 Lorenzo Bianconi <lorenzo@kernel.org> 4 + */ 5 + 6 + #include <linux/pci.h> 7 + 8 + void mt76_pci_disable_aspm(struct pci_dev *pdev) 9 + { 10 + struct pci_dev *parent = pdev->bus->self; 11 + u16 aspm_conf, parent_aspm_conf = 0; 12 + 13 + pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf); 14 + aspm_conf &= PCI_EXP_LNKCTL_ASPMC; 15 + if (parent) { 16 + pcie_capability_read_word(parent, PCI_EXP_LNKCTL, 17 + &parent_aspm_conf); 18 + parent_aspm_conf &= PCI_EXP_LNKCTL_ASPMC; 19 + } 20 + 21 + if (!aspm_conf && (!parent || !parent_aspm_conf)) { 22 + /* aspm already disabled */ 23 + return; 24 + } 25 + 26 + dev_info(&pdev->dev, "disabling ASPM %s %s\n", 27 + (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "", 28 + (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : ""); 29 + 30 + if (IS_ENABLED(CONFIG_PCIEASPM)) { 31 + int err; 32 + 33 + err = pci_disable_link_state(pdev, aspm_conf); 34 + if (!err) 35 + return; 36 + } 37 + 38 + /* both device and parent should have the same ASPM setting. 39 + * disable ASPM in downstream component first and then upstream. 40 + */ 41 + pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_conf); 42 + if (parent) 43 + pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, 44 + aspm_conf); 45 + } 46 + EXPORT_SYMBOL_GPL(mt76_pci_disable_aspm);
+2 -1
drivers/net/wireless/realtek/rtlwifi/pci.c
··· 822 822 hdr = rtl_get_hdr(skb); 823 823 fc = rtl_get_fc(skb); 824 824 825 - if (!stats.crc && !stats.hwerror) { 825 + if (!stats.crc && !stats.hwerror && (skb->len > FCS_LEN)) { 826 826 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, 827 827 sizeof(rx_status)); 828 828 ··· 859 859 _rtl_pci_rx_to_mac80211(hw, skb, rx_status); 860 860 } 861 861 } else { 862 + /* drop packets with errors or those too short */ 862 863 dev_kfree_skb_any(skb); 863 864 } 864 865 new_trx_end:
+6
drivers/net/wireless/realtek/rtlwifi/ps.c
··· 754 754 return; 755 755 } else { 756 756 noa_num = (noa_len - 2) / 13; 757 + if (noa_num > P2P_MAX_NOA_NUM) 758 + noa_num = P2P_MAX_NOA_NUM; 759 + 757 760 } 758 761 noa_index = ie[3]; 759 762 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode == ··· 851 848 return; 852 849 } else { 853 850 noa_num = (noa_len - 2) / 13; 851 + if (noa_num > P2P_MAX_NOA_NUM) 852 + noa_num = P2P_MAX_NOA_NUM; 853 + 854 854 } 855 855 noa_index = ie[3]; 856 856 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
+52 -2
drivers/net/wireless/virt_wifi.c
··· 548 548 priv->is_connected = false; 549 549 priv->is_up = false; 550 550 INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete); 551 + __module_get(THIS_MODULE); 551 552 552 553 return 0; 553 554 unregister_netdev: ··· 579 578 netdev_upper_dev_unlink(priv->lowerdev, dev); 580 579 581 580 unregister_netdevice_queue(dev, head); 581 + module_put(THIS_MODULE); 582 582 583 583 /* Deleting the wiphy is handled in the module destructor. */ 584 584 } ··· 592 590 .priv_size = sizeof(struct virt_wifi_netdev_priv), 593 591 }; 594 592 593 + static bool netif_is_virt_wifi_dev(const struct net_device *dev) 594 + { 595 + return rcu_access_pointer(dev->rx_handler) == virt_wifi_rx_handler; 596 + } 597 + 598 + static int virt_wifi_event(struct notifier_block *this, unsigned long event, 599 + void *ptr) 600 + { 601 + struct net_device *lower_dev = netdev_notifier_info_to_dev(ptr); 602 + struct virt_wifi_netdev_priv *priv; 603 + struct net_device *upper_dev; 604 + LIST_HEAD(list_kill); 605 + 606 + if (!netif_is_virt_wifi_dev(lower_dev)) 607 + return NOTIFY_DONE; 608 + 609 + switch (event) { 610 + case NETDEV_UNREGISTER: 611 + priv = rtnl_dereference(lower_dev->rx_handler_data); 612 + if (!priv) 613 + return NOTIFY_DONE; 614 + 615 + upper_dev = priv->upperdev; 616 + 617 + upper_dev->rtnl_link_ops->dellink(upper_dev, &list_kill); 618 + unregister_netdevice_many(&list_kill); 619 + break; 620 + } 621 + 622 + return NOTIFY_DONE; 623 + } 624 + 625 + static struct notifier_block virt_wifi_notifier = { 626 + .notifier_call = virt_wifi_event, 627 + }; 628 + 595 629 /* Acquires and releases the rtnl lock. */ 596 630 static int __init virt_wifi_init_module(void) 597 631 { ··· 636 598 /* Guaranteed to be locallly-administered and not multicast. */ 637 599 eth_random_addr(fake_router_bssid); 638 600 601 + err = register_netdevice_notifier(&virt_wifi_notifier); 602 + if (err) 603 + return err; 604 + 605 + err = -ENOMEM; 639 606 common_wiphy = virt_wifi_make_wiphy(); 640 607 if (!common_wiphy) 641 - return -ENOMEM; 608 + goto notifier; 642 609 643 610 err = rtnl_link_register(&virt_wifi_link_ops); 644 611 if (err) 645 - virt_wifi_destroy_wiphy(common_wiphy); 612 + goto destroy_wiphy; 646 613 614 + return 0; 615 + 616 + destroy_wiphy: 617 + virt_wifi_destroy_wiphy(common_wiphy); 618 + notifier: 619 + unregister_netdevice_notifier(&virt_wifi_notifier); 647 620 return err; 648 621 } 649 622 ··· 664 615 /* Will delete any devices that depend on the wiphy. */ 665 616 rtnl_link_unregister(&virt_wifi_link_ops); 666 617 virt_wifi_destroy_wiphy(common_wiphy); 618 + unregister_netdevice_notifier(&virt_wifi_notifier); 667 619 } 668 620 669 621 module_init(virt_wifi_init_module);
+1 -1
drivers/nvme/host/tcp.c
··· 2219 2219 struct nvme_tcp_queue *queue = hctx->driver_data; 2220 2220 struct sock *sk = queue->sock->sk; 2221 2221 2222 - if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue)) 2222 + if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue)) 2223 2223 sk_busy_loop(sk, true); 2224 2224 nvme_tcp_try_recv(queue); 2225 2225 return queue->nr_cqe;
+6
include/linux/dynamic_debug.h
··· 204 204 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) 205 205 #define dynamic_dev_dbg(dev, fmt, ...) \ 206 206 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) 207 + #define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ 208 + groupsize, buf, len, ascii) \ 209 + do { if (0) \ 210 + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ 211 + rowsize, groupsize, buf, len, ascii); \ 212 + } while (0) 207 213 #endif 208 214 209 215 #endif
-1
include/linux/filter.h
··· 1099 1099 1100 1100 #endif /* CONFIG_BPF_JIT */ 1101 1101 1102 - void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp); 1103 1102 void bpf_prog_kallsyms_del_all(struct bpf_prog *fp); 1104 1103 1105 1104 #define BPF_ANC BIT(15)
+23
include/linux/gfp.h
··· 325 325 return !!(gfp_flags & __GFP_DIRECT_RECLAIM); 326 326 } 327 327 328 + /** 329 + * gfpflags_normal_context - is gfp_flags a normal sleepable context? 330 + * @gfp_flags: gfp_flags to test 331 + * 332 + * Test whether @gfp_flags indicates that the allocation is from the 333 + * %current context and allowed to sleep. 334 + * 335 + * An allocation being allowed to block doesn't mean it owns the %current 336 + * context. When direct reclaim path tries to allocate memory, the 337 + * allocation context is nested inside whatever %current was doing at the 338 + * time of the original allocation. The nested allocation may be allowed 339 + * to block but modifying anything %current owns can corrupt the outer 340 + * context's expectations. 341 + * 342 + * %true result from this function indicates that the allocation context 343 + * can sleep and use anything that's associated with %current. 344 + */ 345 + static inline bool gfpflags_normal_context(const gfp_t gfp_flags) 346 + { 347 + return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) == 348 + __GFP_DIRECT_RECLAIM; 349 + } 350 + 328 351 #ifdef CONFIG_HIGHMEM 329 352 #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM 330 353 #else
-1
include/linux/if_macvlan.h
··· 29 29 netdev_features_t set_features; 30 30 enum macvlan_mode mode; 31 31 u16 flags; 32 - int nest_level; 33 32 unsigned int macaddr_count; 34 33 #ifdef CONFIG_NET_POLL_CONTROLLER 35 34 struct netpoll *netpoll;
+1
include/linux/if_team.h
··· 223 223 atomic_t count_pending; 224 224 struct delayed_work dw; 225 225 } mcast_rejoin; 226 + struct lock_class_key team_lock_key; 226 227 long mode_priv[TEAM_MODE_PRIV_LONGS]; 227 228 }; 228 229
-11
include/linux/if_vlan.h
··· 182 182 #ifdef CONFIG_NET_POLL_CONTROLLER 183 183 struct netpoll *netpoll; 184 184 #endif 185 - unsigned int nest_level; 186 185 }; 187 186 188 187 static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev) ··· 220 221 221 222 extern bool vlan_uses_dev(const struct net_device *dev); 222 223 223 - static inline int vlan_get_encap_level(struct net_device *dev) 224 - { 225 - BUG_ON(!is_vlan_dev(dev)); 226 - return vlan_dev_priv(dev)->nest_level; 227 - } 228 224 #else 229 225 static inline struct net_device * 230 226 __vlan_find_dev_deep_rcu(struct net_device *real_dev, ··· 288 294 static inline bool vlan_uses_dev(const struct net_device *dev) 289 295 { 290 296 return false; 291 - } 292 - static inline int vlan_get_encap_level(struct net_device *dev) 293 - { 294 - BUG(); 295 - return 0; 296 297 } 297 298 #endif 298 299
+1 -2
include/linux/mlx5/mlx5_ifc.h
··· 1545 1545 }; 1546 1546 1547 1547 union mlx5_ifc_dest_format_struct_flow_counter_list_auto_bits { 1548 - struct mlx5_ifc_dest_format_struct_bits dest_format_struct; 1548 + struct mlx5_ifc_extended_dest_format_bits extended_dest_format; 1549 1549 struct mlx5_ifc_flow_counter_list_bits flow_counter_list; 1550 - u8 reserved_at_0[0x40]; 1551 1550 }; 1552 1551 1553 1552 struct mlx5_ifc_fte_match_param_bits {
+27 -34
include/linux/netdevice.h
··· 925 925 struct devlink; 926 926 struct tlsdev_ops; 927 927 928 + 928 929 /* 929 930 * This structure defines the management hooks for network devices. 930 931 * The following hooks can be defined; unless noted otherwise, they are ··· 1422 1421 void (*ndo_dfwd_del_station)(struct net_device *pdev, 1423 1422 void *priv); 1424 1423 1425 - int (*ndo_get_lock_subclass)(struct net_device *dev); 1426 1424 int (*ndo_set_tx_maxrate)(struct net_device *dev, 1427 1425 int queue_index, 1428 1426 u32 maxrate); ··· 1649 1649 * @perm_addr: Permanent hw address 1650 1650 * @addr_assign_type: Hw address assignment type 1651 1651 * @addr_len: Hardware address length 1652 + * @upper_level: Maximum depth level of upper devices. 1653 + * @lower_level: Maximum depth level of lower devices. 1652 1654 * @neigh_priv_len: Used in neigh_alloc() 1653 1655 * @dev_id: Used to differentiate devices that share 1654 1656 * the same link layer address ··· 1760 1758 * @phydev: Physical device may attach itself 1761 1759 * for hardware timestamping 1762 1760 * @sfp_bus: attached &struct sfp_bus structure. 1763 - * 1764 - * @qdisc_tx_busylock: lockdep class annotating Qdisc->busylock spinlock 1765 - * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount 1761 + * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock 1762 + spinlock 1763 + * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount 1764 + * @qdisc_xmit_lock_key: lockdep class annotating 1765 + * netdev_queue->_xmit_lock spinlock 1766 + * @addr_list_lock_key: lockdep class annotating 1767 + * net_device->addr_list_lock spinlock 1766 1768 * 1767 1769 * @proto_down: protocol port state information can be sent to the 1768 1770 * switch driver and used to set the phys state of the ··· 1881 1875 unsigned char perm_addr[MAX_ADDR_LEN]; 1882 1876 unsigned char addr_assign_type; 1883 1877 unsigned char addr_len; 1878 + unsigned char upper_level; 1879 + unsigned char lower_level; 1884 1880 unsigned short neigh_priv_len; 1885 1881 unsigned short dev_id; 1886 1882 unsigned short dev_port; ··· 2053 2045 #endif 2054 2046 struct phy_device *phydev; 2055 2047 struct sfp_bus *sfp_bus; 2056 - struct lock_class_key *qdisc_tx_busylock; 2057 - struct lock_class_key *qdisc_running_key; 2048 + struct lock_class_key qdisc_tx_busylock_key; 2049 + struct lock_class_key qdisc_running_key; 2050 + struct lock_class_key qdisc_xmit_lock_key; 2051 + struct lock_class_key addr_list_lock_key; 2058 2052 bool proto_down; 2059 2053 unsigned wol_enabled:1; 2060 2054 }; ··· 2132 2122 2133 2123 for (i = 0; i < dev->num_tx_queues; i++) 2134 2124 f(dev, &dev->_tx[i], arg); 2135 - } 2136 - 2137 - #define netdev_lockdep_set_classes(dev) \ 2138 - { \ 2139 - static struct lock_class_key qdisc_tx_busylock_key; \ 2140 - static struct lock_class_key qdisc_running_key; \ 2141 - static struct lock_class_key qdisc_xmit_lock_key; \ 2142 - static struct lock_class_key dev_addr_list_lock_key; \ 2143 - unsigned int i; \ 2144 - \ 2145 - (dev)->qdisc_tx_busylock = &qdisc_tx_busylock_key; \ 2146 - (dev)->qdisc_running_key = &qdisc_running_key; \ 2147 - lockdep_set_class(&(dev)->addr_list_lock, \ 2148 - &dev_addr_list_lock_key); \ 2149 - for (i = 0; i < (dev)->num_tx_queues; i++) \ 2150 - lockdep_set_class(&(dev)->_tx[i]._xmit_lock, \ 2151 - &qdisc_xmit_lock_key); \ 2152 2125 } 2153 2126 2154 2127 u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb, ··· 3132 3139 } 3133 3140 3134 3141 void netif_tx_stop_all_queues(struct net_device *dev); 3142 + void netdev_update_lockdep_key(struct net_device *dev); 3135 3143 3136 3144 static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 3137 3145 { ··· 4050 4056 spin_lock(&dev->addr_list_lock); 4051 4057 } 4052 4058 4053 - static inline void netif_addr_lock_nested(struct net_device *dev) 4054 - { 4055 - int subclass = SINGLE_DEPTH_NESTING; 4056 - 4057 - if (dev->netdev_ops->ndo_get_lock_subclass) 4058 - subclass = dev->netdev_ops->ndo_get_lock_subclass(dev); 4059 - 4060 - spin_lock_nested(&dev->addr_list_lock, subclass); 4061 - } 4062 - 4063 4059 static inline void netif_addr_lock_bh(struct net_device *dev) 4064 4060 { 4065 4061 spin_lock_bh(&dev->addr_list_lock); ··· 4313 4329 struct netlink_ext_ack *extack); 4314 4330 void netdev_upper_dev_unlink(struct net_device *dev, 4315 4331 struct net_device *upper_dev); 4332 + int netdev_adjacent_change_prepare(struct net_device *old_dev, 4333 + struct net_device *new_dev, 4334 + struct net_device *dev, 4335 + struct netlink_ext_ack *extack); 4336 + void netdev_adjacent_change_commit(struct net_device *old_dev, 4337 + struct net_device *new_dev, 4338 + struct net_device *dev); 4339 + void netdev_adjacent_change_abort(struct net_device *old_dev, 4340 + struct net_device *new_dev, 4341 + struct net_device *dev); 4316 4342 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 4317 4343 void *netdev_lower_dev_get_private(struct net_device *dev, 4318 4344 struct net_device *lower_dev); ··· 4334 4340 extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly; 4335 4341 void netdev_rss_key_fill(void *buffer, size_t len); 4336 4342 4337 - int dev_get_nest_level(struct net_device *dev); 4338 4343 int skb_checksum_help(struct sk_buff *skb); 4339 4344 int skb_crc32c_csum_help(struct sk_buff *skb); 4340 4345 int skb_csum_hwoffload_help(struct sk_buff *skb,
+26 -10
include/linux/skbuff.h
··· 1354 1354 return skb->hash; 1355 1355 } 1356 1356 1357 - __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb); 1357 + __u32 skb_get_hash_perturb(const struct sk_buff *skb, 1358 + const siphash_key_t *perturb); 1358 1359 1359 1360 static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) 1360 1361 { ··· 1494 1493 { 1495 1494 return list->next == (const struct sk_buff *) list; 1496 1495 } 1496 + 1497 + /** 1498 + * skb_queue_empty_lockless - check if a queue is empty 1499 + * @list: queue head 1500 + * 1501 + * Returns true if the queue is empty, false otherwise. 1502 + * This variant can be used in lockless contexts. 1503 + */ 1504 + static inline bool skb_queue_empty_lockless(const struct sk_buff_head *list) 1505 + { 1506 + return READ_ONCE(list->next) == (const struct sk_buff *) list; 1507 + } 1508 + 1497 1509 1498 1510 /** 1499 1511 * skb_queue_is_last - check if skb is the last entry in the queue ··· 1861 1847 struct sk_buff *prev, struct sk_buff *next, 1862 1848 struct sk_buff_head *list) 1863 1849 { 1864 - newsk->next = next; 1865 - newsk->prev = prev; 1866 - next->prev = prev->next = newsk; 1850 + /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */ 1851 + WRITE_ONCE(newsk->next, next); 1852 + WRITE_ONCE(newsk->prev, prev); 1853 + WRITE_ONCE(next->prev, newsk); 1854 + WRITE_ONCE(prev->next, newsk); 1867 1855 list->qlen++; 1868 1856 } 1869 1857 ··· 1876 1860 struct sk_buff *first = list->next; 1877 1861 struct sk_buff *last = list->prev; 1878 1862 1879 - first->prev = prev; 1880 - prev->next = first; 1863 + WRITE_ONCE(first->prev, prev); 1864 + WRITE_ONCE(prev->next, first); 1881 1865 1882 - last->next = next; 1883 - next->prev = last; 1866 + WRITE_ONCE(last->next, next); 1867 + WRITE_ONCE(next->prev, last); 1884 1868 } 1885 1869 1886 1870 /** ··· 2021 2005 next = skb->next; 2022 2006 prev = skb->prev; 2023 2007 skb->next = skb->prev = NULL; 2024 - next->prev = prev; 2025 - prev->next = next; 2008 + WRITE_ONCE(next->prev, prev); 2009 + WRITE_ONCE(prev->next, next); 2026 2010 } 2027 2011 2028 2012 /**
+1 -1
include/linux/socket.h
··· 263 263 #define PF_MAX AF_MAX 264 264 265 265 /* Maximum queue length specifiable by listen. */ 266 - #define SOMAXCONN 128 266 + #define SOMAXCONN 4096 267 267 268 268 /* Flags we can use with send/ and recv. 269 269 Added those for 1003.1g not all are supported yet
+1 -1
include/net/bonding.h
··· 203 203 struct slave __rcu *primary_slave; 204 204 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */ 205 205 bool force_primary; 206 - u32 nest_level; 207 206 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ 208 207 int (*recv_probe)(const struct sk_buff *, struct bonding *, 209 208 struct slave *); ··· 238 239 struct dentry *debug_dir; 239 240 #endif /* CONFIG_DEBUG_FS */ 240 241 struct rtnl_link_stats64 bond_stats; 242 + struct lock_class_key stats_lock_key; 241 243 }; 242 244 243 245 #define bond_slave_get_rcu(dev) \
+3 -3
include/net/busy_poll.h
··· 122 122 static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb) 123 123 { 124 124 #ifdef CONFIG_NET_RX_BUSY_POLL 125 - sk->sk_napi_id = skb->napi_id; 125 + WRITE_ONCE(sk->sk_napi_id, skb->napi_id); 126 126 #endif 127 127 sk_rx_queue_set(sk, skb); 128 128 } ··· 132 132 const struct sk_buff *skb) 133 133 { 134 134 #ifdef CONFIG_NET_RX_BUSY_POLL 135 - if (!sk->sk_napi_id) 136 - sk->sk_napi_id = skb->napi_id; 135 + if (!READ_ONCE(sk->sk_napi_id)) 136 + WRITE_ONCE(sk->sk_napi_id, skb->napi_id); 137 137 #endif 138 138 } 139 139
+2 -1
include/net/flow_dissector.h
··· 4 4 5 5 #include <linux/types.h> 6 6 #include <linux/in6.h> 7 + #include <linux/siphash.h> 7 8 #include <uapi/linux/if_ether.h> 8 9 9 10 /** ··· 277 276 struct flow_keys { 278 277 struct flow_dissector_key_control control; 279 278 #define FLOW_KEYS_HASH_START_FIELD basic 280 - struct flow_dissector_key_basic basic; 279 + struct flow_dissector_key_basic basic __aligned(SIPHASH_ALIGNMENT); 281 280 struct flow_dissector_key_tags tags; 282 281 struct flow_dissector_key_vlan vlan; 283 282 struct flow_dissector_key_vlan cvlan;
+1 -1
include/net/fq.h
··· 69 69 struct list_head backlogs; 70 70 spinlock_t lock; 71 71 u32 flows_cnt; 72 - u32 perturbation; 72 + siphash_key_t perturbation; 73 73 u32 limit; 74 74 u32 memory_limit; 75 75 u32 memory_usage;
+2 -2
include/net/fq_impl.h
··· 108 108 109 109 static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb) 110 110 { 111 - u32 hash = skb_get_hash_perturb(skb, fq->perturbation); 111 + u32 hash = skb_get_hash_perturb(skb, &fq->perturbation); 112 112 113 113 return reciprocal_scale(hash, fq->flows_cnt); 114 114 } ··· 308 308 INIT_LIST_HEAD(&fq->backlogs); 309 309 spin_lock_init(&fq->lock); 310 310 fq->flows_cnt = max_t(u32, flows_cnt, 1); 311 - fq->perturbation = prandom_u32(); 311 + get_random_bytes(&fq->perturbation, sizeof(fq->perturbation)); 312 312 fq->quantum = 300; 313 313 fq->limit = 8192; 314 314 fq->memory_limit = 16 << 20; /* 16 MBytes */
+7 -3
include/net/hwbm.h
··· 21 21 int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp); 22 22 int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num); 23 23 #else 24 - void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {} 25 - int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; } 26 - int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num) 24 + static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {} 25 + 26 + static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) 27 + { return 0; } 28 + 29 + static inline int hwbm_pool_add(struct hwbm_pool *bm_pool, 30 + unsigned int buf_num) 27 31 { return 0; } 28 32 #endif /* CONFIG_HWBM */ 29 33 #endif /* _HWBM_H */
+2 -2
include/net/ip.h
··· 185 185 } 186 186 187 187 struct ip_frag_state { 188 - struct iphdr *iph; 188 + bool DF; 189 189 unsigned int hlen; 190 190 unsigned int ll_rs; 191 191 unsigned int mtu; ··· 196 196 }; 197 197 198 198 void ip_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int ll_rs, 199 - unsigned int mtu, struct ip_frag_state *state); 199 + unsigned int mtu, bool DF, struct ip_frag_state *state); 200 200 struct sk_buff *ip_frag_next(struct sk_buff *skb, 201 201 struct ip_frag_state *state); 202 202
+1
include/net/ip_vs.h
··· 889 889 struct delayed_work defense_work; /* Work handler */ 890 890 int drop_rate; 891 891 int drop_counter; 892 + int old_secure_tcp; 892 893 atomic_t dropentry; 893 894 /* locks in ctl.c */ 894 895 spinlock_t dropentry_lock; /* drop entry handling */
+1 -1
include/net/net_namespace.h
··· 342 342 #define __net_initconst __initconst 343 343 #endif 344 344 345 - int peernet2id_alloc(struct net *net, struct net *peer); 345 + int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp); 346 346 int peernet2id(struct net *net, struct net *peer); 347 347 bool peernet_has_id(struct net *net, struct net *peer); 348 348 struct net *get_net_ns_by_id(struct net *net, int id);
+10 -5
include/net/sock.h
··· 954 954 { 955 955 int cpu = raw_smp_processor_id(); 956 956 957 - if (unlikely(sk->sk_incoming_cpu != cpu)) 958 - sk->sk_incoming_cpu = cpu; 957 + if (unlikely(READ_ONCE(sk->sk_incoming_cpu) != cpu)) 958 + WRITE_ONCE(sk->sk_incoming_cpu, cpu); 959 959 } 960 960 961 961 static inline void sock_rps_record_flow_hash(__u32 hash) ··· 2242 2242 * sk_page_frag - return an appropriate page_frag 2243 2243 * @sk: socket 2244 2244 * 2245 - * If socket allocation mode allows current thread to sleep, it means its 2246 - * safe to use the per task page_frag instead of the per socket one. 2245 + * Use the per task page_frag instead of the per socket one for 2246 + * optimization when we know that we're in the normal context and owns 2247 + * everything that's associated with %current. 2248 + * 2249 + * gfpflags_allow_blocking() isn't enough here as direct reclaim may nest 2250 + * inside other socket operations and end up recursing into sk_page_frag() 2251 + * while it's already in use. 2247 2252 */ 2248 2253 static inline struct page_frag *sk_page_frag(struct sock *sk) 2249 2254 { 2250 - if (gfpflags_allow_blocking(sk->sk_allocation)) 2255 + if (gfpflags_normal_context(sk->sk_allocation)) 2251 2256 return &current->task_frag; 2252 2257 2253 2258 return &sk->sk_frag;
+1
include/net/vxlan.h
··· 197 197 u8 offloaded:1; 198 198 __be32 remote_vni; 199 199 u32 remote_ifindex; 200 + struct net_device *remote_dev; 200 201 struct list_head list; 201 202 struct rcu_head rcu; 202 203 struct dst_cache dst_cache;
+1 -1
kernel/bpf/core.c
··· 502 502 return WARN_ON_ONCE(bpf_adj_branches(prog, off, off + cnt, off, false)); 503 503 } 504 504 505 - void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp) 505 + static void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp) 506 506 { 507 507 int i; 508 508
+32 -1
kernel/bpf/devmap.c
··· 128 128 129 129 if (!dtab->n_buckets) /* Overflow check */ 130 130 return -EINVAL; 131 - cost += sizeof(struct hlist_head) * dtab->n_buckets; 131 + cost += (u64) sizeof(struct hlist_head) * dtab->n_buckets; 132 132 } 133 133 134 134 /* if map size is larger than memlock limit, reject it */ ··· 719 719 .map_check_btf = map_check_no_btf, 720 720 }; 721 721 722 + static void dev_map_hash_remove_netdev(struct bpf_dtab *dtab, 723 + struct net_device *netdev) 724 + { 725 + unsigned long flags; 726 + u32 i; 727 + 728 + spin_lock_irqsave(&dtab->index_lock, flags); 729 + for (i = 0; i < dtab->n_buckets; i++) { 730 + struct bpf_dtab_netdev *dev; 731 + struct hlist_head *head; 732 + struct hlist_node *next; 733 + 734 + head = dev_map_index_hash(dtab, i); 735 + 736 + hlist_for_each_entry_safe(dev, next, head, index_hlist) { 737 + if (netdev != dev->dev) 738 + continue; 739 + 740 + dtab->items--; 741 + hlist_del_rcu(&dev->index_hlist); 742 + call_rcu(&dev->rcu, __dev_map_entry_free); 743 + } 744 + } 745 + spin_unlock_irqrestore(&dtab->index_lock, flags); 746 + } 747 + 722 748 static int dev_map_notification(struct notifier_block *notifier, 723 749 ulong event, void *ptr) 724 750 { ··· 761 735 */ 762 736 rcu_read_lock(); 763 737 list_for_each_entry_rcu(dtab, &dev_map_list, list) { 738 + if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) { 739 + dev_map_hash_remove_netdev(dtab, netdev); 740 + continue; 741 + } 742 + 764 743 for (i = 0; i < dtab->map.max_entries; i++) { 765 744 struct bpf_dtab_netdev *dev, *odev; 766 745
+20 -11
kernel/bpf/syscall.c
··· 1326 1326 { 1327 1327 struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu); 1328 1328 1329 + kvfree(aux->func_info); 1329 1330 free_used_maps(aux); 1330 1331 bpf_prog_uncharge_memlock(aux->prog); 1331 1332 security_bpf_prog_free(aux); 1332 1333 bpf_prog_free(aux->prog); 1334 + } 1335 + 1336 + static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred) 1337 + { 1338 + bpf_prog_kallsyms_del_all(prog); 1339 + btf_put(prog->aux->btf); 1340 + bpf_prog_free_linfo(prog); 1341 + 1342 + if (deferred) 1343 + call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu); 1344 + else 1345 + __bpf_prog_put_rcu(&prog->aux->rcu); 1333 1346 } 1334 1347 1335 1348 static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) ··· 1351 1338 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0); 1352 1339 /* bpf_prog_free_id() must be called first */ 1353 1340 bpf_prog_free_id(prog, do_idr_lock); 1354 - bpf_prog_kallsyms_del_all(prog); 1355 - btf_put(prog->aux->btf); 1356 - kvfree(prog->aux->func_info); 1357 - bpf_prog_free_linfo(prog); 1358 - 1359 - call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu); 1341 + __bpf_prog_put_noref(prog, true); 1360 1342 } 1361 1343 } 1362 1344 ··· 1749 1741 return err; 1750 1742 1751 1743 free_used_maps: 1752 - bpf_prog_free_linfo(prog); 1753 - kvfree(prog->aux->func_info); 1754 - btf_put(prog->aux->btf); 1755 - bpf_prog_kallsyms_del_subprogs(prog); 1756 - free_used_maps(prog->aux); 1744 + /* In case we have subprogs, we need to wait for a grace 1745 + * period before we can tear down JIT memory since symbols 1746 + * are already exposed under kallsyms. 1747 + */ 1748 + __bpf_prog_put_noref(prog, prog->aux->func_cnt); 1749 + return err; 1757 1750 free_prog: 1758 1751 bpf_prog_uncharge_memlock(prog); 1759 1752 free_prog_sec:
-1
net/8021q/vlan.c
··· 172 172 if (err < 0) 173 173 goto out_uninit_mvrp; 174 174 175 - vlan->nest_level = dev_get_nest_level(real_dev) + 1; 176 175 err = register_netdevice(dev); 177 176 if (err < 0) 178 177 goto out_uninit_mvrp;
-33
net/8021q/vlan_dev.c
··· 489 489 dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); 490 490 } 491 491 492 - /* 493 - * vlan network devices have devices nesting below it, and are a special 494 - * "super class" of normal network devices; split their locks off into a 495 - * separate class since they always nest. 496 - */ 497 - static struct lock_class_key vlan_netdev_xmit_lock_key; 498 - static struct lock_class_key vlan_netdev_addr_lock_key; 499 - 500 - static void vlan_dev_set_lockdep_one(struct net_device *dev, 501 - struct netdev_queue *txq, 502 - void *_subclass) 503 - { 504 - lockdep_set_class_and_subclass(&txq->_xmit_lock, 505 - &vlan_netdev_xmit_lock_key, 506 - *(int *)_subclass); 507 - } 508 - 509 - static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass) 510 - { 511 - lockdep_set_class_and_subclass(&dev->addr_list_lock, 512 - &vlan_netdev_addr_lock_key, 513 - subclass); 514 - netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass); 515 - } 516 - 517 - static int vlan_dev_get_lock_subclass(struct net_device *dev) 518 - { 519 - return vlan_dev_priv(dev)->nest_level; 520 - } 521 - 522 492 static const struct header_ops vlan_header_ops = { 523 493 .create = vlan_dev_hard_header, 524 494 .parse = eth_header_parse, ··· 578 608 dev->netdev_ops = &vlan_netdev_ops; 579 609 580 610 SET_NETDEV_DEVTYPE(dev, &vlan_type); 581 - 582 - vlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev)); 583 611 584 612 vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats); 585 613 if (!vlan->vlan_pcpu_stats) ··· 780 812 .ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup, 781 813 #endif 782 814 .ndo_fix_features = vlan_dev_fix_features, 783 - .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, 784 815 .ndo_get_iflink = vlan_dev_get_iflink, 785 816 }; 786 817
+1 -1
net/atm/common.c
··· 668 668 mask |= EPOLLHUP; 669 669 670 670 /* readable? */ 671 - if (!skb_queue_empty(&sk->sk_receive_queue)) 671 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 672 672 mask |= EPOLLIN | EPOLLRDNORM; 673 673 674 674 /* writable? */
+52 -9
net/batman-adv/bat_iv_ogm.c
··· 22 22 #include <linux/kernel.h> 23 23 #include <linux/kref.h> 24 24 #include <linux/list.h> 25 + #include <linux/lockdep.h> 26 + #include <linux/mutex.h> 25 27 #include <linux/netdevice.h> 26 28 #include <linux/netlink.h> 27 29 #include <linux/pkt_sched.h> ··· 195 193 unsigned char *ogm_buff; 196 194 u32 random_seqno; 197 195 196 + mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex); 197 + 198 198 /* randomize initial seqno to avoid collision */ 199 199 get_random_bytes(&random_seqno, sizeof(random_seqno)); 200 200 atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno); 201 201 202 202 hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN; 203 203 ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC); 204 - if (!ogm_buff) 204 + if (!ogm_buff) { 205 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 205 206 return -ENOMEM; 207 + } 206 208 207 209 hard_iface->bat_iv.ogm_buff = ogm_buff; 208 210 ··· 218 212 batadv_ogm_packet->reserved = 0; 219 213 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE; 220 214 215 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 216 + 221 217 return 0; 222 218 } 223 219 224 220 static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface) 225 221 { 222 + mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex); 223 + 226 224 kfree(hard_iface->bat_iv.ogm_buff); 227 225 hard_iface->bat_iv.ogm_buff = NULL; 226 + 227 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 228 228 } 229 229 230 230 static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface) 231 231 { 232 232 struct batadv_ogm_packet *batadv_ogm_packet; 233 - unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff; 233 + void *ogm_buff; 234 234 235 - batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; 235 + mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex); 236 + 237 + ogm_buff = hard_iface->bat_iv.ogm_buff; 238 + if (!ogm_buff) 239 + goto unlock; 240 + 241 + batadv_ogm_packet = ogm_buff; 236 242 ether_addr_copy(batadv_ogm_packet->orig, 237 243 hard_iface->net_dev->dev_addr); 238 244 ether_addr_copy(batadv_ogm_packet->prev_sender, 239 245 hard_iface->net_dev->dev_addr); 246 + 247 + unlock: 248 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 240 249 } 241 250 242 251 static void 243 252 batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface) 244 253 { 245 254 struct batadv_ogm_packet *batadv_ogm_packet; 246 - unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff; 255 + void *ogm_buff; 247 256 248 - batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; 257 + mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex); 258 + 259 + ogm_buff = hard_iface->bat_iv.ogm_buff; 260 + if (!ogm_buff) 261 + goto unlock; 262 + 263 + batadv_ogm_packet = ogm_buff; 249 264 batadv_ogm_packet->ttl = BATADV_TTL; 265 + 266 + unlock: 267 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 250 268 } 251 269 252 270 /* when do we schedule our own ogm to be sent */ ··· 772 742 } 773 743 } 774 744 775 - static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) 745 + /** 746 + * batadv_iv_ogm_schedule_buff() - schedule submission of hardif ogm buffer 747 + * @hard_iface: interface whose ogm buffer should be transmitted 748 + */ 749 + static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface) 776 750 { 777 751 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); 778 752 unsigned char **ogm_buff = &hard_iface->bat_iv.ogm_buff; ··· 787 753 u16 tvlv_len = 0; 788 754 unsigned long send_time; 789 755 790 - if (hard_iface->if_status == BATADV_IF_NOT_IN_USE || 791 - hard_iface->if_status == BATADV_IF_TO_BE_REMOVED) 792 - return; 756 + lockdep_assert_held(&hard_iface->bat_iv.ogm_buff_mutex); 793 757 794 758 /* the interface gets activated here to avoid race conditions between 795 759 * the moment of activating the interface in ··· 853 821 out: 854 822 if (primary_if) 855 823 batadv_hardif_put(primary_if); 824 + } 825 + 826 + static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) 827 + { 828 + if (hard_iface->if_status == BATADV_IF_NOT_IN_USE || 829 + hard_iface->if_status == BATADV_IF_TO_BE_REMOVED) 830 + return; 831 + 832 + mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex); 833 + batadv_iv_ogm_schedule_buff(hard_iface); 834 + mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); 856 835 } 857 836 858 837 /**
+33 -8
net/batman-adv/bat_v_ogm.c
··· 18 18 #include <linux/kref.h> 19 19 #include <linux/list.h> 20 20 #include <linux/lockdep.h> 21 + #include <linux/mutex.h> 21 22 #include <linux/netdevice.h> 22 23 #include <linux/random.h> 23 24 #include <linux/rculist.h> ··· 257 256 } 258 257 259 258 /** 260 - * batadv_v_ogm_send() - periodic worker broadcasting the own OGM 261 - * @work: work queue item 259 + * batadv_v_ogm_send_softif() - periodic worker broadcasting the own OGM 260 + * @bat_priv: the bat priv with all the soft interface information 262 261 */ 263 - static void batadv_v_ogm_send(struct work_struct *work) 262 + static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv) 264 263 { 265 264 struct batadv_hard_iface *hard_iface; 266 - struct batadv_priv_bat_v *bat_v; 267 - struct batadv_priv *bat_priv; 268 265 struct batadv_ogm2_packet *ogm_packet; 269 266 struct sk_buff *skb, *skb_tmp; 270 267 unsigned char *ogm_buff; ··· 270 271 u16 tvlv_len = 0; 271 272 int ret; 272 273 273 - bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work); 274 - bat_priv = container_of(bat_v, struct batadv_priv, bat_v); 274 + lockdep_assert_held(&bat_priv->bat_v.ogm_buff_mutex); 275 275 276 276 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING) 277 277 goto out; ··· 362 364 } 363 365 364 366 /** 367 + * batadv_v_ogm_send() - periodic worker broadcasting the own OGM 368 + * @work: work queue item 369 + */ 370 + static void batadv_v_ogm_send(struct work_struct *work) 371 + { 372 + struct batadv_priv_bat_v *bat_v; 373 + struct batadv_priv *bat_priv; 374 + 375 + bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work); 376 + bat_priv = container_of(bat_v, struct batadv_priv, bat_v); 377 + 378 + mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); 379 + batadv_v_ogm_send_softif(bat_priv); 380 + mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); 381 + } 382 + 383 + /** 365 384 * batadv_v_ogm_aggr_work() - OGM queue periodic task per interface 366 385 * @work: work queue item 367 386 * ··· 439 424 struct batadv_priv *bat_priv = netdev_priv(primary_iface->soft_iface); 440 425 struct batadv_ogm2_packet *ogm_packet; 441 426 427 + mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); 442 428 if (!bat_priv->bat_v.ogm_buff) 443 - return; 429 + goto unlock; 444 430 445 431 ogm_packet = (struct batadv_ogm2_packet *)bat_priv->bat_v.ogm_buff; 446 432 ether_addr_copy(ogm_packet->orig, primary_iface->net_dev->dev_addr); 433 + 434 + unlock: 435 + mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); 447 436 } 448 437 449 438 /** ··· 1069 1050 atomic_set(&bat_priv->bat_v.ogm_seqno, random_seqno); 1070 1051 INIT_DELAYED_WORK(&bat_priv->bat_v.ogm_wq, batadv_v_ogm_send); 1071 1052 1053 + mutex_init(&bat_priv->bat_v.ogm_buff_mutex); 1054 + 1072 1055 return 0; 1073 1056 } 1074 1057 ··· 1082 1061 { 1083 1062 cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq); 1084 1063 1064 + mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); 1065 + 1085 1066 kfree(bat_priv->bat_v.ogm_buff); 1086 1067 bat_priv->bat_v.ogm_buff = NULL; 1087 1068 bat_priv->bat_v.ogm_buff_len = 0; 1069 + 1070 + mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); 1088 1071 }
+2
net/batman-adv/hard-interface.c
··· 18 18 #include <linux/kref.h> 19 19 #include <linux/limits.h> 20 20 #include <linux/list.h> 21 + #include <linux/mutex.h> 21 22 #include <linux/netdevice.h> 22 23 #include <linux/printk.h> 23 24 #include <linux/rculist.h> ··· 930 929 INIT_LIST_HEAD(&hard_iface->list); 931 930 INIT_HLIST_HEAD(&hard_iface->neigh_list); 932 931 932 + mutex_init(&hard_iface->bat_iv.ogm_buff_mutex); 933 933 spin_lock_init(&hard_iface->neigh_list_lock); 934 934 kref_init(&hard_iface->refcount); 935 935
-32
net/batman-adv/soft-interface.c
··· 740 740 return 0; 741 741 } 742 742 743 - /* batman-adv network devices have devices nesting below it and are a special 744 - * "super class" of normal network devices; split their locks off into a 745 - * separate class since they always nest. 746 - */ 747 - static struct lock_class_key batadv_netdev_xmit_lock_key; 748 - static struct lock_class_key batadv_netdev_addr_lock_key; 749 - 750 - /** 751 - * batadv_set_lockdep_class_one() - Set lockdep class for a single tx queue 752 - * @dev: device which owns the tx queue 753 - * @txq: tx queue to modify 754 - * @_unused: always NULL 755 - */ 756 - static void batadv_set_lockdep_class_one(struct net_device *dev, 757 - struct netdev_queue *txq, 758 - void *_unused) 759 - { 760 - lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key); 761 - } 762 - 763 - /** 764 - * batadv_set_lockdep_class() - Set txq and addr_list lockdep class 765 - * @dev: network device to modify 766 - */ 767 - static void batadv_set_lockdep_class(struct net_device *dev) 768 - { 769 - lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key); 770 - netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL); 771 - } 772 - 773 743 /** 774 744 * batadv_softif_init_late() - late stage initialization of soft interface 775 745 * @dev: registered network device to modify ··· 752 782 u32 random_seqno; 753 783 int ret; 754 784 size_t cnt_len = sizeof(u64) * BATADV_CNT_NUM; 755 - 756 - batadv_set_lockdep_class(dev); 757 785 758 786 bat_priv = netdev_priv(dev); 759 787 bat_priv->soft_iface = dev;
+7
net/batman-adv/types.h
··· 17 17 #include <linux/if.h> 18 18 #include <linux/if_ether.h> 19 19 #include <linux/kref.h> 20 + #include <linux/mutex.h> 20 21 #include <linux/netdevice.h> 21 22 #include <linux/netlink.h> 22 23 #include <linux/sched.h> /* for linux/wait.h */ ··· 82 81 83 82 /** @ogm_seqno: OGM sequence number - used to identify each OGM */ 84 83 atomic_t ogm_seqno; 84 + 85 + /** @ogm_buff_mutex: lock protecting ogm_buff and ogm_buff_len */ 86 + struct mutex ogm_buff_mutex; 85 87 }; 86 88 87 89 /** ··· 1542 1538 1543 1539 /** @ogm_seqno: OGM sequence number - used to identify each OGM */ 1544 1540 atomic_t ogm_seqno; 1541 + 1542 + /** @ogm_buff_mutex: lock protecting ogm_buff and ogm_buff_len */ 1543 + struct mutex ogm_buff_mutex; 1545 1544 1546 1545 /** @ogm_wq: workqueue used to schedule OGM transmissions */ 1547 1546 struct delayed_work ogm_wq;
-8
net/bluetooth/6lowpan.c
··· 571 571 return err < 0 ? NET_XMIT_DROP : err; 572 572 } 573 573 574 - static int bt_dev_init(struct net_device *dev) 575 - { 576 - netdev_lockdep_set_classes(dev); 577 - 578 - return 0; 579 - } 580 - 581 574 static const struct net_device_ops netdev_ops = { 582 - .ndo_init = bt_dev_init, 583 575 .ndo_start_xmit = bt_xmit, 584 576 }; 585 577
+2 -2
net/bluetooth/af_bluetooth.c
··· 460 460 if (sk->sk_state == BT_LISTEN) 461 461 return bt_accept_poll(sk); 462 462 463 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 463 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 464 464 mask |= EPOLLERR | 465 465 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); 466 466 ··· 470 470 if (sk->sk_shutdown == SHUTDOWN_MASK) 471 471 mask |= EPOLLHUP; 472 472 473 - if (!skb_queue_empty(&sk->sk_receive_queue)) 473 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 474 474 mask |= EPOLLIN | EPOLLRDNORM; 475 475 476 476 if (sk->sk_state == BT_CLOSED)
-8
net/bridge/br_device.c
··· 24 24 const struct nf_br_ops __rcu *nf_br_ops __read_mostly; 25 25 EXPORT_SYMBOL_GPL(nf_br_ops); 26 26 27 - static struct lock_class_key bridge_netdev_addr_lock_key; 28 - 29 27 /* net device transmit always called with BH disabled */ 30 28 netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) 31 29 { ··· 106 108 return NETDEV_TX_OK; 107 109 } 108 110 109 - static void br_set_lockdep_class(struct net_device *dev) 110 - { 111 - lockdep_set_class(&dev->addr_list_lock, &bridge_netdev_addr_lock_key); 112 - } 113 - 114 111 static int br_dev_init(struct net_device *dev) 115 112 { 116 113 struct net_bridge *br = netdev_priv(dev); ··· 143 150 br_mdb_hash_fini(br); 144 151 br_fdb_hash_fini(br); 145 152 } 146 - br_set_lockdep_class(dev); 147 153 148 154 return err; 149 155 }
+1 -1
net/bridge/netfilter/nf_conntrack_bridge.c
··· 95 95 * This may also be a clone skbuff, we could preserve the geometry for 96 96 * the copies but probably not worth the effort. 97 97 */ 98 - ip_frag_init(skb, hlen, ll_rs, frag_max_size, &state); 98 + ip_frag_init(skb, hlen, ll_rs, frag_max_size, false, &state); 99 99 100 100 while (state.left > 0) { 101 101 struct sk_buff *skb2;
+1 -1
net/caif/caif_socket.c
··· 953 953 mask |= EPOLLRDHUP; 954 954 955 955 /* readable? */ 956 - if (!skb_queue_empty(&sk->sk_receive_queue) || 956 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue) || 957 957 (sk->sk_shutdown & RCV_SHUTDOWN)) 958 958 mask |= EPOLLIN | EPOLLRDNORM; 959 959
+4 -4
net/core/datagram.c
··· 97 97 if (error) 98 98 goto out_err; 99 99 100 - if (sk->sk_receive_queue.prev != skb) 100 + if (READ_ONCE(sk->sk_receive_queue.prev) != skb) 101 101 goto out; 102 102 103 103 /* Socket shut down? */ ··· 278 278 break; 279 279 280 280 sk_busy_loop(sk, flags & MSG_DONTWAIT); 281 - } while (sk->sk_receive_queue.prev != *last); 281 + } while (READ_ONCE(sk->sk_receive_queue.prev) != *last); 282 282 283 283 error = -EAGAIN; 284 284 ··· 767 767 mask = 0; 768 768 769 769 /* exceptional events? */ 770 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 770 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 771 771 mask |= EPOLLERR | 772 772 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); 773 773 ··· 777 777 mask |= EPOLLHUP; 778 778 779 779 /* readable? */ 780 - if (!skb_queue_empty(&sk->sk_receive_queue)) 780 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 781 781 mask |= EPOLLIN | EPOLLRDNORM; 782 782 783 783 /* Connection-based need to check for termination and startup */
+467 -156
net/core/dev.c
··· 146 146 #include "net-sysfs.h" 147 147 148 148 #define MAX_GRO_SKBS 8 149 + #define MAX_NEST_DEV 8 149 150 150 151 /* This should be increased if a protocol with a bigger head is added. */ 151 152 #define GRO_MAX_HEAD (MAX_HEADER + 128) ··· 276 275 277 276 DEFINE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 278 277 EXPORT_PER_CPU_SYMBOL(softnet_data); 279 - 280 - #ifdef CONFIG_LOCKDEP 281 - /* 282 - * register_netdevice() inits txq->_xmit_lock and sets lockdep class 283 - * according to dev->type 284 - */ 285 - static const unsigned short netdev_lock_type[] = { 286 - ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25, 287 - ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET, 288 - ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM, 289 - ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP, 290 - ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD, 291 - ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25, 292 - ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP, 293 - ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD, 294 - ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI, 295 - ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE, 296 - ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET, 297 - ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, 298 - ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, 299 - ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE, 300 - ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE}; 301 - 302 - static const char *const netdev_lock_name[] = { 303 - "_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", 304 - "_xmit_PRONET", "_xmit_CHAOS", "_xmit_IEEE802", "_xmit_ARCNET", 305 - "_xmit_APPLETLK", "_xmit_DLCI", "_xmit_ATM", "_xmit_METRICOM", 306 - "_xmit_IEEE1394", "_xmit_EUI64", "_xmit_INFINIBAND", "_xmit_SLIP", 307 - "_xmit_CSLIP", "_xmit_SLIP6", "_xmit_CSLIP6", "_xmit_RSRVD", 308 - "_xmit_ADAPT", "_xmit_ROSE", "_xmit_X25", "_xmit_HWX25", 309 - "_xmit_PPP", "_xmit_CISCO", "_xmit_LAPB", "_xmit_DDCMP", 310 - "_xmit_RAWHDLC", "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD", 311 - "_xmit_SKIP", "_xmit_LOOPBACK", "_xmit_LOCALTLK", "_xmit_FDDI", 312 - "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE", 313 - "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET", 314 - "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", 315 - "_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM", 316 - "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE", 317 - "_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"}; 318 - 319 - static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; 320 - static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; 321 - 322 - static inline unsigned short netdev_lock_pos(unsigned short dev_type) 323 - { 324 - int i; 325 - 326 - for (i = 0; i < ARRAY_SIZE(netdev_lock_type); i++) 327 - if (netdev_lock_type[i] == dev_type) 328 - return i; 329 - /* the last key is used by default */ 330 - return ARRAY_SIZE(netdev_lock_type) - 1; 331 - } 332 - 333 - static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock, 334 - unsigned short dev_type) 335 - { 336 - int i; 337 - 338 - i = netdev_lock_pos(dev_type); 339 - lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i], 340 - netdev_lock_name[i]); 341 - } 342 - 343 - static inline void netdev_set_addr_lockdep_class(struct net_device *dev) 344 - { 345 - int i; 346 - 347 - i = netdev_lock_pos(dev->type); 348 - lockdep_set_class_and_name(&dev->addr_list_lock, 349 - &netdev_addr_lock_key[i], 350 - netdev_lock_name[i]); 351 - } 352 - #else 353 - static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock, 354 - unsigned short dev_type) 355 - { 356 - } 357 - static inline void netdev_set_addr_lockdep_class(struct net_device *dev) 358 - { 359 - } 360 - #endif 361 278 362 279 /******************************************************************************* 363 280 * ··· 6408 6489 /* upper master flag, there can only be one master device per list */ 6409 6490 bool master; 6410 6491 6492 + /* lookup ignore flag */ 6493 + bool ignore; 6494 + 6411 6495 /* counter for the number of times this device was added to us */ 6412 6496 u16 ref_nr; 6413 6497 ··· 6433 6511 return NULL; 6434 6512 } 6435 6513 6436 - static int __netdev_has_upper_dev(struct net_device *upper_dev, void *data) 6514 + static int ____netdev_has_upper_dev(struct net_device *upper_dev, void *data) 6437 6515 { 6438 6516 struct net_device *dev = data; 6439 6517 ··· 6454 6532 { 6455 6533 ASSERT_RTNL(); 6456 6534 6457 - return netdev_walk_all_upper_dev_rcu(dev, __netdev_has_upper_dev, 6535 + return netdev_walk_all_upper_dev_rcu(dev, ____netdev_has_upper_dev, 6458 6536 upper_dev); 6459 6537 } 6460 6538 EXPORT_SYMBOL(netdev_has_upper_dev); ··· 6472 6550 bool netdev_has_upper_dev_all_rcu(struct net_device *dev, 6473 6551 struct net_device *upper_dev) 6474 6552 { 6475 - return !!netdev_walk_all_upper_dev_rcu(dev, __netdev_has_upper_dev, 6553 + return !!netdev_walk_all_upper_dev_rcu(dev, ____netdev_has_upper_dev, 6476 6554 upper_dev); 6477 6555 } 6478 6556 EXPORT_SYMBOL(netdev_has_upper_dev_all_rcu); ··· 6515 6593 return NULL; 6516 6594 } 6517 6595 EXPORT_SYMBOL(netdev_master_upper_dev_get); 6596 + 6597 + static struct net_device *__netdev_master_upper_dev_get(struct net_device *dev) 6598 + { 6599 + struct netdev_adjacent *upper; 6600 + 6601 + ASSERT_RTNL(); 6602 + 6603 + if (list_empty(&dev->adj_list.upper)) 6604 + return NULL; 6605 + 6606 + upper = list_first_entry(&dev->adj_list.upper, 6607 + struct netdev_adjacent, list); 6608 + if (likely(upper->master) && !upper->ignore) 6609 + return upper->dev; 6610 + return NULL; 6611 + } 6518 6612 6519 6613 /** 6520 6614 * netdev_has_any_lower_dev - Check if device is linked to some device ··· 6582 6644 } 6583 6645 EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu); 6584 6646 6647 + static struct net_device *__netdev_next_upper_dev(struct net_device *dev, 6648 + struct list_head **iter, 6649 + bool *ignore) 6650 + { 6651 + struct netdev_adjacent *upper; 6652 + 6653 + upper = list_entry((*iter)->next, struct netdev_adjacent, list); 6654 + 6655 + if (&upper->list == &dev->adj_list.upper) 6656 + return NULL; 6657 + 6658 + *iter = &upper->list; 6659 + *ignore = upper->ignore; 6660 + 6661 + return upper->dev; 6662 + } 6663 + 6585 6664 static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev, 6586 6665 struct list_head **iter) 6587 6666 { ··· 6616 6661 return upper->dev; 6617 6662 } 6618 6663 6664 + static int __netdev_walk_all_upper_dev(struct net_device *dev, 6665 + int (*fn)(struct net_device *dev, 6666 + void *data), 6667 + void *data) 6668 + { 6669 + struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; 6670 + struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; 6671 + int ret, cur = 0; 6672 + bool ignore; 6673 + 6674 + now = dev; 6675 + iter = &dev->adj_list.upper; 6676 + 6677 + while (1) { 6678 + if (now != dev) { 6679 + ret = fn(now, data); 6680 + if (ret) 6681 + return ret; 6682 + } 6683 + 6684 + next = NULL; 6685 + while (1) { 6686 + udev = __netdev_next_upper_dev(now, &iter, &ignore); 6687 + if (!udev) 6688 + break; 6689 + if (ignore) 6690 + continue; 6691 + 6692 + next = udev; 6693 + niter = &udev->adj_list.upper; 6694 + dev_stack[cur] = now; 6695 + iter_stack[cur++] = iter; 6696 + break; 6697 + } 6698 + 6699 + if (!next) { 6700 + if (!cur) 6701 + return 0; 6702 + next = dev_stack[--cur]; 6703 + niter = iter_stack[cur]; 6704 + } 6705 + 6706 + now = next; 6707 + iter = niter; 6708 + } 6709 + 6710 + return 0; 6711 + } 6712 + 6619 6713 int netdev_walk_all_upper_dev_rcu(struct net_device *dev, 6620 6714 int (*fn)(struct net_device *dev, 6621 6715 void *data), 6622 6716 void *data) 6623 6717 { 6624 - struct net_device *udev; 6625 - struct list_head *iter; 6626 - int ret; 6718 + struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; 6719 + struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; 6720 + int ret, cur = 0; 6627 6721 6628 - for (iter = &dev->adj_list.upper, 6629 - udev = netdev_next_upper_dev_rcu(dev, &iter); 6630 - udev; 6631 - udev = netdev_next_upper_dev_rcu(dev, &iter)) { 6632 - /* first is the upper device itself */ 6633 - ret = fn(udev, data); 6634 - if (ret) 6635 - return ret; 6722 + now = dev; 6723 + iter = &dev->adj_list.upper; 6636 6724 6637 - /* then look at all of its upper devices */ 6638 - ret = netdev_walk_all_upper_dev_rcu(udev, fn, data); 6639 - if (ret) 6640 - return ret; 6725 + while (1) { 6726 + if (now != dev) { 6727 + ret = fn(now, data); 6728 + if (ret) 6729 + return ret; 6730 + } 6731 + 6732 + next = NULL; 6733 + while (1) { 6734 + udev = netdev_next_upper_dev_rcu(now, &iter); 6735 + if (!udev) 6736 + break; 6737 + 6738 + next = udev; 6739 + niter = &udev->adj_list.upper; 6740 + dev_stack[cur] = now; 6741 + iter_stack[cur++] = iter; 6742 + break; 6743 + } 6744 + 6745 + if (!next) { 6746 + if (!cur) 6747 + return 0; 6748 + next = dev_stack[--cur]; 6749 + niter = iter_stack[cur]; 6750 + } 6751 + 6752 + now = next; 6753 + iter = niter; 6641 6754 } 6642 6755 6643 6756 return 0; 6644 6757 } 6645 6758 EXPORT_SYMBOL_GPL(netdev_walk_all_upper_dev_rcu); 6759 + 6760 + static bool __netdev_has_upper_dev(struct net_device *dev, 6761 + struct net_device *upper_dev) 6762 + { 6763 + ASSERT_RTNL(); 6764 + 6765 + return __netdev_walk_all_upper_dev(dev, ____netdev_has_upper_dev, 6766 + upper_dev); 6767 + } 6646 6768 6647 6769 /** 6648 6770 * netdev_lower_get_next_private - Get the next ->private from the ··· 6817 6785 return lower->dev; 6818 6786 } 6819 6787 6788 + static struct net_device *__netdev_next_lower_dev(struct net_device *dev, 6789 + struct list_head **iter, 6790 + bool *ignore) 6791 + { 6792 + struct netdev_adjacent *lower; 6793 + 6794 + lower = list_entry((*iter)->next, struct netdev_adjacent, list); 6795 + 6796 + if (&lower->list == &dev->adj_list.lower) 6797 + return NULL; 6798 + 6799 + *iter = &lower->list; 6800 + *ignore = lower->ignore; 6801 + 6802 + return lower->dev; 6803 + } 6804 + 6820 6805 int netdev_walk_all_lower_dev(struct net_device *dev, 6821 6806 int (*fn)(struct net_device *dev, 6822 6807 void *data), 6823 6808 void *data) 6824 6809 { 6825 - struct net_device *ldev; 6826 - struct list_head *iter; 6827 - int ret; 6810 + struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; 6811 + struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; 6812 + int ret, cur = 0; 6828 6813 6829 - for (iter = &dev->adj_list.lower, 6830 - ldev = netdev_next_lower_dev(dev, &iter); 6831 - ldev; 6832 - ldev = netdev_next_lower_dev(dev, &iter)) { 6833 - /* first is the lower device itself */ 6834 - ret = fn(ldev, data); 6835 - if (ret) 6836 - return ret; 6814 + now = dev; 6815 + iter = &dev->adj_list.lower; 6837 6816 6838 - /* then look at all of its lower devices */ 6839 - ret = netdev_walk_all_lower_dev(ldev, fn, data); 6840 - if (ret) 6841 - return ret; 6817 + while (1) { 6818 + if (now != dev) { 6819 + ret = fn(now, data); 6820 + if (ret) 6821 + return ret; 6822 + } 6823 + 6824 + next = NULL; 6825 + while (1) { 6826 + ldev = netdev_next_lower_dev(now, &iter); 6827 + if (!ldev) 6828 + break; 6829 + 6830 + next = ldev; 6831 + niter = &ldev->adj_list.lower; 6832 + dev_stack[cur] = now; 6833 + iter_stack[cur++] = iter; 6834 + break; 6835 + } 6836 + 6837 + if (!next) { 6838 + if (!cur) 6839 + return 0; 6840 + next = dev_stack[--cur]; 6841 + niter = iter_stack[cur]; 6842 + } 6843 + 6844 + now = next; 6845 + iter = niter; 6842 6846 } 6843 6847 6844 6848 return 0; 6845 6849 } 6846 6850 EXPORT_SYMBOL_GPL(netdev_walk_all_lower_dev); 6851 + 6852 + static int __netdev_walk_all_lower_dev(struct net_device *dev, 6853 + int (*fn)(struct net_device *dev, 6854 + void *data), 6855 + void *data) 6856 + { 6857 + struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; 6858 + struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; 6859 + int ret, cur = 0; 6860 + bool ignore; 6861 + 6862 + now = dev; 6863 + iter = &dev->adj_list.lower; 6864 + 6865 + while (1) { 6866 + if (now != dev) { 6867 + ret = fn(now, data); 6868 + if (ret) 6869 + return ret; 6870 + } 6871 + 6872 + next = NULL; 6873 + while (1) { 6874 + ldev = __netdev_next_lower_dev(now, &iter, &ignore); 6875 + if (!ldev) 6876 + break; 6877 + if (ignore) 6878 + continue; 6879 + 6880 + next = ldev; 6881 + niter = &ldev->adj_list.lower; 6882 + dev_stack[cur] = now; 6883 + iter_stack[cur++] = iter; 6884 + break; 6885 + } 6886 + 6887 + if (!next) { 6888 + if (!cur) 6889 + return 0; 6890 + next = dev_stack[--cur]; 6891 + niter = iter_stack[cur]; 6892 + } 6893 + 6894 + now = next; 6895 + iter = niter; 6896 + } 6897 + 6898 + return 0; 6899 + } 6847 6900 6848 6901 static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev, 6849 6902 struct list_head **iter) ··· 6944 6827 return lower->dev; 6945 6828 } 6946 6829 6830 + static u8 __netdev_upper_depth(struct net_device *dev) 6831 + { 6832 + struct net_device *udev; 6833 + struct list_head *iter; 6834 + u8 max_depth = 0; 6835 + bool ignore; 6836 + 6837 + for (iter = &dev->adj_list.upper, 6838 + udev = __netdev_next_upper_dev(dev, &iter, &ignore); 6839 + udev; 6840 + udev = __netdev_next_upper_dev(dev, &iter, &ignore)) { 6841 + if (ignore) 6842 + continue; 6843 + if (max_depth < udev->upper_level) 6844 + max_depth = udev->upper_level; 6845 + } 6846 + 6847 + return max_depth; 6848 + } 6849 + 6850 + static u8 __netdev_lower_depth(struct net_device *dev) 6851 + { 6852 + struct net_device *ldev; 6853 + struct list_head *iter; 6854 + u8 max_depth = 0; 6855 + bool ignore; 6856 + 6857 + for (iter = &dev->adj_list.lower, 6858 + ldev = __netdev_next_lower_dev(dev, &iter, &ignore); 6859 + ldev; 6860 + ldev = __netdev_next_lower_dev(dev, &iter, &ignore)) { 6861 + if (ignore) 6862 + continue; 6863 + if (max_depth < ldev->lower_level) 6864 + max_depth = ldev->lower_level; 6865 + } 6866 + 6867 + return max_depth; 6868 + } 6869 + 6870 + static int __netdev_update_upper_level(struct net_device *dev, void *data) 6871 + { 6872 + dev->upper_level = __netdev_upper_depth(dev) + 1; 6873 + return 0; 6874 + } 6875 + 6876 + static int __netdev_update_lower_level(struct net_device *dev, void *data) 6877 + { 6878 + dev->lower_level = __netdev_lower_depth(dev) + 1; 6879 + return 0; 6880 + } 6881 + 6947 6882 int netdev_walk_all_lower_dev_rcu(struct net_device *dev, 6948 6883 int (*fn)(struct net_device *dev, 6949 6884 void *data), 6950 6885 void *data) 6951 6886 { 6952 - struct net_device *ldev; 6953 - struct list_head *iter; 6954 - int ret; 6887 + struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; 6888 + struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; 6889 + int ret, cur = 0; 6955 6890 6956 - for (iter = &dev->adj_list.lower, 6957 - ldev = netdev_next_lower_dev_rcu(dev, &iter); 6958 - ldev; 6959 - ldev = netdev_next_lower_dev_rcu(dev, &iter)) { 6960 - /* first is the lower device itself */ 6961 - ret = fn(ldev, data); 6962 - if (ret) 6963 - return ret; 6891 + now = dev; 6892 + iter = &dev->adj_list.lower; 6964 6893 6965 - /* then look at all of its lower devices */ 6966 - ret = netdev_walk_all_lower_dev_rcu(ldev, fn, data); 6967 - if (ret) 6968 - return ret; 6894 + while (1) { 6895 + if (now != dev) { 6896 + ret = fn(now, data); 6897 + if (ret) 6898 + return ret; 6899 + } 6900 + 6901 + next = NULL; 6902 + while (1) { 6903 + ldev = netdev_next_lower_dev_rcu(now, &iter); 6904 + if (!ldev) 6905 + break; 6906 + 6907 + next = ldev; 6908 + niter = &ldev->adj_list.lower; 6909 + dev_stack[cur] = now; 6910 + iter_stack[cur++] = iter; 6911 + break; 6912 + } 6913 + 6914 + if (!next) { 6915 + if (!cur) 6916 + return 0; 6917 + next = dev_stack[--cur]; 6918 + niter = iter_stack[cur]; 6919 + } 6920 + 6921 + now = next; 6922 + iter = niter; 6969 6923 } 6970 6924 6971 6925 return 0; ··· 7140 6952 adj->master = master; 7141 6953 adj->ref_nr = 1; 7142 6954 adj->private = private; 6955 + adj->ignore = false; 7143 6956 dev_hold(adj_dev); 7144 6957 7145 6958 pr_debug("Insert adjacency: dev %s adj_dev %s adj->ref_nr %d; dev_hold on %s\n", ··· 7291 7102 return -EBUSY; 7292 7103 7293 7104 /* To prevent loops, check if dev is not upper device to upper_dev. */ 7294 - if (netdev_has_upper_dev(upper_dev, dev)) 7105 + if (__netdev_has_upper_dev(upper_dev, dev)) 7295 7106 return -EBUSY; 7296 7107 7108 + if ((dev->lower_level + upper_dev->upper_level) > MAX_NEST_DEV) 7109 + return -EMLINK; 7110 + 7297 7111 if (!master) { 7298 - if (netdev_has_upper_dev(dev, upper_dev)) 7112 + if (__netdev_has_upper_dev(dev, upper_dev)) 7299 7113 return -EEXIST; 7300 7114 } else { 7301 - master_dev = netdev_master_upper_dev_get(dev); 7115 + master_dev = __netdev_master_upper_dev_get(dev); 7302 7116 if (master_dev) 7303 7117 return master_dev == upper_dev ? -EEXIST : -EBUSY; 7304 7118 } ··· 7322 7130 ret = notifier_to_errno(ret); 7323 7131 if (ret) 7324 7132 goto rollback; 7133 + 7134 + __netdev_update_upper_level(dev, NULL); 7135 + __netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL); 7136 + 7137 + __netdev_update_lower_level(upper_dev, NULL); 7138 + __netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, 7139 + NULL); 7325 7140 7326 7141 return 0; 7327 7142 ··· 7412 7213 7413 7214 call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, 7414 7215 &changeupper_info.info); 7216 + 7217 + __netdev_update_upper_level(dev, NULL); 7218 + __netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL); 7219 + 7220 + __netdev_update_lower_level(upper_dev, NULL); 7221 + __netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, 7222 + NULL); 7415 7223 } 7416 7224 EXPORT_SYMBOL(netdev_upper_dev_unlink); 7225 + 7226 + static void __netdev_adjacent_dev_set(struct net_device *upper_dev, 7227 + struct net_device *lower_dev, 7228 + bool val) 7229 + { 7230 + struct netdev_adjacent *adj; 7231 + 7232 + adj = __netdev_find_adj(lower_dev, &upper_dev->adj_list.lower); 7233 + if (adj) 7234 + adj->ignore = val; 7235 + 7236 + adj = __netdev_find_adj(upper_dev, &lower_dev->adj_list.upper); 7237 + if (adj) 7238 + adj->ignore = val; 7239 + } 7240 + 7241 + static void netdev_adjacent_dev_disable(struct net_device *upper_dev, 7242 + struct net_device *lower_dev) 7243 + { 7244 + __netdev_adjacent_dev_set(upper_dev, lower_dev, true); 7245 + } 7246 + 7247 + static void netdev_adjacent_dev_enable(struct net_device *upper_dev, 7248 + struct net_device *lower_dev) 7249 + { 7250 + __netdev_adjacent_dev_set(upper_dev, lower_dev, false); 7251 + } 7252 + 7253 + int netdev_adjacent_change_prepare(struct net_device *old_dev, 7254 + struct net_device *new_dev, 7255 + struct net_device *dev, 7256 + struct netlink_ext_ack *extack) 7257 + { 7258 + int err; 7259 + 7260 + if (!new_dev) 7261 + return 0; 7262 + 7263 + if (old_dev && new_dev != old_dev) 7264 + netdev_adjacent_dev_disable(dev, old_dev); 7265 + 7266 + err = netdev_upper_dev_link(new_dev, dev, extack); 7267 + if (err) { 7268 + if (old_dev && new_dev != old_dev) 7269 + netdev_adjacent_dev_enable(dev, old_dev); 7270 + return err; 7271 + } 7272 + 7273 + return 0; 7274 + } 7275 + EXPORT_SYMBOL(netdev_adjacent_change_prepare); 7276 + 7277 + void netdev_adjacent_change_commit(struct net_device *old_dev, 7278 + struct net_device *new_dev, 7279 + struct net_device *dev) 7280 + { 7281 + if (!new_dev || !old_dev) 7282 + return; 7283 + 7284 + if (new_dev == old_dev) 7285 + return; 7286 + 7287 + netdev_adjacent_dev_enable(dev, old_dev); 7288 + netdev_upper_dev_unlink(old_dev, dev); 7289 + } 7290 + EXPORT_SYMBOL(netdev_adjacent_change_commit); 7291 + 7292 + void netdev_adjacent_change_abort(struct net_device *old_dev, 7293 + struct net_device *new_dev, 7294 + struct net_device *dev) 7295 + { 7296 + if (!new_dev) 7297 + return; 7298 + 7299 + if (old_dev && new_dev != old_dev) 7300 + netdev_adjacent_dev_enable(dev, old_dev); 7301 + 7302 + netdev_upper_dev_unlink(new_dev, dev); 7303 + } 7304 + EXPORT_SYMBOL(netdev_adjacent_change_abort); 7417 7305 7418 7306 /** 7419 7307 * netdev_bonding_info_change - Dispatch event about slave change ··· 7614 7328 } 7615 7329 EXPORT_SYMBOL(netdev_lower_dev_get_private); 7616 7330 7617 - 7618 - int dev_get_nest_level(struct net_device *dev) 7619 - { 7620 - struct net_device *lower = NULL; 7621 - struct list_head *iter; 7622 - int max_nest = -1; 7623 - int nest; 7624 - 7625 - ASSERT_RTNL(); 7626 - 7627 - netdev_for_each_lower_dev(dev, lower, iter) { 7628 - nest = dev_get_nest_level(lower); 7629 - if (max_nest < nest) 7630 - max_nest = nest; 7631 - } 7632 - 7633 - return max_nest + 1; 7634 - } 7635 - EXPORT_SYMBOL(dev_get_nest_level); 7636 7331 7637 7332 /** 7638 7333 * netdev_lower_change - Dispatch event about lower device state change ··· 8421 8154 return -EINVAL; 8422 8155 } 8423 8156 8424 - if (prog->aux->id == prog_id) { 8157 + /* prog->aux->id may be 0 for orphaned device-bound progs */ 8158 + if (prog->aux->id && prog->aux->id == prog_id) { 8425 8159 bpf_prog_put(prog); 8426 8160 return 0; 8427 8161 } ··· 8887 8619 { 8888 8620 /* Initialize queue lock */ 8889 8621 spin_lock_init(&queue->_xmit_lock); 8890 - netdev_set_xmit_lockdep_class(&queue->_xmit_lock, dev->type); 8622 + lockdep_set_class(&queue->_xmit_lock, &dev->qdisc_xmit_lock_key); 8891 8623 queue->xmit_lock_owner = -1; 8892 8624 netdev_queue_numa_node_write(queue, NUMA_NO_NODE); 8893 8625 queue->dev = dev; ··· 8934 8666 } 8935 8667 EXPORT_SYMBOL(netif_tx_stop_all_queues); 8936 8668 8669 + static void netdev_register_lockdep_key(struct net_device *dev) 8670 + { 8671 + lockdep_register_key(&dev->qdisc_tx_busylock_key); 8672 + lockdep_register_key(&dev->qdisc_running_key); 8673 + lockdep_register_key(&dev->qdisc_xmit_lock_key); 8674 + lockdep_register_key(&dev->addr_list_lock_key); 8675 + } 8676 + 8677 + static void netdev_unregister_lockdep_key(struct net_device *dev) 8678 + { 8679 + lockdep_unregister_key(&dev->qdisc_tx_busylock_key); 8680 + lockdep_unregister_key(&dev->qdisc_running_key); 8681 + lockdep_unregister_key(&dev->qdisc_xmit_lock_key); 8682 + lockdep_unregister_key(&dev->addr_list_lock_key); 8683 + } 8684 + 8685 + void netdev_update_lockdep_key(struct net_device *dev) 8686 + { 8687 + struct netdev_queue *queue; 8688 + int i; 8689 + 8690 + lockdep_unregister_key(&dev->qdisc_xmit_lock_key); 8691 + lockdep_unregister_key(&dev->addr_list_lock_key); 8692 + 8693 + lockdep_register_key(&dev->qdisc_xmit_lock_key); 8694 + lockdep_register_key(&dev->addr_list_lock_key); 8695 + 8696 + lockdep_set_class(&dev->addr_list_lock, &dev->addr_list_lock_key); 8697 + for (i = 0; i < dev->num_tx_queues; i++) { 8698 + queue = netdev_get_tx_queue(dev, i); 8699 + 8700 + lockdep_set_class(&queue->_xmit_lock, 8701 + &dev->qdisc_xmit_lock_key); 8702 + } 8703 + } 8704 + EXPORT_SYMBOL(netdev_update_lockdep_key); 8705 + 8937 8706 /** 8938 8707 * register_netdevice - register a network device 8939 8708 * @dev: device to register ··· 9005 8700 BUG_ON(!net); 9006 8701 9007 8702 spin_lock_init(&dev->addr_list_lock); 9008 - netdev_set_addr_lockdep_class(dev); 8703 + lockdep_set_class(&dev->addr_list_lock, &dev->addr_list_lock_key); 9009 8704 9010 8705 ret = dev_get_valid_name(net, dev, dev->name); 9011 8706 if (ret < 0) ··· 9515 9210 9516 9211 dev_net_set(dev, &init_net); 9517 9212 9213 + netdev_register_lockdep_key(dev); 9214 + 9518 9215 dev->gso_max_size = GSO_MAX_SIZE; 9519 9216 dev->gso_max_segs = GSO_MAX_SEGS; 9217 + dev->upper_level = 1; 9218 + dev->lower_level = 1; 9520 9219 9521 9220 INIT_LIST_HEAD(&dev->napi_list); 9522 9221 INIT_LIST_HEAD(&dev->unreg_list); ··· 9600 9291 9601 9292 free_percpu(dev->pcpu_refcnt); 9602 9293 dev->pcpu_refcnt = NULL; 9294 + 9295 + netdev_unregister_lockdep_key(dev); 9603 9296 9604 9297 /* Compatibility with error handling in drivers */ 9605 9298 if (dev->reg_state == NETREG_UNINITIALIZED) { ··· 9771 9460 call_netdevice_notifiers(NETDEV_UNREGISTER, dev); 9772 9461 rcu_barrier(); 9773 9462 9774 - new_nsid = peernet2id_alloc(dev_net(dev), net); 9463 + new_nsid = peernet2id_alloc(dev_net(dev), net, GFP_KERNEL); 9775 9464 /* If there is an ifindex conflict assign a new one */ 9776 9465 if (__dev_get_by_index(net, dev->ifindex)) 9777 9466 new_ifindex = dev_new_index(net);
+6 -6
net/core/dev_addr_lists.c
··· 637 637 if (to->addr_len != from->addr_len) 638 638 return -EINVAL; 639 639 640 - netif_addr_lock_nested(to); 640 + netif_addr_lock(to); 641 641 err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); 642 642 if (!err) 643 643 __dev_set_rx_mode(to); ··· 667 667 if (to->addr_len != from->addr_len) 668 668 return -EINVAL; 669 669 670 - netif_addr_lock_nested(to); 670 + netif_addr_lock(to); 671 671 err = __hw_addr_sync_multiple(&to->uc, &from->uc, to->addr_len); 672 672 if (!err) 673 673 __dev_set_rx_mode(to); ··· 691 691 return; 692 692 693 693 netif_addr_lock_bh(from); 694 - netif_addr_lock_nested(to); 694 + netif_addr_lock(to); 695 695 __hw_addr_unsync(&to->uc, &from->uc, to->addr_len); 696 696 __dev_set_rx_mode(to); 697 697 netif_addr_unlock(to); ··· 858 858 if (to->addr_len != from->addr_len) 859 859 return -EINVAL; 860 860 861 - netif_addr_lock_nested(to); 861 + netif_addr_lock(to); 862 862 err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); 863 863 if (!err) 864 864 __dev_set_rx_mode(to); ··· 888 888 if (to->addr_len != from->addr_len) 889 889 return -EINVAL; 890 890 891 - netif_addr_lock_nested(to); 891 + netif_addr_lock(to); 892 892 err = __hw_addr_sync_multiple(&to->mc, &from->mc, to->addr_len); 893 893 if (!err) 894 894 __dev_set_rx_mode(to); ··· 912 912 return; 913 913 914 914 netif_addr_lock_bh(from); 915 - netif_addr_lock_nested(to); 915 + netif_addr_lock(to); 916 916 __hw_addr_unsync(&to->mc, &from->mc, to->addr_len); 917 917 __dev_set_rx_mode(to); 918 918 netif_addr_unlock(to);
+3 -1
net/core/ethtool.c
··· 1396 1396 1397 1397 static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) 1398 1398 { 1399 - struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; 1399 + struct ethtool_wolinfo wol; 1400 1400 1401 1401 if (!dev->ethtool_ops->get_wol) 1402 1402 return -EOPNOTSUPP; 1403 1403 1404 + memset(&wol, 0, sizeof(struct ethtool_wolinfo)); 1405 + wol.cmd = ETHTOOL_GWOL; 1404 1406 dev->ethtool_ops->get_wol(dev, &wol); 1405 1407 1406 1408 if (copy_to_user(useraddr, &wol, sizeof(wol)))
+16 -22
net/core/flow_dissector.c
··· 1350 1350 } 1351 1351 EXPORT_SYMBOL(__skb_flow_dissect); 1352 1352 1353 - static u32 hashrnd __read_mostly; 1353 + static siphash_key_t hashrnd __read_mostly; 1354 1354 static __always_inline void __flow_hash_secret_init(void) 1355 1355 { 1356 1356 net_get_random_once(&hashrnd, sizeof(hashrnd)); 1357 1357 } 1358 1358 1359 - static __always_inline u32 __flow_hash_words(const u32 *words, u32 length, 1360 - u32 keyval) 1359 + static const void *flow_keys_hash_start(const struct flow_keys *flow) 1361 1360 { 1362 - return jhash2(words, length, keyval); 1363 - } 1364 - 1365 - static inline const u32 *flow_keys_hash_start(const struct flow_keys *flow) 1366 - { 1367 - const void *p = flow; 1368 - 1369 - BUILD_BUG_ON(FLOW_KEYS_HASH_OFFSET % sizeof(u32)); 1370 - return (const u32 *)(p + FLOW_KEYS_HASH_OFFSET); 1361 + BUILD_BUG_ON(FLOW_KEYS_HASH_OFFSET % SIPHASH_ALIGNMENT); 1362 + return &flow->FLOW_KEYS_HASH_START_FIELD; 1371 1363 } 1372 1364 1373 1365 static inline size_t flow_keys_hash_length(const struct flow_keys *flow) 1374 1366 { 1375 1367 size_t diff = FLOW_KEYS_HASH_OFFSET + sizeof(flow->addrs); 1376 - BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)); 1377 1368 BUILD_BUG_ON(offsetof(typeof(*flow), addrs) != 1378 1369 sizeof(*flow) - sizeof(flow->addrs)); 1379 1370 ··· 1379 1388 diff -= sizeof(flow->addrs.tipckey); 1380 1389 break; 1381 1390 } 1382 - return (sizeof(*flow) - diff) / sizeof(u32); 1391 + return sizeof(*flow) - diff; 1383 1392 } 1384 1393 1385 1394 __be32 flow_get_u32_src(const struct flow_keys *flow) ··· 1445 1454 } 1446 1455 } 1447 1456 1448 - static inline u32 __flow_hash_from_keys(struct flow_keys *keys, u32 keyval) 1457 + static inline u32 __flow_hash_from_keys(struct flow_keys *keys, 1458 + const siphash_key_t *keyval) 1449 1459 { 1450 1460 u32 hash; 1451 1461 1452 1462 __flow_hash_consistentify(keys); 1453 1463 1454 - hash = __flow_hash_words(flow_keys_hash_start(keys), 1455 - flow_keys_hash_length(keys), keyval); 1464 + hash = siphash(flow_keys_hash_start(keys), 1465 + flow_keys_hash_length(keys), keyval); 1456 1466 if (!hash) 1457 1467 hash = 1; 1458 1468 ··· 1463 1471 u32 flow_hash_from_keys(struct flow_keys *keys) 1464 1472 { 1465 1473 __flow_hash_secret_init(); 1466 - return __flow_hash_from_keys(keys, hashrnd); 1474 + return __flow_hash_from_keys(keys, &hashrnd); 1467 1475 } 1468 1476 EXPORT_SYMBOL(flow_hash_from_keys); 1469 1477 1470 1478 static inline u32 ___skb_get_hash(const struct sk_buff *skb, 1471 - struct flow_keys *keys, u32 keyval) 1479 + struct flow_keys *keys, 1480 + const siphash_key_t *keyval) 1472 1481 { 1473 1482 skb_flow_dissect_flow_keys(skb, keys, 1474 1483 FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL); ··· 1517 1524 &keys, NULL, 0, 0, 0, 1518 1525 FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL); 1519 1526 1520 - return __flow_hash_from_keys(&keys, hashrnd); 1527 + return __flow_hash_from_keys(&keys, &hashrnd); 1521 1528 } 1522 1529 EXPORT_SYMBOL_GPL(__skb_get_hash_symmetric); 1523 1530 ··· 1537 1544 1538 1545 __flow_hash_secret_init(); 1539 1546 1540 - hash = ___skb_get_hash(skb, &keys, hashrnd); 1547 + hash = ___skb_get_hash(skb, &keys, &hashrnd); 1541 1548 1542 1549 __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); 1543 1550 } 1544 1551 EXPORT_SYMBOL(__skb_get_hash); 1545 1552 1546 - __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb) 1553 + __u32 skb_get_hash_perturb(const struct sk_buff *skb, 1554 + const siphash_key_t *perturb) 1547 1555 { 1548 1556 struct flow_keys keys; 1549 1557
+6 -1
net/core/lwt_bpf.c
··· 88 88 int err = -EINVAL; 89 89 90 90 if (skb->protocol == htons(ETH_P_IP)) { 91 + struct net_device *dev = skb_dst(skb)->dev; 91 92 struct iphdr *iph = ip_hdr(skb); 92 93 94 + dev_hold(dev); 95 + skb_dst_drop(skb); 93 96 err = ip_route_input_noref(skb, iph->daddr, iph->saddr, 94 - iph->tos, skb_dst(skb)->dev); 97 + iph->tos, dev); 98 + dev_put(dev); 95 99 } else if (skb->protocol == htons(ETH_P_IPV6)) { 100 + skb_dst_drop(skb); 96 101 err = ipv6_stub->ipv6_route_input(skb); 97 102 } else { 98 103 err = -EAFNOSUPPORT;
+10 -8
net/core/net_namespace.c
··· 246 246 } 247 247 248 248 static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, 249 - struct nlmsghdr *nlh); 249 + struct nlmsghdr *nlh, gfp_t gfp); 250 250 /* This function returns the id of a peer netns. If no id is assigned, one will 251 251 * be allocated and returned. 252 252 */ 253 - int peernet2id_alloc(struct net *net, struct net *peer) 253 + int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp) 254 254 { 255 255 bool alloc = false, alive = false; 256 256 int id; ··· 269 269 id = __peernet2id_alloc(net, peer, &alloc); 270 270 spin_unlock_bh(&net->nsid_lock); 271 271 if (alloc && id >= 0) 272 - rtnl_net_notifyid(net, RTM_NEWNSID, id, 0, NULL); 272 + rtnl_net_notifyid(net, RTM_NEWNSID, id, 0, NULL, gfp); 273 273 if (alive) 274 274 put_net(peer); 275 275 return id; ··· 479 479 480 480 if (rv < 0) { 481 481 put_userns: 482 + key_remove_domain(net->key_domain); 482 483 put_user_ns(user_ns); 483 484 net_drop_ns(net); 484 485 dec_ucounts: ··· 534 533 idr_remove(&tmp->netns_ids, id); 535 534 spin_unlock_bh(&tmp->nsid_lock); 536 535 if (id >= 0) 537 - rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL); 536 + rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL, 537 + GFP_KERNEL); 538 538 if (tmp == last) 539 539 break; 540 540 } ··· 768 766 spin_unlock_bh(&net->nsid_lock); 769 767 if (err >= 0) { 770 768 rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid, 771 - nlh); 769 + nlh, GFP_KERNEL); 772 770 err = 0; 773 771 } else if (err == -ENOSPC && nsid >= 0) { 774 772 err = -EEXIST; ··· 1056 1054 } 1057 1055 1058 1056 static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, 1059 - struct nlmsghdr *nlh) 1057 + struct nlmsghdr *nlh, gfp_t gfp) 1060 1058 { 1061 1059 struct net_fill_args fillargs = { 1062 1060 .portid = portid, ··· 1067 1065 struct sk_buff *msg; 1068 1066 int err = -ENOMEM; 1069 1067 1070 - msg = nlmsg_new(rtnl_net_get_size(), GFP_KERNEL); 1068 + msg = nlmsg_new(rtnl_net_get_size(), gfp); 1071 1069 if (!msg) 1072 1070 goto out; 1073 1071 ··· 1075 1073 if (err < 0) 1076 1074 goto err_out; 1077 1075 1078 - rtnl_notify(msg, net, portid, RTNLGRP_NSID, nlh, 0); 1076 + rtnl_notify(msg, net, portid, RTNLGRP_NSID, nlh, gfp); 1079 1077 return; 1080 1078 1081 1079 err_out:
+9 -8
net/core/rtnetlink.c
··· 1523 1523 1524 1524 static int rtnl_fill_link_netnsid(struct sk_buff *skb, 1525 1525 const struct net_device *dev, 1526 - struct net *src_net) 1526 + struct net *src_net, gfp_t gfp) 1527 1527 { 1528 1528 bool put_iflink = false; 1529 1529 ··· 1531 1531 struct net *link_net = dev->rtnl_link_ops->get_link_net(dev); 1532 1532 1533 1533 if (!net_eq(dev_net(dev), link_net)) { 1534 - int id = peernet2id_alloc(src_net, link_net); 1534 + int id = peernet2id_alloc(src_net, link_net, gfp); 1535 1535 1536 1536 if (nla_put_s32(skb, IFLA_LINK_NETNSID, id)) 1537 1537 return -EMSGSIZE; ··· 1589 1589 int type, u32 pid, u32 seq, u32 change, 1590 1590 unsigned int flags, u32 ext_filter_mask, 1591 1591 u32 event, int *new_nsid, int new_ifindex, 1592 - int tgt_netnsid) 1592 + int tgt_netnsid, gfp_t gfp) 1593 1593 { 1594 1594 struct ifinfomsg *ifm; 1595 1595 struct nlmsghdr *nlh; ··· 1681 1681 goto nla_put_failure; 1682 1682 } 1683 1683 1684 - if (rtnl_fill_link_netnsid(skb, dev, src_net)) 1684 + if (rtnl_fill_link_netnsid(skb, dev, src_net, gfp)) 1685 1685 goto nla_put_failure; 1686 1686 1687 1687 if (new_nsid && ··· 2001 2001 NETLINK_CB(cb->skb).portid, 2002 2002 nlh->nlmsg_seq, 0, flags, 2003 2003 ext_filter_mask, 0, NULL, 0, 2004 - netnsid); 2004 + netnsid, GFP_KERNEL); 2005 2005 2006 2006 if (err < 0) { 2007 2007 if (likely(skb->len)) ··· 2355 2355 err = ops->ndo_del_slave(upper_dev, dev); 2356 2356 if (err) 2357 2357 return err; 2358 + netdev_update_lockdep_key(dev); 2358 2359 } else { 2359 2360 return -EOPNOTSUPP; 2360 2361 } ··· 3360 3359 err = rtnl_fill_ifinfo(nskb, dev, net, 3361 3360 RTM_NEWLINK, NETLINK_CB(skb).portid, 3362 3361 nlh->nlmsg_seq, 0, 0, ext_filter_mask, 3363 - 0, NULL, 0, netnsid); 3362 + 0, NULL, 0, netnsid, GFP_KERNEL); 3364 3363 if (err < 0) { 3365 3364 /* -EMSGSIZE implies BUG in if_nlmsg_size */ 3366 3365 WARN_ON(err == -EMSGSIZE); ··· 3472 3471 3473 3472 err = rtnl_fill_ifinfo(skb, dev, dev_net(dev), 3474 3473 type, 0, 0, change, 0, 0, event, 3475 - new_nsid, new_ifindex, -1); 3474 + new_nsid, new_ifindex, -1, flags); 3476 3475 if (err < 0) { 3477 3476 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 3478 3477 WARN_ON(err == -EMSGSIZE); ··· 3917 3916 ndm = nlmsg_data(nlh); 3918 3917 if (ndm->ndm_pad1 || ndm->ndm_pad2 || ndm->ndm_state || 3919 3918 ndm->ndm_flags || ndm->ndm_type) { 3920 - NL_SET_ERR_MSG(extack, "Invalid values in header for fbd dump request"); 3919 + NL_SET_ERR_MSG(extack, "Invalid values in header for fdb dump request"); 3921 3920 return -EINVAL; 3922 3921 } 3923 3922
+3 -3
net/core/sock.c
··· 1127 1127 break; 1128 1128 } 1129 1129 case SO_INCOMING_CPU: 1130 - sk->sk_incoming_cpu = val; 1130 + WRITE_ONCE(sk->sk_incoming_cpu, val); 1131 1131 break; 1132 1132 1133 1133 case SO_CNX_ADVICE: ··· 1476 1476 break; 1477 1477 1478 1478 case SO_INCOMING_CPU: 1479 - v.val = sk->sk_incoming_cpu; 1479 + v.val = READ_ONCE(sk->sk_incoming_cpu); 1480 1480 break; 1481 1481 1482 1482 case SO_MEMINFO: ··· 3600 3600 { 3601 3601 struct sock *sk = p; 3602 3602 3603 - return !skb_queue_empty(&sk->sk_receive_queue) || 3603 + return !skb_queue_empty_lockless(&sk->sk_receive_queue) || 3604 3604 sk_busy_loop_timeout(sk, start_time); 3605 3605 } 3606 3606 EXPORT_SYMBOL(sk_busy_loop_end);
+1 -1
net/dccp/ipv4.c
··· 117 117 inet->inet_daddr, 118 118 inet->inet_sport, 119 119 inet->inet_dport); 120 - inet->inet_id = dp->dccps_iss ^ jiffies; 120 + inet->inet_id = prandom_u32(); 121 121 122 122 err = dccp_connect(sk); 123 123 rt = NULL;
+1 -1
net/decnet/af_decnet.c
··· 1205 1205 struct dn_scp *scp = DN_SK(sk); 1206 1206 __poll_t mask = datagram_poll(file, sock, wait); 1207 1207 1208 - if (!skb_queue_empty(&scp->other_receive_queue)) 1208 + if (!skb_queue_empty_lockless(&scp->other_receive_queue)) 1209 1209 mask |= EPOLLRDBAND; 1210 1210 1211 1211 return mask;
-5
net/dsa/master.c
··· 310 310 rtnl_unlock(); 311 311 } 312 312 313 - static struct lock_class_key dsa_master_addr_list_lock_key; 314 - 315 313 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) 316 314 { 317 315 int ret; ··· 323 325 wmb(); 324 326 325 327 dev->dsa_ptr = cpu_dp; 326 - lockdep_set_class(&dev->addr_list_lock, 327 - &dsa_master_addr_list_lock_key); 328 - 329 328 ret = dsa_master_ethtool_setup(dev); 330 329 if (ret) 331 330 return ret;
-12
net/dsa/slave.c
··· 1341 1341 return ret; 1342 1342 } 1343 1343 1344 - static struct lock_class_key dsa_slave_netdev_xmit_lock_key; 1345 - static void dsa_slave_set_lockdep_class_one(struct net_device *dev, 1346 - struct netdev_queue *txq, 1347 - void *_unused) 1348 - { 1349 - lockdep_set_class(&txq->_xmit_lock, 1350 - &dsa_slave_netdev_xmit_lock_key); 1351 - } 1352 - 1353 1344 int dsa_slave_suspend(struct net_device *slave_dev) 1354 1345 { 1355 1346 struct dsa_port *dp = dsa_slave_to_port(slave_dev); ··· 1423 1432 slave_dev->min_mtu = 0; 1424 1433 slave_dev->max_mtu = ETH_MAX_MTU; 1425 1434 SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); 1426 - 1427 - netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one, 1428 - NULL); 1429 1435 1430 1436 SET_NETDEV_DEV(slave_dev, port->ds->dev); 1431 1437 slave_dev->dev.of_node = port->dn;
-8
net/ieee802154/6lowpan/core.c
··· 58 58 .create = lowpan_header_create, 59 59 }; 60 60 61 - static int lowpan_dev_init(struct net_device *ldev) 62 - { 63 - netdev_lockdep_set_classes(ldev); 64 - 65 - return 0; 66 - } 67 - 68 61 static int lowpan_open(struct net_device *dev) 69 62 { 70 63 if (!open_count) ··· 89 96 } 90 97 91 98 static const struct net_device_ops lowpan_netdev_ops = { 92 - .ndo_init = lowpan_dev_init, 93 99 .ndo_start_xmit = lowpan_xmit, 94 100 .ndo_open = lowpan_open, 95 101 .ndo_stop = lowpan_stop,
+1 -1
net/ipv4/datagram.c
··· 73 73 reuseport_has_conns(sk, true); 74 74 sk->sk_state = TCP_ESTABLISHED; 75 75 sk_set_txhash(sk); 76 - inet->inet_id = jiffies; 76 + inet->inet_id = prandom_u32(); 77 77 78 78 sk_dst_set(sk, &rt->dst); 79 79 err = 0;
+1 -1
net/ipv4/fib_frontend.c
··· 1148 1148 if (!(dev->flags & IFF_UP) || 1149 1149 ifa->ifa_flags & (IFA_F_SECONDARY | IFA_F_NOPREFIXROUTE) || 1150 1150 ipv4_is_zeronet(prefix) || 1151 - prefix == ifa->ifa_local || ifa->ifa_prefixlen == 32) 1151 + (prefix == ifa->ifa_local && ifa->ifa_prefixlen == 32)) 1152 1152 return; 1153 1153 1154 1154 /* add the new */
+1 -1
net/ipv4/inet_hashtables.c
··· 240 240 return -1; 241 241 242 242 score = sk->sk_family == PF_INET ? 2 : 1; 243 - if (sk->sk_incoming_cpu == raw_smp_processor_id()) 243 + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) 244 244 score++; 245 245 } 246 246 return score;
+2 -2
net/ipv4/ip_gre.c
··· 509 509 key = &tun_info->key; 510 510 if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) 511 511 goto err_free_skb; 512 - md = ip_tunnel_info_opts(tun_info); 513 - if (!md) 512 + if (tun_info->options_len < sizeof(*md)) 514 513 goto err_free_skb; 514 + md = ip_tunnel_info_opts(tun_info); 515 515 516 516 /* ERSPAN has fixed 8 byte GRE header */ 517 517 version = md->version;
+6 -5
net/ipv4/ip_output.c
··· 645 645 EXPORT_SYMBOL(ip_fraglist_prepare); 646 646 647 647 void ip_frag_init(struct sk_buff *skb, unsigned int hlen, 648 - unsigned int ll_rs, unsigned int mtu, 648 + unsigned int ll_rs, unsigned int mtu, bool DF, 649 649 struct ip_frag_state *state) 650 650 { 651 651 struct iphdr *iph = ip_hdr(skb); 652 652 653 + state->DF = DF; 653 654 state->hlen = hlen; 654 655 state->ll_rs = ll_rs; 655 656 state->mtu = mtu; ··· 668 667 { 669 668 /* Copy the flags to each fragment. */ 670 669 IPCB(to)->flags = IPCB(from)->flags; 671 - 672 - if (IPCB(from)->flags & IPSKB_FRAG_PMTU) 673 - state->iph->frag_off |= htons(IP_DF); 674 670 675 671 /* ANK: dirty, but effective trick. Upgrade options only if 676 672 * the segment to be fragmented was THE FIRST (otherwise, ··· 736 738 */ 737 739 iph = ip_hdr(skb2); 738 740 iph->frag_off = htons((state->offset >> 3)); 741 + if (state->DF) 742 + iph->frag_off |= htons(IP_DF); 739 743 740 744 /* 741 745 * Added AC : If we are fragmenting a fragment that's not the ··· 883 883 * Fragment the datagram. 884 884 */ 885 885 886 - ip_frag_init(skb, hlen, ll_rs, mtu, &state); 886 + ip_frag_init(skb, hlen, ll_rs, mtu, IPCB(skb)->flags & IPSKB_FRAG_PMTU, 887 + &state); 887 888 888 889 /* 889 890 * Keep copying data until we run out.
+2 -2
net/ipv4/tcp.c
··· 584 584 } 585 585 /* This barrier is coupled with smp_wmb() in tcp_reset() */ 586 586 smp_rmb(); 587 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 587 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 588 588 mask |= EPOLLERR; 589 589 590 590 return mask; ··· 1964 1964 if (unlikely(flags & MSG_ERRQUEUE)) 1965 1965 return inet_recv_error(sk, msg, len, addr_len); 1966 1966 1967 - if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue) && 1967 + if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue) && 1968 1968 (sk->sk_state == TCP_ESTABLISHED)) 1969 1969 sk_busy_loop(sk, nonblock); 1970 1970
+3 -3
net/ipv4/tcp_ipv4.c
··· 303 303 inet->inet_daddr); 304 304 } 305 305 306 - inet->inet_id = tp->write_seq ^ jiffies; 306 + inet->inet_id = prandom_u32(); 307 307 308 308 if (tcp_fastopen_defer_connect(sk, &err)) 309 309 return err; ··· 1450 1450 inet_csk(newsk)->icsk_ext_hdr_len = 0; 1451 1451 if (inet_opt) 1452 1452 inet_csk(newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen; 1453 - newinet->inet_id = newtp->write_seq ^ jiffies; 1453 + newinet->inet_id = prandom_u32(); 1454 1454 1455 1455 if (!dst) { 1456 1456 dst = inet_csk_route_child_sock(sk, newsk, req); ··· 2681 2681 net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2; 2682 2682 net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; 2683 2683 2684 - net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256); 2684 + net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 128); 2685 2685 net->ipv4.sysctl_tcp_sack = 1; 2686 2686 net->ipv4.sysctl_tcp_window_scaling = 1; 2687 2687 net->ipv4.sysctl_tcp_timestamps = 1;
+20 -9
net/ipv4/udp.c
··· 388 388 return -1; 389 389 score += 4; 390 390 391 - if (sk->sk_incoming_cpu == raw_smp_processor_id()) 391 + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) 392 392 score++; 393 393 return score; 394 394 } ··· 1316 1316 scratch->_tsize_state |= UDP_SKB_IS_STATELESS; 1317 1317 } 1318 1318 1319 + static void udp_skb_csum_unnecessary_set(struct sk_buff *skb) 1320 + { 1321 + /* We come here after udp_lib_checksum_complete() returned 0. 1322 + * This means that __skb_checksum_complete() might have 1323 + * set skb->csum_valid to 1. 1324 + * On 64bit platforms, we can set csum_unnecessary 1325 + * to true, but only if the skb is not shared. 1326 + */ 1327 + #if BITS_PER_LONG == 64 1328 + if (!skb_shared(skb)) 1329 + udp_skb_scratch(skb)->csum_unnecessary = true; 1330 + #endif 1331 + } 1332 + 1319 1333 static int udp_skb_truesize(struct sk_buff *skb) 1320 1334 { 1321 1335 return udp_skb_scratch(skb)->_tsize_state & ~UDP_SKB_IS_STATELESS; ··· 1564 1550 *total += skb->truesize; 1565 1551 kfree_skb(skb); 1566 1552 } else { 1567 - /* the csum related bits could be changed, refresh 1568 - * the scratch area 1569 - */ 1570 - udp_set_dev_scratch(skb); 1553 + udp_skb_csum_unnecessary_set(skb); 1571 1554 break; 1572 1555 } 1573 1556 } ··· 1588 1577 1589 1578 spin_lock_bh(&rcvq->lock); 1590 1579 skb = __first_packet_length(sk, rcvq, &total); 1591 - if (!skb && !skb_queue_empty(sk_queue)) { 1580 + if (!skb && !skb_queue_empty_lockless(sk_queue)) { 1592 1581 spin_lock(&sk_queue->lock); 1593 1582 skb_queue_splice_tail_init(sk_queue, rcvq); 1594 1583 spin_unlock(&sk_queue->lock); ··· 1661 1650 return skb; 1662 1651 } 1663 1652 1664 - if (skb_queue_empty(sk_queue)) { 1653 + if (skb_queue_empty_lockless(sk_queue)) { 1665 1654 spin_unlock_bh(&queue->lock); 1666 1655 goto busy_check; 1667 1656 } ··· 1687 1676 break; 1688 1677 1689 1678 sk_busy_loop(sk, flags & MSG_DONTWAIT); 1690 - } while (!skb_queue_empty(sk_queue)); 1679 + } while (!skb_queue_empty_lockless(sk_queue)); 1691 1680 1692 1681 /* sk_queue is empty, reader_queue may contain peeked packets */ 1693 1682 } while (timeo && ··· 2723 2712 __poll_t mask = datagram_poll(file, sock, wait); 2724 2713 struct sock *sk = sock->sk; 2725 2714 2726 - if (!skb_queue_empty(&udp_sk(sk)->reader_queue)) 2715 + if (!skb_queue_empty_lockless(&udp_sk(sk)->reader_queue)) 2727 2716 mask |= EPOLLIN | EPOLLRDNORM; 2728 2717 2729 2718 /* Check for false positives due to checksum errors */
+1
net/ipv6/addrconf_core.c
··· 7 7 #include <linux/export.h> 8 8 #include <net/ipv6.h> 9 9 #include <net/ipv6_stubs.h> 10 + #include <net/addrconf.h> 10 11 #include <net/ip.h> 11 12 12 13 /* if ipv6 module registers this function is used by xfrm to force all
+1 -1
net/ipv6/inet6_hashtables.c
··· 105 105 return -1; 106 106 107 107 score = 1; 108 - if (sk->sk_incoming_cpu == raw_smp_processor_id()) 108 + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) 109 109 score++; 110 110 } 111 111 return score;
+2 -2
net/ipv6/ip6_gre.c
··· 980 980 dsfield = key->tos; 981 981 if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) 982 982 goto tx_err; 983 - md = ip_tunnel_info_opts(tun_info); 984 - if (!md) 983 + if (tun_info->options_len < sizeof(*md)) 985 984 goto tx_err; 985 + md = ip_tunnel_info_opts(tun_info); 986 986 987 987 tun_id = tunnel_id_to_key32(key->tun_id); 988 988 if (md->version == 1) {
+1 -1
net/ipv6/udp.c
··· 135 135 return -1; 136 136 score++; 137 137 138 - if (sk->sk_incoming_cpu == raw_smp_processor_id()) 138 + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) 139 139 score++; 140 140 141 141 return score;
-1
net/l2tp/l2tp_eth.c
··· 56 56 { 57 57 eth_hw_addr_random(dev); 58 58 eth_broadcast_addr(dev->broadcast); 59 - netdev_lockdep_set_classes(dev); 60 59 61 60 return 0; 62 61 }
+10 -2
net/netfilter/ipvs/ip_vs_app.c
··· 193 193 194 194 mutex_lock(&__ip_vs_app_mutex); 195 195 196 + /* increase the module use count */ 197 + if (!ip_vs_use_count_inc()) { 198 + err = -ENOENT; 199 + goto out_unlock; 200 + } 201 + 196 202 list_for_each_entry(a, &ipvs->app_list, a_list) { 197 203 if (!strcmp(app->name, a->name)) { 198 204 err = -EEXIST; 205 + /* decrease the module use count */ 206 + ip_vs_use_count_dec(); 199 207 goto out_unlock; 200 208 } 201 209 } 202 210 a = kmemdup(app, sizeof(*app), GFP_KERNEL); 203 211 if (!a) { 204 212 err = -ENOMEM; 213 + /* decrease the module use count */ 214 + ip_vs_use_count_dec(); 205 215 goto out_unlock; 206 216 } 207 217 INIT_LIST_HEAD(&a->incs_list); 208 218 list_add(&a->a_list, &ipvs->app_list); 209 - /* increase the module use count */ 210 - ip_vs_use_count_inc(); 211 219 212 220 out_unlock: 213 221 mutex_unlock(&__ip_vs_app_mutex);
+11 -18
net/netfilter/ipvs/ip_vs_ctl.c
··· 93 93 static void update_defense_level(struct netns_ipvs *ipvs) 94 94 { 95 95 struct sysinfo i; 96 - static int old_secure_tcp = 0; 97 96 int availmem; 98 97 int nomem; 99 98 int to_change = -1; ··· 173 174 spin_lock(&ipvs->securetcp_lock); 174 175 switch (ipvs->sysctl_secure_tcp) { 175 176 case 0: 176 - if (old_secure_tcp >= 2) 177 + if (ipvs->old_secure_tcp >= 2) 177 178 to_change = 0; 178 179 break; 179 180 case 1: 180 181 if (nomem) { 181 - if (old_secure_tcp < 2) 182 + if (ipvs->old_secure_tcp < 2) 182 183 to_change = 1; 183 184 ipvs->sysctl_secure_tcp = 2; 184 185 } else { 185 - if (old_secure_tcp >= 2) 186 + if (ipvs->old_secure_tcp >= 2) 186 187 to_change = 0; 187 188 } 188 189 break; 189 190 case 2: 190 191 if (nomem) { 191 - if (old_secure_tcp < 2) 192 + if (ipvs->old_secure_tcp < 2) 192 193 to_change = 1; 193 194 } else { 194 - if (old_secure_tcp >= 2) 195 + if (ipvs->old_secure_tcp >= 2) 195 196 to_change = 0; 196 197 ipvs->sysctl_secure_tcp = 1; 197 198 } 198 199 break; 199 200 case 3: 200 - if (old_secure_tcp < 2) 201 + if (ipvs->old_secure_tcp < 2) 201 202 to_change = 1; 202 203 break; 203 204 } 204 - old_secure_tcp = ipvs->sysctl_secure_tcp; 205 + ipvs->old_secure_tcp = ipvs->sysctl_secure_tcp; 205 206 if (to_change >= 0) 206 207 ip_vs_protocol_timeout_change(ipvs, 207 208 ipvs->sysctl_secure_tcp > 1); ··· 1274 1275 struct ip_vs_service *svc = NULL; 1275 1276 1276 1277 /* increase the module use count */ 1277 - ip_vs_use_count_inc(); 1278 + if (!ip_vs_use_count_inc()) 1279 + return -ENOPROTOOPT; 1278 1280 1279 1281 /* Lookup the scheduler by 'u->sched_name' */ 1280 1282 if (strcmp(u->sched_name, "none")) { ··· 2435 2435 if (copy_from_user(arg, user, len) != 0) 2436 2436 return -EFAULT; 2437 2437 2438 - /* increase the module use count */ 2439 - ip_vs_use_count_inc(); 2440 - 2441 2438 /* Handle daemons since they have another lock */ 2442 2439 if (cmd == IP_VS_SO_SET_STARTDAEMON || 2443 2440 cmd == IP_VS_SO_SET_STOPDAEMON) { ··· 2447 2450 ret = -EINVAL; 2448 2451 if (strscpy(cfg.mcast_ifn, dm->mcast_ifn, 2449 2452 sizeof(cfg.mcast_ifn)) <= 0) 2450 - goto out_dec; 2453 + return ret; 2451 2454 cfg.syncid = dm->syncid; 2452 2455 ret = start_sync_thread(ipvs, &cfg, dm->state); 2453 2456 } else { 2454 2457 ret = stop_sync_thread(ipvs, dm->state); 2455 2458 } 2456 - goto out_dec; 2459 + return ret; 2457 2460 } 2458 2461 2459 2462 mutex_lock(&__ip_vs_mutex); ··· 2548 2551 2549 2552 out_unlock: 2550 2553 mutex_unlock(&__ip_vs_mutex); 2551 - out_dec: 2552 - /* decrease the module use count */ 2553 - ip_vs_use_count_dec(); 2554 - 2555 2554 return ret; 2556 2555 } 2557 2556
+2 -1
net/netfilter/ipvs/ip_vs_pe.c
··· 68 68 struct ip_vs_pe *tmp; 69 69 70 70 /* increase the module use count */ 71 - ip_vs_use_count_inc(); 71 + if (!ip_vs_use_count_inc()) 72 + return -ENOENT; 72 73 73 74 mutex_lock(&ip_vs_pe_mutex); 74 75 /* Make sure that the pe with this name doesn't exist
+2 -1
net/netfilter/ipvs/ip_vs_sched.c
··· 179 179 } 180 180 181 181 /* increase the module use count */ 182 - ip_vs_use_count_inc(); 182 + if (!ip_vs_use_count_inc()) 183 + return -ENOENT; 183 184 184 185 mutex_lock(&ip_vs_sched_mutex); 185 186
+10 -3
net/netfilter/ipvs/ip_vs_sync.c
··· 1762 1762 IP_VS_DBG(7, "Each ip_vs_sync_conn entry needs %zd bytes\n", 1763 1763 sizeof(struct ip_vs_sync_conn_v0)); 1764 1764 1765 + /* increase the module use count */ 1766 + if (!ip_vs_use_count_inc()) 1767 + return -ENOPROTOOPT; 1768 + 1765 1769 /* Do not hold one mutex and then to block on another */ 1766 1770 for (;;) { 1767 1771 rtnl_lock(); ··· 1896 1892 mutex_unlock(&ipvs->sync_mutex); 1897 1893 rtnl_unlock(); 1898 1894 1899 - /* increase the module use count */ 1900 - ip_vs_use_count_inc(); 1901 - 1902 1895 return 0; 1903 1896 1904 1897 out: ··· 1925 1924 } 1926 1925 kfree(ti); 1927 1926 } 1927 + 1928 + /* decrease the module use count */ 1929 + ip_vs_use_count_dec(); 1928 1930 return result; 1929 1931 1930 1932 out_early: 1931 1933 mutex_unlock(&ipvs->sync_mutex); 1932 1934 rtnl_unlock(); 1935 + 1936 + /* decrease the module use count */ 1937 + ip_vs_use_count_dec(); 1933 1938 return result; 1934 1939 } 1935 1940
+2 -1
net/netfilter/nf_flow_table_core.c
··· 202 202 { 203 203 int err; 204 204 205 + flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; 206 + 205 207 err = rhashtable_insert_fast(&flow_table->rhashtable, 206 208 &flow->tuplehash[0].node, 207 209 nf_flow_offload_rhash_params); ··· 220 218 return err; 221 219 } 222 220 223 - flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT; 224 221 return 0; 225 222 } 226 223 EXPORT_SYMBOL_GPL(flow_offload_add);
+1 -1
net/netfilter/nf_tables_offload.c
··· 347 347 348 348 policy = nft_trans_chain_policy(trans); 349 349 err = nft_flow_offload_chain(trans->ctx.chain, &policy, 350 - FLOW_BLOCK_BIND); 350 + FLOW_BLOCK_UNBIND); 351 351 break; 352 352 case NFT_MSG_NEWRULE: 353 353 if (!(trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD))
+38
net/netfilter/nft_payload.c
··· 161 161 162 162 switch (priv->offset) { 163 163 case offsetof(struct ethhdr, h_source): 164 + if (priv->len != ETH_ALEN) 165 + return -EOPNOTSUPP; 166 + 164 167 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_ETH_ADDRS, eth_addrs, 165 168 src, ETH_ALEN, reg); 166 169 break; 167 170 case offsetof(struct ethhdr, h_dest): 171 + if (priv->len != ETH_ALEN) 172 + return -EOPNOTSUPP; 173 + 168 174 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_ETH_ADDRS, eth_addrs, 169 175 dst, ETH_ALEN, reg); 170 176 break; 177 + default: 178 + return -EOPNOTSUPP; 171 179 } 172 180 173 181 return 0; ··· 189 181 190 182 switch (priv->offset) { 191 183 case offsetof(struct iphdr, saddr): 184 + if (priv->len != sizeof(struct in_addr)) 185 + return -EOPNOTSUPP; 186 + 192 187 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, src, 193 188 sizeof(struct in_addr), reg); 194 189 break; 195 190 case offsetof(struct iphdr, daddr): 191 + if (priv->len != sizeof(struct in_addr)) 192 + return -EOPNOTSUPP; 193 + 196 194 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, dst, 197 195 sizeof(struct in_addr), reg); 198 196 break; 199 197 case offsetof(struct iphdr, protocol): 198 + if (priv->len != sizeof(__u8)) 199 + return -EOPNOTSUPP; 200 + 200 201 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_BASIC, basic, ip_proto, 201 202 sizeof(__u8), reg); 202 203 nft_offload_set_dependency(ctx, NFT_OFFLOAD_DEP_TRANSPORT); ··· 225 208 226 209 switch (priv->offset) { 227 210 case offsetof(struct ipv6hdr, saddr): 211 + if (priv->len != sizeof(struct in6_addr)) 212 + return -EOPNOTSUPP; 213 + 228 214 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, src, 229 215 sizeof(struct in6_addr), reg); 230 216 break; 231 217 case offsetof(struct ipv6hdr, daddr): 218 + if (priv->len != sizeof(struct in6_addr)) 219 + return -EOPNOTSUPP; 220 + 232 221 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, dst, 233 222 sizeof(struct in6_addr), reg); 234 223 break; 235 224 case offsetof(struct ipv6hdr, nexthdr): 225 + if (priv->len != sizeof(__u8)) 226 + return -EOPNOTSUPP; 227 + 236 228 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_BASIC, basic, ip_proto, 237 229 sizeof(__u8), reg); 238 230 nft_offload_set_dependency(ctx, NFT_OFFLOAD_DEP_TRANSPORT); ··· 281 255 282 256 switch (priv->offset) { 283 257 case offsetof(struct tcphdr, source): 258 + if (priv->len != sizeof(__be16)) 259 + return -EOPNOTSUPP; 260 + 284 261 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_PORTS, tp, src, 285 262 sizeof(__be16), reg); 286 263 break; 287 264 case offsetof(struct tcphdr, dest): 265 + if (priv->len != sizeof(__be16)) 266 + return -EOPNOTSUPP; 267 + 288 268 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_PORTS, tp, dst, 289 269 sizeof(__be16), reg); 290 270 break; ··· 309 277 310 278 switch (priv->offset) { 311 279 case offsetof(struct udphdr, source): 280 + if (priv->len != sizeof(__be16)) 281 + return -EOPNOTSUPP; 282 + 312 283 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_PORTS, tp, src, 313 284 sizeof(__be16), reg); 314 285 break; 315 286 case offsetof(struct udphdr, dest): 287 + if (priv->len != sizeof(__be16)) 288 + return -EOPNOTSUPP; 289 + 316 290 NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_PORTS, tp, dst, 317 291 sizeof(__be16), reg); 318 292 break;
-23
net/netrom/af_netrom.c
··· 64 64 static const struct proto_ops nr_proto_ops; 65 65 66 66 /* 67 - * NETROM network devices are virtual network devices encapsulating NETROM 68 - * frames into AX.25 which will be sent through an AX.25 device, so form a 69 - * special "super class" of normal net devices; split their locks off into a 70 - * separate class since they always nest. 71 - */ 72 - static struct lock_class_key nr_netdev_xmit_lock_key; 73 - static struct lock_class_key nr_netdev_addr_lock_key; 74 - 75 - static void nr_set_lockdep_one(struct net_device *dev, 76 - struct netdev_queue *txq, 77 - void *_unused) 78 - { 79 - lockdep_set_class(&txq->_xmit_lock, &nr_netdev_xmit_lock_key); 80 - } 81 - 82 - static void nr_set_lockdep_key(struct net_device *dev) 83 - { 84 - lockdep_set_class(&dev->addr_list_lock, &nr_netdev_addr_lock_key); 85 - netdev_for_each_tx_queue(dev, nr_set_lockdep_one, NULL); 86 - } 87 - 88 - /* 89 67 * Socket removal during an interrupt is now safe. 90 68 */ 91 69 static void nr_remove_socket(struct sock *sk) ··· 1392 1414 free_netdev(dev); 1393 1415 goto fail; 1394 1416 } 1395 - nr_set_lockdep_key(dev); 1396 1417 dev_nr[i] = dev; 1397 1418 } 1398 1419
+2 -2
net/nfc/llcp_sock.c
··· 554 554 if (sk->sk_state == LLCP_LISTEN) 555 555 return llcp_accept_poll(sk); 556 556 557 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 557 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 558 558 mask |= EPOLLERR | 559 559 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); 560 560 561 - if (!skb_queue_empty(&sk->sk_receive_queue)) 561 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 562 562 mask |= EPOLLIN | EPOLLRDNORM; 563 563 564 564 if (sk->sk_state == LLCP_CLOSED)
+11 -9
net/openvswitch/datapath.c
··· 1881 1881 /* Called with ovs_mutex or RCU read lock. */ 1882 1882 static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, 1883 1883 struct net *net, u32 portid, u32 seq, 1884 - u32 flags, u8 cmd) 1884 + u32 flags, u8 cmd, gfp_t gfp) 1885 1885 { 1886 1886 struct ovs_header *ovs_header; 1887 1887 struct ovs_vport_stats vport_stats; ··· 1902 1902 goto nla_put_failure; 1903 1903 1904 1904 if (!net_eq(net, dev_net(vport->dev))) { 1905 - int id = peernet2id_alloc(net, dev_net(vport->dev)); 1905 + int id = peernet2id_alloc(net, dev_net(vport->dev), gfp); 1906 1906 1907 1907 if (nla_put_s32(skb, OVS_VPORT_ATTR_NETNSID, id)) 1908 1908 goto nla_put_failure; ··· 1943 1943 struct sk_buff *skb; 1944 1944 int retval; 1945 1945 1946 - skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); 1946 + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 1947 1947 if (!skb) 1948 1948 return ERR_PTR(-ENOMEM); 1949 1949 1950 - retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd); 1950 + retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd, 1951 + GFP_KERNEL); 1951 1952 BUG_ON(retval < 0); 1952 1953 1953 1954 return skb; ··· 2090 2089 2091 2090 err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), 2092 2091 info->snd_portid, info->snd_seq, 0, 2093 - OVS_VPORT_CMD_NEW); 2092 + OVS_VPORT_CMD_NEW, GFP_KERNEL); 2094 2093 2095 2094 new_headroom = netdev_get_fwd_headroom(vport->dev); 2096 2095 ··· 2151 2150 2152 2151 err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), 2153 2152 info->snd_portid, info->snd_seq, 0, 2154 - OVS_VPORT_CMD_SET); 2153 + OVS_VPORT_CMD_SET, GFP_KERNEL); 2155 2154 BUG_ON(err < 0); 2156 2155 2157 2156 ovs_unlock(); ··· 2191 2190 2192 2191 err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), 2193 2192 info->snd_portid, info->snd_seq, 0, 2194 - OVS_VPORT_CMD_DEL); 2193 + OVS_VPORT_CMD_DEL, GFP_KERNEL); 2195 2194 BUG_ON(err < 0); 2196 2195 2197 2196 /* the vport deletion may trigger dp headroom update */ ··· 2238 2237 goto exit_unlock_free; 2239 2238 err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), 2240 2239 info->snd_portid, info->snd_seq, 0, 2241 - OVS_VPORT_CMD_GET); 2240 + OVS_VPORT_CMD_GET, GFP_ATOMIC); 2242 2241 BUG_ON(err < 0); 2243 2242 rcu_read_unlock(); 2244 2243 ··· 2274 2273 NETLINK_CB(cb->skb).portid, 2275 2274 cb->nlh->nlmsg_seq, 2276 2275 NLM_F_MULTI, 2277 - OVS_VPORT_CMD_GET) < 0) 2276 + OVS_VPORT_CMD_GET, 2277 + GFP_ATOMIC) < 0) 2278 2278 goto out; 2279 2279 2280 2280 j++;
+4 -7
net/openvswitch/vport-internal_dev.c
··· 137 137 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | 138 138 IFF_NO_QUEUE; 139 139 netdev->needs_free_netdev = true; 140 - netdev->priv_destructor = internal_dev_destructor; 140 + netdev->priv_destructor = NULL; 141 141 netdev->ethtool_ops = &internal_dev_ethtool_ops; 142 142 netdev->rtnl_link_ops = &internal_dev_link_ops; 143 143 ··· 159 159 struct internal_dev *internal_dev; 160 160 struct net_device *dev; 161 161 int err; 162 - bool free_vport = true; 163 162 164 163 vport = ovs_vport_alloc(0, &ovs_internal_vport_ops, parms); 165 164 if (IS_ERR(vport)) { ··· 189 190 190 191 rtnl_lock(); 191 192 err = register_netdevice(vport->dev); 192 - if (err) { 193 - free_vport = false; 193 + if (err) 194 194 goto error_unlock; 195 - } 195 + vport->dev->priv_destructor = internal_dev_destructor; 196 196 197 197 dev_set_promiscuity(vport->dev, 1); 198 198 rtnl_unlock(); ··· 205 207 error_free_netdev: 206 208 free_netdev(dev); 207 209 error_free_vport: 208 - if (free_vport) 209 - ovs_vport_free(vport); 210 + ovs_vport_free(vport); 210 211 error: 211 212 return ERR_PTR(err); 212 213 }
+2 -2
net/phonet/socket.c
··· 338 338 339 339 if (sk->sk_state == TCP_CLOSE) 340 340 return EPOLLERR; 341 - if (!skb_queue_empty(&sk->sk_receive_queue)) 341 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 342 342 mask |= EPOLLIN | EPOLLRDNORM; 343 - if (!skb_queue_empty(&pn->ctrlreq_queue)) 343 + if (!skb_queue_empty_lockless(&pn->ctrlreq_queue)) 344 344 mask |= EPOLLPRI; 345 345 if (!mask && sk->sk_state == TCP_CLOSE_WAIT) 346 346 return EPOLLHUP;
-23
net/rose/af_rose.c
··· 65 65 ax25_address rose_callsign; 66 66 67 67 /* 68 - * ROSE network devices are virtual network devices encapsulating ROSE 69 - * frames into AX.25 which will be sent through an AX.25 device, so form a 70 - * special "super class" of normal net devices; split their locks off into a 71 - * separate class since they always nest. 72 - */ 73 - static struct lock_class_key rose_netdev_xmit_lock_key; 74 - static struct lock_class_key rose_netdev_addr_lock_key; 75 - 76 - static void rose_set_lockdep_one(struct net_device *dev, 77 - struct netdev_queue *txq, 78 - void *_unused) 79 - { 80 - lockdep_set_class(&txq->_xmit_lock, &rose_netdev_xmit_lock_key); 81 - } 82 - 83 - static void rose_set_lockdep_key(struct net_device *dev) 84 - { 85 - lockdep_set_class(&dev->addr_list_lock, &rose_netdev_addr_lock_key); 86 - netdev_for_each_tx_queue(dev, rose_set_lockdep_one, NULL); 87 - } 88 - 89 - /* 90 68 * Convert a ROSE address into text. 91 69 */ 92 70 char *rose2asc(char *buf, const rose_address *addr) ··· 1511 1533 free_netdev(dev); 1512 1534 goto fail; 1513 1535 } 1514 - rose_set_lockdep_key(dev); 1515 1536 dev_rose[i] = dev; 1516 1537 } 1517 1538
+1
net/rxrpc/ar-internal.h
··· 601 601 int debug_id; /* debug ID for printks */ 602 602 unsigned short rx_pkt_offset; /* Current recvmsg packet offset */ 603 603 unsigned short rx_pkt_len; /* Current recvmsg packet len */ 604 + bool rx_pkt_last; /* Current recvmsg packet is last */ 604 605 605 606 /* Rx/Tx circular buffer, depending on phase. 606 607 *
+13 -5
net/rxrpc/recvmsg.c
··· 267 267 */ 268 268 static int rxrpc_locate_data(struct rxrpc_call *call, struct sk_buff *skb, 269 269 u8 *_annotation, 270 - unsigned int *_offset, unsigned int *_len) 270 + unsigned int *_offset, unsigned int *_len, 271 + bool *_last) 271 272 { 272 273 struct rxrpc_skb_priv *sp = rxrpc_skb(skb); 273 274 unsigned int offset = sizeof(struct rxrpc_wire_header); 274 275 unsigned int len; 276 + bool last = false; 275 277 int ret; 276 278 u8 annotation = *_annotation; 277 279 u8 subpacket = annotation & RXRPC_RX_ANNO_SUBPACKET; ··· 283 281 len = skb->len - offset; 284 282 if (subpacket < sp->nr_subpackets - 1) 285 283 len = RXRPC_JUMBO_DATALEN; 284 + else if (sp->rx_flags & RXRPC_SKB_INCL_LAST) 285 + last = true; 286 286 287 287 if (!(annotation & RXRPC_RX_ANNO_VERIFIED)) { 288 288 ret = rxrpc_verify_packet(call, skb, annotation, offset, len); ··· 295 291 296 292 *_offset = offset; 297 293 *_len = len; 294 + *_last = last; 298 295 call->security->locate_data(call, skb, _offset, _len); 299 296 return 0; 300 297 } ··· 314 309 rxrpc_serial_t serial; 315 310 rxrpc_seq_t hard_ack, top, seq; 316 311 size_t remain; 317 - bool last; 312 + bool rx_pkt_last; 318 313 unsigned int rx_pkt_offset, rx_pkt_len; 319 314 int ix, copy, ret = -EAGAIN, ret2; 320 315 ··· 324 319 325 320 rx_pkt_offset = call->rx_pkt_offset; 326 321 rx_pkt_len = call->rx_pkt_len; 322 + rx_pkt_last = call->rx_pkt_last; 327 323 328 324 if (call->state >= RXRPC_CALL_SERVER_ACK_REQUEST) { 329 325 seq = call->rx_hard_ack; ··· 335 329 /* Barriers against rxrpc_input_data(). */ 336 330 hard_ack = call->rx_hard_ack; 337 331 seq = hard_ack + 1; 332 + 338 333 while (top = smp_load_acquire(&call->rx_top), 339 334 before_eq(seq, top) 340 335 ) { ··· 363 356 if (rx_pkt_offset == 0) { 364 357 ret2 = rxrpc_locate_data(call, skb, 365 358 &call->rxtx_annotations[ix], 366 - &rx_pkt_offset, &rx_pkt_len); 359 + &rx_pkt_offset, &rx_pkt_len, 360 + &rx_pkt_last); 367 361 trace_rxrpc_recvmsg(call, rxrpc_recvmsg_next, seq, 368 362 rx_pkt_offset, rx_pkt_len, ret2); 369 363 if (ret2 < 0) { ··· 404 396 } 405 397 406 398 /* The whole packet has been transferred. */ 407 - last = sp->hdr.flags & RXRPC_LAST_PACKET; 408 399 if (!(flags & MSG_PEEK)) 409 400 rxrpc_rotate_rx_window(call); 410 401 rx_pkt_offset = 0; 411 402 rx_pkt_len = 0; 412 403 413 - if (last) { 404 + if (rx_pkt_last) { 414 405 ASSERTCMP(seq, ==, READ_ONCE(call->rx_top)); 415 406 ret = 1; 416 407 goto out; ··· 422 415 if (!(flags & MSG_PEEK)) { 423 416 call->rx_pkt_offset = rx_pkt_offset; 424 417 call->rx_pkt_len = rx_pkt_len; 418 + call->rx_pkt_last = rx_pkt_last; 425 419 } 426 420 done: 427 421 trace_rxrpc_recvmsg(call, rxrpc_recvmsg_data_return, seq,
+6 -2
net/sched/cls_bpf.c
··· 162 162 cls_bpf.name = obj->bpf_name; 163 163 cls_bpf.exts_integrated = obj->exts_integrated; 164 164 165 - if (oldprog) 165 + if (oldprog && prog) 166 166 err = tc_setup_cb_replace(block, tp, TC_SETUP_CLSBPF, &cls_bpf, 167 167 skip_sw, &oldprog->gen_flags, 168 168 &oldprog->in_hw_count, 169 169 &prog->gen_flags, &prog->in_hw_count, 170 170 true); 171 - else 171 + else if (prog) 172 172 err = tc_setup_cb_add(block, tp, TC_SETUP_CLSBPF, &cls_bpf, 173 173 skip_sw, &prog->gen_flags, 174 174 &prog->in_hw_count, true); 175 + else 176 + err = tc_setup_cb_destroy(block, tp, TC_SETUP_CLSBPF, &cls_bpf, 177 + skip_sw, &oldprog->gen_flags, 178 + &oldprog->in_hw_count, true); 175 179 176 180 if (prog && err) { 177 181 cls_bpf_offload_cmd(tp, oldprog, prog, extack);
+8 -11
net/sched/sch_generic.c
··· 799 799 }; 800 800 EXPORT_SYMBOL(pfifo_fast_ops); 801 801 802 - static struct lock_class_key qdisc_tx_busylock; 803 - static struct lock_class_key qdisc_running_key; 804 - 805 802 struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 806 803 const struct Qdisc_ops *ops, 807 804 struct netlink_ext_ack *extack) ··· 851 854 } 852 855 853 856 spin_lock_init(&sch->busylock); 854 - lockdep_set_class(&sch->busylock, 855 - dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); 856 - 857 857 /* seqlock has the same scope of busylock, for NOLOCK qdisc */ 858 858 spin_lock_init(&sch->seqlock); 859 - lockdep_set_class(&sch->busylock, 860 - dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); 861 - 862 859 seqcount_init(&sch->running); 863 - lockdep_set_class(&sch->running, 864 - dev->qdisc_running_key ?: &qdisc_running_key); 865 860 866 861 sch->ops = ops; 867 862 sch->flags = ops->static_flags; ··· 863 874 sch->empty = true; 864 875 dev_hold(dev); 865 876 refcount_set(&sch->refcnt, 1); 877 + 878 + if (sch != &noop_qdisc) { 879 + lockdep_set_class(&sch->busylock, &dev->qdisc_tx_busylock_key); 880 + lockdep_set_class(&sch->seqlock, &dev->qdisc_tx_busylock_key); 881 + lockdep_set_class(&sch->running, &dev->qdisc_running_key); 882 + } 866 883 867 884 return sch; 868 885 errout1: ··· 1038 1043 1039 1044 if (dev->priv_flags & IFF_NO_QUEUE) 1040 1045 ops = &noqueue_qdisc_ops; 1046 + else if(dev->type == ARPHRD_CAN) 1047 + ops = &pfifo_fast_ops; 1041 1048 1042 1049 qdisc = qdisc_create_dflt(dev_queue, ops, TC_H_ROOT, NULL); 1043 1050 if (!qdisc) {
+4 -4
net/sched/sch_hhf.c
··· 5 5 * Copyright (C) 2013 Nandita Dukkipati <nanditad@google.com> 6 6 */ 7 7 8 - #include <linux/jhash.h> 9 8 #include <linux/jiffies.h> 10 9 #include <linux/module.h> 11 10 #include <linux/skbuff.h> 12 11 #include <linux/vmalloc.h> 12 + #include <linux/siphash.h> 13 13 #include <net/pkt_sched.h> 14 14 #include <net/sock.h> 15 15 ··· 126 126 127 127 struct hhf_sched_data { 128 128 struct wdrr_bucket buckets[WDRR_BUCKET_CNT]; 129 - u32 perturbation; /* hash perturbation */ 129 + siphash_key_t perturbation; /* hash perturbation */ 130 130 u32 quantum; /* psched_mtu(qdisc_dev(sch)); */ 131 131 u32 drop_overlimit; /* number of times max qdisc packet 132 132 * limit was hit ··· 264 264 } 265 265 266 266 /* Get hashed flow-id of the skb. */ 267 - hash = skb_get_hash_perturb(skb, q->perturbation); 267 + hash = skb_get_hash_perturb(skb, &q->perturbation); 268 268 269 269 /* Check if this packet belongs to an already established HH flow. */ 270 270 flow_pos = hash & HHF_BIT_MASK; ··· 582 582 583 583 sch->limit = 1000; 584 584 q->quantum = psched_mtu(qdisc_dev(sch)); 585 - q->perturbation = prandom_u32(); 585 + get_random_bytes(&q->perturbation, sizeof(q->perturbation)); 586 586 INIT_LIST_HEAD(&q->new_buckets); 587 587 INIT_LIST_HEAD(&q->old_buckets); 588 588
+7 -6
net/sched/sch_sfb.c
··· 18 18 #include <linux/errno.h> 19 19 #include <linux/skbuff.h> 20 20 #include <linux/random.h> 21 - #include <linux/jhash.h> 21 + #include <linux/siphash.h> 22 22 #include <net/ip.h> 23 23 #include <net/pkt_sched.h> 24 24 #include <net/pkt_cls.h> ··· 45 45 * (Section 4.4 of SFB reference : moving hash functions) 46 46 */ 47 47 struct sfb_bins { 48 - u32 perturbation; /* jhash perturbation */ 48 + siphash_key_t perturbation; /* siphash key */ 49 49 struct sfb_bucket bins[SFB_LEVELS][SFB_NUMBUCKETS]; 50 50 }; 51 51 ··· 217 217 218 218 static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) 219 219 { 220 - q->bins[slot].perturbation = prandom_u32(); 220 + get_random_bytes(&q->bins[slot].perturbation, 221 + sizeof(q->bins[slot].perturbation)); 221 222 } 222 223 223 224 static void sfb_swap_slot(struct sfb_sched_data *q) ··· 315 314 /* If using external classifiers, get result and record it. */ 316 315 if (!sfb_classify(skb, fl, &ret, &salt)) 317 316 goto other_drop; 318 - sfbhash = jhash_1word(salt, q->bins[slot].perturbation); 317 + sfbhash = siphash_1u32(salt, &q->bins[slot].perturbation); 319 318 } else { 320 - sfbhash = skb_get_hash_perturb(skb, q->bins[slot].perturbation); 319 + sfbhash = skb_get_hash_perturb(skb, &q->bins[slot].perturbation); 321 320 } 322 321 323 322 ··· 353 352 /* Inelastic flow */ 354 353 if (q->double_buffering) { 355 354 sfbhash = skb_get_hash_perturb(skb, 356 - q->bins[slot].perturbation); 355 + &q->bins[slot].perturbation); 357 356 if (!sfbhash) 358 357 sfbhash = 1; 359 358 sfb_skb_cb(skb)->hashes[slot] = sfbhash;
+8 -6
net/sched/sch_sfq.c
··· 14 14 #include <linux/errno.h> 15 15 #include <linux/init.h> 16 16 #include <linux/skbuff.h> 17 - #include <linux/jhash.h> 17 + #include <linux/siphash.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/vmalloc.h> 20 20 #include <net/netlink.h> ··· 117 117 u8 headdrop; 118 118 u8 maxdepth; /* limit of packets per flow */ 119 119 120 - u32 perturbation; 120 + siphash_key_t perturbation; 121 121 u8 cur_depth; /* depth of longest slot */ 122 122 u8 flags; 123 123 unsigned short scaled_quantum; /* SFQ_ALLOT_SIZE(quantum) */ ··· 157 157 static unsigned int sfq_hash(const struct sfq_sched_data *q, 158 158 const struct sk_buff *skb) 159 159 { 160 - return skb_get_hash_perturb(skb, q->perturbation) & (q->divisor - 1); 160 + return skb_get_hash_perturb(skb, &q->perturbation) & (q->divisor - 1); 161 161 } 162 162 163 163 static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch, ··· 607 607 struct sfq_sched_data *q = from_timer(q, t, perturb_timer); 608 608 struct Qdisc *sch = q->sch; 609 609 spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); 610 + siphash_key_t nkey; 610 611 612 + get_random_bytes(&nkey, sizeof(nkey)); 611 613 spin_lock(root_lock); 612 - q->perturbation = prandom_u32(); 614 + q->perturbation = nkey; 613 615 if (!q->filter_list && q->tail) 614 616 sfq_rehash(sch); 615 617 spin_unlock(root_lock); ··· 690 688 del_timer(&q->perturb_timer); 691 689 if (q->perturb_period) { 692 690 mod_timer(&q->perturb_timer, jiffies + q->perturb_period); 693 - q->perturbation = prandom_u32(); 691 + get_random_bytes(&q->perturbation, sizeof(q->perturbation)); 694 692 } 695 693 sch_tree_unlock(sch); 696 694 kfree(p); ··· 747 745 q->quantum = psched_mtu(qdisc_dev(sch)); 748 746 q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); 749 747 q->perturb_period = 0; 750 - q->perturbation = prandom_u32(); 748 + get_random_bytes(&q->perturbation, sizeof(q->perturbation)); 751 749 752 750 if (opt) { 753 751 int err = sfq_change(sch, opt);
+1 -1
net/sched/sch_taprio.c
··· 1152 1152 * offload state (PENDING, ACTIVE, INACTIVE) so it can be visible in dump(). 1153 1153 * This is left as TODO. 1154 1154 */ 1155 - void taprio_offload_config_changed(struct taprio_sched *q) 1155 + static void taprio_offload_config_changed(struct taprio_sched *q) 1156 1156 { 1157 1157 struct sched_gate_list *oper, *admin; 1158 1158
+4 -4
net/sctp/socket.c
··· 8476 8476 mask = 0; 8477 8477 8478 8478 /* Is there any exceptional events? */ 8479 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 8479 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 8480 8480 mask |= EPOLLERR | 8481 8481 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); 8482 8482 if (sk->sk_shutdown & RCV_SHUTDOWN) ··· 8485 8485 mask |= EPOLLHUP; 8486 8486 8487 8487 /* Is it readable? Reconsider this code with TCP-style support. */ 8488 - if (!skb_queue_empty(&sk->sk_receive_queue)) 8488 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 8489 8489 mask |= EPOLLIN | EPOLLRDNORM; 8490 8490 8491 8491 /* The association is either gone or not ready. */ ··· 8871 8871 if (sk_can_busy_loop(sk)) { 8872 8872 sk_busy_loop(sk, noblock); 8873 8873 8874 - if (!skb_queue_empty(&sk->sk_receive_queue)) 8874 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 8875 8875 continue; 8876 8876 } 8877 8877 ··· 9306 9306 newinet->inet_rcv_saddr = inet->inet_rcv_saddr; 9307 9307 newinet->inet_dport = htons(asoc->peer.port); 9308 9308 newinet->pmtudisc = inet->pmtudisc; 9309 - newinet->inet_id = asoc->next_tsn ^ jiffies; 9309 + newinet->inet_id = prandom_u32(); 9310 9310 9311 9311 newinet->uc_ttl = inet->uc_ttl; 9312 9312 newinet->mc_loop = 1;
+10 -3
net/smc/af_smc.c
··· 123 123 }; 124 124 EXPORT_SYMBOL_GPL(smc_proto6); 125 125 126 + static void smc_restore_fallback_changes(struct smc_sock *smc) 127 + { 128 + smc->clcsock->file->private_data = smc->sk.sk_socket; 129 + smc->clcsock->file = NULL; 130 + } 131 + 126 132 static int __smc_release(struct smc_sock *smc) 127 133 { 128 134 struct sock *sk = &smc->sk; ··· 147 141 } 148 142 sk->sk_state = SMC_CLOSED; 149 143 sk->sk_state_change(sk); 144 + smc_restore_fallback_changes(smc); 150 145 } 151 146 152 147 sk->sk_prot->unhash(sk); ··· 707 700 int smc_type; 708 701 int rc = 0; 709 702 710 - sock_hold(&smc->sk); /* sock put in passive closing */ 711 - 712 703 if (smc->use_fallback) 713 704 return smc_connect_fallback(smc, smc->fallback_rsn); 714 705 ··· 851 846 rc = kernel_connect(smc->clcsock, addr, alen, flags); 852 847 if (rc && rc != -EINPROGRESS) 853 848 goto out; 849 + 850 + sock_hold(&smc->sk); /* sock put in passive closing */ 854 851 if (flags & O_NONBLOCK) { 855 852 if (schedule_work(&smc->connect_work)) 856 853 smc->connect_nonblock = 1; ··· 1298 1291 /* check if RDMA is available */ 1299 1292 if (!ism_supported) { /* SMC_TYPE_R or SMC_TYPE_B */ 1300 1293 /* prepare RDMA check */ 1301 - memset(&ini, 0, sizeof(ini)); 1302 1294 ini.is_smcd = false; 1295 + ini.ism_dev = NULL; 1303 1296 ini.ib_lcl = &pclc->lcl; 1304 1297 rc = smc_find_rdma_device(new_smc, &ini); 1305 1298 if (rc) {
+1 -1
net/smc/smc_core.c
··· 561 561 } 562 562 563 563 rtnl_lock(); 564 - nest_lvl = dev_get_nest_level(ndev); 564 + nest_lvl = ndev->lower_level; 565 565 for (i = 0; i < nest_lvl; i++) { 566 566 struct list_head *lower = &ndev->adj_list.lower; 567 567
+1 -1
net/smc/smc_pnet.c
··· 718 718 int i, nest_lvl; 719 719 720 720 rtnl_lock(); 721 - nest_lvl = dev_get_nest_level(ndev); 721 + nest_lvl = ndev->lower_level; 722 722 for (i = 0; i < nest_lvl; i++) { 723 723 struct list_head *lower = &ndev->adj_list.lower; 724 724
+2 -2
net/tipc/socket.c
··· 740 740 /* fall through */ 741 741 case TIPC_LISTEN: 742 742 case TIPC_CONNECTING: 743 - if (!skb_queue_empty(&sk->sk_receive_queue)) 743 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 744 744 revents |= EPOLLIN | EPOLLRDNORM; 745 745 break; 746 746 case TIPC_OPEN: ··· 748 748 revents |= EPOLLOUT; 749 749 if (!tipc_sk_type_connectionless(sk)) 750 750 break; 751 - if (skb_queue_empty(&sk->sk_receive_queue)) 751 + if (skb_queue_empty_lockless(&sk->sk_receive_queue)) 752 752 break; 753 753 revents |= EPOLLIN | EPOLLRDNORM; 754 754 break;
+3 -3
net/unix/af_unix.c
··· 2599 2599 mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM; 2600 2600 2601 2601 /* readable? */ 2602 - if (!skb_queue_empty(&sk->sk_receive_queue)) 2602 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 2603 2603 mask |= EPOLLIN | EPOLLRDNORM; 2604 2604 2605 2605 /* Connection-based need to check for termination and startup */ ··· 2628 2628 mask = 0; 2629 2629 2630 2630 /* exceptional events? */ 2631 - if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 2631 + if (sk->sk_err || !skb_queue_empty_lockless(&sk->sk_error_queue)) 2632 2632 mask |= EPOLLERR | 2633 2633 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); 2634 2634 ··· 2638 2638 mask |= EPOLLHUP; 2639 2639 2640 2640 /* readable? */ 2641 - if (!skb_queue_empty(&sk->sk_receive_queue)) 2641 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 2642 2642 mask |= EPOLLIN | EPOLLRDNORM; 2643 2643 2644 2644 /* Connection-based need to check for termination and startup */
+1 -1
net/vmw_vsock/af_vsock.c
··· 870 870 * the queue and write as long as the socket isn't shutdown for 871 871 * sending. 872 872 */ 873 - if (!skb_queue_empty(&sk->sk_receive_queue) || 873 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue) || 874 874 (sk->sk_shutdown & RCV_SHUTDOWN)) { 875 875 mask |= EPOLLIN | EPOLLRDNORM; 876 876 }
+5
net/wireless/chan.c
··· 204 204 return false; 205 205 } 206 206 207 + /* channel 14 is only for IEEE 802.11b */ 208 + if (chandef->center_freq1 == 2484 && 209 + chandef->width != NL80211_CHAN_WIDTH_20_NOHT) 210 + return false; 211 + 207 212 if (cfg80211_chandef_is_edmg(chandef) && 208 213 !cfg80211_edmg_chandef_valid(chandef)) 209 214 return false;
+1 -1
net/wireless/nl80211.c
··· 393 393 [NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ }, 394 394 [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, 395 395 .len = IEEE80211_MAX_MESH_ID_LEN }, 396 - [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, 396 + [NL80211_ATTR_MPATH_NEXT_HOP] = NLA_POLICY_ETH_ADDR_COMPAT, 397 397 398 398 [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, 399 399 [NL80211_ATTR_REG_RULES] = { .type = NLA_NESTED },
+2 -1
net/wireless/util.c
··· 1559 1559 } 1560 1560 1561 1561 if (freq == 2484) { 1562 - if (chandef->width > NL80211_CHAN_WIDTH_40) 1562 + /* channel 14 is only for IEEE 802.11b */ 1563 + if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT) 1563 1564 return false; 1564 1565 1565 1566 *op_class = 82; /* channel 14 */
+6
net/xdp/xdp_umem.c
··· 27 27 { 28 28 unsigned long flags; 29 29 30 + if (!xs->tx) 31 + return; 32 + 30 33 spin_lock_irqsave(&umem->xsk_list_lock, flags); 31 34 list_add_rcu(&xs->list, &umem->xsk_list); 32 35 spin_unlock_irqrestore(&umem->xsk_list_lock, flags); ··· 38 35 void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) 39 36 { 40 37 unsigned long flags; 38 + 39 + if (!xs->tx) 40 + return; 41 41 42 42 spin_lock_irqsave(&umem->xsk_list_lock, flags); 43 43 list_del_rcu(&xs->list);
+5
tools/testing/selftests/bpf/test_offload.py
··· 22 22 import pprint 23 23 import random 24 24 import re 25 + import stat 25 26 import string 26 27 import struct 27 28 import subprocess ··· 312 311 for f in out.split(): 313 312 if f == "ports": 314 313 continue 314 + 315 315 p = os.path.join(path, f) 316 + if not os.stat(p).st_mode & stat.S_IRUSR: 317 + continue 318 + 316 319 if os.path.isfile(p): 317 320 _, out = cmd('cat %s/%s' % (path, f)) 318 321 dfs[f] = out.strip()
+1 -1
tools/testing/selftests/bpf/test_tc_edt.sh
··· 59 59 60 60 # start the listener 61 61 ip netns exec ${NS_DST} bash -c \ 62 - "nc -4 -l -s ${IP_DST} -p 9000 >/dev/null &" 62 + "nc -4 -l -p 9000 >/dev/null &" 63 63 declare -i NC_PID=$! 64 64 sleep 1 65 65
+21
tools/testing/selftests/net/fib_tests.sh
··· 1438 1438 fi 1439 1439 log_test $rc 0 "Prefix route with metric on link up" 1440 1440 1441 + # explicitly check for metric changes on edge scenarios 1442 + run_cmd "$IP addr flush dev dummy2" 1443 + run_cmd "$IP addr add dev dummy2 172.16.104.0/24 metric 259" 1444 + run_cmd "$IP addr change dev dummy2 172.16.104.0/24 metric 260" 1445 + rc=$? 1446 + if [ $rc -eq 0 ]; then 1447 + check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.0 metric 260" 1448 + rc=$? 1449 + fi 1450 + log_test $rc 0 "Modify metric of .0/24 address" 1451 + 1452 + run_cmd "$IP addr flush dev dummy2" 1453 + run_cmd "$IP addr add dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 260" 1454 + run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 261" 1455 + rc=$? 1456 + if [ $rc -eq 0 ]; then 1457 + check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261" 1458 + rc=$? 1459 + fi 1460 + log_test $rc 0 "Modify metric of address with peer route" 1461 + 1441 1462 $IP li del dummy1 1442 1463 $IP li del dummy2 1443 1464 cleanup
tools/testing/selftests/net/l2tp.sh
+2 -1
tools/testing/selftests/net/reuseport_dualstack.c
··· 129 129 { 130 130 struct epoll_event ev; 131 131 int epfd, i, test_fd; 132 - uint16_t test_family; 132 + int test_family; 133 133 socklen_t len; 134 134 135 135 epfd = epoll_create(1); ··· 146 146 send_from_v4(proto); 147 147 148 148 test_fd = receive_once(epfd, proto); 149 + len = sizeof(test_family); 149 150 if (getsockopt(test_fd, SOL_SOCKET, SO_DOMAIN, &test_family, &len)) 150 151 error(1, errno, "failed to read socket domain"); 151 152 if (test_family != AF_INET)